diff --git a/designer-base/src/main/java/com/fr/base/svg/IconUtils.java b/designer-base/src/main/java/com/fr/base/svg/IconUtils.java index 119471dcee..45c11c60c0 100644 --- a/designer-base/src/main/java/com/fr/base/svg/IconUtils.java +++ b/designer-base/src/main/java/com/fr/base/svg/IconUtils.java @@ -35,7 +35,12 @@ public class IconUtils { if (resource.contains(SUFFIX_SEPARATOR)) { // 判断是否以.svg结尾 if (resource.endsWith(ICON_SUFFIX_SVG)) { - return SVGIcon.readSVGIcon(resource); + if (IOUtils.readResource(resource) != null) { + return SVGIcon.readSVGIcon(resource); + } + // 适配某些插件里是_normal.png、_selected.png的情况 + String pngResource = resource.replace(ICON_SUFFIX_SVG, ICON_SUFFIX_PNG); + return IOUtils.readIcon(pngResource); } return IOUtils.readIcon(resource); } diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 791d679b30..b8951ea8ba 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -15,10 +15,12 @@ import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.LocalDesignerWorkspaceInfo; import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.fun.DesignerPortProvider; import com.fr.design.i18n.Toolkit; import com.fr.design.locale.impl.ProductImproveMark; import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.notification.SnapChatConfig; +import com.fr.design.port.DesignerPortContext; import com.fr.design.update.push.DesignerPushUpdateConfigManager; import com.fr.design.style.color.ColorSelectConfigManager; import com.fr.design.utils.DesignUtils; @@ -42,6 +44,7 @@ import com.fr.stable.ListMap; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; +import com.fr.stable.bridge.StableFactory; import com.fr.stable.core.UUID; import com.fr.stable.project.ProjectConstants; import com.fr.stable.xml.XMLPrintWriter; @@ -842,6 +845,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { * 返回Jetty服务器的端口号 */ public int getEmbedServerPort() { + int embeddedServerPort = DesignerPortContext.getEmbeddedServerPort(); + if (embeddedServerPort >= DesignerPort.MIN_PORT && embeddedServerPort <= DesignerPort.MAX_PORT) { + return embeddedServerPort; + } return this.jettyServerPort; } diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index ed67299f6d..c8078777d5 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -146,7 +146,7 @@ public class EnvChangeEntrance { template.refreshToolArea(); } showServiceDialog(selectedEnv); - pluginErrorRemind(selectedEnv); + pluginErrorRemind(); } catch (WorkspaceAuthException | RegistEditionException e) { // String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed"); // String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote"); @@ -302,17 +302,23 @@ public class EnvChangeEntrance { /** * 插件启动错误信息提示 - * @param selectedEnv 选择的工作环境 */ - public void pluginErrorRemind(DesignerWorkspaceInfo selectedEnv) { - if (selectedEnv.getType() == DesignerWorkspaceType.Remote) { + public void pluginErrorRemind() { + if (!WorkContext.getCurrent().isLocal()) { return; } String content = PluginErrorRemindHandler.pluginErrorContent(); if (StringUtils.isNotEmpty(content)) { - PluginErrorRemindDialog dialog = new PluginErrorRemindDialog(DesignerContext.getDesignerFrame(), content); - dialog.setVisible(true); + // 该操作需要在当前awt操作之后执行,使用SwingUtilities.invokeLater将其置于awt操作对列末尾 + // 若使用UIUtil.invokeLaterIfNeeded,会立即执行,影响其他UI操作 + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + PluginErrorRemindDialog dialog = new PluginErrorRemindDialog(DesignerContext.getDesignerFrame(), content); + dialog.setVisible(true); + } + }); } } @@ -431,7 +437,7 @@ public class EnvChangeEntrance { public void chooseEnv(final String envName) { final EnvListPane envListPane = new EnvListPane(); - final BasicDialog envListDialog = envListPane.showWindow(SwingUtilities.getWindowAncestor(DesignerContext.getDesignerFrame())); + final BasicDialog envListDialog = envListPane.showWindow(DesignerContext.getDesignerFrame()); envListPane.populateEnvManager(envName); envListDialog.addDialogActionListener(new DialogActionAdapter() { diff --git a/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java b/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java index 711dd29759..4ff6beda24 100644 --- a/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java +++ b/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java @@ -39,6 +39,23 @@ public class PluginClassRefreshManager { } }; + private final PluginEventListener beforeAllPluginActive = new PluginEventListener() { + @Override + public void on(PluginEvent event) { + PluginListenerRegistration.getInstance().stopListen(pluginAfterRunEventListener); + } + }; + + private final PluginEventListener afterAllPluginsActive = new PluginEventListener() { + @Override + public void on(PluginEvent event) { + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, pluginAfterRunEventListener); + if (DesignerLaunchStatus.getStatus() != DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) { + HistoryTemplateListCache.getInstance().reloadAllEditingTemplate(); + } + } + }; + public static PluginClassRefreshManager getInstance() { return INSTANCE; @@ -50,29 +67,20 @@ public class PluginClassRefreshManager { } private PluginClassRefreshManager() { - PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, new PluginEventListener() { - @Override - public void on(PluginEvent event) { - removePluginListener(); - } - }); - PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, new PluginEventListener() { - @Override - public void on(PluginEvent event) { - addPluginListener(); - if (DesignerLaunchStatus.getStatus() != DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) { - HistoryTemplateListCache.getInstance().reloadAllEditingTemplate(); - } - } - }); + PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, beforeAllPluginActive); + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, afterAllPluginsActive); } public void removePluginListener() { PluginListenerRegistration.getInstance().stopListen(this.pluginAfterRunEventListener); + PluginListenerRegistration.getInstance().stopListen(this.beforeAllPluginActive); + PluginListenerRegistration.getInstance().stopListen(this.afterAllPluginsActive); } public void addPluginListener() { PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginAfterRunEventListener); + PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, beforeAllPluginActive); + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, afterAllPluginsActive); } } diff --git a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java index bb4ba4cccc..5c12ff29c3 100644 --- a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java @@ -339,33 +339,37 @@ public abstract class UpdateAction extends ShortCut implements Action { if (!(object instanceof AbstractButton)) { UIButton button = null; button = new UIButton(); - // 添加一个名字作为自动化测试用 - button.setName(getName()); - button.set4ToolbarButton(); - - //设置属性. - Integer mnemonicInteger = (Integer) this.getValue(Action.MNEMONIC_KEY); - if (mnemonicInteger != null) { - button.setMnemonic((char) mnemonicInteger.intValue()); - } - - button.setIcon((Icon) this.getValue(Action.SMALL_ICON)); - setPressedIcon4Button(button); - setDisabledIcon4Button(button); - button.addActionListener(this); + object = initButton(button, UIButton.class.getName()); + } - button.registerKeyboardAction(this, this.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW); + return (JComponent) object; + } - this.putValue(UIButton.class.getName(), button); - button.setText(StringUtils.EMPTY); - button.setEnabled(this.isEnabled()); + protected JComponent initButton(UIButton button, String name) { + // 添加一个名字作为自动化测试用 + button.setName(getName()); + button.set4ToolbarButton(); - //peter:产生tooltip - button.setToolTipText(getToolTipText()); - object = button; + //设置属性. + Integer mnemonicInteger = (Integer) this.getValue(Action.MNEMONIC_KEY); + if (mnemonicInteger != null) { + button.setMnemonic((char) mnemonicInteger.intValue()); } - return (JComponent) object; + button.setIcon((Icon) this.getValue(Action.SMALL_ICON)); + setPressedIcon4Button(button); + setDisabledIcon4Button(button); + button.addActionListener(this); + + button.registerKeyboardAction(this, this.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW); + + this.putValue(name, button); + button.setText(StringUtils.EMPTY); + button.setEnabled(this.isEnabled()); + + //peter:产生tooltip + button.setToolTipText(getToolTipText()); + return button; } /** @@ -641,14 +645,14 @@ public abstract class UpdateAction extends ShortCut implements Action { shortPinyin.append(PinyinHelper.getShortPinyin(title)).append(separator); } - private void setPressedIcon4Button(AbstractButton button) { + protected void setPressedIcon4Button(AbstractButton button) { Icon pressedIcon = (Icon) this.getValue(UpdateAction.PRESSED_ICON); if (pressedIcon != null && pressedIcon instanceof SVGIcon) { button.setPressedIcon(pressedIcon); } } - private void setDisabledIcon4Button(AbstractButton button) { + protected void setDisabledIcon4Button(AbstractButton button) { Icon disabledIcon = (Icon) this.getValue(UpdateAction.DISABLED_ICON); if (disabledIcon != null && disabledIcon instanceof SVGIcon) { button.setDisabledIcon(disabledIcon); diff --git a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java index 820de79e5e..4742f337cd 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java @@ -1,19 +1,23 @@ package com.fr.design.actions.server; -import com.fr.base.svg.IconUtils; import com.fr.data.impl.Connection; import com.fr.design.actions.UpdateAction; import com.fr.design.data.datapane.connect.ConnectionShowPane; import com.fr.design.data.datapane.connect.DatabaseConnectionPane; import com.fr.design.dialog.BasicDialog; +import com.fr.design.editlock.ConnectionLockChangeChecker; +import com.fr.design.editlock.EditLockUtils; import com.fr.design.gui.NameInspector; +import com.fr.design.gui.imenu.UILockMenuItem; +import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.menu.MenuKeySet; import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSSupportCenter; import com.fr.design.os.impl.DatabaseDialogAction; import com.fr.file.ConnectionConfig; +import com.fr.report.LockItem; -import javax.swing.*; +import javax.swing.KeyStroke; import java.awt.event.ActionEvent; import java.util.Map; @@ -53,8 +57,16 @@ public class ConnectionListAction extends UpdateAction { * @param evt 事件 */ public void actionPerformed(ActionEvent evt) { - OSBasedAction osBasedAction = OSSupportCenter.getAction(DatabaseDialogAction.class); - osBasedAction.execute(); + // 尝试为数据连接加锁 + boolean actionLock = EditLockUtils.lock(LockItem.CONNECTION); + if (!actionLock) { + // 锁定失败,代表已经被其他用户锁定,跳出弹窗提示 + EditLockUtils.showLockMessage(); + } else { + // 锁定成功,执行后续操作 + OSBasedAction osBasedAction = OSSupportCenter.getAction(DatabaseDialogAction.class); + osBasedAction.execute(); + } } /** @@ -96,4 +108,21 @@ public class ConnectionListAction extends UpdateAction { public void update() { this.setEnabled(true); } + + @Override + public UIMenuItem createMenuItem() { + Object object = this.getValue(UILockMenuItem.class.getName()); + if (object == null && !(object instanceof UILockMenuItem)) { + UILockMenuItem menuItem = new UILockMenuItem(this, EditLockUtils.CONNECTION_LOCKED_TOOLTIPS, null, LockItem.CONNECTION); + // 设置名字用作单元测 + menuItem.setName(getName()); + setPressedIcon4Button(menuItem); + setDisabledIcon4Button(menuItem); + object = menuItem; + + this.putValue(UILockMenuItem.class.getName(), object); + ConnectionLockChangeChecker.getInstance().addEditLockChangeListener((UILockMenuItem)object); + } + return (UILockMenuItem) object; + } } diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java index 468fb1f98d..ab85a14dc1 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java @@ -4,7 +4,6 @@ package com.fr.design.actions.server; import com.fr.base.TableData; -import com.fr.base.svg.IconUtils; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; import com.fr.design.data.DesignTableDataManager; @@ -13,7 +12,11 @@ import com.fr.design.data.tabledata.ResponseDataSourceChange; import com.fr.design.data.tabledata.tabledatapane.TableDataManagerPane; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.editlock.EditLockUtils; +import com.fr.design.editlock.ServerTableDataLockChangeChecker; import com.fr.design.gui.NameInspector; +import com.fr.design.gui.imenu.UILockMenuItem; +import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; @@ -22,9 +25,10 @@ import com.fr.file.TableDataConfig; import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; +import com.fr.report.LockItem; import javax.swing.KeyStroke; -import java.awt.*; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.util.HashMap; import java.util.Map; @@ -66,6 +70,14 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS * @param evt 事件 */ public void actionPerformed(ActionEvent evt) { + // 尝试为服务器数据集加锁 + boolean actionLock = EditLockUtils.lock(LockItem.SERVER_TABLE_DATA); + if (!actionLock) { + // 锁定失败,代表已经被其他用户锁定,跳出弹窗提示 + EditLockUtils.showLockMessage(); + return; + } + // 锁定成功,执行后续操作 final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); final TableDataConfig tableDataConfig = TableDataConfig.getInstance(); final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() { @@ -90,7 +102,6 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS globalTableDataDialog.setDoOKSucceed(false); return; } - DesignTableDataManager.clearGlobalDs(); // 保存时 移除服务器数据集列名缓存 for (String name : tableDataConfig.getTableDatas().keySet()) { @@ -114,9 +125,18 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS // 刷新共有数据集 TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); fireDSChanged(globalTableDataPane.getDsChangedNameMap()); + // 关闭服务器数据集页面,为其解锁 + EditLockUtils.unlock(LockItem.SERVER_TABLE_DATA); } })); } + + @Override + public void doCancel() { + super.doCancel(); + // 关闭服务器数据集页面,为其解锁 + EditLockUtils.unlock(LockItem.SERVER_TABLE_DATA); + } }); globalTableDataDialog.setVisible(true); } @@ -166,4 +186,21 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS public void fireDSChanged(Map map) { DesignTableDataManager.fireDSChanged(map); } + + @Override + public UIMenuItem createMenuItem() { + Object object = this.getValue(UILockMenuItem.class.getName()); + if (object == null && !(object instanceof UILockMenuItem)) { + UILockMenuItem menuItem = new UILockMenuItem(this, EditLockUtils.SERVER_TABLEDATA_LOCKED_TOOLTIPS, null, LockItem.SERVER_TABLE_DATA); + // 设置名字用作单元测 + menuItem.setName(getName()); + setPressedIcon4Button(menuItem); + setDisabledIcon4Button(menuItem); + object = menuItem; + + this.putValue(UILockMenuItem.class.getName(), object); + ServerTableDataLockChangeChecker.getInstance().addEditLockChangeListener((UILockMenuItem)object); + } + return (UILockMenuItem) object; + } } diff --git a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java index 83740f6853..34482d0d20 100644 --- a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java @@ -18,7 +18,10 @@ import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; +import com.fr.design.editlock.ConnectionLockChangeChecker; +import com.fr.design.editlock.EditLockUtils; import com.fr.design.gui.ibutton.UIHeadGroup; +import com.fr.design.gui.ibutton.UILockButton; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.icon.IconPathConstants; @@ -31,8 +34,11 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; +import javax.swing.AbstractButton; +import javax.swing.Action; import javax.swing.DefaultCellEditor; import javax.swing.Icon; +import javax.swing.JComponent; import javax.swing.JTree; import javax.swing.event.CellEditorListener; import javax.swing.event.ChangeEvent; @@ -439,6 +445,23 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp this.setMnemonic('D'); this.setSmallIcon("/com/fr/design/images/m_web/connection"); } + + @Override + public JComponent createToolBarComponent() { + Object object = this.getValue(UILockButton.class.getName()); + if (!(object instanceof AbstractButton)) { + UILockButton button = new UILockButton( + EditLockUtils.CONNECTION_LOCKED_ICON, + (Icon) this.getValue(Action.SMALL_ICON), + EditLockUtils.CONNECTION_LOCKED_TOOLTIPS, + getToolTipText() + ); + initButton(button, UILockButton.class.getName()); + object = button; + ConnectionLockChangeChecker.getInstance().addEditLockChangeListener((UILockButton)object); + } + return (JComponent) object; + } } /** diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java index f4a7910b1c..d441984c28 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java @@ -1,5 +1,6 @@ package com.fr.design.data.datapane.connect; +import com.fr.base.svg.IconUtils; import com.fr.data.impl.AbstractDatabaseConnection; import com.fr.data.impl.Connection; import com.fr.data.impl.NameDatabaseConnection; @@ -7,6 +8,10 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.actions.server.ConnectionListAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.editlock.ConnectionLockChangeChecker; +import com.fr.design.editlock.EditLockUtils; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UILockButton; import com.fr.design.mainframe.DesignerContext; import com.fr.file.ConnectionConfig; import com.fr.general.ComparatorUtils; @@ -16,8 +21,12 @@ import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; import com.fr.workspace.WorkContext; import com.fr.workspace.server.connection.DBConnectAuth; +import com.fr.report.LockItem; import javax.swing.SwingUtilities; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.ArrayList; @@ -56,6 +65,24 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { refreshItems(); } + @Override + protected UIButton initEditButton(UIButton editButton, Dimension buttonSize) { + editButton = new UILockButton( + EditLockUtils.CONNECTION_LOCKED_ICON, + IconUtils.readIcon("/com/fr/design/images/m_web/connection"), + EditLockUtils.CONNECTION_LOCKED_TOOLTIPS, + StringUtils.EMPTY + ); + editButton.setPreferredSize(buttonSize); + editButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + editItems(); + } + }); + ConnectionLockChangeChecker.getInstance().addEditLockChangeListener((UILockButton) editButton); + return editButton; + } + /* * 刷新ComboBox.items */ @@ -97,6 +124,14 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { * 弹出对话框编辑Items */ protected void editItems() { + // 尝试为数据连接加锁 + boolean actionLock = EditLockUtils.lock(LockItem.CONNECTION); + if (!actionLock) { + // 锁定失败,代表已经被其他用户锁定,跳出弹窗提示 + EditLockUtils.showLockMessage(); + return; + } + // 锁定成功,执行后续操作 final ConnectionListPane connectionListPane = new ConnectionListPane(); final ConnectionConfig connectionConfig = ConnectionConfig.getInstance(); ConnectionConfig cloned = connectionConfig.mirror(); @@ -109,7 +144,6 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { connectionListDialog.setDoOKSucceed(false); return; } - Configurations.modify(new WorkerFacade(ConnectionConfig.class) { @Override public void run() { @@ -125,10 +159,19 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { @Override public void afterCommit() { DesignerContext.getDesignerBean("databasename").refreshBeanElement(); + // 关闭定义数据连接页面,为其解锁 + EditLockUtils.unlock(LockItem.CONNECTION); } })); } + + @Override + public void doCancel() { + // 关闭定义数据连接页面,为其解锁 + super.doCancel(); + EditLockUtils.unlock(LockItem.CONNECTION); + } }); connectionListDialog.setVisible(true); refreshItems(); @@ -158,4 +201,4 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { } } } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java index 1c61eea265..f06d1405b8 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java @@ -12,7 +12,7 @@ import java.awt.event.ActionListener; public abstract class ItemEditableComboBoxPanel extends JPanel { /** - * + * */ private static final long serialVersionUID = 1L; @@ -21,37 +21,29 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { return ""; } }; - + protected UIComboBox itemComboBox; protected UIButton editButton; protected UIButton refreshButton; - + public ItemEditableComboBoxPanel() { super(); - + initComponents(); } - + protected void initComponents() { this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); - + Dimension buttonSize = new Dimension(26, 20); itemComboBox = new UIComboBox(); itemComboBox.setEnabled(true); this.add(itemComboBox, BorderLayout.CENTER); - - editButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/control-center2.png")); refreshButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); JPanel jPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 4 ,4); + editButton = initEditButton(editButton, buttonSize); jPanel.add(editButton); jPanel.add(refreshButton); this.add(jPanel, BorderLayout.EAST); - Dimension buttonSize = new Dimension(26, 20); - editButton.setPreferredSize(buttonSize); - editButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { - editItems(); - } - }); refreshButton.setPreferredSize(buttonSize); refreshButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -59,32 +51,44 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { } }); } - + + protected UIButton initEditButton(UIButton editButton, Dimension buttonSize) { + editButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/control-center2.png")); + editButton.setPreferredSize(buttonSize); + editButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + editItems(); + } + }); + return editButton; + } + + /** * 给itemComboBox添加ActionListener */ public void addComboBoxActionListener(ActionListener l) { itemComboBox.addActionListener(l); } - + /* * 刷新itemComboBox的内容 */ protected void refreshItems() { // 记录原来选中的Item,重新加载后需要再次选中 Object lastSelectedItem = itemComboBox.getSelectedItem(); - + DefaultComboBoxModel model = ((DefaultComboBoxModel) itemComboBox.getModel()); model.removeAllElements(); - + // 先加EMPTY,再加items model.addElement(EMPTY); - + java.util.Iterator itemIt = items(); while(itemIt.hasNext()) { model.addElement(itemIt.next()); } - + // 再次选中之前选中的Item int idx = model.getIndexOf(lastSelectedItem); if(idx < 0) { @@ -92,16 +96,16 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { } itemComboBox.setSelectedIndex(idx); } - + /* * 得到其中的itemComboBox所选中的Item */ public String getSelectedItem() { Object selected = itemComboBox.getSelectedItem(); - + return selected instanceof String ? (String)selected : null; } - + /* * 选中name项 */ @@ -109,14 +113,14 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { DefaultComboBoxModel model = ((DefaultComboBoxModel) itemComboBox.getModel()); model.setSelectedItem(name); } - + /* * 刷新ComboBox.items */ protected abstract java.util.Iterator items(); - + /* * 弹出对话框编辑Items */ protected abstract void editItems(); -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java index d3881bcd12..da87c10f6e 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java @@ -26,6 +26,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.ui.util.UIUtil; +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.function.TIME; import com.fr.general.FRFont; import com.fr.log.FineLoggerFactory; @@ -168,6 +169,7 @@ public class PreviewTablePane extends BasicPane { this.add(new JScrollPane(preveiwTable), BorderLayout.CENTER); if (this.dialog == null) { this.dialog = this.showWindow(new JFrame()); + GUICoreUtils.centerWindow(DesignerContext.getDesignerFrame(), this.dialog); } progressBar = new AutoProgressBar(this, Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) { public void doMonitorCanceled() { diff --git a/designer-base/src/main/java/com/fr/design/editlock/ConnectionLockChangeChecker.java b/designer-base/src/main/java/com/fr/design/editlock/ConnectionLockChangeChecker.java new file mode 100644 index 0000000000..8eb6a4aa9c --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/editlock/ConnectionLockChangeChecker.java @@ -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; + } +} diff --git a/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java new file mode 100644 index 0000000000..8f276dfe89 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java @@ -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 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)); + } + } + }); + } +} diff --git a/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeEvent.java b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeEvent.java new file mode 100644 index 0000000000..66420fd0b7 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeEvent.java @@ -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; + } +} diff --git a/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeListener.java b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeListener.java new file mode 100644 index 0000000000..dcabe87cce --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeListener.java @@ -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); +} diff --git a/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java b/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java new file mode 100644 index 0000000000..4f332a1707 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java @@ -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); + } +} diff --git a/designer-base/src/main/java/com/fr/design/editlock/ServerTableDataLockChangeChecker.java b/designer-base/src/main/java/com/fr/design/editlock/ServerTableDataLockChangeChecker.java new file mode 100644 index 0000000000..e38a4e940b --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/editlock/ServerTableDataLockChangeChecker.java @@ -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; + } +} diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java index 81e76fa451..92fdd4878a 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java @@ -44,40 +44,32 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback { FineLoggerFactory.getLogger().info(successInfo); FineJOptionPane.showMessageDialog(null, successInfo); } else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) { - int rv = FineJOptionPane.showOptionDialog( + int rv = FineJOptionPane.showConfirmDialog( null, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Dependence"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - FineJOptionPane.YES_NO_CANCEL_OPTION, - FineJOptionPane.INFORMATION_MESSAGE, - null, - FineJOptionPane.OPTION_YES_NO_CANCEL, - null + Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Dependence"), + Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), + FineJOptionPane.OK_CANCEL_OPTION, + FineJOptionPane.INFORMATION_MESSAGE ); - if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) { - return; + if (rv == FineJOptionPane.OK_OPTION) { + List pluginTasks = result.getPreTasks(); + for(PluginTask pluginTask : pluginTasks){ + PluginMarker marker = pluginTask.getMarker(); + PluginOperateUtils.installPluginOnline(marker, jsCallback); + } + PluginManager.getController().install(zipFile, new InstallFromDiskCallback(zipFile, jsCallback)); } - List pluginTasks = result.getPreTasks(); - for(PluginTask pluginTask : pluginTasks){ - PluginMarker marker = pluginTask.getMarker(); - PluginOperateUtils.installPluginOnline(marker, jsCallback); - } - PluginManager.getController().install(zipFile, new InstallFromDiskCallback(zipFile, jsCallback)); } else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){ - int rv = FineJOptionPane.showOptionDialog( + int rv = FineJOptionPane.showConfirmDialog( null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Install_Lower"), Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - FineJOptionPane.YES_NO_CANCEL_OPTION, - FineJOptionPane.INFORMATION_MESSAGE, - null, - FineJOptionPane.OPTION_YES_NO_CANCEL, - null + FineJOptionPane.OK_CANCEL_OPTION, + FineJOptionPane.INFORMATION_MESSAGE ); - if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) { - return; + if (rv == FineJOptionPane.OK_OPTION) { + PluginOperateUtils.updatePluginFromDisk(zipFile, jsCallback); } - PluginOperateUtils.updatePluginFromDisk(zipFile, jsCallback); }else { jsCallback.execute("failed"); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed")); diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java index c7059f50d5..4c94a9f42c 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java @@ -41,22 +41,20 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback { FineLoggerFactory.getLogger().info(successInfo); FineJOptionPane.showMessageDialog(null, successInfo); } else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){ - int rv = FineJOptionPane.showOptionDialog( + int rv = FineJOptionPane.showConfirmDialog( null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Install_Lower"), Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - FineJOptionPane.YES_NO_CANCEL_OPTION, - FineJOptionPane.INFORMATION_MESSAGE, - null, - FineJOptionPane.OPTION_YES_NO_CANCEL, - null + FineJOptionPane.OK_CANCEL_OPTION, + FineJOptionPane.INFORMATION_MESSAGE ); - if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) { + if (rv == FineJOptionPane.OK_OPTION) { + PluginMarker pluginMarker = result.getCurrentTask().getMarker(); + PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback); + } + else { jsCallback.execute("success"); - return; } - PluginMarker pluginMarker = result.getCurrentTask().getMarker(); - PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback); } else { jsCallback.execute("failed"); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed")); diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java index df3839427d..6fba685d75 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java @@ -31,20 +31,16 @@ public class UninstallPluginCallback extends AbstractPluginTaskCallback { FineLoggerFactory.getLogger().info(successInfo); FineJOptionPane.showMessageDialog(null, successInfo); }else if (result.errorCode() == PluginErrorCode.NeedUninstallDependingPluginFirst) { - int rv = FineJOptionPane.showOptionDialog( + int rv = FineJOptionPane.showConfirmDialog( null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Dependence"), Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - FineJOptionPane.YES_NO_CANCEL_OPTION, - FineJOptionPane.INFORMATION_MESSAGE, - null, - FineJOptionPane.OPTION_YES_NO_CANCEL, - null + FineJOptionPane.OK_CANCEL_OPTION, + FineJOptionPane.INFORMATION_MESSAGE ); - if (rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) { - return; + if (rv == FineJOptionPane.OK_OPTION) { + PluginManager.getController().uninstall(pluginMarker, true, new UninstallPluginCallback(pluginMarker, jsCallback)); } - PluginManager.getController().uninstall(pluginMarker, true, new UninstallPluginCallback(pluginMarker, jsCallback)); } else { jsCallback.execute("failed"); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Failed")); diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java index e5396d35ce..21c7871f52 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java @@ -43,40 +43,32 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback { FineLoggerFactory.getLogger().info(successInfo); FineJOptionPane.showMessageDialog(null, successInfo); } else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) { - int rv = FineJOptionPane.showOptionDialog( + int rv = FineJOptionPane.showConfirmDialog( null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Dependence"), Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - FineJOptionPane.YES_NO_CANCEL_OPTION, - FineJOptionPane.INFORMATION_MESSAGE, - null, - FineJOptionPane.OPTION_YES_NO_CANCEL, - null + FineJOptionPane.OK_CANCEL_OPTION, + FineJOptionPane.INFORMATION_MESSAGE ); - if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) { - return; - } - List pluginTasks = result.getPreTasks(); - for(PluginTask pluginTask : pluginTasks){ - PluginMarker marker = pluginTask.getMarker(); - PluginOperateUtils.updatePluginOnline(marker, jsCallback); + if (rv == FineJOptionPane.OK_OPTION) { + List pluginTasks = result.getPreTasks(); + for(PluginTask pluginTask : pluginTasks){ + PluginMarker marker = pluginTask.getMarker(); + PluginOperateUtils.updatePluginOnline(marker, jsCallback); + } + PluginManager.getController().update(zipFile, new UpdateFromDiskCallback(zipFile, jsCallback)); } - PluginManager.getController().update(zipFile, new UpdateFromDiskCallback(zipFile, jsCallback)); } else if(result.errorCode() == PluginErrorCode.NoPluginToUpdate){ - int rv = FineJOptionPane.showOptionDialog( + int rv = FineJOptionPane.showConfirmDialog( null, Toolkit.i18nText("Fine-Design_Basic_Plugin_No_Plugin_Update"), Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - FineJOptionPane.YES_NO_CANCEL_OPTION, - FineJOptionPane.INFORMATION_MESSAGE, - null, - FineJOptionPane.OPTION_YES_NO_CANCEL, - null + FineJOptionPane.OK_CANCEL_OPTION, + FineJOptionPane.INFORMATION_MESSAGE ); - if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) { - return; + if (rv == FineJOptionPane.OK_OPTION) { + PluginOperateUtils.installPluginFromDisk(zipFile, jsCallback); } - PluginOperateUtils.installPluginFromDisk(zipFile, jsCallback); }else { jsCallback.execute("failed"); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Failed")); diff --git a/designer-base/src/main/java/com/fr/design/fun/DesignerLifecycleMonitor.java b/designer-base/src/main/java/com/fr/design/fun/DesignerLifecycleMonitor.java new file mode 100644 index 0000000000..812ef8ac67 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/DesignerLifecycleMonitor.java @@ -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(); + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/DesignerPortProvider.java b/designer-base/src/main/java/com/fr/design/fun/DesignerPortProvider.java new file mode 100644 index 0000000000..2b0178c613 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/DesignerPortProvider.java @@ -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(); + +} diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java index 100daf511b..ec76f5bf79 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java @@ -247,7 +247,7 @@ public abstract class UIListControlPane extends UIControlPane implements ListCon resultPos.x = listPos.x + nameableList.getParent().getWidth(); } // 如果右侧显示不下,可以向左移动 - int maxX = Toolkit.getDefaultToolkit().getScreenSize().width - popupEditDialog.getWidth() - EDIT_RANGE; + int maxX = frame.getLocationOnScreen().x + frame.getWidth() - popupEditDialog.getWidth() - EDIT_RANGE; if (resultPos.x > maxX) { resultPos.x = maxX; } diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPaneWithPercent.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPaneWithPercent.java new file mode 100644 index 0000000000..9a17962b7a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPaneWithPercent.java @@ -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); + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UILockButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UILockButton.java new file mode 100644 index 0000000000..77b5516f51 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UILockButton.java @@ -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(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java index a589b0c878..73bfa0ef79 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java @@ -166,6 +166,9 @@ public class UIModeControlContainer extends JLayeredPane { } // 拖动的距离,为正值表示往下拖动,为负值表示往上拖动 int deltaY = e.getY(); + if (toolPaneY < 0) { + toolPaneY = 0; + } toolPaneY += deltaY; onResize(toolPaneY); refreshContainer(); diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItem.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItem.java new file mode 100644 index 0000000000..c609e5d5c7 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItem.java @@ -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(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItemUI.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItemUI.java new file mode 100644 index 0000000000..c0f70795bb --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItemUI.java @@ -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); + } + + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java index c60ae27605..454b1e5b99 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java @@ -13,15 +13,28 @@ import com.fr.stable.CommonUtils; import com.fr.stable.Constants; import com.fr.stable.StringUtils; -import com.fr.stable.collections.utils.MathUtils; -import javax.swing.*; +import javax.swing.ButtonModel; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.plaf.ButtonUI; -import java.awt.*; -import java.awt.event.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver { @@ -46,6 +59,9 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver */ private int numberFieldColumns; + public UISpinner() { + + } public UISpinner(double minValue, double maxValue, double dierta) { init(minValue, maxValue, dierta); @@ -56,7 +72,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver textField.setValue(defaultValue); } - private void init(double minValue, double maxValue, double dierta) { + protected void init(double minValue, double maxValue, double dierta) { this.minValue = minValue; this.maxValue = maxValue; this.dierta = dierta; diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPercent.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPercent.java new file mode 100644 index 0000000000..5fdc0c3f67 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPercent.java @@ -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); + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPx.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPx.java new file mode 100644 index 0000000000..44397cbc53 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPx.java @@ -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); + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithUnit.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithUnit.java new file mode 100644 index 0000000000..84ac5fbcb1 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithUnit.java @@ -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); + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java index 12b894ddce..f4437a9c4a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java @@ -1,16 +1,15 @@ package com.fr.design.gui.itextfield; import com.fr.base.Utils; -import com.fr.design.gui.ilable.UILabel; import com.fr.general.ComparatorUtils; import com.fr.stable.CoreConstants; import com.fr.stable.StringUtils; -import javax.swing.*; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.PlainDocument; -import java.awt.*; +import java.awt.Dimension; +import java.awt.Toolkit; /** * Number Field. @@ -193,7 +192,6 @@ public class UINumberField extends UITextField { if (!fillNegativeNumber && strNew.contains("-")) { return true; } - boolean noChange = false; boolean isMinus = strNew.startsWith("-"); strNew = strNew.replaceFirst("-", StringUtils.EMPTY); // 控制能输入负数 String strIntPart; @@ -207,25 +205,27 @@ public class UINumberField extends UITextField { } if (isOverMaxOrMinValue(strIntPart, strDecPart, strNew)) { Toolkit.getDefaultToolkit().beep(); - noChange = true; + return true; } + return checkNumber(strNew, isMinus); + } + protected boolean checkNumber(String strValue, boolean isMinus) { try { - if (!ComparatorUtils.equals(strNew, StringUtils.EMPTY) && !ComparatorUtils.equals(strNew, "-")) {// 控制能输入负数 - double d = Double.parseDouble(strNew) * (isMinus ? -1 : 1); + if (!ComparatorUtils.equals(strValue, StringUtils.EMPTY) && !ComparatorUtils.equals(strValue, "-")) {// 控制能输入负数 + double d = Double.parseDouble(strValue) * (isMinus ? -1 : 1); if (d < minValue || d > maxValue) { throw new Exception(); } } } catch (Exception e) { Toolkit.getDefaultToolkit().beep(); - noChange = true; + return true; } - - return noChange; + return false; } - private boolean isOverMaxOrMinValue(String strIntPart, String strDecPart, String strNew) { + protected boolean isOverMaxOrMinValue(String strIntPart, String strDecPart, String strNew) { boolean checkLength = strIntPart.length() > maxIntegerLength || strDecPart.length() > maxDecimalLength; return checkLength || (strNew.length() > 1 && ComparatorUtils.equals(strNew.substring(0, 1), "0") && !ComparatorUtils.equals(strNew.substring(1, 2), ".")); diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberFieldWithUnit.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberFieldWithUnit.java new file mode 100644 index 0000000000..e9f412551e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberFieldWithUnit.java @@ -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 unitList = new ArrayList<>(); + + public UINumberFieldWithUnit(int columns, String unit) { + super(columns); + this.unit = unit; + initUnitList(); + } + + //对单位的字符进行组合 + private void initUnitList() { + char[] chars = unit.toCharArray(); + Set 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 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; + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 66a77e1c2d..8827d6a857 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -99,7 +99,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public enum PropertyMode { REPORT, // 报表 - REPORT_PARA, // 报表参数面板 + REPORT_PARA_WIDGET, //报表参数面板中的控件 + REPORT_PARA(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 报表参数面板 REPORT_FLOAT, // 报表悬浮元素 FORM(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 表单 FORM_REPORT, // 表单报表块 @@ -272,27 +273,27 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyItemMap = new LinkedHashMap<>(); // 有序map // 单元格元素 PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Element"), - "cellelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, + "cellelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); // 单元格属性 PropertyItem cellAttr = new PropertyItem(KEY_CELL_ATTR, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Attributes"), - "cellattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, + "cellattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); // 悬浮元素 PropertyItem floatElement = new PropertyItem(KEY_FLOAT_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Float_Element"), - "floatelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, + "floatelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.POLY_REPORT}); // 控件设置 PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings"), - "widgetsettings", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY}, - new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART}); + "widgetsettings", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY}, + new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART}); // 条件属性 PropertyItem conditionAttr = new PropertyItem(KEY_CONDITION_ATTR, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Condition_Attributes"), - "conditionattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, + "conditionattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); // 超级链接 PropertyItem hyperlink = new PropertyItem(KEY_HYPERLINK, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Hyperlink"), - "hyperlink", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, + "hyperlink", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); // 组件库 PropertyItem widgetLib = new PropertyItem(KEY_WIDGET_LIB, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Library"), diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 4007be8a31..483e74d9d7 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -340,17 +340,24 @@ public abstract class JTemplate> public void refreshResource(FILE file) { - try { - this.template = JTemplateFactory.asIOFile(file, this.suffix()); - setTarget(this.template); + setTargetByFile(file); + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + // 先移除旧的。 + removeCenterPane(); + // 加入新的 + addCenterPane(); - // 先移除旧的。 - removeCenterPane(); - // 加入新的 - addCenterPane(); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + refreshToolArea(); + } + }); + + } + + private void setTargetByFile(FILE file) { + this.template = JTemplateFactory.asIOFile(file, this.suffix()); + setTarget(this.template); } private void addCenterPane() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java index d2a358c192..7f1d270af5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java @@ -12,6 +12,7 @@ import com.fr.form.ui.mobile.MobileParamStyle; import com.fr.general.ComparatorUtils; import com.fr.report.ExtraReportClassManager; import com.fr.report.fun.MobileParamStyleProvider; +import com.fr.report.mobile.EmptyMobileParamStyle; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; @@ -103,7 +104,10 @@ public class MobileParamSettingPane extends BasicPane { if (ComparatorUtils.equals(mobileParamStyle.disPlayName(), provider.displayName())) { String displayName = provider.displayName(); paramStyleList.setSelectedIndex(i); - map.get(displayName).populateBean(mobileParamStyle); + // 如果是兼容空类型 无须填充面板 + if (!(mobileParamStyle instanceof EmptyMobileParamStyle)) { + map.get(displayName).populateBean(mobileParamStyle); + } card.show(right, displayName); return; } diff --git a/designer-base/src/main/java/com/fr/design/monitor/DesignerLifecycleMonitorContext.java b/designer-base/src/main/java/com/fr/design/monitor/DesignerLifecycleMonitorContext.java new file mode 100644 index 0000000000..a50a048197 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/monitor/DesignerLifecycleMonitorContext.java @@ -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() { + + } + } + + +} diff --git a/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java index acd9068974..057b561fa0 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java @@ -1,18 +1,17 @@ package com.fr.design.os.impl; -import com.fr.config.ServerPreferenceConfig; import com.fr.design.data.datapane.connect.ConnectionManagerPane; -import com.fr.design.dcm.UniversalDatabaseOpener; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.editlock.EditLockUtils; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.file.ConnectionConfig; -import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.support.OSBasedAction; import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; +import com.fr.report.LockItem; import static com.fr.design.actions.server.ConnectionListAction.doWithDatasourceManager; /** @@ -68,9 +67,18 @@ public class DatabaseDialogAction implements OSBasedAction { @Override public void afterCommit() { DesignerContext.getDesignerBean("databasename").refreshBeanElement(); + // 定义数据连接弹窗关闭后,解锁 + EditLockUtils.unlock(LockItem.CONNECTION); } })); } + + @Override + public void doCancel() { + super.doCancel(); + // 定义数据连接弹窗关闭后,解锁 + EditLockUtils.unlock(LockItem.CONNECTION); + } }); databaseListDialog.setVisible(true); } diff --git a/designer-base/src/main/java/com/fr/design/port/DesignerPortContext.java b/designer-base/src/main/java/com/fr/design/port/DesignerPortContext.java new file mode 100644 index 0000000000..e1e40ddfb0 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/port/DesignerPortContext.java @@ -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; + } +} diff --git a/designer-base/src/main/java/com/fr/design/style/background/image/ExpandFileChooser.java b/designer-base/src/main/java/com/fr/design/style/background/image/ExpandFileChooser.java index ca091cf940..768e7dacd8 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/image/ExpandFileChooser.java +++ b/designer-base/src/main/java/com/fr/design/style/background/image/ExpandFileChooser.java @@ -85,6 +85,7 @@ public class ExpandFileChooser extends JFileChooser { @Override public int showDialog(Component parent, String approveButtonText) { dialog.setModal(true); + GUICoreUtils.centerWindow(parent, dialog); dialog.setVisible(true); return retVal; } diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java b/designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java index 909501857a..fcdc594b5f 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java @@ -206,6 +206,10 @@ public class ColorAdjustPane extends JPanel implements UIObserver { public void setVisible(boolean b) { super.setVisible(b); } + + protected boolean selectRealTime() { + return false; + } }; colorPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java index c82eac0c0d..68c1b2b992 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java @@ -115,12 +115,16 @@ public class ColorSelectPane extends TransparentPane implements ColorSelectable row1Pane.setPreferredSize(new Dimension(135, 24)); // 宽度为 16 * 8 + 7 // 最近使用 - UsedColorPane usedColorPane = new UsedColorPane(1, 8, 1, this, true, true); + UsedColorPane usedColorPane = new UsedColorPane(1, 8, 1, this, true, selectRealTime()); usedColorPane.getPane().setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 8)); row1Pane.add(usedColorPane.getPane()); return row1Pane; } + protected boolean selectRealTime() { + return true; + } + protected Color[] getColorArray() { return ColorFactory.MenuColors; } diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java index 1ad1948bfa..28ab5e4c14 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java @@ -4,19 +4,21 @@ import com.fr.common.report.ReportState; import com.fr.design.DesignerEnvManager; import com.fr.design.RestartHelper; import com.fr.design.dialog.TipDialog; +import com.fr.design.fun.DesignerPortProvider; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.port.DesignerPortContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.exit.DesignerExiter; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; -import com.fr.process.ProcessEventPipe; import com.fr.process.engine.core.CarryMessageEvent; import com.fr.process.engine.core.FineProcessContext; import com.fr.stable.StringUtils; +import com.fr.stable.bridge.StableFactory; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLWriter; @@ -35,8 +37,8 @@ import java.awt.event.ActionListener; public class DesignerPort implements XMLReadable, XMLWriter { public static final String XML_TAG = "DesignerPort"; - private static final int MIN_PORT = 1024; - private static final int MAX_PORT = 65535; + public static final int MIN_PORT = 1024; + public static final int MAX_PORT = 65535; public static final DesignerPort INSTANCE = new DesignerPort(); @@ -58,6 +60,10 @@ public class DesignerPort implements XMLReadable, XMLWriter { private int debugMessagePort = 51463; public int getMessagePort() { + int extraMessagePort = DesignerPortContext.getMessagePort(); + if (extraMessagePort >= MIN_PORT && extraMessagePort <= MAX_PORT) { + return extraMessagePort; + } return messagePort; } diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java index e6b276437a..d55382c499 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java @@ -292,6 +292,24 @@ public final class GUICoreUtils { return button; } + + /** + * 将独立弹窗设置在中间位置 适应多屏 跟随设计器主界面 + * 可从父界面获取弹窗应该所在的矩形范围 + * + * @param parent 独立弹窗的父窗口 + * @param win 弹窗自身 + */ + public static void centerWindow(Component parent, Window win) { + Rectangle rectangle; + if (parent == null) { + rectangle = DesignerContext.getDesignerFrame().getGraphicsConfiguration().getBounds(); + } else { + rectangle = parent.getGraphicsConfiguration().getBounds(); + } + centerWindow(win, rectangle); + } + /** * 设置一个窗口 * @@ -301,7 +319,14 @@ public final class GUICoreUtils { // Toolkit.getDefaultToolkit().getScreenSize()在有多个显示器也只能获取到主屏的大小 // getGraphicsConfiguration().getBounds()能获取多个屏时 设计器主体界面所在屏的大小和对应的坐标 Rectangle rectangle = win.getGraphicsConfiguration().getBounds(); + centerWindow(win, rectangle); + } + /** + * @param win + * @param rectangle 窗口所在的一个矩形范围 + */ + public static void centerWindow(Window win, Rectangle rectangle) { Dimension screenSize = rectangle.getSize(); Dimension winSize = win.getSize(); @@ -315,6 +340,7 @@ public final class GUICoreUtils { win.setLocation(rectangle.x + (screenSize.width - winSize.width) / 2, rectangle.y + (screenSize.height - winSize.height) / 2 - WINDOW_GAP); } + /** * Gets window/frame to screen center. * @param owerWin 父窗口 diff --git a/designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java b/designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java index 3654cca2d9..42dae0fa19 100644 --- a/designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java +++ b/designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java @@ -6,7 +6,6 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; -import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import javax.swing.BorderFactory; @@ -14,52 +13,65 @@ import javax.swing.Icon; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; -import javax.swing.JTextArea; +import javax.swing.JTextPane; +import javax.swing.text.SimpleAttributeSet; +import javax.swing.text.StyleConstants; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Frame; +import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.Locale; /** * 插件启动失败提示窗 */ public class PluginErrorRemindDialog extends JDialog implements ActionListener { - public PluginErrorRemindDialog(Frame parent, String areaText) { + private static final String SIM_HEI = "SimHei"; + + public PluginErrorRemindDialog(Frame parent, String text) { super(parent, true); //上面的标签面板 JPanel topPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel imagePanel = new JPanel(); - Icon icon = IOUtils.readIcon("com/fr/design/images/warnings/warning5.png"); + Icon icon = IOUtils.readIcon("com/fr/design/images/warnings/icon_WarningIcon_normal.png"); JLabel imageLabel = new JLabel(); imageLabel.setIcon(icon); imagePanel.add(imageLabel); - imagePanel.setPreferredSize(new Dimension(130, 100)); + imagePanel.setPreferredSize(new Dimension(48, 48)); JPanel verticalPanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); JLabel label = new JLabel(Toolkit.i18nText("Fine-Design_Plugin_Error_Remind_Title")); - label.setFont(FRFont.getInstance().applySize(18).applyStyle(1)); - label.setPreferredSize(new Dimension(650, 100)); + label.setFont(FRFont.getInstance().applySize(16).applyName(SIM_HEI)); + label.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); verticalPanel.add(label); topPanel.add(imagePanel, BorderLayout.WEST); topPanel.add(verticalPanel, BorderLayout.CENTER); - topPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); + topPanel.setPreferredSize(new Dimension(600, 73)); + topPanel.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 20)); //中间的文本域面板 JPanel centerPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); - centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10)); - centerPanel.setPreferredSize(new Dimension(480, 320)); + centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); + centerPanel.setPreferredSize(new Dimension(580, 269)); + + JTextPane textPane = new JTextPane(); + + SimpleAttributeSet attributeSet = new SimpleAttributeSet(); + StyleConstants.setFontFamily(attributeSet, SIM_HEI); + StyleConstants.setLineSpacing(attributeSet, 0.5f); + textPane.setParagraphAttributes(attributeSet, true); - JTextArea checkArea = new JTextArea(areaText); - checkArea.setEnabled(false); - centerPanel.add(checkArea, BorderLayout.CENTER); + textPane.setEditable(false); + textPane.setMargin(new Insets(10, 10, 10, 10)); + textPane.setText(text); + centerPanel.add(textPane, BorderLayout.CENTER); UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Plugin_Error_Remind_Not_Deal_With")); UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Plugin_Error_Remind_Deal_With")); @@ -69,7 +81,7 @@ public class PluginErrorRemindDialog extends JDialog implements ActionListener { // 按钮 JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10)); + buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); buttonPanel.add(cancelButton); buttonPanel.add(okButton); @@ -80,7 +92,7 @@ public class PluginErrorRemindDialog extends JDialog implements ActionListener { this.add(topPanel, BorderLayout.NORTH); this.add(centerPanel, BorderLayout.CENTER); this.add(buttonPanel, BorderLayout.SOUTH); - this.setSize(new Dimension(GeneralContext.getLocale().equals(Locale.US) ? 750 : 600, 500)); + this.setSize(new Dimension(600, 400)); GUICoreUtils.centerWindow(this); } diff --git a/designer-base/src/main/java/com/fr/exit/DesignerExiter.java b/designer-base/src/main/java/com/fr/exit/DesignerExiter.java index b9067a22ee..cda2e015b0 100644 --- a/designer-base/src/main/java/com/fr/exit/DesignerExiter.java +++ b/designer-base/src/main/java/com/fr/exit/DesignerExiter.java @@ -1,10 +1,9 @@ package com.fr.exit; import com.fr.design.env.DesignerWorkspaceGenerator; +import com.fr.design.monitor.DesignerLifecycleMonitorContext; import com.fr.process.engine.core.FineProcessContext; import com.fr.process.engine.core.FineProcessEngineEvent; -import com.fr.stable.StableUtils; - /** * @author hades @@ -20,6 +19,7 @@ public class DesignerExiter { } public void execute() { + DesignerLifecycleMonitorContext.getMonitor().beforeStop(); beforeExit(); if (FineProcessContext.getParentPipe() != null) { FineProcessContext.getParentPipe().syncFire(FineProcessEngineEvent.DESTROY); diff --git a/designer-base/src/main/java/com/fr/start/BaseDesigner.java b/designer-base/src/main/java/com/fr/start/BaseDesigner.java index 7808bd7ecd..5eaab74a52 100644 --- a/designer-base/src/main/java/com/fr/start/BaseDesigner.java +++ b/designer-base/src/main/java/com/fr/start/BaseDesigner.java @@ -14,6 +14,7 @@ import com.fr.design.fun.DesignerStartOpenFileProcessor; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; +import com.fr.design.monitor.DesignerLifecycleMonitorContext; import com.fr.design.ui.util.UIUtil; import com.fr.event.Event; import com.fr.event.EventDispatcher; @@ -75,6 +76,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock { EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { @Override public void on(Event event, Null param) { + DesignerLifecycleMonitorContext.getMonitor().afterStart(); EventDispatcher.stopListen(this); // 启动完成 停止监听 ProcessEventPipe eventPipe = FineProcessContext.getParentPipe(); diff --git a/designer-base/src/main/resources/com/fr/design/images/gui/color/background_normal.svg b/designer-base/src/main/resources/com/fr/design/images/gui/color/background_normal.svg index c4714560ce..577e8bd8a0 100644 --- a/designer-base/src/main/resources/com/fr/design/images/gui/color/background_normal.svg +++ b/designer-base/src/main/resources/com/fr/design/images/gui/color/background_normal.svg @@ -3,6 +3,5 @@ icon_文本背景色_normal - - + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_web/connection_locked_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_web/connection_locked_normal.svg new file mode 100644 index 0000000000..b1b9d17929 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_web/connection_locked_normal.svg @@ -0,0 +1,15 @@ + + + 编组 3 + + + + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_web/locked_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_web/locked_normal.svg new file mode 100644 index 0000000000..b3b2ac74f8 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_web/locked_normal.svg @@ -0,0 +1,14 @@ + + + 编组 2 + + + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_web/warningIcon.png b/designer-base/src/main/resources/com/fr/design/images/m_web/warningIcon.png new file mode 100644 index 0000000000..41c7c703a2 Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/m_web/warningIcon.png differ diff --git a/designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal.png b/designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal.png new file mode 100644 index 0000000000..37dbe939b6 Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal.png differ diff --git a/designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal@2x.png b/designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal@2x.png new file mode 100644 index 0000000000..756a456566 Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal@2x.png differ diff --git a/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java b/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java index 3b680915c5..07a1d54f84 100644 --- a/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java +++ b/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java @@ -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(); + } + } +} \ No newline at end of file diff --git a/designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java b/designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java index edcde5d118..bc81cb2c36 100644 --- a/designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java +++ b/designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java @@ -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 pluginTaskResults1 = new ArrayList<>(); -// pluginTaskResults1.add(pluginTaskResult1); -// List 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 pluginTaskResults1 = new ArrayList<>(); + pluginTaskResults1.add(pluginTaskResult1); + List 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(); + } + } + +} diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java index 0cd81f783e..446ed1e616 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java @@ -14,6 +14,7 @@ import com.fr.locale.LocaleMarker; import com.fr.locale.LocaleScope; import com.fr.module.Activator; import com.fr.module.extension.Prepare; +import com.fr.plugin.chart.DownloadSourcesHelper; import com.fr.plugin.chart.vanchart.export.ImagePainter; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; @@ -44,7 +45,7 @@ public class ChartDesignerActivator extends Activator implements Prepare { DesignModuleFactory.registerExtraWidgetOptions(ChartTypeInterfaceManager.initWidgetOption()); - ImagePainter.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); + DownloadSourcesHelper.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); ImagePainter.registerDefaultCallbackEvent(HistoryTemplateListCache.getInstance()); ChartTypeInterfaceManager.addPluginChangedListener(); diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/LabelAlphaPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/LabelAlphaPane.java index 1962ab4a9e..5c91765043 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/LabelAlphaPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/LabelAlphaPane.java @@ -5,6 +5,7 @@ import com.fr.chart.base.DataSeriesCondition; import com.fr.design.condition.ConditionAttrSingleConditionPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ilable.UILabel; @@ -32,7 +33,7 @@ public class LabelAlphaPane extends ConditionAttrSingleConditionPane { }; } }; - lineWidth = new UISpinner(0.5, Double.MAX_VALUE, 0.5, 0.5); + lineWidth = new UISpinnerWithPx(0.5, Double.MAX_VALUE, 0.5, 0.5); Component[][] components = new Component[][]{ new Component[]{null, null}, diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextDetailedFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextDetailedFieldListPane.java new file mode 100644 index 0000000000..d780a44eb1 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextDetailedFieldListPane.java @@ -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 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 getDefaultFieldButtonList() { + List 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()); + } + } + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextResultFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextResultFieldListPane.java new file mode 100644 index 0000000000..9816967ff0 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxRichTextResultFieldListPane.java @@ -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 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 getDefaultFieldButtonList() { + List 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; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java index 25eb587d87..4e7a657d6b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java @@ -4,8 +4,8 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; -import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; import com.fr.plugin.chart.base.format.AttrTooltipDataMaxFormat; import com.fr.plugin.chart.base.format.AttrTooltipDataMedianFormat; @@ -20,17 +20,17 @@ import com.fr.plugin.chart.box.attr.AttrBoxTooltipContent; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; -import java.util.Map; public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { @@ -44,20 +44,9 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { private VanChartFormatPaneWithCheckBox min; private VanChartFormatPaneWithCheckBox outlier; - private VanChartFormatPaneWithoutCheckBox richTextNumber; - private VanChartFormatPaneWithoutCheckBox richTextMax; - private VanChartFormatPaneWithoutCheckBox richTextQ3; - private VanChartFormatPaneWithoutCheckBox richTextMedian; - private VanChartFormatPaneWithoutCheckBox richTextQ1; - private VanChartFormatPaneWithoutCheckBox richTextMin; - private VanChartFormatPaneWithoutCheckBox richTextOutlier; - private JPanel dataNumberPane; private JPanel dataOutlierPane; - private JPanel richTextNumberPane; - private JPanel richTextOutlierPane; - public VanChartBoxTooltipContentPane(VanChartStylePane parent, JPanel showOnPane, boolean isDetailed) { super(parent, showOnPane); checkFormatVisible(isDetailed); @@ -104,47 +93,6 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { }; } - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - - richTextNumber = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Data_Number"); - } - }; - richTextMax = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Max_Value"); - } - }; - richTextQ3 = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Data_Q3"); - } - }; - richTextMedian = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Data_Median"); - } - }; - richTextQ1 = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Data_Q1"); - } - }; - richTextMin = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Min_Value"); - } - }; - richTextOutlier = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Outlier_Value"); - } - }; - } - protected JPanel createCommonFormatPanel() { JPanel commonPanel = new JPanel(new BorderLayout()); @@ -155,27 +103,73 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { return commonPanel; } - protected JPanel createRichFormatPanel() { - JPanel richFormatPanel = new JPanel(new BorderLayout()); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { - richFormatPanel.add(createRichTextCateAndSeriesPane(), BorderLayout.NORTH); - richFormatPanel.add(createRichTextDataNumberPane(), BorderLayout.CENTER); - richFormatPanel.add(createRichTextDataDetailPane(), BorderLayout.SOUTH); + return new VanChartRichTextPane(richEditorPane) { - return richFormatPanel; + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + if (detailed) { + return new VanChartBoxRichTextDetailedFieldListPane(fieldAttrPane, richEditor); + } + + return new VanChartBoxRichTextResultFieldListPane(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } + }; + } + + protected String[] getRichTextFieldNames() { + if (detailed) { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Data_Number"), + Toolkit.i18nText("Fine-Design_Chart_Max_Value"), + Toolkit.i18nText("Fine-Design_Chart_Data_Q3"), + Toolkit.i18nText("Fine-Design_Chart_Data_Median"), + Toolkit.i18nText("Fine-Design_Chart_Data_Q1"), + Toolkit.i18nText("Fine-Design_Chart_Min_Value"), + Toolkit.i18nText("Fine-Design_Chart_Outlier_Value") + }; + } + + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Max_Value"), + Toolkit.i18nText("Fine-Design_Chart_Data_Q3"), + Toolkit.i18nText("Fine-Design_Chart_Data_Median"), + Toolkit.i18nText("Fine-Design_Chart_Data_Q1"), + Toolkit.i18nText("Fine-Design_Chart_Min_Value") + }; } - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextCategoryNameFormatPane(), null}, - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{richTextNumber, null}, - new Component[]{richTextMax, null}, - new Component[]{richTextQ3, null}, - new Component[]{richTextMedian, null}, - new Component[]{richTextQ1, null}, - new Component[]{richTextMin, null}, - new Component[]{richTextOutlier, null} + protected AttrTooltipFormat[] getRichTextFieldFormats() { + if (detailed) { + return new AttrTooltipFormat[]{ + new AttrTooltipCategoryFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipDataNumberFormat(), + new AttrTooltipDataMaxFormat(), + new AttrTooltipDataQ3Format(), + new AttrTooltipDataMedianFormat(), + new AttrTooltipDataQ1Format(), + new AttrTooltipDataMinFormat(), + new AttrTooltipDataOutlierFormat() + }; + } + + return new AttrTooltipFormat[]{ + new AttrTooltipCategoryFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipDataMaxFormat(), + new AttrTooltipDataQ3Format(), + new AttrTooltipDataMedianFormat(), + new AttrTooltipDataQ1Format(), + new AttrTooltipDataMinFormat() }; } @@ -249,72 +243,6 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { return detailPane; } - private JPanel createRichTextCateAndSeriesPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - - double[] columnSize = {f, e}; - double[] rowSize = {p, p, p}; - - Component[][] cateAndSeries = new Component[][]{ - new Component[]{null, null}, - new Component[]{null, getRichTextCategoryNameFormatPane()}, - new Component[]{null, getRichTextSeriesNameFormatPane()} - }; - - return TableLayoutHelper.createTableLayoutPane(cateAndSeries, rowSize, columnSize); - } - - private JPanel createRichTextDataNumberPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - - double[] columnSize = {f, e}; - double[] rowSize = {p, p}; - - Component[][] dataNumber = new Component[][]{ - new Component[]{null, null}, - new Component[]{null, richTextNumber}, - }; - - richTextNumberPane = TableLayoutHelper.createTableLayoutPane(dataNumber, rowSize, columnSize); - - return richTextNumberPane; - } - - private JPanel createRichTextDataDetailPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - - double[] columnSize = {f, e}; - - JPanel detailPane = new JPanel(new BorderLayout()); - - Component[][] richTextDetail = new Component[][]{ - new Component[]{null, null}, - new Component[]{null, richTextMax}, - new Component[]{new UILabel(getLabelContentTitle()), richTextQ3}, - new Component[]{null, richTextMedian}, - new Component[]{null, richTextQ1}, - new Component[]{null, richTextMin} - }; - - Component[][] dataOutlier = new Component[][]{ - new Component[]{null, null}, - new Component[]{null, richTextOutlier}, - }; - - richTextOutlierPane = TableLayoutHelper.createTableLayoutPane(dataOutlier, new double[]{p, p}, columnSize); - - detailPane.add(TableLayoutHelper.createTableLayoutPane(richTextDetail, new double[]{p, p, p, p, p, p}, columnSize), BorderLayout.NORTH); - detailPane.add(richTextOutlierPane, BorderLayout.CENTER); - - return detailPane; - } - public boolean isDirty() { return getCategoryNameFormatPane().isDirty() || getSeriesNameFormatPane().isDirty() @@ -362,63 +290,21 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { } } - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - setRichTextAttr(new AttrTooltipRichText()); - Map params = getRichTextAttr().getParams(); - - AttrTooltipCategoryFormat categoryFormat = attrTooltipContent.getRichTextCategoryFormat(); - getRichTextCategoryNameFormatPane().populate(categoryFormat); - getRichTextCategoryNameFormatPane().updateFormatParams(params, categoryFormat.getJs()); - - AttrTooltipSeriesFormat seriesFormat = attrTooltipContent.getRichTextSeriesFormat(); - getRichTextSeriesNameFormatPane().populate(seriesFormat); - getRichTextSeriesNameFormatPane().updateFormatParams(params, seriesFormat.getJs()); - - if (attrTooltipContent instanceof AttrBoxTooltipContent) { - AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent; - - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = getFormatPaneGroup(); - AttrTooltipFormat[] formatGroup = getFormatGroup(boxTooltipContent); - - populateRichTextFormat(formatPaneGroup, formatGroup); - populateRichText(attrTooltipContent.getRichTextAttr()); - - checkRichEditorState(attrTooltipContent); - } - } - - private VanChartFormatPaneWithoutCheckBox[] getFormatPaneGroup() { - if (detailed) { - return new VanChartFormatPaneWithoutCheckBox[]{ - richTextNumber, richTextMax, richTextQ3, richTextMedian, - richTextQ1, richTextMin, richTextOutlier - }; - } - - return new VanChartFormatPaneWithoutCheckBox[]{ - richTextMax, richTextQ3, richTextMedian, richTextQ1, richTextMin - }; - } + protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) { + super.updateTooltipFormat(target, source); - private AttrTooltipFormat[] getFormatGroup(AttrBoxTooltipContent boxTooltipContent) { - AttrTooltipDataNumberFormat richTextNumber = boxTooltipContent.getRichTextNumber(); - AttrTooltipDataMaxFormat richTextMaxFormat = boxTooltipContent.getRichTextMax(); - AttrTooltipDataQ3Format richTextQ3Format = boxTooltipContent.getRichTextQ3(); - AttrTooltipDataMedianFormat richTextMedianFormat = boxTooltipContent.getRichTextMedian(); - AttrTooltipDataQ1Format richTextQ1Format = boxTooltipContent.getRichTextQ1(); - AttrTooltipDataMinFormat richTextMinFormat = boxTooltipContent.getRichTextMin(); - AttrTooltipDataOutlierFormat richTextOutlierFormat = boxTooltipContent.getRichTextOutlier(); + if (target instanceof AttrBoxTooltipContent && source instanceof AttrBoxTooltipContent) { + AttrBoxTooltipContent targetGantt = (AttrBoxTooltipContent) target; + AttrBoxTooltipContent sourceGantt = (AttrBoxTooltipContent) source; - if (detailed) { - return new AttrTooltipFormat[]{ - richTextNumber, richTextMaxFormat, richTextQ3Format, richTextMedianFormat, - richTextQ1Format, richTextMinFormat, richTextOutlierFormat - }; + targetGantt.setRichTextNumber(sourceGantt.getRichTextNumber()); + targetGantt.setRichTextMax(sourceGantt.getRichTextMax()); + targetGantt.setRichTextQ3(sourceGantt.getRichTextQ3()); + targetGantt.setRichTextMedian(sourceGantt.getRichTextMedian()); + targetGantt.setRichTextQ1(sourceGantt.getRichTextQ1()); + targetGantt.setRichTextMin(sourceGantt.getRichTextMin()); + targetGantt.setRichTextOutlier(sourceGantt.getRichTextOutlier()); } - - return new AttrTooltipFormat[]{ - richTextMaxFormat, richTextQ3Format, richTextMedianFormat, richTextQ1Format, richTextMinFormat - }; } protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { @@ -440,30 +326,10 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { } } - protected void updateRichEditor(AttrTooltipContent attrTooltipContent) { - getRichTextCategoryNameFormatPane().update(attrTooltipContent.getRichTextCategoryFormat()); - getRichTextSeriesNameFormatPane().update(attrTooltipContent.getRichTextSeriesFormat()); - - if (attrTooltipContent instanceof AttrBoxTooltipContent) { - AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent; - - richTextNumber.update(boxTooltipContent.getRichTextNumber()); - richTextMax.update(boxTooltipContent.getRichTextMax()); - richTextQ3.update(boxTooltipContent.getRichTextQ3()); - richTextMedian.update(boxTooltipContent.getRichTextMedian()); - richTextQ1.update(boxTooltipContent.getRichTextQ1()); - richTextMin.update(boxTooltipContent.getRichTextMin()); - richTextOutlier.update(boxTooltipContent.getRichTextOutlier()); - } - } - public void checkFormatVisible(boolean detailed) { this.detailed = detailed; dataNumberPane.setVisible(detailed); dataOutlierPane.setVisible(detailed); - - richTextNumberPane.setVisible(detailed); - richTextOutlierPane.setVisible(detailed); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/bubble/component/VanChartBubblePane.java b/designer-chart/src/main/java/com/fr/van/chart/bubble/component/VanChartBubblePane.java index a51f910479..2d95bf2727 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bubble/component/VanChartBubblePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bubble/component/VanChartBubblePane.java @@ -4,6 +4,7 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -24,8 +25,8 @@ public class VanChartBubblePane extends BasicBeanPane { private UIButtonGroup displayNegative; public VanChartBubblePane(){ - minDiameter = new UISpinner(0,Double.MAX_VALUE,1,0); - maxDiameter = new UISpinner(0,Double.MAX_VALUE,1,0); + minDiameter = new UISpinnerWithPx(0); + maxDiameter = new UISpinnerWithPx(0); shadow = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); displayNegative = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/ColumnBorderAttriPane.java b/designer-chart/src/main/java/com/fr/van/chart/column/ColumnBorderAttriPane.java index c81317a813..af4be834ae 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/ColumnBorderAttriPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/ColumnBorderAttriPane.java @@ -3,6 +3,7 @@ package com.fr.van.chart.column; import com.fr.design.chart.comp.BorderAttriPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import java.awt.Dimension; @@ -19,7 +20,7 @@ public class ColumnBorderAttriPane extends BorderAttriPane { public ColumnBorderAttriPane(String radiusString) { this.add(new UILabel(radiusString + ":")); - radius = new UISpinner(0,1000,1,0); + radius = new UISpinnerWithPx(0,1000,1,0); this.add(radius); radius.setPreferredSize(new Dimension(60, 18)); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java index eb2c3914ac..b83a20f612 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java @@ -3,6 +3,8 @@ package com.fr.van.chart.column; import com.fr.base.background.ImageBackground; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.i18n.Toolkit; import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.ibutton.UIButtonGroup; @@ -76,10 +78,10 @@ public class VanChartColumnSeriesPane extends VanChartAbstractPlotSeriesPane { private JPanel createSeriesStylePane(double[] row, double[] col) { isFixedWidth = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_YES"), Toolkit.i18nText("Fine-Design_Chart_NO")}); - columnWidth = new UISpinner(0,1000,1,0); + columnWidth = new UISpinnerWithPx(0,1000,1,0); columnWidth.setBorder(BorderFactory.createEmptyBorder(0, (int)TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL,0,0)); - seriesGap = new UINumberDragPane(-100, 100); - categoryGap = new UINumberDragPane(0, 100); + seriesGap = new UINumberDragPaneWithPercent(-100, 100); + categoryGap = new UINumberDragPaneWithPercent(0, 100); isFillWithImage = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_YES"), Toolkit.i18nText("Fine-Design_Chart_NO")}); imagePane = new ImageBackgroundQuickPane(false); imagePane.setBorder(BorderFactory.createEmptyBorder(0,(int)TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL,0,0)); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java b/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java index 0f9db09fab..3167b5f59c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java @@ -19,6 +19,7 @@ import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot; import com.fr.plugin.chart.line.VanChartLinePlot; import com.fr.plugin.chart.map.VanChartMapPlot; import com.fr.plugin.chart.multilayer.VanChartMultiPiePlot; +import com.fr.plugin.chart.radar.VanChartRadarPlot; import com.fr.plugin.chart.scatter.VanChartScatterPlot; import com.fr.plugin.chart.structure.VanChartStructurePlot; import com.fr.plugin.chart.treemap.VanChartTreeMapPlot; @@ -94,6 +95,20 @@ public class PlotFactory { return autoAdjustLabelPlots.contains(plot.getClass()); } + private static Set> supportAddTableFieldPlots = new HashSet<>(); + + static { + supportAddTableFieldPlots.add(PiePlot4VanChart.class); + supportAddTableFieldPlots.add(VanChartColumnPlot.class); + supportAddTableFieldPlots.add(VanChartLinePlot.class); + supportAddTableFieldPlots.add(VanChartAreaPlot.class); + supportAddTableFieldPlots.add(VanChartRadarPlot.class); + } + + public static boolean plotSupportAddTableField(Plot plot) { + return supportAddTableFieldPlots.contains(plot.getClass()); + } + private static Set> borderAndBackgroundLabelPlots = new HashSet<>(); static { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartAreaSeriesFillColorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartAreaSeriesFillColorPane.java index 24400cacdc..241798bef3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartAreaSeriesFillColorPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartAreaSeriesFillColorPane.java @@ -2,6 +2,7 @@ package com.fr.van.chart.designer.component; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; @@ -36,7 +37,7 @@ public class VanChartAreaSeriesFillColorPane extends BasicPane { }; } }; - transparent = new UINumberDragPane(0, 100); + transparent = new UINumberDragPaneWithPercent(0, 100); JPanel transparentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha"), transparent); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java index 10c3308b3c..b6119aa642 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java @@ -4,6 +4,7 @@ import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.utils.gui.UIComponentUtils; @@ -15,11 +16,11 @@ import com.fr.plugin.chart.type.LineType; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.JPanel; +import java.util.Arrays; import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.Arrays; /** * line相关设置 @@ -74,7 +75,7 @@ public class VanChartLineTypePane extends BasicPane { lineTypeComboBox = createLineType(); - lineWidthSpinner = new UISpinner(LINE_WIDTH_MIN_VALUE, Integer.MAX_VALUE, LINE_WIDTH_DIERTA_VALUE, LINE_WIDTH_DEFAULT_VALUE); + lineWidthSpinner = new UISpinnerWithPx(LINE_WIDTH_MIN_VALUE, Integer.MAX_VALUE, LINE_WIDTH_DIERTA_VALUE, LINE_WIDTH_DEFAULT_VALUE); lineTypeComboBox.addActionListener(new ActionListener() { @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRefreshTooltipContentPane.java index 7ecb797d6a..93ef147617 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRefreshTooltipContentPane.java @@ -1,9 +1,7 @@ package com.fr.van.chart.designer.component; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -34,14 +32,6 @@ public class VanChartRefreshTooltipContentPane extends VanChartTooltipContentPan setChangedPercentFormatPane(new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - super.initRichTextFormatPane(parent, showOnPane); - - setRichTextChangedValueFormatPane(new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextChangedPercentFormatPane(new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane)); - } - protected Component[][] getPaneComponents(){ return new Component[][]{ new Component[]{getCategoryNameFormatPane(), null}, @@ -52,16 +42,4 @@ public class VanChartRefreshTooltipContentPane extends VanChartTooltipContentPan new Component[]{getChangedPercentFormatPane(), null}, }; } - - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextCategoryNameFormatPane(), null}, - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null}, - new Component[]{getRichTextChangedValueFormatPane(), null}, - new Component[]{getRichTextPercentFormatPane(), null}, - new Component[]{getRichTextChangedPercentFormatPane(), null} - }; - } - } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java index f2c5662307..947c63684e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java @@ -24,17 +24,11 @@ import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; @@ -53,7 +47,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -84,13 +78,6 @@ public class VanChartTooltipContentPane extends BasicBeanPane getContent() { return content; } @@ -512,7 +450,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane params = new HashMap<>(); + Map params = new LinkedHashMap<>(); for (int i = 0, len = fieldNames.length; i < len; i++) { params.put(fieldNames[i], fieldFormats[i].getJs()); @@ -522,7 +460,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane }; } }; - radius = new UISpinner(0, 100, 0.5, 0); + radius = new UISpinnerWithPx(0, 100, 0.5, 0); double p = TableLayout.PREFERRED; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java index 89c3cd73e4..5cab5485f9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldAttrPane.java @@ -2,11 +2,13 @@ package com.fr.van.chart.designer.component.richText; import com.fr.data.util.function.AbstractDataFunction; import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.style.FormatPane; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; +import com.fr.plugin.chart.base.format.IntervalTimeFormat; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.format.FormatPaneWithOutFont; @@ -21,15 +23,18 @@ import java.text.Format; public class VanChartFieldAttrPane extends JPanel { private FormatPane fieldFormatPane; - private CalculateComboBox fieldDataFunction; + private UIComboBox intervalTimeBox; + private CalculateComboBox dataFunctionBox; + private JPanel formatPane; + private JPanel intervalTimePane; private JPanel fieldFunctionPane; public VanChartFieldAttrPane() { initComponents(); this.setLayout(new BorderLayout()); - this.add(fieldFormatPane, BorderLayout.NORTH); + this.add(formatPane, BorderLayout.NORTH); this.add(fieldFunctionPane, BorderLayout.CENTER); this.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); } @@ -44,28 +49,43 @@ public class VanChartFieldAttrPane extends JPanel { return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, new double[]{d, e}); } }; + intervalTimeBox = new UIComboBox(IntervalTimeFormat.getFormats()); + dataFunctionBox = new CalculateComboBox(); - fieldDataFunction = new CalculateComboBox(); - - Component[][] components = new Component[][]{ + Component[][] intervalTimeComponents = new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), intervalTimeBox} + }; + Component[][] dataFunctionComponents = new Component[][]{ new Component[]{null, null}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), fieldDataFunction} + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), dataFunctionBox} }; - fieldFunctionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{d, e}); - } + intervalTimePane = TableLayout4VanChartHelper.createGapTableLayoutPane(intervalTimeComponents, new double[]{p, p}, new double[]{d, e}); - public void registerFunctionListener(ActionListener listener) { - fieldDataFunction.addActionListener(listener); + formatPane = new JPanel(new BorderLayout()); + formatPane.add(fieldFormatPane, BorderLayout.NORTH); + formatPane.add(intervalTimePane, BorderLayout.CENTER); + + fieldFunctionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(dataFunctionComponents, new double[]{p, p}, new double[]{d, e}); } - public void registerChangeListener(UIObserverListener listener) { + public void registerFormatListener(UIObserverListener listener) { fieldFormatPane.registerChangeListener(listener); + intervalTimeBox.registerChangeListener(listener); } - public void populate(Format format, AbstractDataFunction dataFunction, boolean showDataFunction) { + public void registerFunctionListener(ActionListener listener) { + dataFunctionBox.addActionListener(listener); + } + + public void populate(Format format, IntervalTimeFormat intervalTime, AbstractDataFunction dataFunction, boolean showDataFunction, boolean showIntervalTime) { fieldFormatPane.populateBean(format); - fieldDataFunction.populateBean(dataFunction); + intervalTimeBox.setSelectedItem(intervalTime); + dataFunctionBox.populateBean(dataFunction); + + fieldFormatPane.setVisible(!showIntervalTime); + intervalTimePane.setVisible(showIntervalTime); fieldFunctionPane.setVisible(showDataFunction); } @@ -73,7 +93,11 @@ public class VanChartFieldAttrPane extends JPanel { return fieldFormatPane.update(); } + public IntervalTimeFormat updateIntervalTime() { + return (IntervalTimeFormat) intervalTimeBox.getSelectedItem(); + } + public AbstractDataFunction updateDataFunction() { - return fieldDataFunction.updateBean(); + return dataFunctionBox.updateBean(); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java index 74bf770304..1e76d616cc 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldButton.java @@ -7,7 +7,9 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.plugin.chart.base.format.IntervalTimeFormat; import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -33,16 +35,27 @@ public class VanChartFieldButton extends JPanel { private final AttrTooltipFormat tooltipFormat; private final boolean showDataFunction; + private final boolean showIntervalTime; private UIToggleButton fieldButton; private UIButton addButton; private DataFunction dataFunction = new NoneFunction(); + public VanChartFieldButton(String fieldName, AttrTooltipFormat format, VanChartFieldListener listener) { + this(fieldName, format, false, false, listener); + } + public VanChartFieldButton(String fieldName, AttrTooltipFormat format, boolean showDataFunction, VanChartFieldListener listener) { + this(fieldName, format, showDataFunction, false, listener); + } + + public VanChartFieldButton(String fieldName, AttrTooltipFormat format, boolean showDataFunction, boolean showIntervalTime, VanChartFieldListener listener) { this.fieldName = fieldName; this.tooltipFormat = format; + this.showDataFunction = showDataFunction; + this.showIntervalTime = showIntervalTime; this.fieldId = format == null ? StringUtils.EMPTY : format.getFormatJSONKey(); @@ -72,6 +85,20 @@ public class VanChartFieldButton extends JPanel { this.tooltipFormat.setFormat(format); } + public IntervalTimeFormat getIntervalTimeFormat() { + if (tooltipFormat instanceof AttrTooltipDurationFormat) { + return ((AttrTooltipDurationFormat) tooltipFormat).getIntervalTimeFormat(); + } + + return IntervalTimeFormat.DAY; + } + + public void setIntervalTimeFormat(IntervalTimeFormat intervalTime) { + if (tooltipFormat instanceof AttrTooltipDurationFormat) { + ((AttrTooltipDurationFormat) tooltipFormat).setIntervalTimeFormat(intervalTime); + } + } + public DataFunction getDataFunction() { return dataFunction; } @@ -84,6 +111,10 @@ public class VanChartFieldButton extends JPanel { return showDataFunction; } + public boolean isShowIntervalTime() { + return showIntervalTime; + } + public String getFormatJs() { return this.tooltipFormat.getJs(); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java index 2d6b4b5790..61d7cfb257 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartFieldListPane.java @@ -11,11 +11,13 @@ import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.TableFieldCollection; import com.fr.plugin.chart.base.TableFieldDefinition; import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; +import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat; import com.fr.plugin.chart.base.format.AttrTooltipFieldFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; +import com.fr.plugin.chart.base.format.IntervalTimeFormat; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.BorderFactory; @@ -52,7 +54,7 @@ public class VanChartFieldListPane extends JPanel { List richEditorFieldNames = VanChartRichEditorPane.getFieldNames(); - this.tableFieldNameList = richEditorFieldNames == null ? new ArrayList<>() : richEditorFieldNames; + this.tableFieldNameList = (!supportAddField() || richEditorFieldNames == null) ? new ArrayList<>() : richEditorFieldNames; this.fieldAttrPane = fieldAttrPane; this.richEditorPane = richEditorPane; @@ -131,6 +133,10 @@ public class VanChartFieldListPane extends JPanel { new AttrTooltipPercentFormat(), false, fieldListener); } + protected boolean supportAddField() { + return true; + } + protected void addDefaultFieldButton(JPanel fieldPane) { fieldPane.add(categoryNameButton); fieldPane.add(seriesNameButton); @@ -156,7 +162,7 @@ public class VanChartFieldListPane extends JPanel { tableField.setPreferredSize(new Dimension(FIELD_ADD_W, tableFieldNameList.size() * FIELD_ADD_H)); - return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap("数据集字段", tableField); + return TableLayout4VanChartHelper.createExpandablePaneWithTitleTopGap(Toolkit.i18nText("Fine-Design_Report_Table_Field"), tableField); } protected List getDefaultFieldButtonList() { @@ -242,10 +248,13 @@ public class VanChartFieldListPane extends JPanel { } Format format = fieldButton.getFormat(); + IntervalTimeFormat intervalTime = fieldButton.getIntervalTimeFormat(); AbstractDataFunction dataFunction = (AbstractDataFunction) fieldButton.getDataFunction(); + boolean showDataFunction = fieldButton.isShowDataFunction(); + boolean showIntervalTime = fieldButton.isShowIntervalTime(); - fieldAttrPane.populate(format, dataFunction, showDataFunction); + fieldAttrPane.populate(format, intervalTime, dataFunction, showDataFunction, showIntervalTime); } public void updateFieldFormatPane() { @@ -256,6 +265,7 @@ public class VanChartFieldListPane extends JPanel { } fieldButton.setFormat(fieldAttrPane.updateFormat()); + fieldButton.setIntervalTimeFormat(fieldAttrPane.updateIntervalTime()); fieldButton.setDataFunction(fieldAttrPane.updateDataFunction()); if (tableFieldNameList.contains(fieldName)) { @@ -276,7 +286,7 @@ public class VanChartFieldListPane extends JPanel { } }); - fieldAttrPane.registerChangeListener(new UIObserverListener() { + fieldAttrPane.registerFormatListener(new UIObserverListener() { public void doChange() { fieldListener.updateFieldFormatPane(); } @@ -317,6 +327,10 @@ public class VanChartFieldListPane extends JPanel { button.setEnable(format.isEnable()); button.setFormat(format.getFormat()); + + if (button.isShowIntervalTime() && format instanceof AttrTooltipDurationFormat) { + button.setIntervalTimeFormat(((AttrTooltipDurationFormat) format).getIntervalTimeFormat()); + } } public void populateTableField(AttrTooltipContent tooltipContent) { @@ -378,5 +392,9 @@ public class VanChartFieldListPane extends JPanel { format.setEnable(button.isEnable()); format.setFormat(button.getFormat()); + + if (button.isShowIntervalTime() && format instanceof AttrTooltipDurationFormat) { + ((AttrTooltipDurationFormat) format).setIntervalTimeFormat(button.getIntervalTimeFormat()); + } } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java index dcec83deb4..69c93926c5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java @@ -3,6 +3,7 @@ package com.fr.van.chart.designer.component.richText; import com.fr.base.TableData; import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.MoreNameCDDefinition; import com.fr.chart.chartdata.OneValueCDDefinition; import com.fr.data.TableDataSource; @@ -17,6 +18,7 @@ import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.type.TextAlign; import com.fr.stable.StringUtils; +import com.fr.van.chart.designer.PlotFactory; import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.JSValue; import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; @@ -51,6 +53,12 @@ public class VanChartRichEditorPane { return; } + Plot plot = chart.getPlot(); + + if (plot == null || !PlotFactory.plotSupportAddTableField(plot)) { + return; + } + TopDefinitionProvider definition = chart.getFilterDefinition(); if (definition == null) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java index b7c4e968d3..d2d0769ee6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java @@ -1,6 +1,7 @@ package com.fr.van.chart.designer.component.richText; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; @@ -38,7 +39,8 @@ public class VanChartRichTextPane extends BasicBeanPane { } private JPanel createFieldContentPane() { - JPanel fieldPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + JPanel fieldPane = new JPanel(); + fieldPane.setLayout(FRGUIPaneFactory.create2ColumnGridLayout()); // 新增字段目录 JPanel fieldListContent = new JPanel(); @@ -48,12 +50,12 @@ public class VanChartRichTextPane extends BasicBeanPane { JScrollPane fieldListScrollPane = new JScrollPane(fieldListContent); fieldListScrollPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); fieldListScrollPane.setHorizontalScrollBar(null); - fieldListScrollPane.setBorder(BorderFactory.createTitledBorder("添加字段")); + fieldListScrollPane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Report_Add_Field"))); // 字段格式和汇总 JScrollPane fieldAttrScrollPane = new JScrollPane(fieldAttrPane); fieldAttrScrollPane.setPreferredSize(new Dimension(FIELD_PANE_W, FIELD_PANE_H)); - fieldAttrScrollPane.setBorder(BorderFactory.createTitledBorder("字段设置")); + fieldAttrScrollPane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Report_Field_Setting"))); fieldPane.add(fieldListScrollPane); fieldPane.add(fieldAttrScrollPane); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/RefreshTooltipContentPaneWithOutSeries.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/RefreshTooltipContentPaneWithOutSeries.java index ca7479cc05..48d2e55cb3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/RefreshTooltipContentPaneWithOutSeries.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/RefreshTooltipContentPaneWithOutSeries.java @@ -29,14 +29,6 @@ public class RefreshTooltipContentPaneWithOutSeries extends TooltipContentPaneWi setChangedPercentFormatPane(new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - super.initRichTextFormatPane(parent, showOnPane); - - setRichTextChangedValueFormatPane(new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextChangedPercentFormatPane(new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane)); - } - protected double[] getRowSize(double p){ return new double[]{p,p,p,p,p}; } @@ -50,14 +42,4 @@ public class RefreshTooltipContentPaneWithOutSeries extends TooltipContentPaneWi new Component[]{getChangedPercentFormatPane(),null}, }; } - - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextCategoryNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null}, - new Component[]{getRichTextChangedValueFormatPane(), null}, - new Component[]{getRichTextPercentFormatPane(), null}, - new Component[]{getRichTextChangedPercentFormatPane(), null} - }; - } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/TooltipContentPaneWithOutSeries.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/TooltipContentPaneWithOutSeries.java index 8724429f3c..ab2f0a179c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/TooltipContentPaneWithOutSeries.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/TooltipContentPaneWithOutSeries.java @@ -1,10 +1,17 @@ package com.fr.van.chart.designer.component.tooltip; +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.AttrTooltipRichText; +import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -33,31 +40,33 @@ public class TooltipContentPaneWithOutSeries extends VanChartTooltipContentPane }; } - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextCategoryNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null}, - new Component[]{getRichTextPercentFormatPane(), null} + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartFieldListPaneWithOutSeries(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } }; } - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ - getRichTextCategoryNameFormatPane(), - getRichTextValueFormatPane(), - getRichTextPercentFormatPane() + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") }; + } - AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ - attrTooltipContent.getRichTextCategoryFormat(), - attrTooltipContent.getRichTextValueFormat(), - attrTooltipContent.getRichTextPercentFormat() + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipCategoryFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() }; - - setRichTextAttr(new AttrTooltipRichText()); - populateRichTextFormat(formatPaneGroup, formatGroup); - populateRichText(attrTooltipContent.getRichTextAttr()); - - checkRichEditorState(attrTooltipContent); } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/VanChartFieldListPaneWithOutSeries.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/VanChartFieldListPaneWithOutSeries.java new file mode 100644 index 0000000000..c651dbf891 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/tooltip/VanChartFieldListPaneWithOutSeries.java @@ -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 richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(getCategoryNameButton()); + fieldPane.add(getValueButton()); + fieldPane.add(getPercentButton()); + } + + protected List getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(getCategoryNameButton()); + fieldButtonList.add(getValueButton()); + fieldButtonList.add(getPercentButton()); + + return fieldButtonList; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java index 8a0a62f62d..5a16aa4c82 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java @@ -4,11 +4,12 @@ import com.fr.base.BaseUtils; import com.fr.chart.chartattr.Plot; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.UIBubbleFloatPane; +import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -65,7 +66,7 @@ public class VanChartPlotLegendPane extends BasicPane { //区域显示策略 恢复用注释。下面4行删除。 private UIButtonGroup customSize; - private UISpinner maxProportion; + private UINumberDragPane maxProportion; private JPanel maxProportionPane; //区域显示策略 恢复用注释。取消注释。 //private LimitPane limitPane; @@ -294,7 +295,7 @@ public class VanChartPlotLegendPane extends BasicPane { private JPanel createDisplayStrategy() { //区域显示策略 恢复用注释。开始删除。 - maxProportion = new UISpinner(0, 100, 1, 30); + maxProportion = new UINumberDragPaneWithPercent(0, 100, 1); customSize = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"), Toolkit.i18nText("Fine-Design_Chart_Custom")}); JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Area_Size"), customSize); @@ -402,7 +403,7 @@ public class VanChartPlotLegendPane extends BasicPane { legend.setLayout(layoutButton.getSelectedItem()); //区域显示策略 恢复用注释。下面2行删除。 legend.setCustomSize(customSize.getSelectedIndex() == 1); - legend.setMaxHeight(maxProportion.getValue()); + legend.setMaxHeight(maxProportion.updateBean()); //区域显示策略 恢复用注释。取消注释。 //legend.setLimitAttribute(limitPane.updateBean()); legend.setFloatPercentX(customFloatPositionPane.getFloatPosition_x()); @@ -427,7 +428,7 @@ public class VanChartPlotLegendPane extends BasicPane { layoutButton.setSelectedItem(legend.getLayout()); //区域显示策略 恢复用注释。下面2行删除。 customSize.setSelectedIndex(legend.isCustomSize() ? 1 : 0); - maxProportion.setValue(legend.getMaxHeight()); + maxProportion.populateBean(legend.getMaxHeight()); //区域显示策略 恢复用注释。取消注释。 //limitPane.populateBean(legend.getLimitAttribute()); if (highlightButton != null) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java index 1c02f342ca..59652a4afa 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java @@ -7,11 +7,12 @@ import com.fr.chart.base.TextAttr; import com.fr.chartx.config.info.constant.ConfigType; import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.frpane.UIBubbleFloatPane; +import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; @@ -64,7 +65,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { //区域显示策略 恢复用注释。下面3行删除。 private UIButtonGroup limitSize; - private UISpinner maxProportion; + private UINumberDragPane maxProportion; private JPanel maxProportionPane; //区域显示策略 恢复用注释。取消注释。 //private LimitPane limitPane; @@ -183,7 +184,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { private JPanel createDisplayStrategy() { //区域显示策略 恢复用注释。开始删除。 - maxProportion = new UISpinner(0, 100, 1, 30); + maxProportion = new UINumberDragPaneWithPercent(0, 100, 1); limitSize = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"), limitSize); @@ -320,7 +321,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { customFloatPositionPane.setFloatPosition_y(title.getFloatPercentY()); //区域显示策略 恢复用注释。下面2行删除。 limitSize.setSelectedIndex(title.isLimitSize() ? 0 : 1); - maxProportion.setValue(title.getMaxHeight()); + maxProportion.populateBean(title.getMaxHeight()); //区域显示策略 恢复用注释。取消注释。 //limitPane.populateBean(title.getLimitAttribute()); @@ -357,7 +358,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { title.setFloating(customFloatPositionButton.isSelected()); //区域显示策略 恢复用注释。下面2行删除。 title.setLimitSize(limitSize.getSelectedIndex() == 0); - title.setMaxHeight(maxProportion.getValue()); + title.setMaxHeight(maxProportion.updateBean()); //区域显示策略 恢复用注释。取消注释。 //title.setLimitAttribute(limitPane.updateBean()); title.setFloatPercentX(customFloatPositionPane.getFloatPosition_x()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java index 955be0a8c4..9fb0c7e31e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java @@ -8,11 +8,11 @@ import com.fr.chart.chartattr.Title; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.style.FormatPane; import com.fr.design.i18n.Toolkit; @@ -97,7 +97,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { //区域显示策略 恢复用注释。下面3行删除。 protected UIButtonGroup axisLimitSize; - protected UISpinner maxProportion; + protected UINumberDragPane maxProportion; protected JPanel maxProportionPane; //区域显示策略 恢复用注释。取消注释。 //private LimitPane limitPane; @@ -465,7 +465,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected JPanel createDisplayStrategy() { //区域显示策略 恢复用注释。删除到return,即除了注释的代码都删除。 - maxProportion = new UISpinner(0, 100, 1, 30); + maxProportion = new UINumberDragPaneWithPercent(0, 100, 1); axisLimitSize = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Limit"), Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Area_Size"), axisLimitSize); @@ -767,7 +767,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { axisLimitSize.setSelectedIndex(axis.isLimitSize() ? 0 : 1); } if (maxProportion != null) { - maxProportion.setValue(axis.getMaxHeight()); + maxProportion.populateBean(axis.getMaxHeight()); } //区域显示策略 恢复用注释。取消注释。 @@ -909,7 +909,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { axis.setLimitSize(axisLimitSize.getSelectedIndex() == 0); } if (maxProportion != null) { - axis.setMaxHeight(maxProportion.getValue()); + axis.setMaxHeight(maxProportion.updateBean()); } //区域显示策略 恢复用注释。取消注释。 // if (limitPane != null) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java index ca59824f69..387d974d28 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java @@ -10,6 +10,7 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.i18n.Toolkit; import com.fr.design.gui.style.FRFontPane; import com.fr.design.layout.FRGUIPaneFactory; @@ -90,7 +91,7 @@ public class VanChartAlertValuePane extends BasicBeanPane { alertValue.setPreferredSize(new Dimension(VALUE_WD, HT)); alertLineStyle = new LineTypeComboBox(new LineType[]{LineType.SOLID, LineType.DASHED}); - lineWidthSpinner = new UISpinner(LINE_WIDTH_MIN_VALUE, Integer.MAX_VALUE, LINE_WIDTH_DIERTA_VALUE, LINE_WIDTH_DEFAULT_VALUE); + lineWidthSpinner = new UISpinnerWithPx(LINE_WIDTH_MIN_VALUE, Integer.MAX_VALUE, LINE_WIDTH_DIERTA_VALUE, LINE_WIDTH_DEFAULT_VALUE); alertLineColor = new ColorSelectBox(PREFERRED_WIDTH); alertTextPosition = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Axis_Top"), Toolkit.i18nText("Fine-Design_Chart_Axis_Bottom")}); alertText = new TinyFormulaPane(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartCustomIntervalBackgroundPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartCustomIntervalBackgroundPane.java index 81aa8d276d..ef6dc0e111 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartCustomIntervalBackgroundPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartCustomIntervalBackgroundPane.java @@ -5,6 +5,7 @@ import com.fr.base.Utils; import com.fr.design.beans.BasicBeanPane; import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; @@ -52,7 +53,7 @@ public class VanChartCustomIntervalBackgroundPane extends BasicBeanPane richEditorPane) { - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ - getRichTextSeriesNameFormatPane(), - getRichTextValueFormatPane(), - getRichTextPercentFormatPane() - }; + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartFunnelRichTextFieldListPane(fieldAttrPane, richEditor); + } - AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ - attrTooltipContent.getRichTextSeriesFormat(), - attrTooltipContent.getRichTextValueFormat(), - attrTooltipContent.getRichTextPercentFormat() + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } }; + } - setRichTextAttr(new AttrTooltipRichText()); - populateRichTextFormat(formatPaneGroup, formatGroup); - populateRichText(attrTooltipContent.getRichTextAttr()); + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Value_Conversion") + }; + } - checkRichEditorState(attrTooltipContent); + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipNameFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; } protected AttrTooltipContent createAttrTooltip() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRefreshTooltipContentPane.java index b7f817eb3c..bb3b8bea30 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRefreshTooltipContentPane.java @@ -29,14 +29,6 @@ public class VanChartFunnelRefreshTooltipContentPane extends VanChartFunnelToolt setChangedPercentFormatPane(new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - super.initRichTextFormatPane(parent, showOnPane); - - setRichTextChangedValueFormatPane(new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextChangedPercentFormatPane(new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane)); - } - protected double[] getRowSize(double p){ return new double[]{p,p,p,p,p}; } @@ -50,14 +42,4 @@ public class VanChartFunnelRefreshTooltipContentPane extends VanChartFunnelToolt new Component[]{getChangedPercentFormatPane(), null}, }; } - - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null}, - new Component[]{getRichTextChangedValueFormatPane(), null}, - new Component[]{getRichTextPercentFormatPane(), null}, - new Component[]{getRichTextChangedPercentFormatPane(), null} - }; - } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRichTextFieldListPane.java new file mode 100644 index 0000000000..c63f112a7c --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelRichTextFieldListPane.java @@ -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 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 getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(getSeriesNameButton()); + fieldButtonList.add(getValueButton()); + fieldButtonList.add(getPercentButton()); + + return fieldButtonList; + } + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java index 247194ec40..e8c741b14c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelTooltipContentPane.java @@ -1,17 +1,20 @@ 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.AttrTooltipContent; -import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.format.AttrTooltipFormat; 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.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -37,14 +40,6 @@ public class VanChartFunnelTooltipContentPane extends VanChartTooltipContentPane }; } - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null}, - new Component[]{getRichTextPercentFormatPane(), null} - }; - } - @Override protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { setCategoryNameFormatPane(new CategoryNameFormatPaneWithCheckBox(parent, showOnPane)); @@ -53,32 +48,34 @@ public class VanChartFunnelTooltipContentPane extends VanChartTooltipContentPane setPercentFormatPane(new FunnelPercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextPercentFormatPane(new FunnelPercentFormatPaneWithoutCheckBox(parent, showOnPane)); - } + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ - getRichTextSeriesNameFormatPane(), - getRichTextValueFormatPane(), - getRichTextPercentFormatPane() - }; + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartFunnelRichTextFieldListPane(fieldAttrPane, richEditor); + } - AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ - attrTooltipContent.getRichTextSeriesFormat(), - attrTooltipContent.getRichTextValueFormat(), - attrTooltipContent.getRichTextPercentFormat() + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } }; + } - setRichTextAttr(new AttrTooltipRichText()); - populateRichTextFormat(formatPaneGroup, formatGroup); - populateRichText(attrTooltipContent.getRichTextAttr()); + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Value_Conversion") + }; + } - checkRichEditorState(attrTooltipContent); + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipNameFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; } protected AttrTooltipContent createAttrTooltip() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePane.java index 8ff6786bad..fe0d2d6771 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePane.java @@ -2,6 +2,7 @@ package com.fr.van.chart.gantt.designer.style.axis; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -55,7 +56,7 @@ public class GanttAxisStylePane extends BasicBeanPane { protected void initComponents() { textAttrPane = new ChartTextAttrPane(); colorSelectBox4button = new ColorSelectBoxWithOutTransparent(100); - transparent = new UINumberDragPane(0, 100); + transparent = new UINumberDragPaneWithPercent(0, 100); } protected Component[][] getUsedComponents() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttRichTextFieldListPane.java new file mode 100644 index 0000000000..6332c6757a --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttRichTextFieldListPane.java @@ -0,0 +1,107 @@ +package com.fr.van.chart.gantt.designer.style.tooltip; + +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.AttrTooltipDurationFormat; +import com.fr.plugin.chart.base.format.AttrTooltipEndTimeFormat; +import com.fr.plugin.chart.base.format.AttrTooltipProcessesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipProgressFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipStartTimeFormat; +import com.fr.plugin.chart.gantt.attr.AttrGanttTooltipContent; +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 VanChartGanttRichTextFieldListPane extends VanChartFieldListPane { + + private VanChartFieldButton richTextProcessesFormatPane; + private VanChartFieldButton richTextStartTimeFormatPane; + private VanChartFieldButton richTextEndTimeFormatPane; + private VanChartFieldButton richTextDurationFormatPane; + private VanChartFieldButton richTextProgressFormatPane; + + public VanChartGanttRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void initDefaultFieldButton() { + VanChartFieldListener listener = getFieldListener(); + + richTextProcessesFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Project_Name"), + new AttrTooltipProcessesFormat(), false, listener); + + setSeriesNameButton(new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + new AttrTooltipSeriesFormat(), false, listener)); + + richTextStartTimeFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Start_Time"), + new AttrTooltipStartTimeFormat(), false, listener); + + richTextEndTimeFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_End_Time"), + new AttrTooltipEndTimeFormat(), false, listener); + + richTextDurationFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Duration_Time"), + new AttrTooltipDurationFormat(), false, true, listener); + + richTextProgressFormatPane = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Process"), + new AttrTooltipProgressFormat(), false, listener); + } + + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(richTextProcessesFormatPane); + fieldPane.add(getSeriesNameButton()); + fieldPane.add(richTextStartTimeFormatPane); + fieldPane.add(richTextEndTimeFormatPane); + fieldPane.add(richTextDurationFormatPane); + fieldPane.add(richTextProgressFormatPane); + } + + protected List getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(richTextProcessesFormatPane); + fieldButtonList.add(getSeriesNameButton()); + fieldButtonList.add(richTextStartTimeFormatPane); + fieldButtonList.add(richTextEndTimeFormatPane); + fieldButtonList.add(richTextDurationFormatPane); + fieldButtonList.add(richTextProgressFormatPane); + + return fieldButtonList; + } + + public void populateDefaultField(AttrTooltipContent tooltipContent) { + super.populateDefaultField(tooltipContent); + + if (tooltipContent instanceof AttrGanttTooltipContent) { + AttrGanttTooltipContent gantt = (AttrGanttTooltipContent) tooltipContent; + + populateButtonFormat(richTextProcessesFormatPane, gantt.getRichTextProcessesFormat()); + populateButtonFormat(richTextStartTimeFormatPane, gantt.getRichTextStartTimeFormat()); + populateButtonFormat(richTextEndTimeFormatPane, gantt.getRichTextEndTimeFormat()); + populateButtonFormat(richTextDurationFormatPane, gantt.getRichTextDurationFormat()); + populateButtonFormat(richTextProgressFormatPane, gantt.getRichTextProgressFormat()); + } + } + + public void updateDefaultField(AttrTooltipContent tooltipContent) { + super.updateDefaultField(tooltipContent); + + if (tooltipContent instanceof AttrGanttTooltipContent) { + AttrGanttTooltipContent gantt = (AttrGanttTooltipContent) tooltipContent; + + updateButtonFormat(richTextProcessesFormatPane, gantt.getRichTextProcessesFormat()); + updateButtonFormat(richTextStartTimeFormatPane, gantt.getRichTextStartTimeFormat()); + updateButtonFormat(richTextEndTimeFormatPane, gantt.getRichTextEndTimeFormat()); + updateButtonFormat(richTextDurationFormatPane, gantt.getRichTextDurationFormat()); + updateButtonFormat(richTextProgressFormatPane, gantt.getRichTextProgressFormat()); + } + } + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java index d724deff58..6868a0c879 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/tooltip/VanChartGanttTooltipContentPane.java @@ -1,10 +1,11 @@ package com.fr.van.chart.gantt.designer.style.tooltip; 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.AttrTooltipRichText; import com.fr.plugin.chart.base.format.AttrTooltipDurationFormat; import com.fr.plugin.chart.base.format.AttrTooltipEndTimeFormat; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.base.format.AttrTooltipProcessesFormat; import com.fr.plugin.chart.base.format.AttrTooltipProgressFormat; import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; @@ -12,14 +13,15 @@ import com.fr.plugin.chart.base.format.AttrTooltipStartTimeFormat; import com.fr.plugin.chart.gantt.attr.AttrGanttTooltipContent; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; import java.awt.Component; -import java.util.Map; /** * Created by hufan on 2017/1/13. @@ -31,12 +33,6 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane private VanChartFormatComBoxWithCheckBox durationFormatPane; private VanChartFormatPaneWithCheckBox progressFormatPane; - private VanChartFormatPaneWithoutCheckBox richTextProcessesFormatPane; - private VanChartDateFormatPaneWithoutCheckBox richTextStartTimeFormatPane; - private VanChartDateFormatPaneWithoutCheckBox richTextEndTimeFormatPane; - private VanChartFormatComBoxWithoutCheckBox richTextDurationFormatPane; - private VanChartFormatPaneWithoutCheckBox richTextProgressFormatPane; - public VanChartGanttTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) { super(parent, showOnPane); } @@ -70,28 +66,39 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane }; } - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - richTextProcessesFormatPane = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane){ - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Project_Name"); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartGanttRichTextFieldListPane(fieldAttrPane, richEditor); } - }; - setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - richTextStartTimeFormatPane = new VanChartDateFormatPaneWithoutCheckBox(parent, showOnPane){ - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Start_Time"); + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); } }; - richTextEndTimeFormatPane = new VanChartDateFormatPaneWithoutCheckBox(parent, showOnPane){ - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_End_Time"); - } + } + + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Project_Name"), + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Start_Time"), + Toolkit.i18nText("Fine-Design_Chart_End_Time"), + Toolkit.i18nText("Fine-Design_Chart_Duration_Time"), + Toolkit.i18nText("Fine-Design_Chart_Process") }; - richTextDurationFormatPane = new VanChartFormatComBoxWithoutCheckBox(); - richTextProgressFormatPane = new VanChartFormatPaneWithoutCheckBox(parent, showOnPane){ - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Process"); - } + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipProcessesFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipStartTimeFormat(), + new AttrTooltipEndTimeFormat(), + new AttrTooltipDurationFormat(), + new AttrTooltipProgressFormat() }; } @@ -106,17 +113,6 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane }; } - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{richTextProcessesFormatPane,null}, - new Component[]{getRichTextSeriesNameFormatPane(),null}, - new Component[]{richTextStartTimeFormatPane,null}, - new Component[]{richTextEndTimeFormatPane,null}, - new Component[]{richTextDurationFormatPane, null}, - new Component[]{richTextProgressFormatPane, null} - }; - } - protected double[] getRowSize(double p){ return new double[]{p,p,p,p,p,p}; } @@ -135,43 +131,6 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane } } - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - if(attrTooltipContent instanceof AttrGanttTooltipContent){ - setRichTextAttr(new AttrTooltipRichText()); - - AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent; - Map params = getRichTextAttr().getParams(); - - AttrTooltipProcessesFormat processesFormat = ganttTooltipContent.getRichTextProcessesFormat(); - richTextProcessesFormatPane.populate(processesFormat); - richTextProcessesFormatPane.updateFormatParams(params, processesFormat.getJs()); - - AttrTooltipSeriesFormat seriesFormat = ganttTooltipContent.getRichTextSeriesFormat(); - getRichTextSeriesNameFormatPane().populate(seriesFormat); - getRichTextSeriesNameFormatPane().updateFormatParams(params, seriesFormat.getJs()); - - AttrTooltipStartTimeFormat startTimeFormat = ganttTooltipContent.getRichTextStartTimeFormat(); - richTextStartTimeFormatPane.populate(startTimeFormat); - richTextStartTimeFormatPane.updateFormatParams(params, startTimeFormat.getJs()); - - AttrTooltipEndTimeFormat endTimeFormat = ganttTooltipContent.getRichTextEndTimeFormat(); - richTextEndTimeFormatPane.populate(endTimeFormat); - richTextEndTimeFormatPane.updateFormatParams(params, endTimeFormat.getJs()); - - AttrTooltipDurationFormat durationFormat = ganttTooltipContent.getRichTextDurationFormat(); - richTextDurationFormatPane.populate(durationFormat); - richTextDurationFormatPane.updateFormatParams(params, durationFormat.getJs()); - - AttrTooltipProgressFormat progressFormat = ganttTooltipContent.getRichTextProgressFormat(); - richTextProgressFormatPane.populate(progressFormat); - richTextProgressFormatPane.updateFormatParams(params, progressFormat.getJs()); - - populateRichText(attrTooltipContent.getRichTextAttr()); - - checkRichEditorState(attrTooltipContent); - } - } - protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { if (attrTooltipContent instanceof AttrGanttTooltipContent){ AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent; @@ -184,16 +143,18 @@ public class VanChartGanttTooltipContentPane extends VanChartTooltipContentPane } } - protected void updateRichEditor(AttrTooltipContent attrTooltipContent) { - if(attrTooltipContent instanceof AttrGanttTooltipContent) { - AttrGanttTooltipContent ganttTooltipContent = (AttrGanttTooltipContent) attrTooltipContent; + protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) { + super.updateTooltipFormat(target, source); + + if (target instanceof AttrGanttTooltipContent && source instanceof AttrGanttTooltipContent) { + AttrGanttTooltipContent targetGantt = (AttrGanttTooltipContent) target; + AttrGanttTooltipContent sourceGantt = (AttrGanttTooltipContent) source; - richTextProcessesFormatPane.update(ganttTooltipContent.getRichTextProcessesFormat()); - getRichTextSeriesNameFormatPane().update(ganttTooltipContent.getRichTextSeriesFormat()); - richTextStartTimeFormatPane.update(ganttTooltipContent.getRichTextStartTimeFormat()); - richTextEndTimeFormatPane.update(ganttTooltipContent.getRichTextEndTimeFormat()); - richTextDurationFormatPane.update(ganttTooltipContent.getRichTextDurationFormat()); - richTextProgressFormatPane.update(ganttTooltipContent.getRichTextProgressFormat()); + targetGantt.setRichTextProcessesFormat(sourceGantt.getRichTextProcessesFormat()); + targetGantt.setRichTextStartTimeFormat(sourceGantt.getRichTextStartTimeFormat()); + targetGantt.setRichTextEndTimeFormat(sourceGantt.getRichTextEndTimeFormat()); + targetGantt.setRichTextDurationFormat(sourceGantt.getRichTextDurationFormat()); + targetGantt.setRichTextProgressFormat(sourceGantt.getRichTextProgressFormat()); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java index 8a48837cb3..aab8f3cf2c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java @@ -3,9 +3,11 @@ package com.fr.van.chart.gauge; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -257,12 +259,12 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { } private Component[] getThermometerWidth() { - thermometerWidth = new UISpinner(0, Double.MAX_VALUE, 0.1, 10); + thermometerWidth = new UISpinnerWithPx(0, Double.MAX_VALUE, 0.1, 10); return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Thermometer_Width")),thermometerWidth}; } private Component[] getChutePercent() { - chutePercent = new UINumberDragPane(0, 100, 1); + chutePercent = new UINumberDragPaneWithPercent(0, 100, 1); return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Chute_Percent")),chutePercent}; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java index 1e06db777e..0dd9cea31b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java @@ -3,9 +3,11 @@ package com.fr.van.chart.heatmap.designer.style; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -31,7 +33,7 @@ import java.awt.Component; public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { private UISpinner radius; - private UISpinner blur; + private UINumberDragPane blur; private UINumberDragPane minOpacity; private UINumberDragPane maxOpacity; @@ -119,8 +121,8 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { } private JPanel createHeatPointStylePane() { - radius = new UISpinner(0, Double.MAX_VALUE, 1, 30); - blur = new UISpinner(0, 100, 1, 30); + radius = new UISpinnerWithPx(0, Double.MAX_VALUE, 1, 30); + blur = new UINumberDragPaneWithPercent(0, 100, 1); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -130,8 +132,8 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { Component[][] components = new Component[][]{ new Component[]{null, null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Heat_Map_Radius")), radius, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Heat_Map_Blur")), blur, new UILabel("%")} + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Heat_Map_Radius")), radius, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Heat_Map_Blur")), blur, null} }; JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); @@ -141,8 +143,8 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { } private JPanel createOpacityPane() { - maxOpacity = new UINumberDragPane(0, 100); - minOpacity = new UINumberDragPane(0, 100); + maxOpacity = new UINumberDragPaneWithPercent(0, 100); + minOpacity = new UINumberDragPaneWithPercent(0, 100); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -169,7 +171,7 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { if (plot instanceof VanChartHeatMapPlot) { VanChartHeatMapPlot heatMapPlot = (VanChartHeatMapPlot) plot; radius.setValue(heatMapPlot.getRadius()); - blur.setValue(heatMapPlot.getBlur()); + blur.populateBean(heatMapPlot.getBlur()); maxOpacity.populateBean(heatMapPlot.getMaxOpacity()); minOpacity.populateBean(heatMapPlot.getMinOpacity()); getVanChartValueColorPane().populateBean((VanChartRangeLegend) plot.getLegend()); @@ -187,7 +189,7 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { if (plot instanceof VanChartHeatMapPlot) { VanChartHeatMapPlot heatMapPlot = (VanChartHeatMapPlot) plot; heatMapPlot.setRadius(radius.getValue()); - heatMapPlot.setBlur(blur.getValue()); + heatMapPlot.setBlur(blur.updateBean()); heatMapPlot.setMaxOpacity(maxOpacity.updateBean()); heatMapPlot.setMinOpacity(minOpacity.updateBean()); getVanChartValueColorPane().updateBean((VanChartRangeLegend) plot.getLegend()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java index 8f5a3d1783..2d1cb2304c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java @@ -5,6 +5,7 @@ import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; @@ -321,7 +322,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { //不透明度 protected JPanel createAlphaPane() { - setTransparent(new UINumberDragPane(0, 100)); + setTransparent(new UINumberDragPaneWithPercent(0, 100)); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {f, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java index baec70ca92..ce3e34ba76 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java @@ -1,6 +1,7 @@ package com.fr.van.chart.map.designer.style.label; 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.AttrTooltipAreaNameFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; @@ -14,7 +15,12 @@ import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheck import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; +import com.fr.van.chart.map.designer.style.VanChartMapRichTextFieldListPane; import javax.swing.JPanel; @@ -35,6 +41,20 @@ public class VanChartMapLabelContentPane extends VanChartLabelContentPane { setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); } + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartMapRichTextFieldListPane(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } + }; + } + protected String[] getRichTextFieldNames() { return new String[]{ Toolkit.i18nText("Fine-Design_Chart_Area_Name"), diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java index 745c3a79a8..d34a89b5de 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java @@ -3,6 +3,7 @@ package com.fr.van.chart.map.designer.style.series; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -10,6 +11,7 @@ import com.fr.plugin.chart.base.VanChartAttrMarker; import com.fr.plugin.chart.marker.type.MarkerType; import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; @@ -19,7 +21,7 @@ public class VanChartMapAnchorMarkerPane extends BasicBeanPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartMapRichTextFieldListPane(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } + }; + } + protected String[] getRichTextFieldNames() { return new String[]{ Toolkit.i18nText("Fine-Design_Chart_Area_Name"), diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartCurvePane.java b/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartCurvePane.java index df14ff5552..83fb0249df 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartCurvePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartCurvePane.java @@ -2,8 +2,10 @@ package com.fr.van.chart.map.line; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -29,9 +31,9 @@ public class VanChartCurvePane extends BasicBeanPane{ } private void initComponents(){ - lineWidth = new UISpinner(0, MAX_WIDTH, STEP, 0.5); + lineWidth = new UISpinnerWithPx(0, MAX_WIDTH, STEP, 0.5); bending = new UINumberDragPane(0, 100); - lineAlphaPane = new UINumberDragPane(0, 100); + lineAlphaPane = new UINumberDragPaneWithPercent(0, 100); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapRichTextFieldListPane.java new file mode 100644 index 0000000000..0a1e2bbb6b --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapRichTextFieldListPane.java @@ -0,0 +1,41 @@ +package com.fr.van.chart.map.line; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipStartAndEndNameFormat; +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; + +public class VanChartLineMapRichTextFieldListPane extends VanChartFieldListPane { + + public VanChartLineMapRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void initDefaultFieldButton() { + VanChartFieldListener fieldListener = getFieldListener(); + + VanChartFieldButton categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Start_And_End"), + new AttrTooltipStartAndEndNameFormat(), false, fieldListener); + + VanChartFieldButton seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + new AttrTooltipSeriesFormat(), 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_Use_Percent"), + new AttrTooltipPercentFormat(), false, fieldListener); + + setCategoryNameButton(categoryNameButton); + setSeriesNameButton(seriesNameButton); + setValueButton(valueButton); + setPercentButton(percentButton); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapTooltipContentPane.java index 9dbc696a68..04ab53b6a8 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapTooltipContentPane.java @@ -1,15 +1,21 @@ package com.fr.van.chart.map.line; +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.AttrTooltipFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; import com.fr.plugin.chart.base.format.AttrTooltipStartAndEndNameFormat; import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -30,12 +36,36 @@ public class VanChartLineMapTooltipContentPane extends VanChartTooltipContentPan setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new StartAndEndNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane)); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartLineMapRichTextFieldListPane(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } + }; + } + + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Start_And_End"), + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipStartAndEndNameFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieLabelContentPane.java index 73e766afc0..b62655a263 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieLabelContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieLabelContentPane.java @@ -1,13 +1,21 @@ package com.fr.van.chart.multilayer.style; +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.AttrTooltipFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.plugin.chart.multilayer.style.AttrTooltipMultiLevelNameFormat; import com.fr.plugin.chart.type.TextAlign; import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -28,12 +36,35 @@ public class VanChartMultiPieLabelContentPane extends VanChartLabelContentPane { setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new MultiPieLevelNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextSeriesNameFormatPane(new MultiPieSeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane)); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartMultiPieRichTextFieldListPane(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } + }; + } + + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Level_Name"), + Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipMultiLevelNameFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; } protected AttrTooltipContent createAttrTooltip() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieRichTextFieldListPane.java new file mode 100644 index 0000000000..2a0aea8194 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieRichTextFieldListPane.java @@ -0,0 +1,41 @@ +package com.fr.van.chart.multilayer.style; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; +import com.fr.plugin.chart.multilayer.style.AttrTooltipMultiLevelNameFormat; +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; + +public class VanChartMultiPieRichTextFieldListPane extends VanChartFieldListPane { + + public VanChartMultiPieRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void initDefaultFieldButton() { + VanChartFieldListener fieldListener = getFieldListener(); + + VanChartFieldButton categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Level_Name"), + new AttrTooltipMultiLevelNameFormat(), false, fieldListener); + + VanChartFieldButton seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"), + new AttrTooltipSeriesFormat(), 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_Use_Percent"), + new AttrTooltipPercentFormat(), false, fieldListener); + + setCategoryNameButton(categoryNameButton); + setSeriesNameButton(seriesNameButton); + setValueButton(valueButton); + setPercentButton(percentButton); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java index 4fa61802de..6c1575cfdf 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieSeriesPane.java @@ -1,6 +1,7 @@ package com.fr.van.chart.multilayer.style; import com.fr.chart.chartattr.Plot; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; @@ -46,7 +47,7 @@ public class VanChartMultiPieSeriesPane extends VanChartPieSeriesPane { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gradual_Deep")}); startAngle = new UISpinner(MIN_ANGLE, MAX_ANGLE, 1, 0); endAngle = new UISpinner(MIN_ANGLE, MAX_ANGLE, 1, 0); - innerRadius = new UISpinner(0, 100, 1, 0); + innerRadius = new UINumberDragPaneWithPercent(0, 100, 1); supportRotation = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); supportDrill = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), @@ -72,7 +73,7 @@ public class VanChartMultiPieSeriesPane extends VanChartPieSeriesPane { gradualLevel.setSelectedIndex(multiPiePlot.isLight() ? 0 : 1); startAngle.setValue(multiPiePlot.getStartAngle()); endAngle.setValue(multiPiePlot.getEndAngle()); - innerRadius.setValue(multiPiePlot.getInnerRadiusPercent()); + innerRadius.populateBean(multiPiePlot.getInnerRadiusPercent()); supportDrill.setSelectedIndex(multiPiePlot.isSupportDrill() ? 0 : 1); supportRotation.setSelectedIndex(multiPiePlot.isSupportRotation() ? 0 : 1); } @@ -85,7 +86,7 @@ public class VanChartMultiPieSeriesPane extends VanChartPieSeriesPane { multiPiePlot.setLight(gradualLevel.getSelectedIndex() == 0); multiPiePlot.setStartAngle(startAngle.getValue()); multiPiePlot.setEndAngle(endAngle.getValue()); - multiPiePlot.setInnerRadiusPercent(innerRadius.getValue()); + multiPiePlot.setInnerRadiusPercent(innerRadius.updateBean()); multiPiePlot.setSupportDrill(supportDrill.getSelectedIndex() == 0); multiPiePlot.setSupportRotation(supportRotation.getSelectedIndex() == 0); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieTooltipContentPane.java index 1fbe0870a5..76d536d5bc 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMultiPieTooltipContentPane.java @@ -1,12 +1,20 @@ package com.fr.van.chart.multilayer.style; +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.AttrTooltipFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.plugin.chart.multilayer.style.AttrTooltipMultiLevelNameFormat; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -27,12 +35,35 @@ public class VanChartMultiPieTooltipContentPane extends VanChartTooltipContentPa setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new MultiPieLevelNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextSeriesNameFormatPane(new MultiPieSeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane)); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartMultiPieRichTextFieldListPane(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } + }; + } + + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Level_Name"), + Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipMultiLevelNameFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMutiPieRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMutiPieRefreshTooltipContentPane.java index f375fa78fa..f2e3534de1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMutiPieRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/style/VanChartMutiPieRefreshTooltipContentPane.java @@ -31,14 +31,6 @@ public class VanChartMutiPieRefreshTooltipContentPane extends VanChartMultiPieTo setChangedPercentFormatPane(new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - super.initRichTextFormatPane(parent, showOnPane); - - setRichTextChangedValueFormatPane(new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextChangedPercentFormatPane(new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane)); - } - protected double[] getRowSize(double p){ return new double[]{p,p,p,p,p,p}; } @@ -53,16 +45,4 @@ public class VanChartMutiPieRefreshTooltipContentPane extends VanChartMultiPieTo new Component[]{getChangedPercentFormatPane(), null}, }; } - - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextCategoryNameFormatPane(), null}, - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null}, - new Component[]{getRichTextChangedValueFormatPane(), null}, - new Component[]{getRichTextPercentFormatPane(), null}, - new Component[]{getRichTextChangedPercentFormatPane(), null} - }; - } - } diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/RadiusCardLayoutPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/RadiusCardLayoutPane.java index 4932eddb4e..7befd40e7d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/RadiusCardLayoutPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/RadiusCardLayoutPane.java @@ -4,9 +4,10 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; - import com.fr.plugin.chart.attr.radius.VanChartRadiusPlot; import com.fr.plugin.chart.base.VanChartRadius; import com.fr.plugin.chart.type.RadiusType; @@ -14,11 +15,11 @@ import com.fr.van.chart.layout.VanChartCardLayoutPane; import javax.swing.BorderFactory; import javax.swing.JPanel; +import java.util.HashMap; +import java.util.Map; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; -import java.util.HashMap; -import java.util.Map; /** * Created by hufan on 2016/10/25. @@ -40,8 +41,8 @@ public class RadiusCardLayoutPane extends BasicBeanPane { Map paneList = new HashMap(); - radiusType = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Auto"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Fixed")}); - radius = new UISpinner(MIN_RADIUS, MAX_RADIUS, 1, 100); + radiusType = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"), Toolkit.i18nText("Fine-Design_Chart_Fixed")}); + radius = new UISpinnerWithPx(100); radiusContent = new JPanel(new BorderLayout()); radiusContent.add(radius, BorderLayout.CENTER); diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java index a6a1a5e28a..6253190da2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java @@ -2,6 +2,8 @@ package com.fr.van.chart.pie; import com.fr.chart.chartattr.Plot; +import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; @@ -27,7 +29,7 @@ public class VanChartPieSeriesPane extends VanChartAbstractPlotSeriesPane { protected UISpinner startAngle; protected UISpinner endAngle; - protected UISpinner innerRadius; + protected UINumberDragPane innerRadius; private UIButtonGroup supportRotation; public VanChartPieSeriesPane(ChartStylePane parent, Plot plot) { @@ -52,7 +54,7 @@ public class VanChartPieSeriesPane extends VanChartAbstractPlotSeriesPane { protected JPanel createSeriesStylePane(double[] row, double[] col) { startAngle = new UISpinner(MIN_ANGLE, MAX_ANGLE, 1, 0); endAngle = new UISpinner(MIN_ANGLE, MAX_ANGLE, 1, 0); - innerRadius = new UISpinner(0, 100, 1, 0); + innerRadius = new UINumberDragPaneWithPercent(0, 100, 1); supportRotation = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); @@ -86,7 +88,7 @@ public class VanChartPieSeriesPane extends VanChartAbstractPlotSeriesPane { PiePlot4VanChart piePlot4VanChart = (PiePlot4VanChart) plot; startAngle.setValue(piePlot4VanChart.getStartAngle()); endAngle.setValue(piePlot4VanChart.getEndAngle()); - innerRadius.setValue(piePlot4VanChart.getInnerRadiusPercent()); + innerRadius.populateBean(piePlot4VanChart.getInnerRadiusPercent()); supportRotation.setSelectedIndex(piePlot4VanChart.isSupportRotation() == true ?0:1); } } @@ -107,7 +109,7 @@ public class VanChartPieSeriesPane extends VanChartAbstractPlotSeriesPane { PiePlot4VanChart piePlot4VanChart = (PiePlot4VanChart)plot; piePlot4VanChart.setStartAngle(startAngle.getValue()); piePlot4VanChart.setEndAngle(endAngle.getValue()); - piePlot4VanChart.setInnerRadiusPercent(innerRadius.getValue()); + piePlot4VanChart.setInnerRadiusPercent(innerRadius.updateBean()); piePlot4VanChart.setSupportRotation(supportRotation.getSelectedItem()); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java index e5b55d7491..73c63bbeec 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java @@ -1,16 +1,20 @@ package com.fr.van.chart.pie.style; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; +import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; -import com.fr.plugin.chart.base.AttrTooltipRichText; +import com.fr.plugin.chart.base.format.AttrTooltipCategoryFormat; import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSummaryValueFormat; import com.fr.plugin.chart.pie.attr.PieCategoryLabelContent; import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SummaryValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SummaryValueFormatPaneWithoutCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -25,8 +29,6 @@ public class VanChartPieCategoryLabelContentPane extends VanChartLabelContentPan private SummaryValueFormatPaneWithCheckBox summaryValueFormatPane; - private SummaryValueFormatPaneWithoutCheckBox richTextSummaryValueFormatPane; - public VanChartPieCategoryLabelContentPane(VanChartStylePane parent, JPanel showOnPane, boolean inCondition) { super(parent, showOnPane, inCondition); } @@ -42,25 +44,39 @@ public class VanChartPieCategoryLabelContentPane extends VanChartLabelContentPan summaryValueFormatPane = new SummaryValueFormatPaneWithCheckBox(parent, showOnPane); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextCategoryNameFormatPane(new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane)); - richTextSummaryValueFormatPane = new SummaryValueFormatPaneWithoutCheckBox(parent, showOnPane); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartPieCategoryRichTextFieldListPane(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } + }; } - @Override - protected Component[][] getPaneComponents() { - return new Component[][]{ - new Component[]{getCategoryNameFormatPane(), null}, - new Component[]{summaryValueFormatPane, null}, + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Summary_Value") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipCategoryFormat(), + new AttrTooltipSummaryValueFormat() }; } @Override - protected Component[][] getRichTextComponents() { + protected Component[][] getPaneComponents() { return new Component[][]{ - new Component[]{getRichTextCategoryNameFormatPane(), null}, - new Component[]{richTextSummaryValueFormatPane, null}, + new Component[]{getCategoryNameFormatPane(), null}, + new Component[]{summaryValueFormatPane, null}, }; } @@ -81,23 +97,15 @@ public class VanChartPieCategoryLabelContentPane extends VanChartLabelContentPan summaryValueFormatPane.populate(pieCategoryLabelContent.getSummaryValueFormat()); } - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - PieCategoryLabelContent pieCategoryLabelContent = (PieCategoryLabelContent) attrTooltipContent; - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ - getRichTextCategoryNameFormatPane(), - richTextSummaryValueFormatPane - }; - - AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ - pieCategoryLabelContent.getRichTextCategoryFormat(), - pieCategoryLabelContent.getRichTextSummaryValueFormat() - }; + protected void updateTooltipFormat(AttrTooltipContent target, AttrTooltipContent source) { + super.updateTooltipFormat(target, source); - setRichTextAttr(new AttrTooltipRichText()); - populateRichTextFormat(formatPaneGroup, formatGroup); - populateRichText(pieCategoryLabelContent.getRichTextAttr()); + if (target instanceof PieCategoryLabelContent && source instanceof PieCategoryLabelContent) { + PieCategoryLabelContent targetPieCategory = (PieCategoryLabelContent) target; + PieCategoryLabelContent sourcePieCategory = (PieCategoryLabelContent) source; - checkRichEditorState(pieCategoryLabelContent); + targetPieCategory.setRichTextSummaryValueFormat(sourcePieCategory.getRichTextSummaryValueFormat()); + } } @Override @@ -107,12 +115,6 @@ public class VanChartPieCategoryLabelContentPane extends VanChartLabelContentPan summaryValueFormatPane.update(pieCategoryLabelContent.getSummaryValueFormat()); } - protected void updateRichEditor(AttrTooltipContent attrTooltipContent) { - PieCategoryLabelContent pieCategoryLabelContent = (PieCategoryLabelContent) attrTooltipContent; - super.updateRichEditor(pieCategoryLabelContent); - richTextSummaryValueFormatPane.update(pieCategoryLabelContent.getRichTextSummaryValueFormat()); - } - @Override public void setDirty(boolean isDirty) { getCategoryNameFormatPane().setDirty(isDirty); diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryRichTextFieldListPane.java new file mode 100644 index 0000000000..15361b490e --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryRichTextFieldListPane.java @@ -0,0 +1,70 @@ +package com.fr.van.chart.pie.style; + +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.AttrTooltipSummaryValueFormat; +import com.fr.plugin.chart.pie.attr.PieCategoryLabelContent; +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 VanChartPieCategoryRichTextFieldListPane extends VanChartFieldListPane { + + private VanChartFieldButton summaryValueButton; + + public VanChartPieCategoryRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void initDefaultFieldButton() { + super.initDefaultFieldButton(); + + VanChartFieldListener listener = getFieldListener(); + + summaryValueButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Use_Summary_Value"), + new AttrTooltipSummaryValueFormat(), false, listener); + } + + protected boolean supportAddField() { + return false; + } + + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(getCategoryNameButton()); + fieldPane.add(summaryValueButton); + } + + protected List getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(getCategoryNameButton()); + fieldButtonList.add(summaryValueButton); + + return fieldButtonList; + } + + public void populateDefaultField(AttrTooltipContent tooltipContent) { + super.populateDefaultField(tooltipContent); + + if (tooltipContent instanceof PieCategoryLabelContent) { + PieCategoryLabelContent pieCategory = (PieCategoryLabelContent) tooltipContent; + populateButtonFormat(summaryValueButton, pieCategory.getRichTextSummaryValueFormat()); + } + } + + public void updateDefaultField(AttrTooltipContent tooltipContent) { + super.updateDefaultField(tooltipContent); + + if (tooltipContent instanceof PieCategoryLabelContent) { + PieCategoryLabelContent pieCategory = (PieCategoryLabelContent) tooltipContent; + updateButtonFormat(summaryValueButton, pieCategory.getRichTextSummaryValueFormat()); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java index ddc6e66313..f8c094aa5c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java @@ -1,12 +1,20 @@ package com.fr.van.chart.pie.style; +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.AttrTooltipFormat; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -35,11 +43,34 @@ public class VanChartPieValueLabelContentPane extends VanChartLabelContentPane { setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); } - @Override - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane)); - setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane)); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartPieValueRichTextFieldListPane(fieldAttrPane, richEditor); + } + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); + } + }; + } + + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Use_Percent") + }; + } + + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat(), + new AttrTooltipPercentFormat() + }; } @Override @@ -56,15 +87,6 @@ public class VanChartPieValueLabelContentPane extends VanChartLabelContentPane { }; } - @Override - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null}, - new Component[]{getRichTextPercentFormatPane(), null} - }; - } - @Override public void setDirty(boolean isDirty) { getSeriesNameFormatPane().setDirty(isDirty); diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueRichTextFieldListPane.java new file mode 100644 index 0000000000..072b3a8012 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueRichTextFieldListPane.java @@ -0,0 +1,34 @@ +package com.fr.van.chart.pie.style; + +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 VanChartPieValueRichTextFieldListPane extends VanChartFieldListPane { + + public VanChartPieValueRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(getSeriesNameButton()); + fieldPane.add(getValueButton()); + fieldPane.add(getPercentButton()); + } + + protected List getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(getSeriesNameButton()); + fieldButtonList.add(getValueButton()); + fieldButtonList.add(getPercentButton()); + + return fieldButtonList; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java index e5416b1c21..dea0756505 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterRefreshTooltipContentPane.java @@ -1,13 +1,9 @@ package com.fr.van.chart.scatter; import com.fr.plugin.chart.base.AttrTooltipContent; -import com.fr.plugin.chart.base.format.AttrTooltipFormat; import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltipContent; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -19,7 +15,6 @@ import java.awt.Component; public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterTooltipContentPane { private ChangedValueFormatPaneWithCheckBox changedSizeFormatPane; - private ChangedValueFormatPaneWithoutCheckBox richTextChangedSizeFormatPane; public VanChartScatterRefreshTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) { super(null, showOnPane); @@ -33,14 +28,6 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo setChangedPercentFormatPane(changedPercentFormatPane); } - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - super.initRichTextFormatPane(parent, showOnPane); - - richTextChangedSizeFormatPane = new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane); - ChangedPercentFormatPaneWithoutCheckBox richTextChangedPercentFormatPane = new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane); - setRichTextChangedPercentFormatPane(richTextChangedPercentFormatPane); - } - protected boolean supportRichEditor() { return false; } @@ -60,12 +47,6 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo }; } - @Override - protected Component[][] getRichTextComponents() { - return null; - } - - @Override protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { super.populateFormatPane(attrTooltipContent); @@ -77,27 +58,6 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo } } - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - super.populateRichEditor(attrTooltipContent); - - if (attrTooltipContent instanceof ScatterAttrTooltipContent) { - ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent; - - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ - richTextChangedSizeFormatPane, - getRichTextChangedPercentFormatPane() - }; - - AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ - scatterAttrTooltipContent.getRichTextChangeSizeFormat(), - scatterAttrTooltipContent.getRichTextChangedSizePercentFormat() - }; - - populateRichTextFormat(formatPaneGroup, formatGroup); - populateRichText(attrTooltipContent.getRichTextAttr()); - } - } - @Override protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { super.updateFormatPane(attrTooltipContent); @@ -108,16 +68,6 @@ public class VanChartScatterRefreshTooltipContentPane extends VanChartScatterToo } } - protected void updateRichEditor(AttrTooltipContent attrTooltipContent) { - super.updateRichEditor(attrTooltipContent); - - if (attrTooltipContent instanceof ScatterAttrTooltipContent) { - ScatterAttrTooltipContent scatterAttrTooltipContent = (ScatterAttrTooltipContent) attrTooltipContent; - richTextChangedSizeFormatPane.update(scatterAttrTooltipContent.getRichTextChangeSizeFormat()); - getRichTextChangedPercentFormatPane().update(scatterAttrTooltipContent.getRichTextChangedSizePercentFormat()); - } - } - @Override public void setDirty(boolean isDirty) { super.setDirty(isDirty); diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/StructureNodeStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/StructureNodeStylePane.java index 610c616d9c..333646c3c4 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/StructureNodeStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/StructureNodeStylePane.java @@ -3,13 +3,15 @@ package com.fr.van.chart.structure.desinger.style; import com.fr.base.background.ImageBackground; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane; - import com.fr.plugin.chart.base.AttrNode; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.background.VanChartMarkerBackgroundPane; @@ -42,38 +44,46 @@ public class StructureNodeStylePane extends BasicBeanPane { double[] columnSize = {f, e}; double[] rowSize = {p, p, p, p, p}; - nodeRadiusType = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); - nodeRadius = new UISpinner(0,Double.MAX_VALUE,0.5,0); - nodeBorderWidth = new UISpinner(0,Double.MAX_VALUE,0.5,0); - nodeBorderColor = new VanChartMarkerBackgroundPane(); - nodeOpacity = new UINumberDragPane(0,100); + nodeRadiusType = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), + Toolkit.i18nText("Fine-Design_Chart_Custom")}); + nodeRadius = new UISpinnerWithPx(0, Double.MAX_VALUE, 0.5, 0); + nodeBorderWidth = new UISpinnerWithPx(0, Double.MAX_VALUE, 0.5, 0); + nodeBorderColor = new VanChartMarkerBackgroundPane() { + protected Component[][] getPaneComponents() { + return new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Node_Radius")), typeComboBox}, + new Component[]{null, centerPane}, + }; + } + }; + nodeOpacity = new UINumberDragPaneWithPercent(0, 100); JPanel jPanel = new JPanel(new BorderLayout()); - jPanel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Node_Radius"), nodeRadiusType), BorderLayout.NORTH); + jPanel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Node_Radius"), nodeRadiusType), BorderLayout.NORTH); nodeRadiusPane = TableLayout4VanChartHelper.createGapTableLayoutPane("", nodeRadius); jPanel.add(nodeRadiusPane, BorderLayout.CENTER); Component[][] components1 = new Component[][]{ new Component[]{null, null}, new Component[]{jPanel, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border_Width")), nodeBorderWidth}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Border_Color")), nodeBorderColor}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha")), nodeOpacity} + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Border_Width")), nodeBorderWidth}, + new Component[]{nodeBorderColor, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Alpha")), nodeOpacity} }; JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(components1, rowSize, columnSize); - useImage = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_YES"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_NO")}); + useImage = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_YES"), + Toolkit.i18nText("Fine-Design_Chart_NO")}); imagePane = new ImageBackgroundQuickPane(false); - imagePane.setBorder(BorderFactory.createEmptyBorder(0,(int)TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL,0,0)); + imagePane.setBorder(BorderFactory.createEmptyBorder(0, (int) TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL, 0, 0)); Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Filled_With_Image")),useImage}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Filled_With_Image")), useImage}, }; JPanel useImagePane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, columnSize); - JPanel panel2 = new JPanel(new BorderLayout(0,6)); + JPanel panel2 = new JPanel(new BorderLayout(0, 6)); panel2.add(useImagePane, BorderLayout.NORTH); panel2.add(imagePane, BorderLayout.CENTER); @@ -91,7 +101,7 @@ public class StructureNodeStylePane extends BasicBeanPane { } }); - this.setLayout(new BorderLayout(0,6)); + this.setLayout(new BorderLayout(0, 6)); this.add(panel1, BorderLayout.NORTH); this.add(panel2, BorderLayout.CENTER); } @@ -112,7 +122,7 @@ public class StructureNodeStylePane extends BasicBeanPane { nodeBorderColor.populate(ob.getBorderColor()); nodeOpacity.populateBean(ob.getOpacity()); useImage.setSelectedIndex(ob.isUseImage() ? 0 : 1); - if(ob.getImageBackground() != null) { + if (ob.getImageBackground() != null) { imagePane.populateBean(ob.getImageBackground()); } checkRadius(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRefreshTooltipContentPane.java index ea09ff3c83..cfbaefc02d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRefreshTooltipContentPane.java @@ -1,9 +1,7 @@ package com.fr.van.chart.structure.desinger.style; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -28,16 +26,6 @@ public class VanChartStructureRefreshTooltipContentPane extends VanChartStructur setChangedPercentFormatPane(changedPercentFormatPane); } - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - super.initRichTextFormatPane(parent, showOnPane); - - ChangedValueFormatPaneWithoutCheckBox richTextChangedValueFormatPane = new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane); - ChangedPercentFormatPaneWithoutCheckBox richTextChangedPercentFormatPane = new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane); - - setRichTextChangedValueFormatPane(richTextChangedValueFormatPane); - setRichTextChangedPercentFormatPane(richTextChangedPercentFormatPane); - } - protected boolean supportRichEditor() { return false; } @@ -55,14 +43,4 @@ public class VanChartStructureRefreshTooltipContentPane extends VanChartStructur new Component[]{getChangedPercentFormatPane(), null}, }; } - - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextCategoryNameFormatPane(), null}, - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null}, - new Component[]{getRichTextChangedValueFormatPane(), null}, - new Component[]{getRichTextChangedPercentFormatPane(), null} - }; - } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRichTextFieldListPane.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRichTextFieldListPane.java new file mode 100644 index 0000000000..49f81968cf --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureRichTextFieldListPane.java @@ -0,0 +1,61 @@ +package com.fr.van.chart.structure.desinger.style; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIPane; +import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; +import com.fr.plugin.chart.multilayer.style.AttrTooltipMultiLevelNameFormat; +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 VanChartStructureRichTextFieldListPane extends VanChartFieldListPane { + + public VanChartStructureRichTextFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditorPane) { + super(fieldAttrPane, richEditorPane); + } + + protected void initDefaultFieldButton() { + VanChartFieldListener fieldListener = getFieldListener(); + + VanChartFieldButton categoryNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_Node_Name"), + new AttrTooltipMultiLevelNameFormat(), false, fieldListener); + + VanChartFieldButton seriesNameButton = new VanChartFieldButton(Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"), + new AttrTooltipSeriesFormat(), 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_Use_Percent"), + new AttrTooltipPercentFormat(), false, fieldListener); + + setCategoryNameButton(categoryNameButton); + setSeriesNameButton(seriesNameButton); + setValueButton(valueButton); + setPercentButton(percentButton); + } + + protected void addDefaultFieldButton(JPanel fieldPane) { + fieldPane.add(getCategoryNameButton()); + fieldPane.add(getSeriesNameButton()); + fieldPane.add(getValueButton()); + } + + protected List getDefaultFieldButtonList() { + List fieldButtonList = new ArrayList<>(); + + fieldButtonList.add(getCategoryNameButton()); + fieldButtonList.add(getSeriesNameButton()); + fieldButtonList.add(getValueButton()); + + return fieldButtonList; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureSeriesPane.java index ee2cda46a6..daa0eaa6e3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureSeriesPane.java @@ -3,9 +3,12 @@ package com.fr.van.chart.structure.desinger.style; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; @@ -43,7 +46,7 @@ public class VanChartStructureSeriesPane extends VanChartAbstractPlotSeriesPane double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {f}; - double[] rowSize = {p,p,p}; + double[] rowSize = {p, p, p}; Component[][] components = new Component[][]{ new Component[]{createLinkPane()}, new Component[]{createNodePane()} @@ -57,10 +60,10 @@ public class VanChartStructureSeriesPane extends VanChartAbstractPlotSeriesPane private JPanel createLinkPane() { linkColor = new ColorSelectBox(100); - linkWidthType = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); - linkWidth = new UISpinner(0,Double.MAX_VALUE,0.5,0); - linkOpacity = new UINumberDragPane(0,100); + linkWidthType = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), + Toolkit.i18nText("Fine-Design_Chart_Custom")}); + linkWidth = new UISpinnerWithPx(0, Double.MAX_VALUE, 0.5, 0); + linkOpacity = new UINumberDragPaneWithPercent(0, 100); linkWidthType.addChangeListener(new ChangeListener() { @Override @@ -73,10 +76,10 @@ public class VanChartStructureSeriesPane extends VanChartAbstractPlotSeriesPane double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double[] columnSize = {f, e}; - double[] rowSize = {p,p,p,p}; + double[] rowSize = {p, p, p, p}; JPanel jPanel = new JPanel(new BorderLayout()); - jPanel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tree_Width")+" ", linkWidthType), BorderLayout.NORTH); + jPanel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Report_Tree_Width") + " ", linkWidthType), BorderLayout.NORTH); linkWidthPane = TableLayout4VanChartHelper.createGapTableLayoutPane(" ", linkWidth); jPanel.add(linkWidthPane, BorderLayout.CENTER); @@ -104,8 +107,8 @@ public class VanChartStructureSeriesPane extends VanChartAbstractPlotSeriesPane @Override public void populateBean(Plot plot) { super.populateBean(plot); - if(plot instanceof VanChartStructurePlot){ - VanChartStructurePlot structurePlot = (VanChartStructurePlot)plot; + if (plot instanceof VanChartStructurePlot) { + VanChartStructurePlot structurePlot = (VanChartStructurePlot) plot; linkColor.setSelectObject(structurePlot.getLinkColor()); linkWidthType.setSelectedIndex(structurePlot.isAutoLinkWidth() ? 0 : 1); linkWidth.setValue(structurePlot.getLinkWidth()); @@ -117,8 +120,8 @@ public class VanChartStructureSeriesPane extends VanChartAbstractPlotSeriesPane @Override public void updateBean(Plot plot) { super.updateBean(plot); - if(plot instanceof VanChartStructurePlot){ - VanChartStructurePlot structurePlot = (VanChartStructurePlot)plot; + if (plot instanceof VanChartStructurePlot) { + VanChartStructurePlot structurePlot = (VanChartStructurePlot) plot; structurePlot.setLinkColor(linkColor.getSelectObject()); structurePlot.setAutoLinkWidth(linkWidthType.getSelectedIndex() == 0); structurePlot.setLinkWidth(linkWidth.getValue()); @@ -126,16 +129,16 @@ public class VanChartStructureSeriesPane extends VanChartAbstractPlotSeriesPane } } - protected void populateCondition(ConditionAttr defaultAttr){ - if(nodeStylePane != null){ + protected void populateCondition(ConditionAttr defaultAttr) { + if (nodeStylePane != null) { AttrNode attrNode = defaultAttr.getExisted(AttrNode.class); nodeStylePane.populateBean(attrNode); } } - protected void updateCondition(ConditionAttr defaultAttr){ - if(nodeStylePane != null){ - AttrNode attrNode =defaultAttr.getExisted(AttrNode.class); + protected void updateCondition(ConditionAttr defaultAttr) { + if (nodeStylePane != null) { + AttrNode attrNode = defaultAttr.getExisted(AttrNode.class); if (attrNode != null) { defaultAttr.remove(attrNode); defaultAttr.addDataSeriesCondition(nodeStylePane.updateBean()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java index f5999391f0..a2cb16308f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/style/VanChartStructureTooltipContentPane.java @@ -2,20 +2,21 @@ package com.fr.van.chart.structure.desinger.style; 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.AttrTooltipRichText; import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; +import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.plugin.chart.multilayer.style.AttrTooltipMultiLevelNameFormat; import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; -import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.richText.VanChartFieldAttrPane; +import com.fr.van.chart.designer.component.richText.VanChartFieldListPane; +import com.fr.van.chart.designer.component.richText.VanChartRichEditorModel; +import com.fr.van.chart.designer.component.richText.VanChartRichTextPane; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -38,15 +39,6 @@ public class VanChartStructureTooltipContentPane extends VanChartTooltipContentP }; } - @Override - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextCategoryNameFormatPane(), null}, - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null} - }; - } - @Override protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { CategoryNameFormatPaneWithCheckBox categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane) { @@ -70,44 +62,34 @@ public class VanChartStructureTooltipContentPane extends VanChartTooltipContentP setPercentFormatPane(percentFormatPane); } - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - CategoryNameFormatPaneWithoutCheckBox richTextCategoryNameFormatPane = new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Node_Name"); + protected VanChartRichTextPane createRichTextPane(ModernUIPane richEditorPane) { + + return new VanChartRichTextPane(richEditorPane) { + + protected VanChartFieldListPane createFieldListPane(VanChartFieldAttrPane fieldAttrPane, ModernUIPane richEditor) { + return new VanChartStructureRichTextFieldListPane(fieldAttrPane, richEditor); } - }; - SeriesNameFormatPaneWithoutCheckBox richTextSeriesNameFormatPane = new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"); + + protected AttrTooltipContent getInitialTooltipContent() { + return createAttrTooltip(); } }; - ValueFormatPaneWithoutCheckBox richTextValueFormatPane = new ValueFormatPaneWithoutCheckBox(parent, showOnPane); - PercentFormatPaneWithoutCheckBox richTextPercentFormatPane = new PercentFormatPaneWithoutCheckBox(parent, showOnPane); - - setRichTextCategoryNameFormatPane(richTextCategoryNameFormatPane); - setRichTextSeriesNameFormatPane(richTextSeriesNameFormatPane); - setRichTextValueFormatPane(richTextValueFormatPane); - setRichTextPercentFormatPane(richTextPercentFormatPane); } - protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { - VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ - getRichTextCategoryNameFormatPane(), - getRichTextSeriesNameFormatPane(), - getRichTextValueFormatPane() + protected String[] getRichTextFieldNames() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Node_Name"), + Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value") }; + } - AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ - attrTooltipContent.getRichTextCategoryFormat(), - attrTooltipContent.getRichTextSeriesFormat(), - attrTooltipContent.getRichTextValueFormat() + protected AttrTooltipFormat[] getRichTextFieldFormats() { + return new AttrTooltipFormat[]{ + new AttrTooltipMultiLevelNameFormat(), + new AttrTooltipSeriesFormat(), + new AttrTooltipValueFormat() }; - - setRichTextAttr(new AttrTooltipRichText()); - populateRichTextFormat(formatPaneGroup, formatGroup); - populateRichText(attrTooltipContent.getRichTextAttr()); - - checkRichEditorState(attrTooltipContent); } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRefreshTooltipContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRefreshTooltipContentPane.java index cab4d85584..5d0ff9f921 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRefreshTooltipContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudRefreshTooltipContentPane.java @@ -3,9 +3,7 @@ package com.fr.van.chart.wordcloud.designer.style; import com.fr.design.i18n.Toolkit; import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedPercentFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; -import com.fr.van.chart.designer.component.format.ChangedValueFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -36,21 +34,6 @@ public class VanChartWordCloudRefreshTooltipContentPane extends VanChartWordClou setChangedPercentFormatPane(changedPercentFormatPane); } - protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { - super.initRichTextFormatPane(parent, showOnPane); - - ChangedValueFormatPaneWithoutCheckBox richTextChangedValueFormatPane = new ChangedValueFormatPaneWithoutCheckBox(parent, showOnPane) { - protected String getCheckBoxText() { - return Toolkit.i18nText("Fine-Design_Chart_Change_Word_Value"); - } - }; - - ChangedPercentFormatPaneWithoutCheckBox richTextChangedPercentFormatPane = new ChangedPercentFormatPaneWithoutCheckBox(parent, showOnPane); - - setRichTextChangedValueFormatPane(richTextChangedValueFormatPane); - setRichTextChangedPercentFormatPane(richTextChangedPercentFormatPane); - } - protected boolean supportRichEditor() { return false; } @@ -69,15 +52,4 @@ public class VanChartWordCloudRefreshTooltipContentPane extends VanChartWordClou new Component[]{getChangedPercentFormatPane(), null}, }; } - - protected Component[][] getRichTextComponents() { - return new Component[][]{ - new Component[]{getRichTextCategoryNameFormatPane(), null}, - new Component[]{getRichTextSeriesNameFormatPane(), null}, - new Component[]{getRichTextValueFormatPane(), null}, - new Component[]{getRichTextChangedValueFormatPane(), null}, - new Component[]{getRichTextPercentFormatPane(), null}, - new Component[]{getRichTextChangedPercentFormatPane(), null} - }; - } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java index 4e9c612c09..543b8139f6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java @@ -4,10 +4,12 @@ import com.fr.base.Utils; import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageFileBackground; import com.fr.chart.chartattr.Plot; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.chart.UISpinnerWithPx; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane; @@ -61,7 +63,7 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {f}; - double[] rowSize = {p,p,p}; + double[] rowSize = {p, p, p}; Component[][] components = new Component[][]{ new Component[]{createWordCloudStylePane()}, }; @@ -71,42 +73,43 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane { return contentPane; } - private JPanel createWordCloudStylePane(){ + private JPanel createWordCloudStylePane() { double labelSize = LABEL_SIZE; double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] centerC = {labelSize,f,p,f}; + double[] centerC = {labelSize, f, p, f}; double[] centerR = {p}; - minRotation = new UISpinner(-MAX_ROTATION,MAX_ROTATION,1,0); + minRotation = new UISpinner(-MAX_ROTATION, MAX_ROTATION, 1, 0); maxRotation = new - UISpinner(-MAX_ROTATION,MAX_ROTATION,1,0); + UISpinner(-MAX_ROTATION, MAX_ROTATION, 1, 0); Component[][] centerComps = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Rotation_Angle")), minRotation, new UILabel("-"), maxRotation}, }; - JPanel centerPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(centerComps,centerR,centerC); + JPanel centerPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(centerComps, centerR, centerC); double[] northC = {f, e}; - double[] northR = {p,p}; + double[] northR = {p, p}; fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); defineFontSize = new UIButtonGroup(new String[]{AUTO_FONT_SIZE, CUSTOM_FONT_SIZE}); Component[][] northComps = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font")), fontNameComboBox}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")), defineFontSize } + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")), defineFontSize} }; - JPanel northPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(northComps,northR,northC); + JPanel northPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(northComps, northR, northC); - minFontSize = new UISpinner(0,Double.MAX_VALUE,1,10); - maxFontSize = new UISpinner(0,Double.MAX_VALUE,1,100); + minFontSize = new UISpinnerWithPx(10); + maxFontSize = new UISpinnerWithPx(100); Component[][] fontComps = new Component[][]{ new Component[]{null, minFontSize, new UILabel("-"), maxFontSize}, }; - fontPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(fontComps,centerR,centerC); + fontPanel = TableLayoutHelper.createGapTableLayoutPane(fontComps, centerR, centerC, + 6, LayoutConstants.VGAP_LARGE); double[] columnSize = {f}; double[] rowSize = {p, p, p, p}; @@ -132,27 +135,27 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane { private JPanel createCloudShapePane() { cloudShape = new UIComboBox(CloudShapeType.getTypes()); - imageBackgroundQuickPane = new ImageBackgroundQuickPane(false){ + imageBackgroundQuickPane = new ImageBackgroundQuickPane(false) { @Override public Dimension getPreferredSize() { - if(cloudShape.getSelectedItem() == CloudShapeType.DEFAULT){ - return new Dimension(0,0); + if (cloudShape.getSelectedItem() == CloudShapeType.DEFAULT) { + return new Dimension(0, 0); } else { return super.getPreferredSize(); } } }; - JPanel panel = new JPanel(new BorderLayout(0,4)); + JPanel panel = new JPanel(new BorderLayout(0, 4)); panel.add(cloudShape, BorderLayout.NORTH); panel.add(imageBackgroundQuickPane, BorderLayout.CENTER); cloudShape.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { - CloudShapeType type = (CloudShapeType)cloudShape.getSelectedItem(); + CloudShapeType type = (CloudShapeType) cloudShape.getSelectedItem(); String path = type.getImageUrl(); - if(path != null) { + if (path != null) { ImageFileBackground imageBackground = new ImageFileBackground(IOUtils.readImage(path)); imageBackgroundQuickPane.populateBean(imageBackground); } else { @@ -181,8 +184,8 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane { @Override public void populateBean(Plot plot) { super.populateBean(plot); - if(plot instanceof VanChartWordCloudPlot){ - VanChartWordCloudPlot wordCloudPlot = (VanChartWordCloudPlot)plot; + if (plot instanceof VanChartWordCloudPlot) { + VanChartWordCloudPlot wordCloudPlot = (VanChartWordCloudPlot) plot; fontNameComboBox.setSelectedItem(wordCloudPlot.getFont().getFamily()); minRotation.setValue(wordCloudPlot.getMinRotation()); maxRotation.setValue(wordCloudPlot.getMaxRotation()); @@ -193,7 +196,7 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane { cloudShape.setSelectedItem(wordCloudPlot.getShapeType()); ImageBackground imageBackground = wordCloudPlot.getShapeImage(); - if(imageBackground != null) { + if (imageBackground != null) { imageBackgroundQuickPane.populateBean(imageBackground); } } @@ -209,8 +212,8 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane { @Override public void updateBean(Plot plot) { super.updateBean(plot); - if(plot instanceof VanChartWordCloudPlot){ - VanChartWordCloudPlot wordCloudPlot = (VanChartWordCloudPlot)plot; + if (plot instanceof VanChartWordCloudPlot) { + VanChartWordCloudPlot wordCloudPlot = (VanChartWordCloudPlot) plot; wordCloudPlot.setFont(FRFont.getInstance(fontNameComboBox.getSelectedItem().toString(), Font.PLAIN, 9)); wordCloudPlot.setMinRotation(minRotation.getValue()); wordCloudPlot.setMaxRotation(maxRotation.getValue()); @@ -220,7 +223,7 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane { wordCloudPlot.setMaxFontSize(maxFontSize.getValue()); wordCloudPlot.setShapeType((CloudShapeType) cloudShape.getSelectedItem()); - if(wordCloudPlot.getShapeType() != CloudShapeType.DEFAULT) { + if (wordCloudPlot.getShapeType() != CloudShapeType.DEFAULT) { wordCloudPlot.setShapeImage((ImageBackground) imageBackgroundQuickPane.updateBean()); } else { wordCloudPlot.setShapeImage(null); diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java index 0a44164104..f10b877e27 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java @@ -55,7 +55,6 @@ public interface LayoutAdapter { */ boolean addBean(XCreator creator, int x, int y, boolean accept); - /** * 返回该布局管理适配器的Painter,为容器提供放置位置的标识。 */ diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index b39dc91889..d39de1d447 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -97,6 +97,7 @@ import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import javax.swing.tree.TreePath; public class JForm extends JTemplate implements BaseJForm
{ private static final String FORM_CARD = "FORM"; @@ -623,6 +624,15 @@ public class JForm extends JTemplate implements BaseJForm() { + @Override + public void on(Event event, Null aNull) { + EnvChangeEntrance.getInstance().pluginErrorRemind(); + } + }); } @Override public void stop() { // void + editLockCheckerStop(); + } + + private void editLockCheckerStop() { + ConnectionLockChangeChecker.getInstance().stop(); + ServerTableDataLockChangeChecker.getInstance().stop(); } @Override diff --git a/designer-realize/src/test/java/com/fr/start/module/DesignerWorkspaceProviderTest.java b/designer-realize/src/test/java/com/fr/start/module/DesignerWorkspaceProviderTest.java new file mode 100644 index 0000000000..d058ee8de9 --- /dev/null +++ b/designer-realize/src/test/java/com/fr/start/module/DesignerWorkspaceProviderTest.java @@ -0,0 +1,50 @@ +package com.fr.start.module; + +import com.fr.design.constants.DesignerLaunchStatus; +import com.fr.event.EventDispatcher; +import com.fr.invoke.Reflect; +import com.fr.workspace.WorkContext; +import com.fr.workspace.Workspace; +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; + +/** + * @author Lucian.Chen + * @version 10.0 + * Created by Lucian.Chen on 2021/1/7 + */ +@RunWith(PowerMockRunner.class) +@PrepareForTest({WorkContext.class}) +public class DesignerWorkspaceProviderTest { + + @Test + public void testPluginErrorRemind() { + + try { + Workspace workspace = EasyMock.mock(Workspace.class); + EasyMock.expect(workspace.isLocal()).andReturn(false).once(); + PowerMock.mockStatic(WorkContext.class); + EasyMock.expect(WorkContext.getCurrent()).andReturn(workspace).anyTimes(); + + EasyMock.replay(workspace); + PowerMock.replayAll(); + + DesignerWorkspaceProvider provider = new DesignerWorkspaceProvider(); + Reflect.on(provider).call("pluginErrorRemind"); + EventDispatcher.fire(DesignerLaunchStatus.STARTUP_COMPLETE); + + EasyMock.verify(workspace); + PowerMock.verifyAll(); + + } catch (Exception e) { + Assert.fail(e.getMessage()); + } + + + } +}