* commit '81f43d92dbc03dc93e63de947007ee80e68d94af': (74 commits) REPORT-47193 插件管理提示弹窗优化 REPORT-47193 插件管理提示弹窗优化 REPORT-43833 【10.0.14】远程设计数据连接/服务器数据集增加锁定 漏掉了这个panel,将解锁放到aftercommit()中 REPORT-45901 【10.0.14】oem设计器多开接口 --加上端口限制 REPORT-45901 【10.0.14】设计器多开接口 REPORT-43833 【10.0.14】远程设计数据连接/服务器数据集增加锁定 【问题原因】在设计器启动的过程中,UILockButton会调用isLocked方法,此时工作空间对象池中还没有对象,因此获取到的operator是null,会报npe 【改动方案】做个判断 CHART-17983 仪表盘目标值默认 && CHART-18024 数据集改变,监听重复导致结果错误 CHART-18050 使用双列网格布局代替流式布局,补充国际化 CHART-18050 富文本弹窗界面设置为可拖拽大小 CHART-17775 删除无用方法 CHART-18006 design 插件 提示下载地图资源 CHART-17775 像素 & 百分比控件优化 新增字段支持部分图表类型 调整富文本参数顺序 适配仪表盘,清理代码 适配饼图 适配箱型图 REPORT-44666 fix 无用import REPORT-44666 多屏情况下 部分弹窗显示在另一块屏幕 适配甘特图 ...research/11.0
@ -0,0 +1,25 @@
|
||||
package com.fr.design.editlock; |
||||
|
||||
|
||||
import com.fr.report.LockItem; |
||||
|
||||
/** |
||||
* @author Yvan |
||||
* @version 10.0 |
||||
* Created by Yvan on 2021/1/20 |
||||
* 定义数据连接的checker |
||||
*/ |
||||
public class ConnectionLockChangeChecker extends EditLockChangeChecker{ |
||||
|
||||
private static class Holder { |
||||
private static final ConnectionLockChangeChecker INSTANCE = new ConnectionLockChangeChecker(); |
||||
} |
||||
|
||||
public static ConnectionLockChangeChecker getInstance() { |
||||
return ConnectionLockChangeChecker.Holder.INSTANCE; |
||||
} |
||||
|
||||
public ConnectionLockChangeChecker() { |
||||
this.lockItem = LockItem.CONNECTION; |
||||
} |
||||
} |
@ -0,0 +1,73 @@
|
||||
package com.fr.design.editlock; |
||||
|
||||
import com.fr.concurrent.NamedThreadFactory; |
||||
import com.fr.design.ui.util.UIUtil; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.workspace.WorkContext; |
||||
import com.fr.workspace.server.lock.editlock.EditLockOperator; |
||||
import com.fr.report.LockItem; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
import java.util.concurrent.Executors; |
||||
import java.util.concurrent.ScheduledExecutorService; |
||||
import java.util.concurrent.TimeUnit; |
||||
|
||||
/** |
||||
* @author Yvan |
||||
* @version 10.0 |
||||
* Created by Yvan on 2021/1/19 |
||||
* 判断当前设计器在远程设计服务器中的锁状态是否发生了改变 |
||||
*/ |
||||
public abstract class EditLockChangeChecker { |
||||
|
||||
private static final int INTERVAL = 30000; |
||||
private ScheduledExecutorService scheduler; |
||||
protected LockItem lockItem; |
||||
private boolean isLocked = false; |
||||
private List<EditLockChangeListener> listeners = new ArrayList<>(); |
||||
|
||||
/** |
||||
* 轮询任务,如果是远程设计状态,每隔30s查询一次相应lockItem的锁状态是否改变 |
||||
*/ |
||||
public void start() { |
||||
this.scheduler = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("EditLockChangeChecker")); |
||||
this.scheduler.scheduleAtFixedRate(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
// 判断是否为远程设计环境
|
||||
if (!WorkContext.getCurrent().isLocal()) { |
||||
try { |
||||
EditLockOperator operator = WorkContext.getCurrent().get(EditLockOperator.class); |
||||
boolean locked = operator.isLocked(lockItem); |
||||
if (isLocked != locked) { |
||||
isLocked = locked; |
||||
fireChange(); |
||||
} |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} |
||||
} |
||||
} |
||||
}, 0, INTERVAL, TimeUnit.MILLISECONDS); |
||||
} |
||||
|
||||
public void stop() { |
||||
this.scheduler.shutdown(); |
||||
} |
||||
|
||||
public void addEditLockChangeListener(EditLockChangeListener listener) { |
||||
this.listeners.add(listener); |
||||
} |
||||
|
||||
private void fireChange() { |
||||
UIUtil.invokeLaterIfNeeded(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
for (EditLockChangeListener listener : EditLockChangeChecker.this.listeners) { |
||||
listener.updateLockedState(new EditLockChangeEvent(isLocked)); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,25 @@
|
||||
package com.fr.design.editlock; |
||||
|
||||
import java.util.EventObject; |
||||
|
||||
/** |
||||
* @author Yvan |
||||
* @version 10.0 |
||||
* Created by Yvan on 2021/1/20 |
||||
*/ |
||||
public class EditLockChangeEvent extends EventObject { |
||||
|
||||
private boolean isLocked; |
||||
|
||||
/** |
||||
* @param source 锁状态发生了改变,且当前锁状态就是source |
||||
*/ |
||||
public EditLockChangeEvent(boolean source) { |
||||
super(source); |
||||
this.isLocked = source; |
||||
} |
||||
|
||||
public boolean isLocked() { |
||||
return isLocked; |
||||
} |
||||
} |
@ -0,0 +1,16 @@
|
||||
package com.fr.design.editlock; |
||||
|
||||
import java.util.EventListener; |
||||
|
||||
/** |
||||
* @author Yvan |
||||
* @version 10.0 |
||||
* Created by Yvan on 2021/1/20 |
||||
*/ |
||||
public interface EditLockChangeListener extends EventListener { |
||||
/** |
||||
* 锁定状态改变后执行的动作 |
||||
* @param event 事件 |
||||
*/ |
||||
void updateLockedState(EditLockChangeEvent event); |
||||
} |
@ -0,0 +1,81 @@
|
||||
package com.fr.design.editlock; |
||||
|
||||
import com.fr.base.svg.IconUtils; |
||||
import com.fr.base.svg.SVGLoader; |
||||
import com.fr.design.dialog.FineJOptionPane; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.general.IOUtils; |
||||
import com.fr.workspace.WorkContext; |
||||
import com.fr.workspace.server.lock.editlock.EditLockOperator; |
||||
import com.fr.report.LockItem; |
||||
import org.jetbrains.annotations.Nullable; |
||||
|
||||
import javax.swing.Icon; |
||||
import javax.swing.JOptionPane; |
||||
import java.awt.Image; |
||||
|
||||
/** |
||||
* @author Yvan |
||||
* @version 10.0 |
||||
* Created by Yvan on 2021/1/20 |
||||
* 关于编辑锁定的一些常量和静态方法 |
||||
*/ |
||||
public class EditLockUtils { |
||||
|
||||
/** |
||||
* 数据连接锁定标志 |
||||
*/ |
||||
public static final Icon CONNECTION_LOCKED_ICON = IconUtils.readIcon("/com/fr/design/images/m_web/connection_locked"); |
||||
|
||||
/** |
||||
* 小锁图片 |
||||
*/ |
||||
public static final @Nullable Image LOCKED_IMAGE = SVGLoader.load("/com/fr/design/images/m_web/locked_normal.svg"); |
||||
|
||||
/** |
||||
* 提示弹窗中的提示标志 |
||||
*/ |
||||
public static final Icon TOOLTIPS_ICON = IOUtils.readIcon("/com/fr/design/images/m_web/warningIcon.png"); |
||||
|
||||
/** |
||||
* 数据连接锁定中 |
||||
*/ |
||||
public static final String CONNECTION_LOCKED_TOOLTIPS = Toolkit.i18nText("Fine_Designer_Remote_Design_Data_Connection_Locked"); |
||||
|
||||
/** |
||||
* 服务器数据集锁定中 |
||||
*/ |
||||
public static final String SERVER_TABLEDATA_LOCKED_TOOLTIPS = Toolkit.i18nText("Fine_Designer_Remote_Design_Server_TableData_Locked"); |
||||
|
||||
/** |
||||
* 提示弹窗中的提示信息 |
||||
*/ |
||||
public static final String LOCKED_MESSAGE = Toolkit.i18nText("Fine_Designer_Remote_Design_Locked_Message"); |
||||
|
||||
/** |
||||
* 提示弹窗中的标题 |
||||
*/ |
||||
public static final String TOOLTIPS = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Title_Hint"); |
||||
|
||||
/** |
||||
* 已经被锁,跳出弹窗提示 |
||||
*/ |
||||
public static void showLockMessage() { |
||||
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), EditLockUtils.LOCKED_MESSAGE, EditLockUtils.TOOLTIPS, JOptionPane.INFORMATION_MESSAGE, EditLockUtils.TOOLTIPS_ICON); |
||||
} |
||||
|
||||
public static boolean lock(LockItem lockItem) { |
||||
return WorkContext.getCurrent().get(EditLockOperator.class).lock(lockItem); |
||||
} |
||||
|
||||
public static boolean unlock(LockItem lockItem) { |
||||
return WorkContext.getCurrent().get(EditLockOperator.class).unlock(lockItem); |
||||
} |
||||
|
||||
public static boolean isLocked(LockItem lockItem) { |
||||
EditLockOperator operator = WorkContext.getCurrent().get(EditLockOperator.class); |
||||
// 启动过程中UILockButton初始化的时候会调用这个方法,但是此时workObjectPool中还没有对象,会报npe
|
||||
return operator != null && operator.isLocked(lockItem); |
||||
} |
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fr.design.editlock; |
||||
|
||||
import com.fr.report.LockItem; |
||||
|
||||
/** |
||||
* @author Yvan |
||||
* @version 10.0 |
||||
* Created by Yvan on 2021/1/20 |
||||
* 服务器数据集的checker |
||||
*/ |
||||
public class ServerTableDataLockChangeChecker extends EditLockChangeChecker{ |
||||
private static class Holder { |
||||
private static final ServerTableDataLockChangeChecker INSTANCE = new ServerTableDataLockChangeChecker(); |
||||
} |
||||
|
||||
public static ServerTableDataLockChangeChecker getInstance() { |
||||
return ServerTableDataLockChangeChecker.Holder.INSTANCE; |
||||
} |
||||
|
||||
public ServerTableDataLockChangeChecker() { |
||||
this.lockItem = LockItem.SERVER_TABLE_DATA; |
||||
} |
||||
} |
@ -0,0 +1,31 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
/** |
||||
* 设计器生命周期接口 |
||||
* |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/1/26 |
||||
*/ |
||||
public interface DesignerLifecycleMonitor { |
||||
|
||||
String MARK_STRING = "DesignerLifecycleMonitor"; |
||||
|
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
/** |
||||
* 设计器启动之前 |
||||
*/ |
||||
void beforeStart(); |
||||
|
||||
/** |
||||
* 设计器启动完成 界面出现之后 |
||||
*/ |
||||
void afterStart(); |
||||
|
||||
/** |
||||
* 设计器关闭退出之前 |
||||
*/ |
||||
void beforeStop(); |
||||
|
||||
} |
@ -0,0 +1,31 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
/** |
||||
* 设计器所有端口获取 |
||||
* |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/1/18 |
||||
*/ |
||||
public interface DesignerPortProvider { |
||||
|
||||
String MARK_STRING = "DesignerPortProvider"; |
||||
|
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
|
||||
/** |
||||
* 设计器自身端口 |
||||
* |
||||
* @return |
||||
*/ |
||||
int messagePort(); |
||||
|
||||
/** |
||||
* 内置服务器端口 |
||||
* |
||||
* @return |
||||
*/ |
||||
int embeddedServerPort(); |
||||
|
||||
} |
@ -0,0 +1,24 @@
|
||||
package com.fr.design.gui.frpane; |
||||
|
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.gui.ispinner.chart.UISpinnerWithPercent; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2021-01-21 |
||||
*/ |
||||
public class UINumberDragPaneWithPercent extends UINumberDragPane { |
||||
|
||||
public UINumberDragPaneWithPercent(double minValue, double maxValue) { |
||||
super(minValue, maxValue); |
||||
} |
||||
|
||||
public UINumberDragPaneWithPercent(double minValue, double maxValue, double dierta) { |
||||
super(minValue, maxValue, dierta); |
||||
} |
||||
|
||||
protected UISpinner createUISpinner(double minValue, double maxValue, double dierta) { |
||||
return new UISpinnerWithPercent(minValue, maxValue, dierta, minValue); |
||||
} |
||||
} |
@ -0,0 +1,55 @@
|
||||
package com.fr.design.gui.ibutton; |
||||
|
||||
import com.fr.design.editlock.EditLockChangeEvent; |
||||
import com.fr.design.editlock.EditLockChangeListener; |
||||
import com.fr.design.editlock.EditLockUtils; |
||||
import com.fr.report.LockItem; |
||||
|
||||
import javax.swing.Icon; |
||||
|
||||
/** |
||||
* @author Yvan |
||||
* @version 10.0 |
||||
* Created by Yvan on 2021/1/20 |
||||
*/ |
||||
public class UILockButton extends UIButton implements EditLockChangeListener { |
||||
|
||||
/** |
||||
* 锁定状态图标 |
||||
*/ |
||||
private Icon lockedIcon; |
||||
/** |
||||
* 正常状态图标 |
||||
*/ |
||||
private Icon normalIcon; |
||||
/** |
||||
* 锁定状态的提示信息 |
||||
*/ |
||||
private String lockedTooltips; |
||||
/** |
||||
* 正常状态的提示信息 |
||||
*/ |
||||
private String normalTooltips; |
||||
|
||||
public UILockButton(Icon lockedIcon, Icon normalIcon, String lockedTooltips, String normalTooltips) { |
||||
super(); |
||||
this.lockedIcon = lockedIcon; |
||||
this.normalIcon = normalIcon; |
||||
this.lockedTooltips = lockedTooltips; |
||||
this.normalTooltips = normalTooltips; |
||||
init(); |
||||
} |
||||
|
||||
private void init() { |
||||
boolean locked = EditLockUtils.isLocked(LockItem.CONNECTION); |
||||
this.setIcon(locked ? lockedIcon : normalIcon); |
||||
this.setToolTipText(locked ? lockedTooltips : normalTooltips); |
||||
} |
||||
|
||||
@Override |
||||
public void updateLockedState(EditLockChangeEvent event) { |
||||
this.setIcon(event.isLocked() ? lockedIcon : normalIcon); |
||||
this.setToolTipText(event.isLocked() ? lockedTooltips : normalTooltips); |
||||
this.repaint(); |
||||
} |
||||
} |
@ -0,0 +1,47 @@
|
||||
package com.fr.design.gui.imenu; |
||||
|
||||
import com.fr.design.editlock.EditLockChangeEvent; |
||||
import com.fr.design.editlock.EditLockChangeListener; |
||||
import com.fr.report.LockItem; |
||||
|
||||
import javax.swing.Action; |
||||
|
||||
/** |
||||
* @author Yvan |
||||
* @version 10.0 |
||||
* Created by Yvan on 2021/1/20 |
||||
*/ |
||||
public class UILockMenuItem extends UIMenuItem implements EditLockChangeListener { |
||||
|
||||
/** |
||||
* 锁定状态的提示信息 |
||||
*/ |
||||
private String lockedTooltips; |
||||
/** |
||||
* 正常状态的提示信息 |
||||
*/ |
||||
private String normalTooltips; |
||||
|
||||
/** |
||||
* 当前锁定项 |
||||
*/ |
||||
private LockItem lockItem; |
||||
|
||||
public UILockMenuItem(Action action, String lockedTooltips, String normalTooltips, LockItem lockItem) { |
||||
super(action); |
||||
this.lockedTooltips = lockedTooltips; |
||||
this.normalTooltips = normalTooltips; |
||||
this.lockItem = lockItem; |
||||
setUI(new UILockMenuItemUI()); |
||||
} |
||||
|
||||
public LockItem getLockItem() { |
||||
return lockItem; |
||||
} |
||||
|
||||
@Override |
||||
public void updateLockedState(EditLockChangeEvent event) { |
||||
this.setToolTipText(event.isLocked() ? lockedTooltips : normalTooltips); |
||||
this.repaint(); |
||||
} |
||||
} |
@ -0,0 +1,28 @@
|
||||
package com.fr.design.gui.imenu; |
||||
|
||||
import com.fr.design.editlock.EditLockUtils; |
||||
|
||||
import javax.swing.JMenuItem; |
||||
import java.awt.Graphics; |
||||
import java.awt.Rectangle; |
||||
|
||||
/** |
||||
* @author Yvan |
||||
* @version 10.0 |
||||
* Created by Yvan on 2021/1/20 |
||||
*/ |
||||
public class UILockMenuItemUI extends UIMenuItemUI{ |
||||
|
||||
@Override |
||||
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) { |
||||
super.paintText(g, menuItem, textRect, text); |
||||
// 除了绘制text之外,还需要画一下锁定图标
|
||||
UILockMenuItem lockMenuItem = (UILockMenuItem) menuItem; |
||||
if (EditLockUtils.isLocked(lockMenuItem.getLockItem())) { |
||||
int width = menuItem.getWidth(); |
||||
int height = menuItem.getHeight(); |
||||
g.drawImage(EditLockUtils.LOCKED_IMAGE, (int) Math.round(width * 0.9), (int) Math.round(height * 0.1), 16, 16, null); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,15 @@
|
||||
package com.fr.design.gui.ispinner.chart; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2021-01-21 |
||||
*/ |
||||
public class UISpinnerWithPercent extends UISpinnerWithUnit { |
||||
|
||||
private static final String UNIT = "%"; |
||||
|
||||
public UISpinnerWithPercent(double minValue, double maxValue, double dierta, double defaultValue) { |
||||
super(minValue, maxValue, dierta, defaultValue, UNIT); |
||||
} |
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.fr.design.gui.ispinner.chart; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2021-01-21 |
||||
*/ |
||||
public class UISpinnerWithPx extends UISpinnerWithUnit { |
||||
|
||||
private static final String UNIT = "px"; |
||||
|
||||
public UISpinnerWithPx(double defaultValue) { |
||||
this(0, Double.MAX_VALUE, 1, defaultValue); |
||||
} |
||||
|
||||
public UISpinnerWithPx(double minValue, double maxValue, double dierta, double defaultValue) { |
||||
super(minValue, maxValue, dierta, defaultValue, UNIT); |
||||
this.getTextField().canFillNegativeNumber(false); |
||||
} |
||||
} |
@ -0,0 +1,26 @@
|
||||
package com.fr.design.gui.ispinner.chart; |
||||
|
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.gui.itextfield.UINumberField; |
||||
import com.fr.design.gui.itextfield.UINumberFieldWithUnit; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2021-01-20 |
||||
*/ |
||||
public class UISpinnerWithUnit extends UISpinner { |
||||
|
||||
private String unit; |
||||
|
||||
public UISpinnerWithUnit(double minValue, double maxValue, double dierta, double defaultValue, String unit) { |
||||
this.unit = unit; |
||||
init(minValue, maxValue, dierta); |
||||
getTextField().setValue(defaultValue); |
||||
} |
||||
|
||||
@Override |
||||
protected UINumberField initNumberField() { |
||||
return new UINumberFieldWithUnit(3, unit); |
||||
} |
||||
} |
@ -0,0 +1,114 @@
|
||||
package com.fr.design.gui.itextfield; |
||||
|
||||
import com.fr.base.Utils; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Collections; |
||||
import java.util.Comparator; |
||||
import java.util.LinkedHashSet; |
||||
import java.util.List; |
||||
import java.util.Set; |
||||
import java.awt.Toolkit; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2021-01-20 |
||||
* 这个控件不会限制输入的数字大小,但是同样不允许输入数字之外的字符 |
||||
*/ |
||||
public class UINumberFieldWithUnit extends UINumberField { |
||||
|
||||
private String unit; |
||||
|
||||
private List<String> unitList = new ArrayList<>(); |
||||
|
||||
public UINumberFieldWithUnit(int columns, String unit) { |
||||
super(columns); |
||||
this.unit = unit; |
||||
initUnitList(); |
||||
} |
||||
|
||||
//对单位的字符进行组合
|
||||
private void initUnitList() { |
||||
char[] chars = unit.toCharArray(); |
||||
Set<String> set = new LinkedHashSet<>(); |
||||
initUnitList(chars, 0, StringUtils.EMPTY, set); |
||||
unitList.addAll(set); |
||||
Collections.sort(unitList, Comparator.comparing(String::length)); |
||||
} |
||||
|
||||
private void initUnitList(char[] chars, int index, String str, Set<String> set) { |
||||
if (index == chars.length) { |
||||
return; |
||||
} |
||||
for (int i = index; i < chars.length; i++) { |
||||
String newStr = str + chars[i]; |
||||
set.add(newStr); |
||||
initUnitList(chars, i + 1, newStr, set); |
||||
} |
||||
} |
||||
|
||||
public void setFieldDocument() { |
||||
setDocument(new NumberDocumentNoLimit()); |
||||
} |
||||
|
||||
public void setValue(double value) { |
||||
this.setText(Utils.doubleToString(value) + unit); |
||||
} |
||||
|
||||
public double getValue() throws NumberFormatException { |
||||
try { |
||||
String text = this.getText(); |
||||
if (StringUtils.isEmpty(text)) { |
||||
return 0; |
||||
} |
||||
|
||||
return Double.parseDouble(text.replace(getEndString(text), StringUtils.EMPTY)); |
||||
} catch (NumberFormatException numberFormatException) { |
||||
return UINumberField.ERROR_VALUE; |
||||
} |
||||
} |
||||
|
||||
private String getEndString(String text) { |
||||
int size = unitList.size(); |
||||
for (int i = size - 1; i >= 0; i--) { |
||||
String unit = unitList.get(i); |
||||
if (text.endsWith(unit)) { |
||||
return unit; |
||||
|
||||
} |
||||
} |
||||
return StringUtils.EMPTY; |
||||
} |
||||
|
||||
class NumberDocumentNoLimit extends NumberDocument { |
||||
|
||||
public boolean checkString(int offset, String s, String str) { |
||||
return (ComparatorUtils.equals(s, "F") |
||||
|| ComparatorUtils.equals(s, "f") |
||||
|| ComparatorUtils.equals(s, "D") |
||||
|| ComparatorUtils.equals(s, "d") |
||||
|| (ComparatorUtils.equals(s, ".") && getMaxDecimalLength() == 0)); |
||||
|
||||
} |
||||
|
||||
protected boolean isOverMaxOrMinValue(String strIntPart, String strDecPart, String strNew) { |
||||
return super.isOverMaxOrMinValue(strIntPart, strDecPart, strNew.replaceFirst(getEndString(strNew), StringUtils.EMPTY)); |
||||
} |
||||
|
||||
protected boolean checkNumber(String strValue, boolean isMinus) { |
||||
try { |
||||
if (ComparatorUtils.equals(strValue, StringUtils.EMPTY) || ComparatorUtils.equals(strValue, "-")) { |
||||
return false; |
||||
} |
||||
Double.parseDouble(strValue.replaceFirst(getEndString(strValue), StringUtils.EMPTY)); |
||||
} catch (Exception e) { |
||||
Toolkit.getDefaultToolkit().beep(); |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,47 @@
|
||||
package com.fr.design.monitor; |
||||
|
||||
import com.fr.design.fun.DesignerLifecycleMonitor; |
||||
import com.fr.stable.bridge.StableFactory; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/1/27 |
||||
*/ |
||||
public class DesignerLifecycleMonitorContext { |
||||
|
||||
private static DesignerLifecycleMonitor monitor; |
||||
|
||||
static { |
||||
DesignerLifecycleMonitor designerLifecycleMonitor = StableFactory.getMarkedInstanceObjectFromClass(DesignerLifecycleMonitor.MARK_STRING, DesignerLifecycleMonitor.class); |
||||
if (designerLifecycleMonitor != null) { |
||||
monitor = designerLifecycleMonitor; |
||||
} else { |
||||
monitor = new EmptyDesignerLifecycleMonitor(); |
||||
} |
||||
} |
||||
|
||||
public static DesignerLifecycleMonitor getMonitor() { |
||||
return monitor; |
||||
} |
||||
|
||||
static class EmptyDesignerLifecycleMonitor implements DesignerLifecycleMonitor { |
||||
|
||||
@Override |
||||
public void beforeStart() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void afterStart() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void beforeStop() { |
||||
|
||||
} |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,32 @@
|
||||
package com.fr.design.port; |
||||
|
||||
import com.fr.design.fun.DesignerPortProvider; |
||||
import com.fr.stable.bridge.StableFactory; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/1/27 |
||||
*/ |
||||
public class DesignerPortContext { |
||||
|
||||
private static int messagePort = -1; |
||||
|
||||
private static int embeddedServerPort = -1; |
||||
|
||||
static { |
||||
DesignerPortProvider designerPortProvider = StableFactory.getMarkedInstanceObjectFromClass(DesignerPortProvider.MARK_STRING, DesignerPortProvider.class); |
||||
if (designerPortProvider != null) { |
||||
messagePort = designerPortProvider.messagePort(); |
||||
embeddedServerPort = designerPortProvider.embeddedServerPort(); |
||||
} |
||||
} |
||||
|
||||
public static int getMessagePort() { |
||||
return messagePort; |
||||
} |
||||
|
||||
public static int getEmbeddedServerPort() { |
||||
return embeddedServerPort; |
||||
} |
||||
} |
Before Width: | Height: | Size: 938 B After Width: | Height: | Size: 850 B |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 959 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.7 KiB |
@ -1,143 +1,140 @@
|
||||
//package com.fr.design;
|
||||
//
|
||||
////import com.fr.decision.webservice.v10.plugin.helper.PluginErrorRemindHandler;
|
||||
//import com.fr.design.env.DesignerWorkspaceInfo;
|
||||
//import com.fr.design.env.DesignerWorkspaceType;
|
||||
//import com.fr.design.env.LocalDesignerWorkspaceInfo;
|
||||
//import com.fr.design.env.RemoteDesignerWorkspaceInfo;
|
||||
//import com.fr.env.CheckServiceDialog;
|
||||
//import com.fr.env.PluginErrorRemindDialog;
|
||||
//import com.fr.invoke.Reflect;
|
||||
//import com.fr.workspace.connect.WorkspaceConnectionInfo;
|
||||
//import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
|
||||
//import org.easymock.EasyMock;
|
||||
//import org.junit.Assert;
|
||||
//import org.junit.Test;
|
||||
//import org.junit.runner.RunWith;
|
||||
//import org.powermock.api.easymock.PowerMock;
|
||||
//import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
//import org.powermock.modules.junit4.PowerMockRunner;
|
||||
//
|
||||
//import java.awt.Frame;
|
||||
//
|
||||
///**
|
||||
// * @author: Maksim
|
||||
// * @Date: Created in 2020/3/5
|
||||
// * @Description:
|
||||
// */
|
||||
//@RunWith(PowerMockRunner.class)
|
||||
//@PrepareForTest({FunctionalHttpRequest.class,
|
||||
// EnvChangeEntrance.class,
|
||||
// CheckServiceDialog.class,
|
||||
// DesignerEnvManager.class,
|
||||
// PluginErrorRemindHandler.class})
|
||||
//public class EnvChangeEntranceTest {
|
||||
//
|
||||
// @Test
|
||||
// public void showServiceDialog() throws Exception {
|
||||
// try {
|
||||
// EnvChangeEntrance entrance = EnvChangeEntrance.getInstance();
|
||||
// DesignerWorkspaceInfo selectedEnv = EasyMock.mock(DesignerWorkspaceInfo.class);
|
||||
// WorkspaceConnectionInfo connectionInfo = EasyMock.mock(WorkspaceConnectionInfo.class);
|
||||
//
|
||||
// String remoteBranch = "Build#persist-2020.02.15.01.01.12.12";
|
||||
// EasyMock.expect(selectedEnv.getConnection()).andReturn(connectionInfo);
|
||||
// EasyMock.expect(selectedEnv.getType()).andReturn(DesignerWorkspaceType.Remote);
|
||||
// EasyMock.expect(selectedEnv.getRemindTime()).andReturn(null);
|
||||
//
|
||||
// FunctionalHttpRequest request = EasyMock.mock(FunctionalHttpRequest.class);
|
||||
// EasyMock.expect(request.getServiceList()).andReturn(null);
|
||||
//
|
||||
// PowerMock.expectNew(FunctionalHttpRequest.class, connectionInfo).andReturn(request).anyTimes();
|
||||
// EasyMock.expect(request.getServerBranch()).andReturn(remoteBranch);
|
||||
//
|
||||
// CheckServiceDialog dialog = EasyMock.mock(CheckServiceDialog.class);
|
||||
// PowerMock.expectNew(CheckServiceDialog.class, EasyMock.anyObject(Frame.class), EasyMock.anyString(), EasyMock.anyString(), EasyMock.anyString()).andReturn(dialog);
|
||||
//
|
||||
// EasyMock.replay(request, selectedEnv, connectionInfo);
|
||||
// PowerMock.replayAll();
|
||||
//
|
||||
// entrance.showServiceDialog(selectedEnv);
|
||||
//
|
||||
// }catch (Exception e){
|
||||
// Assert.fail();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testUpdateNotRememberPwdEnv() {
|
||||
//
|
||||
// DesignerEnvManager manager = new DesignerEnvManager();
|
||||
//
|
||||
// PowerMock.mockStatic(DesignerEnvManager.class);
|
||||
// EasyMock.expect(DesignerEnvManager.getEnvManager()).andReturn(manager).anyTimes();
|
||||
//
|
||||
// PowerMock.replayAll();
|
||||
//
|
||||
// EnvChangeEntrance entrance = EnvChangeEntrance.getInstance();
|
||||
//
|
||||
// manager.putEnv("test1", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true)));
|
||||
// manager.putEnv("test2", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", false)));
|
||||
// manager.putEnv("test3", LocalDesignerWorkspaceInfo.create("name", "path"));
|
||||
//
|
||||
// Reflect.on(entrance).call("updateNotRememberPwdEnv");
|
||||
//
|
||||
// Assert.assertEquals(manager.getWorkspaceInfo("test1").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true)).getConnection());
|
||||
// Assert.assertEquals(manager.getWorkspaceInfo("test2").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "", "", "", false)).getConnection());
|
||||
// Assert.assertEquals(manager.getWorkspaceInfo("test3").getName(), "name");
|
||||
// Assert.assertEquals(manager.getWorkspaceInfo("test3").getPath(), "path");
|
||||
//
|
||||
// PowerMock.verifyAll();
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testIsNotRememberPwd() {
|
||||
// EnvChangeEntrance entrance = EnvChangeEntrance.getInstance();
|
||||
//
|
||||
// DesignerWorkspaceInfo info1 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true));
|
||||
// DesignerWorkspaceInfo info2 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "111", "", "", false));
|
||||
// DesignerWorkspaceInfo info3 = LocalDesignerWorkspaceInfo.create("name", "path");
|
||||
// DesignerWorkspaceInfo info4 = null;
|
||||
//
|
||||
// Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info1).get());
|
||||
// Assert.assertTrue(Reflect.on(entrance).call("isNotRememberPwd", info2).get());
|
||||
// Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info3).get());
|
||||
// Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info4).get());
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testPluginErrorRemind() throws Exception {
|
||||
//
|
||||
// try {
|
||||
// DesignerWorkspaceInfo selectedEnv = EasyMock.mock(DesignerWorkspaceInfo.class);
|
||||
// EasyMock.expect(selectedEnv.getType()).andReturn(DesignerWorkspaceType.Remote).once();
|
||||
// EasyMock.expect(selectedEnv.getType()).andReturn(DesignerWorkspaceType.Local).times(2);
|
||||
//
|
||||
// PowerMock.mockStatic(PluginErrorRemindHandler.class);
|
||||
// EasyMock.expect(PluginErrorRemindHandler.pluginErrorContent()).andReturn("").once();
|
||||
// EasyMock.expect(PluginErrorRemindHandler.pluginErrorContent()).andReturn("111").once();
|
||||
//
|
||||
// PluginErrorRemindDialog dialog = EasyMock.mock(PluginErrorRemindDialog.class);
|
||||
// PowerMock.expectNew(PluginErrorRemindDialog.class, EasyMock.anyObject(Frame.class), EasyMock.anyString()).andReturn(dialog).once();
|
||||
//
|
||||
// dialog.setVisible(true);
|
||||
// EasyMock.expectLastCall();
|
||||
//
|
||||
// EasyMock.replay(selectedEnv, dialog);
|
||||
// PowerMock.replayAll();
|
||||
//
|
||||
// EnvChangeEntrance entrance = EnvChangeEntrance.getInstance();
|
||||
//
|
||||
// entrance.pluginErrorRemind(selectedEnv);
|
||||
// entrance.pluginErrorRemind(selectedEnv);
|
||||
// entrance.pluginErrorRemind(selectedEnv);
|
||||
//
|
||||
//
|
||||
// EasyMock.verify(selectedEnv, dialog);
|
||||
// PowerMock.verifyAll();
|
||||
// } catch (Exception e) {
|
||||
// Assert.fail();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
package com.fr.design; |
||||
|
||||
import com.fr.decision.webservice.v10.plugin.helper.PluginErrorRemindHandler; |
||||
import com.fr.design.env.DesignerWorkspaceInfo; |
||||
import com.fr.design.env.DesignerWorkspaceType; |
||||
import com.fr.design.env.LocalDesignerWorkspaceInfo; |
||||
import com.fr.design.env.RemoteDesignerWorkspaceInfo; |
||||
import com.fr.env.CheckServiceDialog; |
||||
import com.fr.env.PluginErrorRemindDialog; |
||||
import com.fr.invoke.Reflect; |
||||
import com.fr.workspace.WorkContext; |
||||
import com.fr.workspace.Workspace; |
||||
import com.fr.workspace.connect.WorkspaceConnectionInfo; |
||||
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; |
||||
import org.easymock.EasyMock; |
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
import org.junit.runner.RunWith; |
||||
import org.powermock.api.easymock.PowerMock; |
||||
import org.powermock.core.classloader.annotations.PrepareForTest; |
||||
import org.powermock.modules.junit4.PowerMockRunner; |
||||
|
||||
import java.awt.Frame; |
||||
|
||||
/** |
||||
* @author: Maksim |
||||
* @Date: Created in 2020/3/5 |
||||
* @Description: |
||||
*/ |
||||
@RunWith(PowerMockRunner.class) |
||||
@PrepareForTest({FunctionalHttpRequest.class, |
||||
EnvChangeEntrance.class, |
||||
CheckServiceDialog.class, |
||||
DesignerEnvManager.class, |
||||
PluginErrorRemindHandler.class, |
||||
WorkContext.class}) |
||||
public class EnvChangeEntranceTest { |
||||
|
||||
@Test |
||||
public void showServiceDialog() throws Exception { |
||||
try { |
||||
EnvChangeEntrance entrance = EnvChangeEntrance.getInstance(); |
||||
DesignerWorkspaceInfo selectedEnv = EasyMock.mock(DesignerWorkspaceInfo.class); |
||||
WorkspaceConnectionInfo connectionInfo = EasyMock.mock(WorkspaceConnectionInfo.class); |
||||
|
||||
String remoteBranch = "Build#persist-2020.02.15.01.01.12.12"; |
||||
EasyMock.expect(selectedEnv.getConnection()).andReturn(connectionInfo); |
||||
EasyMock.expect(selectedEnv.getType()).andReturn(DesignerWorkspaceType.Remote); |
||||
EasyMock.expect(selectedEnv.getRemindTime()).andReturn(null); |
||||
|
||||
FunctionalHttpRequest request = EasyMock.mock(FunctionalHttpRequest.class); |
||||
EasyMock.expect(request.getServiceList()).andReturn(null); |
||||
|
||||
PowerMock.expectNew(FunctionalHttpRequest.class, connectionInfo).andReturn(request).anyTimes(); |
||||
EasyMock.expect(request.getServerBranch()).andReturn(remoteBranch); |
||||
|
||||
CheckServiceDialog dialog = EasyMock.mock(CheckServiceDialog.class); |
||||
PowerMock.expectNew(CheckServiceDialog.class, EasyMock.anyObject(Frame.class), EasyMock.anyString(), EasyMock.anyString(), EasyMock.anyString()).andReturn(dialog); |
||||
|
||||
EasyMock.replay(request, selectedEnv, connectionInfo); |
||||
PowerMock.replayAll(); |
||||
|
||||
entrance.showServiceDialog(selectedEnv); |
||||
|
||||
}catch (Exception e){ |
||||
Assert.fail(); |
||||
} |
||||
} |
||||
|
||||
@Test |
||||
public void testUpdateNotRememberPwdEnv() { |
||||
|
||||
DesignerEnvManager manager = new DesignerEnvManager(); |
||||
|
||||
PowerMock.mockStatic(DesignerEnvManager.class); |
||||
EasyMock.expect(DesignerEnvManager.getEnvManager()).andReturn(manager).anyTimes(); |
||||
|
||||
PowerMock.replayAll(); |
||||
|
||||
EnvChangeEntrance entrance = EnvChangeEntrance.getInstance(); |
||||
|
||||
manager.putEnv("test1", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true))); |
||||
manager.putEnv("test2", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", false))); |
||||
manager.putEnv("test3", LocalDesignerWorkspaceInfo.create("name", "path")); |
||||
|
||||
Reflect.on(entrance).call("updateNotRememberPwdEnv"); |
||||
|
||||
Assert.assertEquals(manager.getWorkspaceInfo("test1").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true)).getConnection()); |
||||
Assert.assertEquals(manager.getWorkspaceInfo("test2").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "", "", "", false)).getConnection()); |
||||
Assert.assertEquals(manager.getWorkspaceInfo("test3").getName(), "name"); |
||||
Assert.assertEquals(manager.getWorkspaceInfo("test3").getPath(), "path"); |
||||
|
||||
PowerMock.verifyAll(); |
||||
|
||||
} |
||||
|
||||
@Test |
||||
public void testIsNotRememberPwd() { |
||||
EnvChangeEntrance entrance = EnvChangeEntrance.getInstance(); |
||||
|
||||
DesignerWorkspaceInfo info1 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true)); |
||||
DesignerWorkspaceInfo info2 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "111", "", "", false)); |
||||
DesignerWorkspaceInfo info3 = LocalDesignerWorkspaceInfo.create("name", "path"); |
||||
DesignerWorkspaceInfo info4 = null; |
||||
|
||||
Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info1).get()); |
||||
Assert.assertTrue(Reflect.on(entrance).call("isNotRememberPwd", info2).get()); |
||||
Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info3).get()); |
||||
Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info4).get()); |
||||
} |
||||
|
||||
@Test |
||||
public void testPluginErrorRemind() { |
||||
|
||||
try { |
||||
|
||||
Workspace workspace = EasyMock.mock(Workspace.class); |
||||
EasyMock.expect(workspace.isLocal()).andReturn(false).once(); |
||||
EasyMock.expect(workspace.isLocal()).andReturn(true).once(); |
||||
PowerMock.mockStatic(WorkContext.class); |
||||
EasyMock.expect(WorkContext.getCurrent()).andReturn(workspace).anyTimes(); |
||||
|
||||
PowerMock.mockStatic(PluginErrorRemindHandler.class); |
||||
EasyMock.expect(PluginErrorRemindHandler.pluginErrorContent()).andReturn("").once(); |
||||
|
||||
EasyMock.replay(workspace); |
||||
PowerMock.replayAll(); |
||||
|
||||
EnvChangeEntrance entrance = EnvChangeEntrance.getInstance(); |
||||
|
||||
entrance.pluginErrorRemind(); |
||||
entrance.pluginErrorRemind(); |
||||
|
||||
EasyMock.verify(workspace); |
||||
PowerMock.verifyAll(); |
||||
} catch (Exception e) { |
||||
Assert.fail(); |
||||
} |
||||
} |
||||
} |
@ -1,155 +1,155 @@
|
||||
//package com.fr.design.extra;
|
||||
//
|
||||
//import com.fr.invoke.Reflect;
|
||||
//import com.fr.json.JSONObject;
|
||||
//import com.fr.plugin.context.PluginContext;
|
||||
//import com.fr.plugin.context.PluginMarker;
|
||||
//import com.fr.plugin.context.PluginMarkerAdapter;
|
||||
//import com.fr.plugin.error.PluginErrorCode;
|
||||
//import com.fr.plugin.manage.PluginManager;
|
||||
//import com.fr.plugin.manage.control.PluginTask;
|
||||
//import com.fr.plugin.manage.control.PluginTaskResult;
|
||||
//import org.easymock.EasyMock;
|
||||
//import org.junit.Assert;
|
||||
//import org.junit.Test;
|
||||
//import org.junit.runner.RunWith;
|
||||
//import org.powermock.api.easymock.PowerMock;
|
||||
//import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
//import org.powermock.modules.junit4.PowerMockRunner;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * @author Lucian.Chen
|
||||
// * @version 10.0
|
||||
// * Created by Lucian.Chen on 2020/12/17
|
||||
// */
|
||||
//@RunWith(PowerMockRunner.class)
|
||||
//@PrepareForTest({PluginManager.class, PluginUtils.class})
|
||||
//public class PluginOperateUtilsTest {
|
||||
//
|
||||
// @Test
|
||||
// public void testGetSuccessInfo() {
|
||||
// PluginTaskResult pluginTaskResult = EasyMock.mock(PluginTaskResult.class);
|
||||
// PluginTaskResult pluginTaskResult1 = EasyMock.mock(PluginTaskResult.class);
|
||||
// PluginTaskResult pluginTaskResult2 = EasyMock.mock(PluginTaskResult.class);
|
||||
//
|
||||
// List<PluginTaskResult> pluginTaskResults1 = new ArrayList<>();
|
||||
// pluginTaskResults1.add(pluginTaskResult1);
|
||||
// List<PluginTaskResult> pluginTaskResults2 = new ArrayList<>();
|
||||
// pluginTaskResults2.add(pluginTaskResult1);
|
||||
// pluginTaskResults2.add(pluginTaskResult2);
|
||||
//
|
||||
// PluginMarker pluginMarker1 = PluginMarker.create("plugin-1", "1.0");
|
||||
// PluginMarker pluginMarker2 = PluginMarkerAdapter.create("plugin-2", "2.0", "name-2");
|
||||
// PluginTask pluginTask1 = PluginTask.installTask(pluginMarker1);
|
||||
// PluginTask pluginTask2 = PluginTask.installTask(pluginMarker2);
|
||||
//
|
||||
// EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults1).times(2);
|
||||
// EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults2).times(2);
|
||||
// EasyMock.expect(pluginTaskResult1.getCurrentTask()).andReturn(pluginTask1).anyTimes();
|
||||
// EasyMock.expect(pluginTaskResult2.getCurrentTask()).andReturn(pluginTask2).anyTimes();
|
||||
//
|
||||
// EasyMock.expect(pluginTaskResult1.errorCode()).andReturn(PluginErrorCode.BelowSystem).anyTimes();
|
||||
// EasyMock.expect(pluginTaskResult2.errorCode()).andReturn(PluginErrorCode.BeyondSystem).anyTimes();
|
||||
//
|
||||
// PluginContext plugin1 = EasyMock.mock(PluginContext.class);
|
||||
// PluginContext plugin2 = EasyMock.mock(PluginContext.class);
|
||||
// EasyMock.expect(plugin1.getName()).andReturn("context-1").anyTimes();
|
||||
// EasyMock.expect(plugin2.getName()).andReturn("context-2").anyTimes();
|
||||
// PowerMock.mockStatic(PluginManager.class);
|
||||
// EasyMock.expect(PluginManager.getContext(pluginMarker1.getPluginID()))
|
||||
// .andReturn(plugin1).once().andReturn(null).once().andReturn(plugin1).once().andReturn(null).once();
|
||||
// EasyMock.expect(PluginManager.getContext(pluginMarker2.getPluginID()))
|
||||
// .andReturn(plugin2).once().andReturn(null).once();
|
||||
//
|
||||
// EasyMock.replay(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2);
|
||||
// PowerMock.replayAll();
|
||||
//
|
||||
// // 1个
|
||||
// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem");
|
||||
// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem");
|
||||
//
|
||||
//
|
||||
// // 2个
|
||||
// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem\ncontext-2Fine-Core_Plugin_Error_BeyondSystem");
|
||||
// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem\nname-2Fine-Core_Plugin_Error_BeyondSystem");
|
||||
//
|
||||
// EasyMock.verify(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2);
|
||||
// PowerMock.verifyAll();
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Test
|
||||
// public void testGetPluginName() {
|
||||
// PluginContext pluginContext = EasyMock.mock(PluginContext.class);
|
||||
// EasyMock.expect(pluginContext.getName()).andReturn("pluginContext").once();
|
||||
//
|
||||
// PluginMarker pluginMarker1 = PluginMarker.create("id-1", "1");
|
||||
// PluginMarker pluginMarker2 = PluginMarkerAdapter.create("id-2", "2", "name-2");
|
||||
//
|
||||
// EasyMock.replay(pluginContext);
|
||||
//
|
||||
// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, null).get(), "");
|
||||
// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", pluginContext, pluginMarker1).get(), "pluginContext");
|
||||
// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker1).get(), "id-1");
|
||||
// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker2).get(), "name-2");
|
||||
//
|
||||
// EasyMock.verify(pluginContext);
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testUpdateMarker2Online() {
|
||||
//
|
||||
// try {
|
||||
// PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0");
|
||||
// String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}";
|
||||
// JSONObject object = new JSONObject(pluginJson);
|
||||
//
|
||||
// PowerMock.mockStatic(PluginUtils.class);
|
||||
// EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once();
|
||||
// EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andThrow(new NullPointerException()).once();
|
||||
//
|
||||
// PowerMock.replayAll();
|
||||
//
|
||||
// PluginMarker marker1 = PluginOperateUtils.updateMarker2Online(pluginMarker);
|
||||
// PluginMarker marker2 = PluginOperateUtils.updateMarker2Online(pluginMarker);
|
||||
//
|
||||
// Assert.assertTrue(marker1 instanceof PluginMarkerAdapter);
|
||||
// Assert.assertEquals(marker1.getPluginID(), "plugin-1");
|
||||
// Assert.assertEquals(marker1.getVersion(), "1.0");
|
||||
// Assert.assertEquals(((PluginMarkerAdapter) marker1).getPluginName(), "图表(新特性)");
|
||||
// Assert.assertEquals(marker2, pluginMarker);
|
||||
//
|
||||
// PowerMock.verifyAll();
|
||||
// } catch (Exception e) {
|
||||
// Assert.fail();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Test
|
||||
// public void testUpdatePluginOnline() {
|
||||
// try {
|
||||
// PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0");
|
||||
// String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}";
|
||||
// JSONObject object = new JSONObject(pluginJson);
|
||||
//
|
||||
// PowerMock.mockStatic(PluginUtils.class);
|
||||
// EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once();
|
||||
// EasyMock.expect(PluginUtils.getInstalledPluginMarkerByID("plugin-1")).andReturn(pluginMarker).once();
|
||||
//
|
||||
// PowerMock.replayAll();
|
||||
//
|
||||
// PluginOperateUtils.updatePluginOnline(pluginMarker, null);
|
||||
//
|
||||
// PowerMock.verifyAll();
|
||||
// } catch (Exception e) {
|
||||
// Assert.fail();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
package com.fr.design.extra; |
||||
|
||||
import com.fr.invoke.Reflect; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.context.PluginContext; |
||||
import com.fr.plugin.context.PluginMarker; |
||||
import com.fr.plugin.context.PluginMarkerAdapter; |
||||
import com.fr.plugin.error.PluginErrorCode; |
||||
import com.fr.plugin.manage.PluginManager; |
||||
import com.fr.plugin.manage.control.PluginTask; |
||||
import com.fr.plugin.manage.control.PluginTaskResult; |
||||
import org.easymock.EasyMock; |
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
import org.junit.runner.RunWith; |
||||
import org.powermock.api.easymock.PowerMock; |
||||
import org.powermock.core.classloader.annotations.PrepareForTest; |
||||
import org.powermock.modules.junit4.PowerMockRunner; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author Lucian.Chen |
||||
* @version 10.0 |
||||
* Created by Lucian.Chen on 2020/12/17 |
||||
*/ |
||||
@RunWith(PowerMockRunner.class) |
||||
@PrepareForTest({PluginManager.class, PluginUtils.class}) |
||||
public class PluginOperateUtilsTest { |
||||
|
||||
@Test |
||||
public void testGetSuccessInfo() { |
||||
PluginTaskResult pluginTaskResult = EasyMock.mock(PluginTaskResult.class); |
||||
PluginTaskResult pluginTaskResult1 = EasyMock.mock(PluginTaskResult.class); |
||||
PluginTaskResult pluginTaskResult2 = EasyMock.mock(PluginTaskResult.class); |
||||
|
||||
List<PluginTaskResult> pluginTaskResults1 = new ArrayList<>(); |
||||
pluginTaskResults1.add(pluginTaskResult1); |
||||
List<PluginTaskResult> pluginTaskResults2 = new ArrayList<>(); |
||||
pluginTaskResults2.add(pluginTaskResult1); |
||||
pluginTaskResults2.add(pluginTaskResult2); |
||||
|
||||
PluginMarker pluginMarker1 = PluginMarker.create("plugin-1", "1.0"); |
||||
PluginMarker pluginMarker2 = PluginMarkerAdapter.create("plugin-2", "2.0", "name-2"); |
||||
PluginTask pluginTask1 = PluginTask.installTask(pluginMarker1); |
||||
PluginTask pluginTask2 = PluginTask.installTask(pluginMarker2); |
||||
|
||||
EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults1).times(2); |
||||
EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults2).times(2); |
||||
EasyMock.expect(pluginTaskResult1.getCurrentTask()).andReturn(pluginTask1).anyTimes(); |
||||
EasyMock.expect(pluginTaskResult2.getCurrentTask()).andReturn(pluginTask2).anyTimes(); |
||||
|
||||
EasyMock.expect(pluginTaskResult1.errorCode()).andReturn(PluginErrorCode.BelowSystem).anyTimes(); |
||||
EasyMock.expect(pluginTaskResult2.errorCode()).andReturn(PluginErrorCode.BeyondSystem).anyTimes(); |
||||
|
||||
PluginContext plugin1 = EasyMock.mock(PluginContext.class); |
||||
PluginContext plugin2 = EasyMock.mock(PluginContext.class); |
||||
EasyMock.expect(plugin1.getName()).andReturn("context-1").anyTimes(); |
||||
EasyMock.expect(plugin2.getName()).andReturn("context-2").anyTimes(); |
||||
PowerMock.mockStatic(PluginManager.class); |
||||
EasyMock.expect(PluginManager.getContext(pluginMarker1.getPluginID())) |
||||
.andReturn(plugin1).once().andReturn(null).once().andReturn(plugin1).once().andReturn(null).once(); |
||||
EasyMock.expect(PluginManager.getContext(pluginMarker2.getPluginID())) |
||||
.andReturn(plugin2).once().andReturn(null).once(); |
||||
|
||||
EasyMock.replay(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2); |
||||
PowerMock.replayAll(); |
||||
|
||||
// 1个
|
||||
Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem"); |
||||
Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem"); |
||||
|
||||
|
||||
// 2个
|
||||
Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem\ncontext-2Fine-Core_Plugin_Error_BeyondSystem"); |
||||
Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem\nname-2Fine-Core_Plugin_Error_BeyondSystem"); |
||||
|
||||
EasyMock.verify(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2); |
||||
PowerMock.verifyAll(); |
||||
|
||||
} |
||||
|
||||
|
||||
@Test |
||||
public void testGetPluginName() { |
||||
PluginContext pluginContext = EasyMock.mock(PluginContext.class); |
||||
EasyMock.expect(pluginContext.getName()).andReturn("pluginContext").once(); |
||||
|
||||
PluginMarker pluginMarker1 = PluginMarker.create("id-1", "1"); |
||||
PluginMarker pluginMarker2 = PluginMarkerAdapter.create("id-2", "2", "name-2"); |
||||
|
||||
EasyMock.replay(pluginContext); |
||||
|
||||
Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, null).get(), ""); |
||||
Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", pluginContext, pluginMarker1).get(), "pluginContext"); |
||||
Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker1).get(), "id-1"); |
||||
Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker2).get(), "name-2"); |
||||
|
||||
EasyMock.verify(pluginContext); |
||||
} |
||||
|
||||
@Test |
||||
public void testUpdateMarker2Online() { |
||||
|
||||
try { |
||||
PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0"); |
||||
String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}"; |
||||
JSONObject object = new JSONObject(pluginJson); |
||||
|
||||
PowerMock.mockStatic(PluginUtils.class); |
||||
EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once(); |
||||
EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andThrow(new NullPointerException()).once(); |
||||
|
||||
PowerMock.replayAll(); |
||||
|
||||
PluginMarker marker1 = PluginOperateUtils.updateMarker2Online(pluginMarker); |
||||
PluginMarker marker2 = PluginOperateUtils.updateMarker2Online(pluginMarker); |
||||
|
||||
Assert.assertTrue(marker1 instanceof PluginMarkerAdapter); |
||||
Assert.assertEquals(marker1.getPluginID(), "plugin-1"); |
||||
Assert.assertEquals(marker1.getVersion(), "1.0"); |
||||
Assert.assertEquals(((PluginMarkerAdapter) marker1).getPluginName(), "图表(新特性)"); |
||||
Assert.assertEquals(marker2, pluginMarker); |
||||
|
||||
PowerMock.verifyAll(); |
||||
} catch (Exception e) { |
||||
Assert.fail(); |
||||
} |
||||
|
||||
} |
||||
|
||||
|
||||
@Test |
||||
public void testUpdatePluginOnline() { |
||||
try { |
||||
PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0"); |
||||
String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}"; |
||||
JSONObject object = new JSONObject(pluginJson); |
||||
|
||||
PowerMock.mockStatic(PluginUtils.class); |
||||
EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once(); |
||||
EasyMock.expect(PluginUtils.getInstalledPluginMarkerByID("plugin-1")).andReturn(pluginMarker).once(); |
||||
|
||||
PowerMock.replayAll(); |
||||
|
||||
PluginOperateUtils.updatePluginOnline(pluginMarker, null); |
||||
|
||||
PowerMock.verifyAll(); |
||||
} catch (Exception e) { |
||||
Assert.fail(); |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
@ -0,0 +1,135 @@
|
||||
package com.fr.van.chart.box; |
||||
|
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.ui.ModernUIPane; |
||||
import com.fr.plugin.chart.base.AttrTooltipContent; |
||||
import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; |
||||
import com.fr.plugin.chart.base.format.AttrTooltipDataMaxFormat; |
||||
import com.fr.plugin.chart.base.format.AttrTooltipDataMedianFormat; |
||||
import com.fr.plugin.chart.base.format.AttrTooltipDataMinFormat; |
||||
import com.fr.plugin.chart.base.format.AttrTooltipDataNumberFormat; |
||||
import com.fr.plugin.chart.base.format.AttrTooltipDataOutlierFormat; |
||||
import com.fr.plugin.chart.base.format.AttrTooltipDataQ1Format; |
||||
import com.fr.plugin.chart.base.format.AttrTooltipDataQ3Format; |
||||
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; |
||||
import com.fr.plugin.chart.box.attr.AttrBoxTooltipContent; |
||||
import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; |
||||
import com.fr.van.chart.designer.component.richText.VanChartFieldButton; |
||||
import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; |
||||
import com.fr.van.chart.designer.component.richText.VanChartFieldListener; |
||||
import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
public class VanChartBoxRichTextDetailedFieldListPane extends VanChartFieldListPane { |
||||
|
||||
private VanChartFieldButton richTextNumber; |
||||
private VanChartFieldButton richTextMax; |
||||
private VanChartFieldButton richTextQ3; |
||||
private VanChartFieldButton richTextMedian; |
||||
private VanChartFieldButton richTextQ1; |
||||
private VanChartFieldButton richTextMin; |
||||
private VanChartFieldButton richTextOutlier; |
||||
|
||||
public VanChartBoxRichTextDetailedFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditorPane) { |
||||
super(fieldAttrPane, richEditorPane); |
||||
} |
||||
|
||||
public VanChartFieldButton getRichTextMax() { |
||||
return richTextMax; |
||||
} |
||||
|
||||
public VanChartFieldButton getRichTextQ3() { |
||||
return richTextQ3; |
||||
} |
||||
|
||||
public VanChartFieldButton getRichTextMedian() { |
||||
return richTextMedian; |
||||
} |
||||
|
||||
public VanChartFieldButton getRichTextQ1() { |
||||
return richTextQ1; |
||||
} |
||||
|
||||
public VanChartFieldButton getRichTextMin() { |
||||
return richTextMin; |
||||
} |
||||
|
||||
protected void initDefaultFieldButton() { |
||||
VanChartFieldListener listener = getFieldListener(); |
||||
|
||||
setCategoryNameButton(new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), new AttrTooltipCategoryFormat(), listener)); |
||||
setSeriesNameButton(new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), new AttrTooltipSeriesFormat(), listener)); |
||||
|
||||
richTextNumber = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Data_Number"), new AttrTooltipDataNumberFormat(), listener); |
||||
richTextMax = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Max_Value"), new AttrTooltipDataMaxFormat(), listener); |
||||
richTextQ3 = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Data_Q3"), new AttrTooltipDataQ3Format(), listener); |
||||
richTextMedian = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Data_Median"), new AttrTooltipDataMedianFormat(), listener); |
||||
richTextQ1 = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Data_Q1"), new AttrTooltipDataQ1Format(), listener); |
||||
richTextMin = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Min_Value"), new AttrTooltipDataMinFormat(), listener); |
||||
richTextOutlier = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Outlier_Value"), new AttrTooltipDataOutlierFormat(), listener); |
||||
} |
||||
|
||||
protected void addDefaultFieldButton(JPanel fieldPane) { |
||||
fieldPane.add(getCategoryNameButton()); |
||||
fieldPane.add(getSeriesNameButton()); |
||||
fieldPane.add(richTextNumber); |
||||
fieldPane.add(richTextMax); |
||||
fieldPane.add(richTextQ3); |
||||
fieldPane.add(richTextMedian); |
||||
fieldPane.add(richTextQ1); |
||||
fieldPane.add(richTextMin); |
||||
fieldPane.add(richTextOutlier); |
||||
} |
||||
|
||||
protected List<VanChartFieldButton> getDefaultFieldButtonList() { |
||||
List<VanChartFieldButton> fieldButtonList = new ArrayList<>(); |
||||
|
||||
fieldButtonList.add(getCategoryNameButton()); |
||||
fieldButtonList.add(getSeriesNameButton()); |
||||
fieldButtonList.add(richTextNumber); |
||||
fieldButtonList.add(richTextMax); |
||||
fieldButtonList.add(richTextQ3); |
||||
fieldButtonList.add(richTextMedian); |
||||
fieldButtonList.add(richTextQ1); |
||||
fieldButtonList.add(richTextMin); |
||||
fieldButtonList.add(richTextOutlier); |
||||
|
||||
return fieldButtonList; |
||||
} |
||||
|
||||
public void populateDefaultField(AttrTooltipContent tooltipContent) { |
||||
super.populateDefaultField(tooltipContent); |
||||
|
||||
if (tooltipContent instanceof AttrBoxTooltipContent) { |
||||
AttrBoxTooltipContent box = (AttrBoxTooltipContent) tooltipContent; |
||||
|
||||
populateButtonFormat(richTextNumber, box.getRichTextNumber()); |
||||
populateButtonFormat(richTextMax, box.getRichTextMax()); |
||||
populateButtonFormat(richTextQ3, box.getRichTextQ3()); |
||||
populateButtonFormat(richTextMedian, box.getRichTextMedian()); |
||||
populateButtonFormat(richTextQ1, box.getRichTextQ1()); |
||||
populateButtonFormat(richTextMin, box.getRichTextMin()); |
||||
populateButtonFormat(richTextOutlier, box.getRichTextOutlier()); |
||||
} |
||||
} |
||||
|
||||
public void updateDefaultField(AttrTooltipContent tooltipContent) { |
||||
super.updateDefaultField(tooltipContent); |
||||
|
||||
if (tooltipContent instanceof AttrBoxTooltipContent) { |
||||
AttrBoxTooltipContent box = (AttrBoxTooltipContent) tooltipContent; |
||||
|
||||
updateButtonFormat(richTextNumber, box.getRichTextNumber()); |
||||
updateButtonFormat(richTextMax, box.getRichTextMax()); |
||||
updateButtonFormat(richTextQ3, box.getRichTextQ3()); |
||||
updateButtonFormat(richTextMedian, box.getRichTextMedian()); |
||||
updateButtonFormat(richTextQ1, box.getRichTextQ1()); |
||||
updateButtonFormat(richTextMin, box.getRichTextMin()); |
||||
updateButtonFormat(richTextOutlier, box.getRichTextOutlier()); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,41 @@
|
||||
package com.fr.van.chart.box; |
||||
|
||||
import com.fr.design.ui.ModernUIPane; |
||||
import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; |
||||
import com.fr.van.chart.designer.component.richText.VanChartFieldButton; |
||||
import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
public class VanChartBoxRichTextResultFieldListPane extends VanChartBoxRichTextDetailedFieldListPane { |
||||
|
||||
public VanChartBoxRichTextResultFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditorPane) { |
||||
super(fieldAttrPane, richEditorPane); |
||||
} |
||||
|
||||
protected void addDefaultFieldButton(JPanel fieldPane) { |
||||
fieldPane.add(getCategoryNameButton()); |
||||
fieldPane.add(getSeriesNameButton()); |
||||
fieldPane.add(getRichTextMax()); |
||||
fieldPane.add(getRichTextQ3()); |
||||
fieldPane.add(getRichTextMedian()); |
||||
fieldPane.add(getRichTextQ1()); |
||||
fieldPane.add(getRichTextMin()); |
||||
} |
||||
|
||||
protected List<VanChartFieldButton> getDefaultFieldButtonList() { |
||||
List<VanChartFieldButton> fieldButtonList = new ArrayList<>(); |
||||
|
||||
fieldButtonList.add(getCategoryNameButton()); |
||||
fieldButtonList.add(getSeriesNameButton()); |
||||
fieldButtonList.add(getRichTextMax()); |
||||
fieldButtonList.add(getRichTextQ3()); |
||||
fieldButtonList.add(getRichTextMedian()); |
||||
fieldButtonList.add(getRichTextQ1()); |
||||
fieldButtonList.add(getRichTextMin()); |
||||
|
||||
return fieldButtonList; |
||||
} |
||||
} |
@ -0,0 +1,34 @@
|
||||
package com.fr.van.chart.designer.component.tooltip; |
||||
|
||||
import com.fr.design.ui.ModernUIPane; |
||||
import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; |
||||
import com.fr.van.chart.designer.component.richText.VanChartFieldButton; |
||||
import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; |
||||
import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
public class VanChartFieldListPaneWithOutSeries extends VanChartFieldListPane { |
||||
|
||||
public VanChartFieldListPaneWithOutSeries(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditorPane) { |
||||
super(fieldAttrPane, richEditorPane); |
||||
} |
||||
|
||||
protected void addDefaultFieldButton(JPanel fieldPane) { |
||||
fieldPane.add(getCategoryNameButton()); |
||||
fieldPane.add(getValueButton()); |
||||
fieldPane.add(getPercentButton()); |
||||
} |
||||
|
||||
protected List<VanChartFieldButton> getDefaultFieldButtonList() { |
||||
List<VanChartFieldButton> fieldButtonList = new ArrayList<>(); |
||||
|
||||
fieldButtonList.add(getCategoryNameButton()); |
||||
fieldButtonList.add(getValueButton()); |
||||
fieldButtonList.add(getPercentButton()); |
||||
|
||||
return fieldButtonList; |
||||
} |
||||
} |
@ -0,0 +1,62 @@
|
||||
package com.fr.van.chart.funnel.designer.style; |
||||
|
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.ui.ModernUIPane; |
||||
import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; |
||||
import com.fr.plugin.chart.base.format.AttrTooltipNameFormat; |
||||
import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; |
||||
import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; |
||||
import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; |
||||
import com.fr.van.chart.designer.component.richText.VanChartFieldButton; |
||||
import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; |
||||
import com.fr.van.chart.designer.component.richText.VanChartFieldListener; |
||||
import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
public class VanChartFunnelRichTextFieldListPane extends VanChartFieldListPane { |
||||
|
||||
public VanChartFunnelRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane<VanChartRichEditorModel> richEditorPane) { |
||||
super(fieldAttrPane, richEditorPane); |
||||
} |
||||
|
||||
protected void initDefaultFieldButton() { |
||||
VanChartFieldListener fieldListener = getFieldListener(); |
||||
|
||||
VanChartFieldButton categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), |
||||
new AttrTooltipCategoryFormat(), false, fieldListener); |
||||
|
||||
VanChartFieldButton seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), |
||||
new AttrTooltipNameFormat(), false, fieldListener); |
||||
|
||||
VanChartFieldButton valueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Value"), |
||||
new AttrTooltipValueFormat(), false, fieldListener); |
||||
|
||||
VanChartFieldButton percentButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Value_Conversion"), |
||||
new AttrTooltipPercentFormat(), false, fieldListener); |
||||
|
||||
setCategoryNameButton(categoryNameButton); |
||||
setSeriesNameButton(seriesNameButton); |
||||
setValueButton(valueButton); |
||||
setPercentButton(percentButton); |
||||
} |
||||
|
||||
protected void addDefaultFieldButton(JPanel fieldPane) { |
||||
fieldPane.add(getSeriesNameButton()); |
||||
fieldPane.add(getValueButton()); |
||||
fieldPane.add(getPercentButton()); |
||||
} |
||||
|
||||
protected List<VanChartFieldButton> getDefaultFieldButtonList() { |
||||
List<VanChartFieldButton> fieldButtonList = new ArrayList<>(); |
||||
|
||||
fieldButtonList.add(getSeriesNameButton()); |
||||
fieldButtonList.add(getValueButton()); |
||||
fieldButtonList.add(getPercentButton()); |
||||
|
||||
return fieldButtonList; |
||||
} |
||||
|
||||
} |