diff --git a/designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java b/designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java index bd2e50d570..656a7a6a78 100644 --- a/designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java +++ b/designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java @@ -7,7 +7,14 @@ package com.fr.design; import com.fr.base.BaseUtils; import com.fr.common.annotations.Open; import com.fr.design.data.datapane.TableDataNameObjectCreator; -import com.fr.design.fun.*; +import com.fr.design.fun.CellWidgetOptionProvider; +import com.fr.design.fun.FormWidgetOptionProvider; +import com.fr.design.fun.MobileWidgetStyleProvider; +import com.fr.design.fun.ParameterWidgetOptionProvider; +import com.fr.design.fun.PreviewProvider; +import com.fr.design.fun.ServerTableDataDefineProvider; +import com.fr.design.fun.TableDataDefineProvider; +import com.fr.design.fun.ToolbarItemProvider; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOptionFactory; import com.fr.design.menu.ShortCut; @@ -24,6 +31,7 @@ import com.fr.stable.Filter; import com.fr.stable.plugin.ExtraDesignClassManagerProvider; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -127,21 +135,25 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement } public WidgetOption[] getWebWidgetOptions(Set set, Filter filter) { - if (set == null || set.isEmpty()) { - return new WidgetOption[0]; - } - List list = new ArrayList<>(); - for (ToolbarItemProvider provider : set) { - if (filter != null && filter.accept(provider)) { - WidgetOption option = WidgetOptionFactory.createByWidgetClass( + return new DesignExtraBridge() { + + @Override + WidgetOption createT(ToolbarItemProvider provider) { + return WidgetOptionFactory.createByWidgetClass( provider.nameForWidget(), IOUtils.readIcon(provider.iconPathForWidget()), provider.classForWidget() ); - list.add(option); } - } - return list.toArray(new WidgetOption[list.size()]); + + @Override + WidgetOption[] toArray(Collection sCollection) { + if (sCollection == null) { + return new WidgetOption[0]; + } + return sCollection.toArray(new WidgetOption[sCollection.size()]); + } + }.filterSAndTransformT(set, filter); } @@ -224,8 +236,8 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement return new MobileWidgetStyleProvider[0]; } List providers = new ArrayList<>(); - for (MobileWidgetStyleProvider provider: set) { - if(ComparatorUtils.equalsIgnoreCase(provider.xTypeForWidget(), xType)) { + for (MobileWidgetStyleProvider provider : set) { + if (ComparatorUtils.equalsIgnoreCase(provider.xTypeForWidget(), xType)) { providers.add(provider); } } @@ -256,4 +268,55 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement return Collections.unmodifiableSet(shortCuts); } + + public PreviewProvider[] getTemplatePreviews(Filter filter) { + Set set = ExtraDesignClassManager.getInstance().getArray(PreviewProvider.MARK_STRING); + return new DesignExtraBridge() { + + @Override + PreviewProvider createT(PreviewProvider previewProvider) { + return previewProvider; + } + + @Override + PreviewProvider[] toArray(Collection sCollection) { + if (sCollection == null) { + return new PreviewProvider[0]; + } + return sCollection.toArray(new PreviewProvider[sCollection.size()]); + } + }.filterSAndTransformT(set, filter); + } + + /** + * 抽了一个可能用到的公用逻辑出来:通过filter过滤接口实现(Set)并将对外接口实例转成内部实例S转成T,比如ToolItemProvider转成WidgetOption,当然也可以不转 + * + * @param 你想要得到的类型,可以跟S相同 + * @param 待转换的目标类型 + */ + abstract class DesignExtraBridge { + T[] filterSAndTransformT(Set set, Filter filter) { + if (set == null || set.isEmpty()) { + return toArray(set); + } + List list = new ArrayList<>(); + for (S provider : set) { + if (filter == null || filter.accept(provider)) { + list.add(createT(provider)); + } + } + + return toArray(list); + } + + /** + * S转T + * @param s + * @return + */ + abstract T createT(S s); + + abstract T[] toArray(Collection sCollection); + + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java b/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java index 6e627434d8..ff62c6fb81 100644 --- a/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java @@ -64,6 +64,7 @@ public class TableDataSourceAction extends TemplateComponentAction globalDsCache = new java.util.HashMap(); private static java.util.Map dsNameChangedMap = new HashMap(); -// private static List dsListeners = new ArrayList(); + private static List globalDsListeners = new ArrayList<>(); private static Map> dsListenersMap = new HashMap>(); @@ -95,15 +95,19 @@ public abstract class DesignTableDataManager { * 响应数据集改变. */ private static void fireDsChanged() { + fireDsChanged(globalDsListeners); for (Entry> listenerEntry : dsListenersMap.entrySet()) { List dsListeners = listenerEntry.getValue(); - for (int i = 0; i < dsListeners.size(); i++) { - //增强for循环用的iterator实现的, 如果中间哪个listener修改或删除了(如ChartEditPane.dsChangeListener), - // 由于dsListeners是arraylist, 此时会ConcurrentModifyException -// for (ChangeListener l : dsListeners) { - ChangeEvent e = null; - dsListeners.get(i).stateChanged(e); - } + fireDsChanged(dsListeners); + } + } + + private static void fireDsChanged(List dsListeners) { + for (int i = 0; i < dsListeners.size(); i++) { + //增强for循环用的iterator实现的, 如果中间哪个listener修改或删除了(如ChartEditPane.dsChangeListener), + // 由于dsListeners是arraylist, 此时会ConcurrentModifyException + ChangeEvent e = null; + dsListeners.get(i).stateChanged(e); } } @@ -160,13 +164,17 @@ public abstract class DesignTableDataManager { } } + public static void addGlobalDsChangeListener(ChangeListener l) { + globalDsListeners.add(l); + } + /** * 添加模板数据集改变 监听事件. * * @param l ChangeListener监听器 */ public static void addDsChangeListener(ChangeListener l) { - JTemplate template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); String key = StringUtils.EMPTY; if (template != null) { key = template.getPath(); @@ -178,7 +186,6 @@ public abstract class DesignTableDataManager { } dsListeners.add(l); } - /** * 获取数据源source中dsName的所有字段 * diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java index dddb269bc8..ebbdbf0f35 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java @@ -34,6 +34,7 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC private static final long serialVersionUID = 1L; private boolean refresModel = false; private String treeName; //树数据集本身的名字 + private ChangeListener changeListener; public TableDataComboBox(TableDataSource source){ this(source,StringUtils.EMPTY); @@ -136,15 +137,22 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC } } - /** - *注册listener,相应数据集改变 - */ - public void registerDSChangeListener() { - DesignTableDataManager.addDsChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - TableDataComboBox.this.refresh(DesignTableDataManager.getEditingTableDataSource()); - } - }); - } + /** + *注册listener,相应数据集改变 + */ + @Override + public void registerDSChangeListener() { + changeListener = new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + TableDataComboBox.this.refresh(DesignTableDataManager.getEditingTableDataSource()); + } + }; + DesignTableDataManager.addDsChangeListener(changeListener); + } + + public void registerGlobalDSChangeListener() { + DesignTableDataManager.addGlobalDsChangeListener(changeListener); + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptor.java b/designer-base/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptor.java index e4729f0709..2a42fabd28 100644 --- a/designer-base/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptor.java +++ b/designer-base/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptor.java @@ -5,6 +5,7 @@ package com.fr.design.designer.creator; import com.fr.stable.StringUtils; import com.fr.stable.core.PropertyChangeAdapter; +import com.fr.stable.core.PropertyChangeListener; import java.beans.IntrospectionException; import java.beans.PropertyDescriptor; @@ -17,7 +18,7 @@ public final class CRPropertyDescriptor extends PropertyDescriptor { public static final String RENDERER = "renderer"; private boolean isSubProperty = false; - private PropertyChangeAdapter l; + private PropertyChangeListener l; public CRPropertyDescriptor(String name, Class beanClass) throws IntrospectionException { super(name, beanClass); @@ -35,6 +36,12 @@ public final class CRPropertyDescriptor extends PropertyDescriptor { return this; } + public CRPropertyDescriptor setPropertyChangeListener(PropertyChangeListener l) { + this.l = l; + return this; + } + + @Deprecated public CRPropertyDescriptor setPropertyChangeListener(PropertyChangeAdapter l) { this.l = l; return this; diff --git a/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java b/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java index 36d8e7f7a5..c0319f9357 100644 --- a/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java +++ b/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java @@ -1,5 +1,6 @@ package com.fr.design.env; +import com.fr.cluster.engine.base.FineClusterConfig; import com.fr.design.i18n.Toolkit; import com.fr.stable.AssistUtils; import com.fr.workspace.WorkContext; @@ -66,7 +67,12 @@ public class RemoteWorkspace implements Workspace { } return isRoot; } - + + @Override + public boolean isCluster() { + return FineClusterConfig.getInstance().isCluster(); + } + @Override public WorkspaceConnection getConnection() { diff --git a/designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java b/designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java index 2a1c0cc94e..a1082b62f9 100644 --- a/designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java +++ b/designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java @@ -13,6 +13,7 @@ import com.fr.workspace.WorkContext; import com.fr.workspace.server.authority.AuthorityOperator; import com.fr.workspace.server.authority.decision.DecisionOperator; +import java.lang.reflect.UndeclaredThrowableException; import java.util.ArrayList; public class NodeAuthProcessor { @@ -41,9 +42,15 @@ public class NodeAuthProcessor { if (!WorkContext.getCurrent().isLocal()) { try { String userName = WorkContext.getCurrent().getConnection().getUserName(); - String userId = WorkContext.getCurrent().get(DecisionOperator.class).getUserIdByName(userName); + DesignAuthority[] authorities = null; + try { + String userId = WorkContext.getCurrent().get(DecisionOperator.class).getUserIdByName(userName); + authorities = WorkContext.getCurrent().get(AuthorityOperator.class).getAuthorities(userId); + } catch(UndeclaredThrowableException e) { + // 兼容旧版本的服务器 + authorities = WorkContext.getCurrent().get(AuthorityOperator.class).getAuthorities(); + } // 远程设计获取设计成员的权限列表 - DesignAuthority[] authorities = WorkContext.getCurrent().get(AuthorityOperator.class).getAuthorities(userId); DesignAuthority authority = null; if (authorities != null) { diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index ed63b06cef..1708c07533 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -44,6 +44,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Enumeration; +import java.util.Objects; import static javax.swing.JOptionPane.WARNING_MESSAGE; import static javax.swing.JOptionPane.YES_NO_OPTION; @@ -299,7 +300,18 @@ public class TemplateTreePane extends JPanel implements FileOperations { } } } - reportletsTree.refresh(); + refreshAfterDelete(); + } + + private void refreshAfterDelete() { + TreePath[] paths = reportletsTree.getSelectionPaths(); + if (paths == null) { + reportletsTree.refresh(); + } else { + for (TreePath path : Objects.requireNonNull(reportletsTree.getSelectionPaths())) { + reportletsTree.refreshParent(path); + } + } } private boolean deleteNodes(Collection nodes) { diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaConstants.java b/designer-base/src/main/java/com/fr/design/formula/FormulaConstants.java new file mode 100644 index 0000000000..4dfcb4bb47 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaConstants.java @@ -0,0 +1,57 @@ +package com.fr.design.formula; + +import com.fr.stable.StringUtils; + +/** + * @author Joe + * @version 10.0 + * Created by Joe on 10/30/2019 + */ +public enum FormulaConstants { + + PAGE_NUMBER("$$page_number", "Page_Number"), + TOTAL_PAGE_NUMBER("$$totalPage_number", "Total_Page_Number"), + FINE_USERNAME("$fine_username", "Fine_Username"), + FINE_ROLE("$fine_role", "Fine_Role"), + FINE_POSITION("$fine_position", "Fine_Position"), + NULL("NULL", "Null"), + NOFILTER("NOFILTER", "No_Filter"), + REPORT_NAME("reportName", "Report_Name"), + FORMLET_NAME("formletName", "Formlet_Name"), + SERVLET_URL("servletURL", "Servlet_URL"), + SERVER_SCHEMA("serverSchema", "Server_Schema"), + SERVER_NAME("serverName", "Server_Name"), + SERVER_PORT("serverPort", "Server_Port"), + SERVER_URL("serverURL", "Server_URL"), + CONTEXT_PATH("contextPath", "Context_Path"), + SESSION_ID("sessionID", "SessionID"); + + private String key; + private String value; + private static final String KEY_PREFIX = "Fine-Design_CurReport_Variable_"; + + private FormulaConstants(String key, String value) { + this.key = key; + this.value = KEY_PREFIX + value; + } + + public String getKey() { + return key; + } + + public String getValue() { + return value; + } + + public static String getValueByKey(String key) { + for (FormulaConstants formulaConstant : values()) { + if (formulaConstant.getKey().equals(key)) { + return formulaConstant.getValue(); + } + } + return StringUtils.EMPTY; + } + + + +} diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index 2cf6efa910..a8c8c34779 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -19,6 +19,7 @@ import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.parser.FRLexer; import com.fr.parser.FRParser; @@ -779,31 +780,31 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private void initVariablesTreeSelectionListener() { variablesTree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { - Object selectedValue = ((DefaultMutableTreeNode) variablesTree.getLastSelectedPathComponent()).getUserObject(); + DefaultMutableTreeNode selectedTreeNode = (DefaultMutableTreeNode) variablesTree.getLastSelectedPathComponent(); + Object selectedValue = selectedTreeNode.getUserObject(); + Object selectedParentValue = ((DefaultMutableTreeNode)selectedTreeNode.getParent()).getUserObject(); + if (selectedValue == null) { return; } - StringBuilder desBuf = new StringBuilder(); - try { - String path; - Locale locale = FRContext.getLocale(); - if (locale.equals(Locale.CHINA)) { - path = "/com/fr/design/insert/formula/variable/cn/"; + + if (selectedValue instanceof TextUserObject) { + //有公式说明的条件:1.属于TextUserObject 2.parent是系统参数 + if (ComparatorUtils.equals(((TextFolderUserObject) selectedParentValue).getText(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Variables"))) { + descriptionTextArea.setText(com.fr.design.i18n.Toolkit.i18nText(FormulaConstants.getValueByKey(((TextUserObject) selectedValue).getText()))); } else { - path = "/com/fr/design/insert/formula/variable/en/"; + descriptionTextArea.setText(StringUtils.EMPTY); } - if (selectedValue instanceof TextUserObject) { - desBuf = getText((TextUserObject) selectedValue, path); - } - } catch (IOException exp) { - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + } else if (selectedValue instanceof TextFolderUserObject) { + descriptionTextArea.setText(StringUtils.EMPTY); } - descriptionTextArea.setText(desBuf.toString()); descriptionTextArea.moveCaretPosition(0); } }); } + private void initVariablesTree() { // vairable. variablesTree = new JTree(); diff --git a/designer-base/src/main/java/com/fr/design/fun/PreviewProvider.java b/designer-base/src/main/java/com/fr/design/fun/PreviewProvider.java index f6e8cb2192..c07a4efe03 100644 --- a/designer-base/src/main/java/com/fr/design/fun/PreviewProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/PreviewProvider.java @@ -1,6 +1,7 @@ package com.fr.design.fun; import com.fr.design.mainframe.JTemplate; +import com.fr.stable.Filter; import com.fr.stable.fun.mark.Mutable; import java.util.Map; @@ -11,7 +12,7 @@ import java.util.Map; * @since 8.0 * 自定义预览方式接口 */ -public interface PreviewProvider extends Mutable { +public interface PreviewProvider extends Mutable, Filter { String MARK_STRING = "PreviewProvider"; diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractPreviewProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractPreviewProvider.java index f0b7809039..3cdac80350 100644 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractPreviewProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractPreviewProvider.java @@ -1,7 +1,9 @@ package com.fr.design.fun.impl; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fun.PreviewProvider; import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.JVirtualTemplate; import com.fr.general.ComparatorUtils; import com.fr.general.web.ParameterConstants; import com.fr.stable.fun.impl.AbstractProvider; @@ -52,4 +54,12 @@ public abstract class AbstractPreviewProvider extends AbstractProvider implement public String getActionType() { return ParameterConstants.VIEWLET; } + + @Override + public boolean accept(JTemplate jTemplate) { + if (jTemplate == null) { + jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + } + return jTemplate == null || jTemplate.isJWorkBook() || jTemplate instanceof JVirtualTemplate; + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java index 27934efb79..6ab6bce56f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java @@ -9,19 +9,10 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.ShortCut; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; - import com.fr.stable.os.OperatingSystem; -import javax.swing.BorderFactory; -import javax.swing.JComponent; -import javax.swing.JDialog; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JSplitPane; -import javax.swing.border.EmptyBorder; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Cursor; @@ -35,6 +26,14 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.Window; +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JSplitPane; +import javax.swing.border.EmptyBorder; + import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; @@ -73,7 +72,6 @@ abstract class UIControlPane extends JControlPane { this.creators = this.createNameableCreators(); initCardPane(); - if (isNewStyle()) { getPopupEditDialog(cardPane); this.add(getLeftPane(), BorderLayout.CENTER); @@ -149,9 +147,7 @@ abstract class UIControlPane extends JControlPane { topToolBar.setLayout(new BorderLayout()); ShortCut addItem = shortCutFactory.addItemShortCut().getShortCut(); addItem.intoJToolBar(topToolBar); - JPanel leftTopPane = getLeftTopPane(topToolBar); - leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0)); leftPane.add(leftTopPane, BorderLayout.NORTH); @@ -172,7 +168,6 @@ abstract class UIControlPane extends JControlPane { JPanel leftTopPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); leftTopPane.add(toolBarPane, BorderLayout.EAST); leftTopPane.add(addItemLabel, BorderLayout.CENTER); - return leftTopPane; } @@ -203,7 +198,6 @@ abstract class UIControlPane extends JControlPane { topToolBar.validate(); this.controlUpdatePane = createControlUpdatePane();//REPORT-4841 刷新一下编辑面板 cardPane.add(controlUpdatePane, "EDIT"); - this.repaint(); } @@ -249,7 +243,6 @@ abstract class UIControlPane extends JControlPane { return; } } - // 要隐藏 先检查有没有非法输入 // 非法输入检查放在最后,因为可能出现面板弹出新弹框而失去焦点的情况,比如 输入公式时,弹出公式编辑对话框 try { @@ -269,7 +262,8 @@ abstract class UIControlPane extends JControlPane { addWindowFocusListener(new WindowAdapter() { @Override public void windowLostFocus(WindowEvent e) { - if (OperatingSystem.isLinux()) { + //在Linux上拉回焦点,不然导致一些面板关不掉 + if(OperatingSystem.isLinux()) { requestFocus(); } hideDialog(); diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java index 1366b46b3c..6af1194265 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java @@ -65,7 +65,7 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane { } - protected void initListener(Container parentComponent) { + public void initListener(Container parentComponent) { for (int i = 0; i < parentComponent.getComponentCount(); i++) { Component tmpComp = parentComponent.getComponent(i); diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/ModeButtonGroup.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/ModeButtonGroup.java new file mode 100644 index 0000000000..c13498705a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/ModeButtonGroup.java @@ -0,0 +1,36 @@ +package com.fr.design.gui.ibutton; + + +import javax.swing.*; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * 互斥的按钮 + * @author hades + * @version 10.0 + * Created by hades on 2019/11/12 + */ +public class ModeButtonGroup extends ButtonGroup { + + private Map buttonMap = new LinkedHashMap<>(); + + public void put(T t, AbstractButton button) { + add(button); + buttonMap.put(t, button); + } + + public void setSelectButton(T t) { + buttonMap.get(t).setSelected(true); + } + + public T getCurrentSelected() { + for (Map.Entry entry : buttonMap.entrySet()) { + if (entry.getValue().isSelected()) { + return entry.getKey(); + } + } + return buttonMap.entrySet().iterator().next().getKey(); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java index e570ee515d..e2a5719d4b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java @@ -15,6 +15,8 @@ import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -23,6 +25,8 @@ import java.awt.FlowLayout; import java.awt.FontMetrics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; @@ -132,7 +136,39 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam } private UITextField createEditor() { - UITextField editor = new UITextField(); + UITextField editor = new UITextField() { + @Override + protected void initListener() { + this.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + attributeChange(); + } + }); + this.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + attributeChange(); + } + }); + UIComboCheckBox.this.popup.addPopupMenuListener(new PopupMenuListener() { + @Override + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + // do nothing + } + + @Override + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + attributeChange(); + } + + @Override + public void popupMenuCanceled(PopupMenuEvent e) { + // do nothing + } + }); + } + }; editor.setEditable(false); editor.setPreferredSize(new Dimension(110, 20)); addPopupListener(editor); diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/UIBasicSpinner.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/UIBasicSpinner.java index 4b71a2c752..9c9f48fae2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ispinner/UIBasicSpinner.java +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/UIBasicSpinner.java @@ -7,6 +7,9 @@ import javax.swing.*; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import java.awt.*; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.text.ParseException; /** * Created by IntelliJ IDEA. @@ -56,7 +59,17 @@ public class UIBasicSpinner extends JSpinner implements UIObserver { } }); } + final JFormattedTextField textField = ((JSpinner.DefaultEditor) this.getEditor()).getTextField(); + textField.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + try { + textField.commitEdit(); + } catch (ParseException ignore) { + } + } + }); } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java index b2008f3867..a22f2a302a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java @@ -145,6 +145,11 @@ public abstract class RefreshableJTree extends CheckBoxTree { refresh((ExpandMutableTreeNode) this.getModel().getRoot(), StringUtils.EMPTY); } + //REPORT-24085,只刷新父节点 + public void refreshParent(TreePath path) { + refresh((ExpandMutableTreeNode) path.getParentPath().getLastPathComponent(), StringUtils.EMPTY); + } + public void refreshChildByName(String childName) { refresh((ExpandMutableTreeNode) this.getModel().getRoot(), childName); } diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/UserInfoMark.java b/designer-base/src/main/java/com/fr/design/locale/impl/UserInfoMark.java index 3739c49f6a..c72f6a4ff0 100644 --- a/designer-base/src/main/java/com/fr/design/locale/impl/UserInfoMark.java +++ b/designer-base/src/main/java/com/fr/design/locale/impl/UserInfoMark.java @@ -19,10 +19,11 @@ public class UserInfoMark implements LocaleMark { private static final String EN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.en"); private static final String TW_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.tw"); private static final String JP_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.jp"); + private static final String KR_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.kr"); public UserInfoMark() { map.put(Locale.CHINA, CN_LOGIN_HTML); - map.put(Locale.KOREA, EN_LOGIN_HTML); + map.put(Locale.KOREA, KR_LOGIN_HTML); map.put(Locale.JAPAN, JP_LOGIN_HTML); map.put(Locale.US, EN_LOGIN_HTML); map.put(Locale.TAIWAN, TW_LOGIN_HTML); diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java b/designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java index 2071faba3f..8e086a569c 100644 --- a/designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java +++ b/designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java @@ -15,9 +15,9 @@ import java.util.Map; public class VideoMark implements LocaleMark { private Map map = new HashMap<>(); - private static final String VIDEO_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en"); - private static final String VIDEO_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.video"); - private static final String VIDEO_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.video.tw"); + private static final String VIDEO_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en_US"); + private static final String VIDEO_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.zh_CN"); + private static final String VIDEO_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.video.zh_TW"); public VideoMark() { map.put(Locale.CHINA, VIDEO_CN); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 2071215985..f24375da1f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -3,8 +3,6 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.extension.FileExtension; import com.fr.base.vcs.DesignerMode; -import com.fr.cluster.ClusterBridge; -import com.fr.cluster.engine.base.FineClusterConfig; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; @@ -369,7 +367,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt private void fireVcsActionChange() { if (!DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable() || VcsHelper.getInstance().isUnSelectedTemplate() - || FineClusterConfig.getInstance().isCluster()) { + || WorkContext.getCurrent().isCluster()) { setEnabled(false); return; } 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 31944deb03..4ac0200696 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 @@ -4,7 +4,6 @@ import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.Parameter; import com.fr.base.ScreenResolution; -import com.fr.base.extension.FileExtension; import com.fr.base.io.BaseBook; import com.fr.base.iofile.attr.DesignBanCopyAttrMark; import com.fr.base.iofile.attr.TemplateIdAttrMark; @@ -27,8 +26,8 @@ import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.TemplateTreePane; import com.fr.design.fun.DesignerFrameUpButtonProvider; import com.fr.design.fun.MenuHandler; -import com.fr.design.fun.ReportSupportedFileUIProvider; import com.fr.design.fun.PreviewProvider; +import com.fr.design.fun.ReportSupportedFileUIProvider; import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.ibutton.UIButton; @@ -50,7 +49,6 @@ import com.fr.design.write.submit.DBManipulationPane; import com.fr.file.FILE; import com.fr.file.FILEChooserPane; import com.fr.file.MemFILE; -import com.fr.file.filter.ChooseFileFilter; import com.fr.form.ui.NoneWidget; import com.fr.form.ui.Widget; import com.fr.general.ComparatorUtils; @@ -58,6 +56,7 @@ import com.fr.log.FineLoggerFactory; import com.fr.report.cell.Elem; import com.fr.report.cell.cellattr.CellImage; import com.fr.stable.ArrayUtils; +import com.fr.stable.Filter; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.core.UUID; @@ -628,7 +627,7 @@ public abstract class JTemplate> } } - protected void addChooseFILEFilter(FILEChooserPane fileChooser){ + protected void addChooseFILEFilter(FILEChooserPane fileChooser) { } @@ -651,13 +650,13 @@ public abstract class JTemplate> return result; } - protected boolean saveToNewFile(String oldName){ + protected boolean saveToNewFile(String oldName) { boolean result = false; Set providers = ExtraDesignClassManager.getInstance().getArray(ReportSupportedFileUIProvider.XML_TAG); for (ReportSupportedFileUIProvider provider : providers) { result = result || provider.saveToNewFile(this.editingFILE.getPath(), this); } - if(!result){ + if (!result) { result = result || this.saveFile(); //更换最近打开 DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(oldName, this.getPath()); @@ -1154,7 +1153,12 @@ public abstract class JTemplate> * @return 预览模式 */ public PreviewProvider[] supportPreview() { - return new PreviewProvider[0]; + return ExtraDesignClassManager.getInstance().getTemplatePreviews(new Filter() { + @Override + public boolean accept(PreviewProvider previewProvider) { + return previewProvider.accept(JTemplate.this); + } + }); } /** diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java index be8ff823a9..d096471a7c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java @@ -5,10 +5,12 @@ import com.fr.design.constants.LayoutConstants; import com.fr.design.designer.IntervalConstants; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.widget.UITitleSplitLine; import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane; +import com.fr.design.utils.gui.UIComponentUtils; import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.general.FRFont; @@ -20,21 +22,14 @@ import javax.swing.ButtonGroup; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.RenderingHints; -import java.awt.Stroke; +import java.awt.*; public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { private UIRadioButton gapFix; private UIRadioButton titleWidthFix; private LinePane bottomBorderPane; private LinePane underLinePane; + private UISpinner minTabWidth; public UpMenuStyleDefinePane(WCardTagLayout tagLayout) { super(tagLayout); @@ -44,6 +39,10 @@ public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { JPanel panel = super.createCenterPane(); UILabel displayGap = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Display_Gap")); displayGap.setPreferredSize(new Dimension(55, 20)); + UILabel tabWidthLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Min_Width")); + tabWidthLabel.setPreferredSize(new Dimension(75, 20)); + minTabWidth = new UISpinner(0, Integer.MAX_VALUE, 1, 92); + JPanel tabWidthPanel = UIComponentUtils.wrapWithBorderLayoutPane(minTabWidth); gapFix = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Gap_Fix")); titleWidthFix = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Title_Width_Fix")); ButtonGroup buttonGroup = new ButtonGroup(); @@ -52,29 +51,33 @@ public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { gapFix.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); titleWidthFix.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); buttonGroup.add(titleWidthFix); + JPanel flowLeft = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); + flowLeft.add(gapFix); + flowLeft.add(titleWidthFix); + JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{displayGap, flowLeft}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + centerPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 15, 20)); + centerPane.setPreferredSize(new Dimension(500, 20)); + final JPanel wrapTabWidthPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{tabWidthLabel, tabWidthPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + wrapTabWidthPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 15, 20)); + wrapTabWidthPanel.setPreferredSize(new Dimension(200, 20)); gapFix.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { updatePreviewPane(); + wrapTabWidthPanel.setVisible(titleWidthFix.isSelected()); } }); titleWidthFix.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { updatePreviewPane(); + wrapTabWidthPanel.setVisible(titleWidthFix.isSelected()); } }); - - - JPanel flowLeft = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); - flowLeft.add(gapFix); - flowLeft.add(titleWidthFix); - JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{displayGap, flowLeft}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); - centerPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 15, 20)); - centerPane.setPreferredSize(new Dimension(500, 20)); - JPanel outerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - outerPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 15, 0)); - outerPane.add(centerPane, BorderLayout.CENTER); + JPanel outerPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); + outerPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20)); + outerPane.add(centerPane); + outerPane.add(wrapTabWidthPanel); panel.add(outerPane); return panel; } @@ -125,6 +128,7 @@ public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { UpMenuStyle style = (UpMenuStyle) ob; gapFix.setSelected(style.isGapFix()); titleWidthFix.setSelected(style.isTitleWidthFix()); + minTabWidth.setValueWithoutEvent(style.getMinTabWidth()); bottomBorderPane.populate(style.getBottomBorder()); underLinePane.populate(style.getUnderline()); } @@ -140,6 +144,7 @@ public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { UpMenuStyle style = new UpMenuStyle(); style.setGapFix(gapFix.isSelected()); style.setTitleWidthFix(titleWidthFix.isSelected()); + style.setMinTabWidth((int) minTabWidth.getValue()); style.setBottomBorder(bottomBorderPane.update()); style.setUnderline(underLinePane.update()); return style; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index 547ddf6ae6..8229c9f8d8 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -1,7 +1,5 @@ package com.fr.design.mainframe.vcs.common; -import com.fr.cluster.ClusterBridge; -import com.fr.cluster.engine.base.FineClusterConfig; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.DesignerEnvManager; import com.fr.design.file.HistoryTemplateListCache; @@ -27,7 +25,6 @@ import com.fr.workspace.server.vcs.git.config.GcConfig; import javax.swing.Icon; import javax.swing.border.EmptyBorder; import java.awt.Color; - import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -174,7 +171,7 @@ public class VcsHelper implements JTemplateActionListener { public void templateSaved(JTemplate jt) { if (needInit() && DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable() - && !FineClusterConfig.getInstance().isCluster()) { + && !WorkContext.getCurrent().isCluster()) { fireVcs(jt); } } diff --git a/designer-base/src/main/java/com/fr/design/os/impl/DemoAction.java b/designer-base/src/main/java/com/fr/design/os/impl/DemoAction.java index 8feb02952a..1696e6ce8a 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/DemoAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/DemoAction.java @@ -21,13 +21,12 @@ public class DemoAction implements OSBasedAction { } String executorPath; - if (OperatingSystem.isMacos()) { executorPath = StableUtils.pathJoin(installHome, "bin", "designer.app"); } else if(OperatingSystem.isWindows()){ executorPath = StableUtils.pathJoin(installHome, "bin", "designer.exe demo"); }else{ - executorPath = StableUtils.pathJoin(installHome, "bin", "designer.sh demo"); + executorPath = StableUtils.pathJoin(installHome, "bin", "designer demo"); } if (OperatingSystem.isMacos()) { diff --git a/designer-base/src/main/java/com/fr/design/os/impl/RestartAction.java b/designer-base/src/main/java/com/fr/design/os/impl/RestartAction.java index 47a7ae43bf..d80fad5546 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/RestartAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/RestartAction.java @@ -65,8 +65,7 @@ public class RestartAction implements OSBasedAction { private static void restartInLinux(String installHome, String[] filesToBeDelete) throws Exception { ProcessBuilder builder = new ProcessBuilder(); List commands = new ArrayList(); - //现在先写的是restart.sh - commands.add(installHome + File.separator + "bin" + File.separator + "restart.sh"); + commands.add(installHome + File.separator + "bin" + File.separator + "restart"); if (ArrayUtils.isNotEmpty(filesToBeDelete)) { commands.add(StableUtils.join(filesToBeDelete, "+")); } diff --git a/designer-base/src/main/java/com/fr/design/present/DictPresentPane.java b/designer-base/src/main/java/com/fr/design/present/DictPresentPane.java index 17733fb1bb..cba37ea19e 100644 --- a/designer-base/src/main/java/com/fr/design/present/DictPresentPane.java +++ b/designer-base/src/main/java/com/fr/design/present/DictPresentPane.java @@ -5,6 +5,7 @@ import java.awt.event.ItemListener; import com.fr.base.present.DictPresent; import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.present.dict.DictionaryPane; @@ -13,7 +14,7 @@ import com.fr.design.present.dict.DictionaryPane; * @author zhou * @since 2012-5-31上午10:54:20 */ -public class DictPresentPane extends FurtherBasicBeanPane { +public class DictPresentPane extends FurtherBasicBeanPane implements Prepare4DataSourceChange { private DictionaryPane dictionaryPane; public DictPresentPane() { @@ -50,4 +51,8 @@ public class DictPresentPane extends FurtherBasicBeanPane { dictionaryPane.reset(); } + @Override + public void registerDSChangeListener() { + dictionaryPane.registerDSChangeListener(); + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/present/dict/DictionaryPane.java b/designer-base/src/main/java/com/fr/design/present/dict/DictionaryPane.java index 3f62c01703..e50ed86b93 100644 --- a/designer-base/src/main/java/com/fr/design/present/dict/DictionaryPane.java +++ b/designer-base/src/main/java/com/fr/design/present/dict/DictionaryPane.java @@ -5,6 +5,7 @@ import com.fr.data.impl.DynamicSQLDict; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.constants.LayoutConstants; import com.fr.design.data.DataCreatorUI; +import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; @@ -20,7 +21,7 @@ import java.util.List; * @author zhou * @since 2012-5-31下午12:20:41 */ -public class DictionaryPane extends UIComboBoxPane implements DataCreatorUI { +public class DictionaryPane extends UIComboBoxPane implements DataCreatorUI, Prepare4DataSourceChange { private TableDataDictPane tableDataDictPane; @Override @@ -77,4 +78,9 @@ public class DictionaryPane extends UIComboBoxPane implements DataCr paneList.add(new FormulaDictPane()); return paneList; } + + @Override + public void registerDSChangeListener() { + tableDataDictPane.registerDSChangeListener(); + } } diff --git a/designer-base/src/main/java/com/fr/design/present/dict/TableDataDictPane.java b/designer-base/src/main/java/com/fr/design/present/dict/TableDataDictPane.java index ab9d8d90c8..3c08c1c9da 100644 --- a/designer-base/src/main/java/com/fr/design/present/dict/TableDataDictPane.java +++ b/designer-base/src/main/java/com/fr/design/present/dict/TableDataDictPane.java @@ -16,6 +16,7 @@ import com.fr.design.data.datapane.TableDataComboBox; import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.preview.PreviewLabel; import com.fr.design.data.datapane.preview.PreviewLabel.Previewable; +import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; import com.fr.design.editor.DoubleDeckValueEditorPane; @@ -48,7 +49,7 @@ import java.util.List; * @editor zhou * @since 2012-3-29下午1:49:24 */ -public class TableDataDictPane extends FurtherBasicBeanPane implements Previewable, UIObserver { +public class TableDataDictPane extends FurtherBasicBeanPane implements Previewable, UIObserver, Prepare4DataSourceChange { private static final int BEGIN = 1; private static final int END = 10; private static final int VGAP = 24; @@ -368,4 +369,9 @@ public class TableDataDictPane extends FurtherBasicBeanPane public boolean shouldResponseChangeListener() { return true; } + + @Override + public void registerDSChangeListener() { + tableDataNameComboBox.registerGlobalDSChangeListener(); + } } diff --git a/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java b/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java index 63929685d9..f48cb12edf 100644 --- a/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java @@ -9,11 +9,14 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.remote.ui.AuthorityManagerPane; import com.fr.log.FineLoggerFactory; import com.fr.report.DesignAuthority; +import com.fr.report.constant.RoleType; import com.fr.stable.ArrayUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.server.authority.AuthorityOperator; import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.List; /** * @author yaohwu @@ -38,13 +41,24 @@ public class RemoteDesignAuthManagerAction extends UpdateAction { if (!WorkContext.getCurrent().isLocal()) { try { // 远程设计获取全部设计成员的权限列表 - DesignAuthority[] userAuthorities = WorkContext.getCurrent().get(AuthorityOperator.class).getUserAuthorities(); - DesignAuthority[] customAuthorities = WorkContext.getCurrent().get(AuthorityOperator.class).getCustomRoleAuthorities(); - if (userAuthorities != null && userAuthorities.length != 0) { - managerPane.populateByUser(userAuthorities); - } - if (customAuthorities != null && customAuthorities.length != 0) { - managerPane.populateByCustom(customAuthorities); + DesignAuthority[] authorities = WorkContext.getCurrent().get(AuthorityOperator.class).getAuthorities(); + List userAuthorities = new ArrayList(); + List customAuthorities = new ArrayList(); + if (authorities != null) { + for (DesignAuthority authority : authorities) { + if (authority.getRoleType() == RoleType.CUSTOM) { + customAuthorities.add(authority); + } + else { + userAuthorities.add(authority); + } + } + if (userAuthorities.size() != 0) { + managerPane.populateByUser(userAuthorities.toArray(new DesignAuthority[userAuthorities.size()])); + } + if (customAuthorities.size() != 0) { + managerPane.populateByCustom(customAuthorities.toArray(new DesignAuthority[customAuthorities.size()])); + } } } catch (Exception exception) { FineLoggerFactory.getLogger().error(exception.getMessage(), exception); diff --git a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java b/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java index 79ecdc9461..49a3a91254 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java +++ b/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java @@ -142,13 +142,13 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec */ private static final UILabel B = new UILabel("B"); - private static final int H_MAX = 365; + private static final int H_MAX = 360; private static final int S_MAX = 100; - private static final int L_MAX = 100; + private static final int B_MAX = 100; private static final float HSPINNER_VALUE = 360f; private static final float SSPINNER_VALUE = 100f; - private static final float LSPINNER_VALUE = 100f; + private static final float BSPINNER_VALUE = 100f; private static final int BINARY_FOR_EIGHT = 255; private static final int BINARY_FOR_FOUR = 16; @@ -321,7 +321,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec internalChange = true; sSpinner.setValue(new Integer((int) (s * S_MAX))); internalChange = false; - bSpinner.setValue(new Integer((int) (b * L_MAX))); + bSpinner.setValue(new Integer((int) (b * B_MAX))); revalidate(); } @@ -338,7 +338,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec internalChange = true; hSpinner.setValue(new Integer((int) (h * H_MAX))); internalChange = false; - bSpinner.setValue(new Integer((int) (b * L_MAX))); + bSpinner.setValue(new Integer((int) (b * B_MAX))); revalidate(); } @@ -431,7 +431,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec } /** - * hsl 监听 + * hsb 监听 */ class ImageScrollListener implements ChangeListener { /** @@ -506,7 +506,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec null); internalChange = true; - adjustHSLValue(hsbVals); + adjustHSBValue(hsbVals); internalChange = false; @@ -521,11 +521,11 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec updateHexFields(); } - private void adjustHSLValue(float[] hsbVals) { + private void adjustHSBValue(float[] hsbVals) { if (!spinnerTrigger) { hSpinner.setValue(new Integer((int) (hsbVals[0] * HSPINNER_VALUE))); sSpinner.setValue(new Integer((int) (hsbVals[1] * SSPINNER_VALUE))); - bSpinner.setValue(new Integer((int) (hsbVals[2] * LSPINNER_VALUE))); + bSpinner.setValue(new Integer((int) (hsbVals[2] * BSPINNER_VALUE))); } switch (locked) { case HLOCKED: @@ -536,7 +536,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec gradientPoint.x = (int) ((1 - ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE) * IMG_WIDTH); gradientPoint.y = (int) ((1 - - ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE) * IMG_HEIGHT); + - ((Number) bSpinner.getValue()).intValue() / BSPINNER_VALUE) * IMG_HEIGHT); } break; case SLOCKED: @@ -546,7 +546,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec if (!handlingMouse) { gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE * IMG_WIDTH); gradientPoint.y = (int) ((1 - - ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE) * IMG_HEIGHT); + - ((Number) bSpinner.getValue()).intValue() / BSPINNER_VALUE) * IMG_HEIGHT); } break; case BLOCKED: @@ -565,7 +565,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec private void updateImageAndTrack() { float h = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE; float s = ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE; - float b = ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE; + float b = ((Number) bSpinner.getValue()).intValue() / BSPINNER_VALUE; spinnerTrigger = true; getColorSelectionModel().setSelectedColor(new Color(Color.HSBtoRGB(h, s, b))); @@ -691,11 +691,11 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec container.add(label); container.add(mainPanel); - // hsl和rgb面板 - JPanel hslAndRgbPanel = new JPanel(); - hslAndRgbPanel.setLayout(new BorderLayout(0, 16)); - hslAndRgbPanel.add(initialHSLPanel(), BorderLayout.CENTER); - hslAndRgbPanel.add(initialRGBPanel(), BorderLayout.SOUTH); + // hsb和rgb面板 + JPanel hsbAndRgbPanel = new JPanel(); + hsbAndRgbPanel.setLayout(new BorderLayout(0, 16)); + hsbAndRgbPanel.add(initialHSBPanel(), BorderLayout.CENTER); + hsbAndRgbPanel.add(initialRGBPanel(), BorderLayout.SOUTH); // 十六进制面板 JPanel hexPanel = new JPanel(); @@ -703,7 +703,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec hexPanel.add(new UILabel("#")); hexPanel.add(field); - mainPanel.add(hslAndRgbPanel, BorderLayout.CENTER); + mainPanel.add(hsbAndRgbPanel, BorderLayout.CENTER); mainPanel.add(hexPanel, BorderLayout.SOUTH); JPanel rightPane = new JPanel(new BorderLayout()); @@ -719,11 +719,11 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec return container; } - //初始化HSL部分 - private JPanel initialHSLPanel() { + //初始化HSB部分 + private JPanel initialHSBPanel() { hRadio = new UIRadioButton("H"); sRadio = new UIRadioButton("S"); - bRadio = new UIRadioButton("L"); + bRadio = new UIRadioButton("B"); ButtonGroup group = new ButtonGroup(); group.add(hRadio); group.add(sRadio); @@ -748,27 +748,27 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec sSpinner.addChangeListener(scroll); bSpinner.addChangeListener(scroll); - JPanel hslPanel = new JPanel(); - hslPanel.setLayout(new GridLayout(3, 0, 0, 5)); + JPanel hsbPanel = new JPanel(); + hsbPanel.setLayout(new GridLayout(3, 0, 0, 5)); JPanel hPanel = new JPanel(); hPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 10, 0)); hPanel.add(hRadio); hPanel.add(hSpinner); - hslPanel.add(hPanel); + hsbPanel.add(hPanel); JPanel sPanel = new JPanel(); sPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 10, 0)); sPanel.add(sRadio); sPanel.add(sSpinner); - hslPanel.add(sPanel); + hsbPanel.add(sPanel); JPanel lPanel = new JPanel(); lPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 10, 0)); lPanel.add(bRadio); lPanel.add(bSpinner); - hslPanel.add(lPanel); - return hslPanel; + hsbPanel.add(lPanel); + return hsbPanel; } private JPanel initialRGBPanel() { @@ -856,7 +856,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec */ private void updateBLockImage() { int[] pix = new int[IMG_WIDTH * IMG_HEIGHT]; - float bValue = ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE; + float bValue = ((Number) bSpinner.getValue()).intValue() / BSPINNER_VALUE; int index = 0; for (int j = 0; j < IMG_HEIGHT; j++) { @@ -1028,7 +1028,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec int[] trackPix = new int[TRACK_WIDTH * IMG_HEIGHT]; float hValue = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE; - float bValue = ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE; + float bValue = ((Number) bSpinner.getValue()).intValue() / BSPINNER_VALUE; int trackIndex = 0; for (int j = 0; j < IMG_HEIGHT; j++) { diff --git a/designer-base/src/test/java/com/fr/design/ExtraDesignClassManagerTest.java b/designer-base/src/test/java/com/fr/design/ExtraDesignClassManagerTest.java index 89f4ee1b2d..8d996611eb 100644 --- a/designer-base/src/test/java/com/fr/design/ExtraDesignClassManagerTest.java +++ b/designer-base/src/test/java/com/fr/design/ExtraDesignClassManagerTest.java @@ -9,7 +9,6 @@ import com.fr.design.gui.core.WidgetOption; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JVirtualTemplate; import com.fr.general.ModuleContext; -import com.fr.log.FineLoggerFactory; import com.fr.report.restriction.CellCountRestriction; import com.fr.report.restriction.ReportRestrictionScene; import com.fr.restriction.Restrictions; @@ -62,9 +61,11 @@ public class ExtraDesignClassManagerTest extends TestCase { return toolbarItemProvider.accept(jTemplate); } }); + WidgetOption[] widgetOptions1 = ExtraDesignClassManager.getInstance().getWebWidgetOptions(set, null); Assert.assertEquals(1, widgetOptions.length); + Assert.assertEquals(2, widgetOptions1.length); } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + Assert.fail(e.getMessage()); } } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java index 4ef5beffb1..a2d824f51c 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java @@ -133,6 +133,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 @Deprecated public void reLayout(Chart currentChart) { + //do nothing } /** diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java index 012c410a89..b774de89ea 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java @@ -1,6 +1,7 @@ package com.fr.van.chart.designer.style.label; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.TwoTuple; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButtonGroup; @@ -11,6 +12,7 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.style.color.ColorSelectBox; +import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.attr.plot.VanChartLabelPositionPlot; import com.fr.plugin.chart.base.AttrLabelDetail; import com.fr.plugin.chart.base.AttrTooltipContent; @@ -47,11 +49,16 @@ public class VanChartPlotLabelDetailPane extends BasicPane { protected ColorSelectBox backgroundColor; private JPanel tractionLinePane; + private JPanel positionPane; + private Integer[] oldPositionValues; protected VanChartStylePane parent; + private Plot plot; public VanChartPlotLabelDetailPane(Plot plot, VanChartStylePane parent) { this.parent = parent; + this.plot = plot; + this.setLayout(new BorderLayout()); initToolTipContentPane(plot); JPanel contentPane = createLabelPane(plot); @@ -105,42 +112,85 @@ public class VanChartPlotLabelDetailPane extends BasicPane { return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel); } - protected JPanel createLabelPositionPane(double[] row, double[] col, Plot plot) { - if(plot instanceof VanChartLabelPositionPlot){ + private TwoTuple getPositionNamesAndValues() { + if (plot instanceof VanChartLabelPositionPlot) { + String[] names = ((VanChartLabelPositionPlot) plot).getLabelLocationNameArray(); - Integer[] values = ((VanChartLabelPositionPlot) plot).getLabelLocationValueArray(); + Integer[] values = ((VanChartLabelPositionPlot) plot).getLabelLocationValueArray(); - if(names == null || names.length == 0){ - return new JPanel(); + if (names == null || names.length == 0) { + return null; } - if(values == null || values.length == 0){ - return new JPanel(); + if (values == null || values.length == 0) { + return null; } - position = new UIButtonGroup(names, values); - autoAdjust = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_On"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); + return new TwoTuple<>(names, values); + } + return null; + } + private JPanel createLabelPositionPane(double[] row, double[] col, Plot plot) { - Component[][] comps = new Component[2][2]; + if (getPositionNamesAndValues() == null) { + return new JPanel(); + } - comps[0] = new Component[]{null,null}; - comps[1] = new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), SwingConstants.LEFT), position}; + autoAdjust = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_On"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); - JPanel panel =new JPanel(new BorderLayout()); - panel.add(getLabelPositionPane(comps,row,col),BorderLayout.CENTER); - if(plot.isSupportLeadLine()){ - tractionLine = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Show_Guideline")); - tractionLinePane = TableLayout4VanChartHelper.createGapTableLayoutPane("",tractionLine); - panel.add(tractionLinePane, BorderLayout.SOUTH); - initPositionListener(); - } else if(PlotFactory.plotAutoAdjustLabelPosition(plot)){ - panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Auto_Adjust"),autoAdjust), BorderLayout.SOUTH); - } - return panel; + JPanel panel = new JPanel(new BorderLayout()); + + positionPane = new JPanel(); + checkPositionPane(); + panel.add(positionPane, BorderLayout.CENTER); + + + if (plot.isSupportLeadLine()) { + tractionLine = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Show_Guideline")); + tractionLinePane = TableLayout4VanChartHelper.createGapTableLayoutPane("", tractionLine); + panel.add(tractionLinePane, BorderLayout.SOUTH); + initPositionListener(); + } else if (PlotFactory.plotAutoAdjustLabelPosition(plot)) { + panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Auto_Adjust"), autoAdjust), BorderLayout.SOUTH); + } + return panel; + } + + private void checkPositionPane() { + if (positionPane == null) { + return; + } + TwoTuple result = getPositionNamesAndValues(); + if (result == null) { + return; + } + + Integer[] values = result.getSecond(); + if (ComparatorUtils.equals(values, oldPositionValues)) { + return; + } + oldPositionValues = values; + + position = new UIButtonGroup(result.getFirst(), values); + + Component[][] comps = new Component[2][2]; + + comps[0] = new Component[]{null, null}; + comps[1] = new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), SwingConstants.LEFT), position}; + + double[] row = new double[]{TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}; + double[] col = new double[]{TableLayout.FILL, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; + + positionPane.removeAll(); + positionPane.setLayout(new BorderLayout()); + positionPane.add(getLabelPositionPane(comps, row, col), BorderLayout.CENTER); + + if (parent != null) { + parent.initListener(positionPane); } - return new JPanel(); } + protected JPanel getLabelPositionPane (Component[][] comps, double[] row, double[] col){ JPanel panel = TableLayoutHelper.createTableLayoutPane(comps,row,col); return createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout"), panel); @@ -228,6 +278,8 @@ public class VanChartPlotLabelDetailPane extends BasicPane { } public void populate(AttrLabelDetail detail) { + checkPositionPane(); + dataLabelContentPane.populateBean(detail.getContent()); if(position != null){ position.setSelectedItem(detail.getPosition()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java index bbce11d9fe..297d781667 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java @@ -3,6 +3,8 @@ package com.fr.van.chart.map.designer.type; import com.fr.base.Parameter; import com.fr.base.Utils; import com.fr.decision.webservice.v10.map.WMSFactory; +import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper; +import com.fr.design.constants.LayoutConstants; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.file.HistoryTemplateListPane; @@ -15,10 +17,12 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.JTemplate; import com.fr.general.ComparatorUtils; +import com.fr.general.IOUtils; import com.fr.general.http.HttpClient; import com.fr.plugin.chart.base.GisLayer; import com.fr.plugin.chart.base.ViewCenter; @@ -34,6 +38,7 @@ import com.fr.plugin.chart.type.ZoomLevel; import com.fr.stable.ArrayUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.drillmap.designer.data.comp.MapDataTree; +import com.fr.workspace.WorkContext; import javax.swing.BorderFactory; import javax.swing.JOptionPane; @@ -223,17 +228,33 @@ public class VanChartMapSourceChoosePane extends JPanel implements UIObserver { sourceTitleLabel = createSourceTitleLabel(); + boolean hasRefreshButton = !WorkContext.getCurrent().isLocal(); + + UIButton button = new UIButton(IOUtils.readIcon("/com/fr/design/images/control/refresh.png")); + button.setToolTipText(Toolkit.i18nText("Fine-Design_Chart_Update_Remote_Map_JSON")); + button.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + GEOJSONHelper.reset(); + GEOJSONHelper.getInstance(); + } + }); + + double p = TableLayout.PREFERRED; double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] columnSize = {d, e}; double[] rowSize = {p, p}; + + double[] columnSize = hasRefreshButton ? new double[]{d + 10, e - 20, 20} : new double[]{d, e}; + Component[] comps = hasRefreshButton ? new Component[]{sourceTitleLabel, sourceComboBox, button} : new Component[]{sourceTitleLabel, sourceComboBox}; + double hGap = hasRefreshButton ? 0 : TableLayout4VanChartHelper.COMPONENT_INTERVAL; Component[][] components = new Component[][]{ new Component[]{null,null}, - new Component[]{sourceTitleLabel,sourceComboBox}, + comps, }; - return TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize, columnSize); + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, hGap, LayoutConstants.VGAP_LARGE); } private JPanel createGISLayerPane() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java index fc3967a992..7f1304d3a1 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java @@ -12,14 +12,11 @@ import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.event.AWTEventListener; import java.awt.event.MouseEvent; - import javax.swing.JPanel; import javax.swing.JWindow; - import com.fr.design.constants.UIConstants; -import com.fr.design.designer.beans.location.Location; import com.fr.design.gui.core.WidgetOption; -import com.fr.stable.OperatingSystem; +import com.fr.stable.os.OperatingSystem; //august: public class FormWidgetPopWindow extends JWindow { @@ -52,24 +49,28 @@ public class FormWidgetPopWindow extends JWindow { if (event instanceof MouseEvent) { MouseEvent mv = (MouseEvent) event; if (mv.getClickCount() > 0) { - Point point = new Point((int) (mv.getLocationOnScreen().getX()), (int) mv.getLocationOnScreen().getY()); - if (OperatingSystem.isWindows()) { - if(!FormWidgetPopWindow.this.contains(point)) { - FormWidgetPopWindow.this.setVisible(false); - } - } else if (OperatingSystem.isMacOS()) { - Dimension d = FormWidgetPopWindow.this.getSize(); - Point p = FormWidgetPopWindow.this.getLocation(); - Rectangle rect = new Rectangle(p, d); - if (!rect.contains(point)) { - FormWidgetPopWindow.this.setVisible(false); - } - } + hideWindow(mv); } } } }; + private void hideWindow(MouseEvent mv){ + Point point = new Point((int) (mv.getLocationOnScreen().getX()), (int) mv.getLocationOnScreen().getY()); + if (OperatingSystem.isWindows()) { + if (!FormWidgetPopWindow.this.contains(point)) { + FormWidgetPopWindow.this.setVisible(false); + } + }else if(OperatingSystem.isMacos() || OperatingSystem.isLinux()){ + Dimension d = FormWidgetPopWindow.this.getSize(); + Point p = FormWidgetPopWindow.this.getLocation(); + Rectangle rect = new Rectangle(p, d); + if (!rect.contains(point)) { + FormWidgetPopWindow.this.setVisible(false); + } + } + } + private class EditorChoosePane extends JPanel { public EditorChoosePane() { super(); 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 a37a1c4665..a5b76e1fca 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 @@ -937,7 +937,8 @@ public class JForm extends JTemplate implements BaseJForm extends AbstractDataModify { + + + public AbstractFRLayoutDefinePane(XCreator xCreator) { + super(xCreator); + } + + public AbstractFRLayoutDefinePane(XCreator xCreator, FormDesigner designer) { + super(xCreator, designer); + } + + protected void copyLayoutAttr(WSortLayout srcLayout, WSortLayout destLayout) { + destLayout.clearListeners(); + destLayout.clearMobileWidgetList(); + for (int i = 0, len = srcLayout.getMobileWidgetListSize(); i < len; i++) { + destLayout.addMobileWidget(srcLayout.getMobileWidget(i)); + } + destLayout.setSorted(true); + for (int i = 0, len = srcLayout.getListenerSize(); i < len; i++) { + destLayout.addListener(srcLayout.getListener(i)); + } + } + +} diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java index 900334cb7a..3a53cf5ffb 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java @@ -131,7 +131,9 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane { if (layoutType == WBodyLayoutType.ABSOLUTE) { ((XWFitLayout) creator.getBackupParent()).toData().resetStyle(); if (state == WBodyLayoutType.FIT.getTypeValue()) { - ((XWFitLayout)creator.getBackupParent()).switch2FitBodyLayout(creator); + XWFitLayout xwFitLayout = ((XWFitLayout)creator.getBackupParent()); + xwFitLayout.switch2FitBodyLayout(creator); + copyLayoutAttr(layout, xwFitLayout.toData()); } } layout.setBorderStyle((LayoutBorderStyle) borderStyleEditor.getValue()); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteLayoutDefinePane.java index a5dabe2f05..dff0e159a1 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteLayoutDefinePane.java @@ -11,7 +11,6 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.widget.ui.designer.AbstractDataModify; import com.fr.form.ui.container.WAbsoluteLayout; import javax.swing.BorderFactory; @@ -23,7 +22,7 @@ import java.awt.Component; /** * Created by ibm on 2017/8/2. */ -public class FRAbsoluteLayoutDefinePane extends AbstractDataModify { +public class FRAbsoluteLayoutDefinePane extends AbstractFRLayoutDefinePane { protected UIComboBox comboBox; public FRAbsoluteLayoutDefinePane(XCreator xCreator) { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java index ff8ef4411f..4481307bff 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java @@ -26,7 +26,6 @@ import com.fr.design.mainframe.widget.accessibles.AccessibleBodyWatermarkEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; -import com.fr.design.widget.ui.designer.AbstractDataModify; import com.fr.design.widget.ui.designer.component.PaddingBoundPane; import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.Widget; @@ -48,7 +47,7 @@ import java.awt.Dimension; /** * Created by ibm on 2017/8/2. */ -public class FRFitLayoutDefinePane extends AbstractDataModify { +public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane { private static final int ADAPT_LABEL_MAX_WIDTH = 80; private XWFitLayout xWFitLayout; private WFitLayout wFitLayout; @@ -208,6 +207,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify { } xwAbsoluteBodyLayout.add(component); } + copyLayoutAttr(wFitLayout, wAbsoluteBodyLayout); xWFitLayout.setBackupParent(xwAbsoluteBodyLayout); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); formDesigner.getSelectionModel().setSelectedCreators( diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java index dfa902d862..444569fbcd 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java @@ -1,24 +1,24 @@ package com.fr.design.widget.ui.designer.mobile; import com.fr.base.mobile.MobileScanCodeAttr; -import com.fr.base.mobile.ScanCodeState; +import com.fr.base.mobile.TextInputMode; import com.fr.design.designer.creator.XCreator; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.frpane.AttributeChangeListener; -import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ibutton.ModeButtonGroup; +import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.FormDesigner; import com.fr.form.ui.TextEditor; -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import java.awt.BorderLayout; +import javax.swing.*; +import java.awt.*; public class ScanCodeMobileDefinePane extends MobileWidgetDefinePane { private XCreator xCreator; - private UICheckBox appScanCodeCheck; + private ModeButtonGroup buttonGroup; public ScanCodeMobileDefinePane(XCreator xCreator) { this.xCreator = xCreator; @@ -33,14 +33,31 @@ public class ScanCodeMobileDefinePane extends MobileWidgetDefinePane { } private UIExpandablePane getMobileSettingsPane() { - JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - appScanCodeCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Support_Scan_Code"), true); - appScanCodeCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); + JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); + buttonGroup = new ModeButtonGroup<>(); + UIRadioButton scanCodeAndManualInput = new UIRadioButton( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design__Mobile_Support_Scan_Code_And_Manual_Input"), true); + UIRadioButton onlyManualInput = new UIRadioButton( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Only_Support_Manual_Input"), false); + UIRadioButton onlyScanCodeInput = new UIRadioButton( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Only_Support_Scan_Code_Input"), false); + scanCodeAndManualInput.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + onlyManualInput.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + onlyScanCodeInput.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + buttonGroup.put(TextInputMode.SUPPORT_SCAN_CODE_And_MANUAL, scanCodeAndManualInput); + buttonGroup.put(TextInputMode.ONLY_SUPPORT_MANUAL, onlyManualInput); + buttonGroup.put(TextInputMode.ONLY_SUPPORT_SCAN_CODE, onlyScanCodeInput); + buttonGroup.add(scanCodeAndManualInput); + buttonGroup.add(onlyManualInput); + buttonGroup.add(onlyScanCodeInput); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - panel.add(appScanCodeCheck); + panel.add(scanCodeAndManualInput); + panel.add(onlyManualInput); + panel.add(onlyScanCodeInput); final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); panelWrapper.add(panel, BorderLayout.NORTH); - return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, panelWrapper); + return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, + panelWrapper); } private void bindListeners2Widgets() { @@ -61,15 +78,14 @@ public class ScanCodeMobileDefinePane extends MobileWidgetDefinePane { @Override public void populate(FormDesigner designer) { MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) xCreator.toData()).getMobileScanCodeAttr(); - ScanCodeState scanCodeState = mobileScanCodeAttr.getScanCodeState(); - appScanCodeCheck.setSelected(scanCodeState.getState()); + buttonGroup.setSelectButton(mobileScanCodeAttr.getTextInputMode()); this.bindListeners2Widgets(); } @Override public void update() { MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) xCreator.toData()).getMobileScanCodeAttr(); - mobileScanCodeAttr.setScanCodeState(ScanCodeState.parse(appScanCodeCheck.isSelected())); + mobileScanCodeAttr.setTextInputMode(buttonGroup.getCurrentSelected()); DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); } diff --git a/designer-realize/src/main/java/com/fr/design/condition/WHPane.java b/designer-realize/src/main/java/com/fr/design/condition/WHPane.java index 753e3e7763..dce2d466ad 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/WHPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/WHPane.java @@ -10,7 +10,10 @@ import com.fr.stable.Constants; import com.fr.stable.unit.*; import javax.swing.*; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; import java.math.BigDecimal; +import java.text.ParseException; /** * @author richie diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/HyperlinkGroupPaneActionImpl.java b/designer-realize/src/main/java/com/fr/design/mainframe/HyperlinkGroupPaneActionImpl.java index fcade7789b..71a37e42f0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/HyperlinkGroupPaneActionImpl.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/HyperlinkGroupPaneActionImpl.java @@ -3,7 +3,7 @@ package com.fr.design.mainframe; import com.fr.base.Style; import com.fr.design.actions.utils.ReportActionUtils; import com.fr.design.designer.TargetComponent; -import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.general.FRFont; @@ -24,7 +24,7 @@ import java.awt.Color; */ public class HyperlinkGroupPaneActionImpl implements HyperlinkGroupPaneActionProvider { private static HyperlinkGroupPaneActionProvider instance; - + private static Selection selection ; private HyperlinkGroupPaneActionImpl() { } @@ -40,7 +40,9 @@ public class HyperlinkGroupPaneActionImpl implements HyperlinkGroupPaneActionPro ElementCasePane reportPane = (ElementCasePane)elementCasePane; final TemplateElementCase report = reportPane.getEditingElementCase(); NameJavaScriptGroup nameHyperlinks = getNameJSGroup(reportPane, report); + selection = reportPane.getSelection(); hyperlinkGroupPane.populate(nameHyperlinks); + } private NameJavaScriptGroup getNameJSGroup(ElementCasePane reportPane, final TemplateElementCase report) { @@ -67,13 +69,12 @@ public class HyperlinkGroupPaneActionImpl implements HyperlinkGroupPaneActionPro } ElementCasePane reportPane = (ElementCasePane)jt.getCurrentElementCasePane(); final TemplateElementCase report = reportPane.getEditingElementCase(); - final Selection sel = reportPane.getSelection(); final NameJavaScriptGroup updateNameHyperlinks = hyperlinkGroupPane.updateJSGroup(); - if (sel instanceof FloatSelection) { - FloatElement selectedFloatElement = report.getFloatElement(((FloatSelection)sel).getSelectedFloatName()); + if (selection instanceof FloatSelection) { + FloatElement selectedFloatElement = report.getFloatElement(((FloatSelection)selection).getSelectedFloatName()); selectedFloatElement.setNameHyperlinkGroup(updateNameHyperlinks); } else { - ReportActionUtils.actionIterateWithCellSelection((CellSelection)sel, report, new ReportActionUtils.IterAction() { + ReportActionUtils.actionIterateWithCellSelection((CellSelection)selection, report, new ReportActionUtils.IterAction() { public void dealWith(CellElement editCellElement) { Style elementStyle = editCellElement.getStyle(); FRFont frFont = elementStyle.getFRFont(); @@ -94,7 +95,6 @@ public class HyperlinkGroupPaneActionImpl implements HyperlinkGroupPaneActionPro } }); } - - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified(); + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index 125cb4ccb4..621d3f40b6 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -35,8 +35,8 @@ import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.MutilTempalteTabPane; -import com.fr.design.fun.ReportSupportedFileUIProvider; import com.fr.design.fun.PreviewProvider; +import com.fr.design.fun.ReportSupportedFileUIProvider; import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.ibutton.UIButton; @@ -102,6 +102,10 @@ import com.fr.stable.module.Module; import com.fr.stable.project.ProjectConstants; import com.fr.web.controller.ViewRequestConstants; import com.fr.workspace.WorkContext; + +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JPanel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.FileOutputStream; @@ -109,9 +113,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JPanel; /** * JWorkBook used to edit WorkBook. @@ -900,10 +901,10 @@ public class JWorkBook extends JTemplate { */ @Override public PreviewProvider[] supportPreview() { - Set set = ExtraDesignClassManager.getInstance().getArray(PreviewProvider.MARK_STRING); + PreviewProvider[] templatePreviews = super.supportPreview(); return ArrayUtils.addAll(new PreviewProvider[]{ new PagePreview(), new WritePreview(), new ViewPreview(), new WriteEnhancePreview(), new MobilePreview() - }, set.toArray(new PreviewProvider[set.size()])); + }, templatePreviews); } /** diff --git a/designer-realize/src/main/java/com/fr/design/present/PresentPane.java b/designer-realize/src/main/java/com/fr/design/present/PresentPane.java index fa7683bb02..8e8a669c9f 100644 --- a/designer-realize/src/main/java/com/fr/design/present/PresentPane.java +++ b/designer-realize/src/main/java/com/fr/design/present/PresentPane.java @@ -75,6 +75,7 @@ public class PresentPane extends UIComboBoxPane { displays.add(none.title4PopupWindow()); dictPresentPane = new DictPresentPane(); + dictPresentPane.registerDSChangeListener(); paneList.add(dictPresentPane); keys.add(DictPresent.class.getName()); displays.add(dictPresentPane.title4PopupWindow()); diff --git a/designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java b/designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java index 1dd75e1633..17cf8566a9 100644 --- a/designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java @@ -214,14 +214,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane { JPanel repeatPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); repeatPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); JPanel freezePanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - - //自适应插件 - if (shouldShowTip()) { - JPanel infoPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Attention")); - BoxCenterAligmentPane actionLabel = getURLActionLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Form_Fit_Tip")); - infoPane.add(actionLabel, BorderLayout.SOUTH); - this.add(infoPane, BorderLayout.SOUTH); - } + outfreezePanel.add(freezePanel); // 重复打印部分 // 重复打印标题的起始行 diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java b/designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java index fc3d813523..a8cd06a9b3 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java @@ -227,6 +227,15 @@ public class ToolBarDragPane extends WidgetToolBarPane { GUICoreUtils.setEnabled(this, b); isEnabled = b; removeAllListener(northToolBar.getToolBarButtons()); + removeAllListener(southToolBar.getToolBarButtons()); + removeToolBarListener(northToolBar); + removeToolBarListener(southToolBar); + } + + private void removeToolBarListener(ToolBarPane toolBarPane) { + if (!isEnabled) { + toolBarPane.removeDefaultMouseListener(); + } } private void removeAllListener(List toolBarButtons) { diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java index e9c798ec95..74807add94 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java @@ -1,49 +1,63 @@ package com.fr.design.widget.ui.mobile; import com.fr.base.mobile.MobileScanCodeAttr; -import com.fr.base.mobile.ScanCodeState; +import com.fr.base.mobile.TextInputMode; import com.fr.design.foldablepane.UIExpandablePane; -import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ibutton.ModeButtonGroup; +import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.widget.mobile.WidgetMobilePane; import com.fr.form.ui.TextEditor; import com.fr.form.ui.Widget; -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import java.awt.BorderLayout; +import javax.swing.*; +import java.awt.*; public class ScanCodeMobilePane extends WidgetMobilePane { - private UICheckBox appScanCodeCheck; + private ModeButtonGroup buttonGroup; + @Override protected void init() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.add(getMobileSettingPane(), BorderLayout.NORTH); } private UIExpandablePane getMobileSettingPane() { - JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - appScanCodeCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Support_Scan_Code"), true); - appScanCodeCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); + JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); + buttonGroup = new ModeButtonGroup<>(); + UIRadioButton scanCodeAndManualInput = new UIRadioButton( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design__Mobile_Support_Scan_Code_And_Manual_Input"), true); + UIRadioButton onlyManualInput = new UIRadioButton( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Only_Support_Manual_Input"), false); + UIRadioButton onlyScanCodeInput = new UIRadioButton( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Only_Support_Scan_Code_Input"), false); + scanCodeAndManualInput.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + onlyManualInput.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + onlyScanCodeInput.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + buttonGroup.put(TextInputMode.SUPPORT_SCAN_CODE_And_MANUAL, scanCodeAndManualInput); + buttonGroup.put(TextInputMode.ONLY_SUPPORT_MANUAL, onlyManualInput); + buttonGroup.put(TextInputMode.ONLY_SUPPORT_SCAN_CODE, onlyScanCodeInput); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - panel.add(appScanCodeCheck); + panel.add(scanCodeAndManualInput); + panel.add(onlyManualInput); + panel.add(onlyScanCodeInput); final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); panelWrapper.add(panel, BorderLayout.NORTH); - return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, panelWrapper); + return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, + panelWrapper); } @Override public void populate(Widget widget) { MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr(); - ScanCodeState scanCodeState = mobileScanCodeAttr.getScanCodeState(); - appScanCodeCheck.setSelected(scanCodeState.getState()); + buttonGroup.setSelectButton(mobileScanCodeAttr.getTextInputMode()); } @Override public void update(Widget widget) { MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr(); - mobileScanCodeAttr.setScanCodeState(ScanCodeState.parse(appScanCodeCheck.isSelected())); + mobileScanCodeAttr.setTextInputMode(buttonGroup.getCurrentSelected()); } diff --git a/designer-realize/src/main/java/com/fr/start/common/SplashWindow.java b/designer-realize/src/main/java/com/fr/start/common/SplashWindow.java index 951fba3266..aa375c1dca 100644 --- a/designer-realize/src/main/java/com/fr/start/common/SplashWindow.java +++ b/designer-realize/src/main/java/com/fr/start/common/SplashWindow.java @@ -1,14 +1,12 @@ package com.fr.start.common; -import com.fr.base.BaseUtils; import com.fr.design.fun.OemProcessor; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.image4j.codec.ico.ICODecoder; import com.fr.stable.os.OperatingSystem; import com.fr.start.OemHandler; -import com.sun.awt.AWTUtilities; - import javax.swing.*; import java.awt.*; import java.awt.image.*; @@ -41,8 +39,6 @@ public class SplashWindow extends JFrame { this.setAlwaysOnTop(false); this.setUndecorated(true); - AWTUtilities.setWindowOpaque(this, false); - //使窗体背景透明 if (OperatingSystem.isWindows()) { this.setBackground(new Color(0, 0, 0, 0)); @@ -73,7 +69,7 @@ public class SplashWindow extends JFrame { this.setIconImages(image); } catch (IOException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png")); + this.setIconImage(IOUtils.readImage("/com/fr/base/images/oem/logo.png")); } }