diff --git a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java index 4ebc64103d..84fd684ae8 100644 --- a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java +++ b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java @@ -134,7 +134,7 @@ public abstract class DesignModelAdapter parameterNameList = new java.util.ArrayList(); java.util.List parameterValueList = new java.util.ArrayList(); - // 暂时屏蔽cptx直接访问 - if (path.endsWith(FileExtension.CPTX.getSuffix())) { - path = path.substring(0, path.length() - 1); - parameterNameList.add(AbstractWebletCreator.FORMAT); - parameterValueList.add(AbstractWebletCreator.X); - } - parameterNameList.add(actionType); parameterValueList.add(path); if (map != null) { diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/VerticalChoosePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/VerticalChoosePane.java index bd5f8ed51f..374efb1121 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/VerticalChoosePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/VerticalChoosePane.java @@ -9,6 +9,8 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerBean; import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.design.widget.FRWidgetFactory; import javax.swing.*; @@ -16,6 +18,7 @@ import java.awt.*; public class VerticalChoosePane extends ChoosePane implements DesignerBean { private static final int RIGHTBORDER = 5; + private static final int MAX_WIDTH = 60; public VerticalChoosePane(Previewable previewable) { this(previewable, -1); @@ -40,8 +43,7 @@ public class VerticalChoosePane extends ChoosePane implements DesignerBean { rs.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, -RIGHTBORDER)); UILabel l1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database"), UILabel.LEFT); UILabel l2 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Model"), UILabel.LEFT); - UILabel l3 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Select_Table"), UILabel.LEFT); - + UILabel l3 = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Select_Table"), MAX_WIDTH, UILabel.LEFT); if (labelSize > 0) { Dimension pSize = new Dimension(labelSize, 20); l1.setPreferredSize(pSize); @@ -52,7 +54,7 @@ public class VerticalChoosePane extends ChoosePane implements DesignerBean { Component[][] components = new Component[][]{ new Component[]{l1, dsNameComboBox}, new Component[]{l2, schemaBox}, - new Component[]{l3, rs} + new Component[]{l3, UIComponentUtils.wrapWithBorderLayoutPane(rs)} }; JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_HUGER, LayoutConstants.VGAP_LARGE); diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java index 3a64aa0759..09459f5b87 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java @@ -32,11 +32,11 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.ToolBarDef; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.design.utils.gui.UIComponentUtils; import com.fr.file.FILE; import com.fr.file.FILEChooserPane; import com.fr.file.filter.ChooseFileFilter; import com.fr.general.ComparatorUtils; - import com.fr.general.data.DataSource; import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; @@ -45,13 +45,24 @@ import com.fr.stable.StringUtils; import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLableReader; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -99,7 +110,7 @@ public class FileTableDataPane extends AbstractTableDataPane { private UIRadioButton commaDismenberRadioButton;// 逗号 private UIRadioButton otherDismenberRadioButton;// 其他 private UITextField otherDismenberTextField;// 其他分隔符编辑 - private UICheckBox igoreOneMoreDelimiterCheckBox;// 连续分隔符是否作为单一 + private UICheckBox ignoreOneMoreDelimiterCheckBox;// 连续分隔符是否作为单一 private UIComboBox charsetComboBox; private UILabel encodeLabel; private UILabel dismenberLabel; @@ -374,7 +385,8 @@ public class FileTableDataPane extends AbstractTableDataPane { bg2.add(spaceDismenberRadioButton); bg2.add(commaDismenberRadioButton); bg2.add(otherDismenberRadioButton); - igoreOneMoreDelimiterCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Series_Dismenber_As_Single"), true); + ignoreOneMoreDelimiterCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Series_Dismenber_As_Single"), true); + UIComponentUtils.setLineWrap(ignoreOneMoreDelimiterCheckBox); encodeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Encoding_Type") + ":"); charsetComboBox = new UIComboBox(EncodeConstants.ALL_ENCODING_ARRAY); Component[][] comps = { @@ -384,7 +396,7 @@ public class FileTableDataPane extends AbstractTableDataPane { {null,spaceDismenberRadioButton,null}, {null,commaDismenberRadioButton,null}, {null,otherDismenberRadioButton,otherDismenberTextField}, - {igoreOneMoreDelimiterCheckBox,null,null} + {ignoreOneMoreDelimiterCheckBox,null,null} }; northPane.add(TableLayoutHelper.createTableLayoutPane(comps, rowSize, columnSize),BorderLayout.EAST); } @@ -586,7 +598,7 @@ public class FileTableDataPane extends AbstractTableDataPane { } editorPane.populate(ttd.getParams()); needColumnNameCheckBox.setSelected(ttd.needColumnName()); - igoreOneMoreDelimiterCheckBox.setSelected(ttd.isIgnoreOneMoreDelimiter()); + ignoreOneMoreDelimiterCheckBox.setSelected(ttd.isIgnoreOneMoreDelimiter()); charsetComboBox.setSelectedItem(ttd.getCharset()); } @@ -624,7 +636,7 @@ public class FileTableDataPane extends AbstractTableDataPane { ttd.setFilePath(filePath); ttd.setParams(this.params); ttd.setDelimiter(this.showDelimiter()); - ttd.setIgnoreOneMoreDelimiter(igoreOneMoreDelimiterCheckBox.isSelected()); + ttd.setIgnoreOneMoreDelimiter(ignoreOneMoreDelimiterCheckBox.isSelected()); ttd.setNeedColumnName(needColumnNameCheckBox.isSelected()); ttd.setCharset((String)charsetComboBox.getSelectedItem()); fileTableData = ttd; diff --git a/designer-base/src/main/java/com/fr/design/designer/IntervalConstants.java b/designer-base/src/main/java/com/fr/design/designer/IntervalConstants.java index a2a2ee669e..3983bbe046 100644 --- a/designer-base/src/main/java/com/fr/design/designer/IntervalConstants.java +++ b/designer-base/src/main/java/com/fr/design/designer/IntervalConstants.java @@ -29,4 +29,6 @@ public class IntervalConstants { public static final int INTERVAL_W4 = 22; + public static final int INTERVAL_W5 = 10; + } diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginConstants.java b/designer-base/src/main/java/com/fr/design/extra/PluginConstants.java index b218d9205b..aa5538a403 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginConstants.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginConstants.java @@ -1,14 +1,14 @@ package com.fr.design.extra; +import com.fr.stable.StableUtils; +import com.fr.workspace.WorkContext; + /** * Created by ibm on 2017/5/25. */ public class PluginConstants { public static final int BYTES_NUM = 1024; - private static final String TEMP_PATH = System.getProperty("user.dir") + "/tmp"; - public static final String DOWNLOAD_PATH = System.getProperty("user.dir") + "/download"; - //插件依赖的下载位置 - public static final String DEPENDENCE_DOWNLOAD_PATH = System.getProperty("user.dir") + "/download/dependence"; + public static final String DOWNLOAD_PATH = StableUtils.pathJoin(WorkContext.getCurrent().getPath() + "/cache"); public static final String TEMP_FILE = "temp.zip"; public static final String CONNECTION_404 = "404"; diff --git a/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java b/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java index 3e4099bc62..54ddcd8c0e 100644 --- a/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java +++ b/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java @@ -16,6 +16,7 @@ import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.plugin.PluginStoreConstants; import com.fr.plugin.PluginVerifyException; +import com.fr.stable.CommonUtils; import com.fr.stable.EnvChangedListener; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; @@ -280,7 +281,11 @@ public class WebViewDlgHelper { try { if (get()) { - IOUtils.unzip(new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE)), installHome); + File scriptZip = new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE)); + if(scriptZip.exists()){ + IOUtils.unzip(scriptZip, installHome); + CommonUtils.deleteFile(scriptZip); + } PluginStoreConstants.refreshProps(); // 下载完刷新一下版本号等 JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE); } diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index a84442c588..f790eca94f 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -2,7 +2,6 @@ package com.fr.design.file; import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.base.io.BaseBook; -import com.fr.base.io.IOFile; import com.fr.design.DesignerEnvManager; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.data.DesignTableDataManager; @@ -10,17 +9,18 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.JTemplateFactory; import com.fr.design.mainframe.JVirtualTemplate; import com.fr.design.module.DesignModuleFactory; import com.fr.file.FILE; import com.fr.file.FileNodeFILE; +import com.fr.file.StashedFILE; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.CoreConstants; import com.fr.stable.StringUtils; import com.fr.third.org.apache.commons.io.FilenameUtils; -import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.util.ArrayList; import java.util.Collections; @@ -315,7 +315,7 @@ public class HistoryTemplateListCache implements CallbackEvent { /** * 切换环境时暂存打开的模板内容,key 是在历史中的index,value 是模板xml 内容byte[] */ - private Map bytesMap; + private Map stashFILEMap; /** * 切换环境前将正在编辑的模板暂存起来,并且在新环境中重新读取一遍,暂存的不是模板文件的内容而是模板对象的内容 @@ -326,20 +326,21 @@ public class HistoryTemplateListCache implements CallbackEvent { */ public void stash() { FineLoggerFactory.getLogger().info("Env Change Template Stashing..."); - if (bytesMap == null) { - bytesMap = new HashMap(); + if (stashFILEMap == null) { + stashFILEMap = new HashMap(); } else { - bytesMap.clear(); + stashFILEMap.clear(); } int size = historyList.size(); for (int i = 0; i < size; i++) { JTemplate template = historyList.get(i); + FILE file = template.getEditingFILE(); try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); BaseBook target = template.getTarget(); if (target != null) { target.export(outputStream); - bytesMap.put(i, outputStream.toByteArray()); + stashFILEMap.put(i, new StashedFILE(file, outputStream.toByteArray())); } // 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理 } catch (Exception e) { @@ -358,27 +359,31 @@ public class HistoryTemplateListCache implements CallbackEvent { */ public void load() { FineLoggerFactory.getLogger().info("Env Change Template Loading..."); - if (bytesMap != null && bytesMap.size() != 0) { + if (stashFILEMap != null && stashFILEMap.size() != 0) { int size = historyList.size(); for (int i = 0; i < size; i++) { try { - byte[] bytes = bytesMap.get(i); + FILE stashedFile = stashFILEMap.get(i); // 可能有模板 stash 失败的情况,在 load 的时候不更新它 - if (bytes == null) { + // 或者这个模板是被模板内存优化功能处理过的,不用处理 + if (stashedFile == null) { continue; } - ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes); - BaseBook target = historyList.get(i).getTarget(); - if (target != null) { - // todo readStream 这个行为应该上升到 BaseBook 上 - ((IOFile) target).readStream(inputStream); + JTemplate template = JTemplateFactory.createJTemplate(stashedFile); + if (template != null) { + historyList.set(i, template); + // 替换当前正在编辑的模板,使用添加并激活的方式,以便使用统一的入口来处理监听事件 + if (isCurrentEditingFile(template.getPath())) { + DesignerContext.getDesignerFrame().addAndActivateJTemplate(template); + setCurrentEditingTemplate(template); + FineLoggerFactory.getLogger().info("Env Change Current Editing Template."); + } } - // 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理 } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } - bytesMap.clear(); + stashFILEMap.clear(); MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList); MutilTempalteTabPane.getInstance().repaint(); } 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 27ab268dc9..d47805de96 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 @@ -6,11 +6,11 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itoolbar.UIToolBarUI; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; 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; @@ -23,7 +23,6 @@ import javax.swing.JSplitPane; import javax.swing.border.EmptyBorder; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Component; import java.awt.Cursor; import java.awt.Dimension; import java.awt.FlowLayout; @@ -159,14 +158,21 @@ abstract class UIControlPane extends JControlPane { } protected JPanel getLeftTopPane(UIToolbar topToolBar) { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f, isNewStyle() ? TOP_TOOLBAR_WIDTH : TOP_TOOLBAR_WIDTH_SHORT}; - double[] rowSize = {TOP_TOOLBAR_HEIGHT}; - Component[][] components = new Component[][]{ - new Component[]{new UILabel(getAddItemText()), new JPanel(), topToolBar}, - }; - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + UILabel addItemLabel = FRWidgetFactory.createLineWrapLabel(getAddItemText()); + + topToolBar.setPreferredSize( + new Dimension( + isNewStyle() ? TOP_TOOLBAR_WIDTH : TOP_TOOLBAR_WIDTH_SHORT, + TOP_TOOLBAR_HEIGHT + )); + JPanel toolBarPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + toolBarPane.add(topToolBar, BorderLayout.NORTH); + + JPanel leftTopPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + leftTopPane.add(toolBarPane, BorderLayout.EAST); + leftTopPane.add(addItemLabel, BorderLayout.CENTER); + + return leftTopPane; } /** diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java index 59ad63de60..624e2e8ee8 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java @@ -3,6 +3,7 @@ package com.fr.design.gui.ibutton; import com.fr.design.constants.UIConstants; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; +import com.fr.design.utils.gui.UIComponentUtils; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; import sun.swing.SwingUtilities2; @@ -25,6 +26,9 @@ import java.util.List; public class UIButtonGroup extends JPanel implements GlobalNameObserver { private static final long serialVersionUID = 1L; + private static final int TEXT_LENGTH = 3; + private static final int BUTTON_SIZE = 2; + private int currentButtonSize = 0; protected List labelButtonList; protected int selectedIndex = -1; private List objectList;// 起到一个render的作用 @@ -153,6 +157,7 @@ public class UIButtonGroup extends JPanel implements GlobalNameObserver { if (!ArrayUtils.isEmpty(objects) && textArray.length == objects.length) { this.objectList = Arrays.asList(objects); } + currentButtonSize = textArray.length; labelButtonList = new ArrayList(textArray.length); this.setLayout(getGridLayout(textArray.length)); this.setBorder(getGroupBorder()); @@ -213,10 +218,20 @@ public class UIButtonGroup extends JPanel implements GlobalNameObserver { protected void initButton(UIToggleButton labelButton) { labelButton.setBorderPainted(false); + adjustButton(labelButton); + UIComponentUtils.setLineWrap(labelButton); labelButtonList.add(labelButton); this.add(labelButton); } + private void adjustButton(UIToggleButton labelButton) { + if (labelButton.getText().length() > TEXT_LENGTH && currentButtonSize > BUTTON_SIZE) { + Dimension dimension = labelButton.getPreferredSize(); + dimension.height <<= 1; + labelButton.setPreferredSize(dimension); + } + } + protected Border getGroupBorder() { return BorderFactory.createEmptyBorder(1, 1, 1, 1); } diff --git a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java b/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java index 0fd211adfe..e43a68f22b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java +++ b/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java @@ -4,8 +4,8 @@ import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.data.core.DataCoreUtils; import com.fr.data.core.db.TableProcedure; -import com.fr.data.core.db.dialect.DialectFactory; -import com.fr.data.core.db.dialect.OracleDialect; +import com.fr.data.core.db.dialect.base.key.check.DataBaseDetail; +import com.fr.data.core.db.dialect.base.key.check.DataBaseType; import com.fr.data.impl.Connection; import com.fr.data.operator.DataOperator; import com.fr.design.DesignerEnvManager; @@ -13,7 +13,7 @@ import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.dnd.SerializableTransferable; import com.fr.file.ConnectionConfig; import com.fr.general.ComparatorUtils; - +import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; import javax.swing.*; @@ -138,21 +138,16 @@ public class TableViewList extends UIList { String[] schemas = DataCoreUtils.getDatabaseSchema(datasource); searchFilter = searchFilter.toLowerCase(); - - - boolean isOracle = DataOperator.getInstance().isOracle(datasource); boolean isOracleSystemSpace = DesignerEnvManager.getEnvManager().isOracleSystemSpace(); - // oracleb不勾选显示所有表,则只显示用户下的(包括存储过程和table表) - if (isOracle && !isOracleSystemSpace) { - java.sql.Connection connection = datasource.createConnection(); - OracleDialect orcDialect = (OracleDialect)DialectFactory.generateDialect(connection); - schemas = new String[]{orcDialect.getOracleCurrentUserSchema(connection)}; + // oracle不勾选显示所有表,则只显示用户下的(包括存储过程和table表) + DataBaseDetail detail = DataOperator.getInstance().getDataBaseDetail(datasource, isOracleSystemSpace); + if (ArrayUtils.isNotEmpty(detail.getSchemas())) { + schemas = detail.getSchemas(); } - if (typesFilter.length == 1 && ComparatorUtils.equals(typesFilter[0], TableProcedure.PROCEDURE)) { - return processStoreProcedure(defaultListModel, schemas, datasource, isOracle, searchFilter); + return processStoreProcedure(defaultListModel, schemas, datasource, DataBaseType.ORACLE.equals(detail.getType()), searchFilter); } else { - return processTableAndView(defaultListModel, schemas, datasource, searchFilter, isOracle, typesFilter); + return processTableAndView(defaultListModel, schemas, datasource, searchFilter, DataBaseType.ORACLE.equals(detail.getType()), typesFilter); } } @@ -182,7 +177,7 @@ public class TableViewList extends UIList { if (!isOracle) { String schema = null; for (String type : typesFilter) { - //非oracle数据库,默认都是显示所有表的,参数为true + //非oracle数据库,默认都是显示所有表的,参数为true TableProcedure[] sqlTables = DataCoreUtils.getTables(datasource, type, schema, true); for (int i = 0; i < sqlTables.length; i++) { if (isBlank || sqlTables[i].getName().toLowerCase().indexOf(searchFilter) != -1) { @@ -192,17 +187,17 @@ public class TableViewList extends UIList { } } else { for (String type : typesFilter) { - for (String schema : schemas) { - TableProcedure[] sqlTables = DataCoreUtils.getTables(datasource, type, schema, isOracleSystemSpace); - // oracle的表名加上模式 - for (int i = 0; i < sqlTables.length; i++) { - TableProcedure ta = sqlTables[i]; - String name = ta.getSchema() + '.' + ta.getName(); - if (isBlank || name.toLowerCase().indexOf(searchFilter) != -1) { - defaultListModel.addElement(sqlTables[i]); - } - } - } + for (String schema : schemas) { + TableProcedure[] sqlTables = DataCoreUtils.getTables(datasource, type, schema, isOracleSystemSpace); + // oracle的表名加上模式 + for (int i = 0; i < sqlTables.length; i++) { + TableProcedure ta = sqlTables[i]; + String name = ta.getSchema() + '.' + ta.getName(); + if (isBlank || name.toLowerCase().indexOf(searchFilter) != -1) { + defaultListModel.addElement(sqlTables[i]); + } + } + } } } return defaultListModel; diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java index f9b18b7f8d..51af636aa2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java @@ -2,8 +2,10 @@ package com.fr.design.gui.itree.filetree; import com.fr.base.FRContext; import com.fr.base.extension.FileExtension; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.file.NodeAuthProcessor; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; +import com.fr.design.mainframe.App; import com.fr.file.filetree.FileNode; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; @@ -15,7 +17,9 @@ import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreePath; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashSet; import java.util.List; +import java.util.Set; /* * 显示Env下的reportlets目录下面的所有cpt文件 @@ -124,9 +128,28 @@ public class TemplateFileTree extends EnvFileTree { } public FileNode[] listFile(String path) { + // 支持插件扩展, 先从env的filter拿, 再从插件拿 + Set supportTypes = createFileExtensionFilter(); return FRContext.getFileNodes().list( path, - new FileExtension[]{FileExtension.CPT, FileExtension.FRM, FileExtension.CHT, FileExtension.XLS, FileExtension.XLSX}); + supportTypes.toArray(new FileExtension[supportTypes.size()]) + ); + } + + private Set createFileExtensionFilter() { + Set supportTypes = new HashSet(); + if (filter != null) { + for (String temp : filter.getSupportedTypes()) { + supportTypes.add(FileExtension.parse(temp)); + } + } + Set apps = ExtraDesignClassManager.getInstance().getArray(App.MARK_STRING); + for (App temp : apps) { + for (String extendsion : temp.defaultExtensions()) { + supportTypes.add(FileExtension.parse(extendsion)); + } + } + return supportTypes; } /* @@ -205,18 +228,6 @@ public class TemplateFileTree extends EnvFileTree { if (fileNodes == null) { fileNodes = new FileNode[0]; } - // 用FileNodeFilter过滤一下 - if (filter != null) { - List list = new ArrayList(); - for (FileNode fileNode : fileNodes) { - if (filter.accept(fileNode)) { - list.add(fileNode); - } - } - - fileNodes = list.toArray(new FileNode[list.size()]); - } - Arrays.sort(fileNodes, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes())); return fileNodes; diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperLinkPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperLinkPane.java index bdd46a9ecd..ea0b6a9a1e 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperLinkPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperLinkPane.java @@ -4,9 +4,16 @@ import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPaneFactory; import com.fr.design.gui.frpane.ReportletParameterViewPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itableeditorpane.ParameterTableModel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.js.JavaScript; +import com.fr.js.LinkAnimateType; +import javax.swing.JPanel; +import java.awt.Dimension; import java.util.HashMap; /** @@ -16,6 +23,7 @@ public abstract class AbstractHyperLinkPane extends FurtherBasicBeanPane { private HashMap hyperLinkEditorMap; private boolean needRenamePane = false; protected ReportletParameterViewPane parameterViewPane; + private UIButtonGroup animateTypeUIButtonGroup; public AbstractHyperLinkPane(HashMap hyperLinkEditorMap, boolean needRenamePane) { @@ -41,6 +49,34 @@ public abstract class AbstractHyperLinkPane extends FurtherBasicBeanPane { public void reset() { } + protected JPanel createAnimateTypeUIButtonGroup() { + animateTypeUIButtonGroup = new UIButtonGroup( + new String[]{LinkAnimateType.RELOAD.toLocaleString(), LinkAnimateType.INCREMENT.toLocaleString()}, + new LinkAnimateType[]{LinkAnimateType.RELOAD, LinkAnimateType.INCREMENT}); + animateTypeUIButtonGroup.setPreferredSize(new Dimension(120,20)); + animateTypeUIButtonGroup.setSelectedIndex(1); + + JPanel jp = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); + + jp.add(new UILabel(Toolkit.i18nText("Fine-Design_Chart_Link_Animate_Type"))); + jp.add(animateTypeUIButtonGroup); + + return jp; + } + + protected void populateAnimateType(LinkAnimateType animateType) { + if (animateTypeUIButtonGroup != null && animateType != LinkAnimateType.NONE) { + animateTypeUIButtonGroup.setSelectedItem(animateType); + } + } + + protected LinkAnimateType updateAnimateType() { + if (animateTypeUIButtonGroup != null) { + return animateTypeUIButtonGroup.getSelectedItem(); + } + return LinkAnimateType.NONE; + } + protected int getChartParaType() { return hyperLinkEditorMap != null ? ParameterTableModel.CHART_NORMAL_USE : ParameterTableModel.NO_CHART_USE; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/AbstractAppProvider.java b/designer-base/src/main/java/com/fr/design/mainframe/AbstractAppProvider.java index 95a9696355..cc859ce178 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/AbstractAppProvider.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/AbstractAppProvider.java @@ -8,7 +8,7 @@ import com.fr.stable.fun.mark.API; * Created by Administrator on 2016/3/17/0017. */ @API(level = App.CURRENT_LEVEL) -public abstract class AbstractAppProvider extends AbstractProvider implements App{ +public abstract class AbstractAppProvider extends AbstractProvider implements App { public int currentAPILevel() { return CURRENT_LEVEL; @@ -21,12 +21,12 @@ public abstract class AbstractAppProvider extends AbstractProv @Override public void process() { - DesignerFrame.registApp(this); + JTemplateFactory.register(this); } - + @Override public void undo() { - - DesignerFrame.removeApp(this); + + JTemplateFactory.remove(this); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 714c561e7c..2cc83543c3 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -51,7 +51,6 @@ import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; -import com.fr.stable.CoreConstants; import com.fr.stable.OperatingSystem; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; @@ -115,11 +114,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta private static final int MENU_HEIGHT = 26; - private static final Integer SECOND_LAYER = new Integer(100); + private static final Integer SECOND_LAYER = 100; - private static final Integer TOP_LAYER = new Integer((200)); - - private static java.util.List> appList = new java.util.ArrayList>(); + private static final Integer TOP_LAYER = 200; private List designerOpenedListenerList = new ArrayList<>(); @@ -326,7 +323,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta this.progressDialog = new ProgressDialog(this); } - public void closeAuthorityEditing(){ + public void closeAuthorityEditing() { DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); WestRegionContainerPane.getInstance().replaceDownPane( TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); @@ -342,19 +339,22 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 注册app. * * @param app 注册app. + * @deprecated use {@link JTemplateFactory#register(App)} instead */ + @Deprecated public static void registApp(App app) { - - if (app != null) { - appList.add(app); - } + JTemplateFactory.register(app); } + /** + * 移除app + * + * @param app app + * @deprecated use {@link JTemplateFactory#remove(App)} instead + */ + @Deprecated public static void removeApp(App app) { - - if (app != null) { - appList.remove(app); - } + JTemplateFactory.remove(app); } /** @@ -1027,39 +1027,17 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ private void openFile(FILE tplFile) { - String fileName = tplFile.getName(); - int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT); - if (indexOfLastDot < 0) { + JTemplate jt = JTemplateFactory.createJTemplate(tplFile); + if (jt == null) { return; } - String fileExtention = fileName.substring(indexOfLastDot + 1); - for (int i = 0, len = appList.size(); i < len; i++) { - App app = appList.get(i); - String[] defaultAppExtentions = app.defaultExtensions(); - boolean opened = false; - for (int j = 0; j < defaultAppExtentions.length; j++) { - if (defaultAppExtentions[j].equalsIgnoreCase(fileExtention)) { - // 不要catch - JTemplate jt = app.openTemplate(tplFile); - - if (jt == null) { - return; - } - // 新的form不往前兼容 - if (inValidDesigner(jt)) { - this.addAndActivateJTemplate(); - MutilTempalteTabPane.getInstance().setTemTemplate( - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); - } else { - activeTemplate(jt); - } - opened = true; - break; - } - } - if (opened) { - break; - } + // 新的form不往前兼容 + if (inValidDesigner(jt)) { + this.addAndActivateJTemplate(); + MutilTempalteTabPane.getInstance().setTemTemplate( + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); + } else { + activeTemplate(jt); } } 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 3e7b952869..8525023799 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 @@ -610,7 +610,7 @@ public abstract class JTemplate> } else { JOptionPane.showMessageDialog( DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), + Toolkit.i18nText("Fine-Design-Basic_Save_Failure"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.WARNING_MESSAGE); return false; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java new file mode 100644 index 0000000000..1c68665353 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java @@ -0,0 +1,63 @@ +package com.fr.design.mainframe; + +import com.fr.file.FILE; +import com.fr.stable.CoreConstants; +import com.fr.third.javax.annotation.Nonnull; +import com.fr.third.javax.annotation.Nullable; + +import java.util.ArrayList; +import java.util.List; + +public final class JTemplateFactory { + private static final List> ALL_APP = new ArrayList>(); + + private JTemplateFactory() { + } + + /** + * 生成设计器编辑模板对象 + * + * @param file 包含了模板名称,类型以及内容的文件 + * @return 设计器编辑的模板对象 + */ + @Nullable + public static JTemplate createJTemplate(@Nonnull FILE file) { + + String fileName = file.getName(); + int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT); + if (indexOfLastDot < 0) { + return null; + } + String fileExtension = fileName.substring(indexOfLastDot + 1); + for (App app : ALL_APP) { + String[] defaultAppExtensions = app.defaultExtensions(); + for (String defaultAppExtension : defaultAppExtensions) { + if (defaultAppExtension.equalsIgnoreCase(fileExtension)) { + JTemplate jt = app.openTemplate(file); + if (jt != null) { + return jt; + } + } + } + } + return null; + } + + + /** + * 注册app. + * + * @param app 注册app. + */ + public static void register(App app) { + if (app != null) { + ALL_APP.add(app); + } + } + + public static void remove(App app) { + if (app != null) { + ALL_APP.remove(app); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index b46719efe4..3885ff71d5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -496,7 +496,6 @@ public abstract class ToolBarMenuDock { if (WorkContext.getCurrent().isLocal()) { shortCuts.add(new SoftwareUpdateAction()); } - if (AlphaFineConfigManager.isALPHALicAvailable()) { shortCuts.add(new AlphaFineAction()); } diff --git a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java index 1592fe59ad..c18749c12c 100644 --- a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java +++ b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java @@ -24,6 +24,7 @@ import java.util.List; public class MenuDef extends ShortCut { private static final int MENU_DEFAULTWDITH = 156; + private static final int BLANK_WIDTH = 30; protected String name; //右侧属性表弹出框重绘 protected Boolean isEastAttr = false; @@ -410,7 +411,7 @@ public class MenuDef extends ShortCut { popupMenu = new UIPopupEastAttrMenu(); popupMenu.setInvoker(button); MenuDef.this.updateEastPopupMenu(popupMenu); - popupMenu.setPopupSize(new Dimension(MENU_DEFAULTWDITH, popupMenu.getPreferredSize().height)); + updatePopupMenuSize(); GUICoreUtils.showPopupMenu(popupMenu, button, 0, button.getSize().height); } else { popupMenu = new UIPopupMenu(); @@ -421,6 +422,12 @@ public class MenuDef extends ShortCut { } }; + private void updatePopupMenuSize() { + int preferredWidth = popupMenu.getPreferredSize().width - BLANK_WIDTH; // 减少行尾的空白部分 + int popupMenuWidth = preferredWidth > MENU_DEFAULTWDITH ? preferredWidth : MENU_DEFAULTWDITH; + popupMenu.setPopupSize(new Dimension(popupMenuWidth, popupMenu.getPreferredSize().height)); + } + //ben: for ui test public JPopupMenu getPopupMenu() { diff --git a/designer-base/src/main/java/com/fr/design/parameter/ParaDefinitePane.java b/designer-base/src/main/java/com/fr/design/parameter/ParaDefinitePane.java index 43e260bfd6..303e48a40d 100644 --- a/designer-base/src/main/java/com/fr/design/parameter/ParaDefinitePane.java +++ b/designer-base/src/main/java/com/fr/design/parameter/ParaDefinitePane.java @@ -1 +1,24 @@ -package com.fr.design.parameter; import com.fr.base.Parameter; public interface ParaDefinitePane { public Parameter[] getNoRepeatParas(Parameter[] paras); public void setParameterArray(Parameter[] ps); public Parameter[] getParameterArray(); public void refreshParameter(); public boolean isWithQueryButton(); public void addingParameter2Editor(Parameter p); public void addingParameter2EditorWithQueryButton(Parameter p); public void addingAllParameter2Editor(); } \ No newline at end of file +package com.fr.design.parameter; + +import com.fr.base.Parameter; + + +public interface ParaDefinitePane { + + Parameter[] getNoRepeatParas(Parameter[] paras); + + void setParameterArray(Parameter[] ps); + + Parameter[] getParameterArray(); + + void refreshParameter(); + + boolean isWithQueryButton(); + + void addingParameter2Editor(Parameter p); + + void addingParameter2EditorWithQueryButton(Parameter p); + + void addingAllParameter2Editor(); + +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java index a2f6e70d61..59aed2a6f0 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBackgroundPane.java @@ -6,6 +6,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.style.background.BackgroundDetailPane; import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.design.widget.FRWidgetFactory; import com.fr.general.Background; import javax.swing.BorderFactory; @@ -42,9 +43,8 @@ public class GradientBackgroundPane extends BackgroundDetailPane { JPanel blankJp = new JPanel(); gradientBar = new GradientBar(4, 254); blankJp.add(gradientBar); - UILabel jl = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Drag_To_Select_Gradient")); + UILabel jl = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Drag_To_Select_Gradient")); jl.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); - UIComponentUtils.setLineWrap(jl); jl.setHorizontalAlignment(SwingConstants.CENTER); gradientPanel.add(jl, BorderLayout.NORTH); gradientPanel.add(blankJp, BorderLayout.SOUTH); diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java index 676369e75c..3e1f98555f 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java @@ -1,8 +1,15 @@ package com.fr.design.utils.gui; import com.fr.design.gui.core.UITextComponent; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.stable.StringUtils; +import javax.swing.JComponent; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; + /** * 包含 UI 组件相关的工具方法 * Created by plough on 2019/1/11. @@ -48,4 +55,31 @@ public class UIComponentUtils { } comp.setText(prefix + comp.getText()); } + + /** + * 将一个组件包装到 BorderLayout 布局的面板中 + * @param comp,待包装的组件 + * @param layoutConstraint,添加的方向,如 BorderLayout.NORTH + * @return 包装好的 JPanel + */ + public static JPanel wrapWithBorderLayoutPane(Component comp, String layoutConstraint) { + JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + panel.add(comp, layoutConstraint); + return panel; + } + + /** + * 将一个组件包装到 BorderLayout 布局的面板中 + * @param comp,待包装的组件 + * @return 包装好的 JPanel(布局方向为 BorderLayout.NORTH) + */ + public static JPanel wrapWithBorderLayoutPane(Component comp) { + return wrapWithBorderLayoutPane(comp, BorderLayout.NORTH); + } + + public static void setPreferedWidth(JComponent comp, int width) { + Dimension dim = comp.getPreferredSize(); + dim.setSize(width, dim.getHeight()); + comp.setPreferredSize(dim); + } } diff --git a/designer-base/src/main/java/com/fr/design/widget/FRWidgetFactory.java b/designer-base/src/main/java/com/fr/design/widget/FRWidgetFactory.java new file mode 100644 index 0000000000..4db368bc3f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/widget/FRWidgetFactory.java @@ -0,0 +1,51 @@ +package com.fr.design.widget; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.utils.gui.UIComponentUtils; + +/** + * 创建 widget 的静态工厂 + * Created by plough on 2019/1/15. + */ +public class FRWidgetFactory { + // 不可实例化 + private FRWidgetFactory() { + throw new AssertionError(); + } + + /** + * 创建一个可换行的 UILabel + * @param text 标签文字 + * @return com.fr.design.gui.ilable.UILabel + */ + public static UILabel createLineWrapLabel(String text) { + UILabel label = new UILabel(text); + UIComponentUtils.setLineWrap(label); + return label; + } + + /** + * 创建一个可换行的 UILabel + * @param text 标签文字 + * @param lineWidth 最大行宽 + * @return com.fr.design.gui.ilable.UILabel + */ + public static UILabel createLineWrapLabel(String text, int lineWidth) { + UILabel label = new UILabel(text); + UIComponentUtils.setLineWrap(label, lineWidth); + return label; + } + + /** + * 创建一个可换行可调整水平对齐的 UILabel + * @param text + * @param lineWidth + * @param horizontalAlignment + * @return com.fr.design.gui.ilable.UILabel + */ + public static UILabel createLineWrapLabel(String text, int lineWidth, int horizontalAlignment) { + UILabel label = createLineWrapLabel(text, lineWidth); + label.setHorizontalAlignment(horizontalAlignment); + return label; + } +} diff --git a/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java b/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java index 4bbbcecfbc..5476cb3a16 100644 --- a/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java @@ -8,7 +8,6 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; - import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingConstants; @@ -19,19 +18,20 @@ import java.awt.Component; * Created by plough on 2017/8/7. */ public class WidgetBoundsPaneFactory { + private static final int RIGHT_PANE_WIDTH = 145; public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) { JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Size")), createRightPane(width, height)}, + new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Size")), createRightPane(width, height)}, new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, }; double[] rowSize = {p, p}; - double[] columnSize = {p, f}; + double[] columnSize = {f, RIGHT_PANE_WIDTH}; int[][] rowCount = {{1, 1}, {1, 1}}; - final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L6); + final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); boundsPane.add(panel); return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane); @@ -53,18 +53,18 @@ public class WidgetBoundsPaneFactory { double p = TableLayout.PREFERRED; Component[][] northComponents = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Position")), createRightPane(x, y)}, + new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Position")), createRightPane(x, y)}, new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_X_Coordinate"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Y_Coordinate"), SwingConstants.CENTER))}, }; Component[][] centerComponents = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Size")), createRightPane(width, height)}, + new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Size")), createRightPane(width, height)}, new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, }; double[] rowSize = {p, p}; - double[] columnSize = {p, f}; + double[] columnSize = {f, RIGHT_PANE_WIDTH}; int[][] rowCount = {{1, 1}, {1, 1}}; - final JPanel northPanel = TableLayoutHelper.createGapTableLayoutPane(northComponents, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L6); - final JPanel centerPanel = TableLayoutHelper.createGapTableLayoutPane(centerComponents, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L6); + final JPanel northPanel = TableLayoutHelper.createGapTableLayoutPane(northComponents, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6); + final JPanel centerPanel = TableLayoutHelper.createGapTableLayoutPane(centerComponents, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6); JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); northPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); diff --git a/designer-base/src/main/java/com/fr/file/FileFILE.java b/designer-base/src/main/java/com/fr/file/FileFILE.java index d5a9beb42e..5331cd7785 100644 --- a/designer-base/src/main/java/com/fr/file/FileFILE.java +++ b/designer-base/src/main/java/com/fr/file/FileFILE.java @@ -201,7 +201,7 @@ public class FileFILE implements FILE { OutputStream out; try { StableUtils.makesureFileExist(file); - out = new FileOutputStream(file); + out = new FileOutputStream(file, true); } catch (Exception e) { throw SessionLocalManager.createLogPackedException(e); } diff --git a/designer-base/src/main/java/com/fr/file/StashedFILE.java b/designer-base/src/main/java/com/fr/file/StashedFILE.java new file mode 100644 index 0000000000..4bc9b431ea --- /dev/null +++ b/designer-base/src/main/java/com/fr/file/StashedFILE.java @@ -0,0 +1,106 @@ +package com.fr.file; + +import javax.swing.Icon; +import javax.transaction.NotSupportedException; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.OutputStream; + +/** + * 切换环境用于暂存的文件类型 + */ +public class StashedFILE implements FILE { + + private FILE file; + private byte[] content; + + public StashedFILE(FILE file, byte[] content) { + this.file = file; + this.content = content; + } + + @Override + public String prefix() { + return file.prefix(); + } + + @Override + public boolean isDirectory() { + return file.isDirectory(); + } + + @Override + public String getName() { + return file.getName(); + } + + @Override + public Icon getIcon() { + return file.getIcon(); + } + + @Override + public String getPath() { + return file.getPath(); + } + + @Override + public void setPath(String path) { + throw new UnsupportedOperationException(); + } + + @Override + public FILE getParent() { + throw new UnsupportedOperationException(); + } + + @Override + public FILE[] listFiles() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean createFolder(String name) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean mkfile() throws Exception { + throw new UnsupportedOperationException(); + } + + @Override + public boolean exists() { + return false; + } + + @Override + public void closeTemplate() throws Exception { + // do nothing + } + + @Override + public InputStream asInputStream() throws Exception { + return new ByteArrayInputStream(content); + } + + @Override + public OutputStream asOutputStream() throws Exception { + throw new NotSupportedException(); + } + + @Override + public String getEnvFullName() { + return file.getEnvFullName(); + } + + @Override + public boolean isMemFile() { + return true; + } + + @Override + public boolean isEnvFile() { + return false; + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateCellLinkPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateCellLinkPane.java index 897aef8f79..185f776159 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateCellLinkPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateCellLinkPane.java @@ -8,12 +8,12 @@ import com.fr.design.gui.itextfield.UITextField; import com.fr.design.hyperlink.AbstractHyperLinkPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; - import com.fr.stable.ColumnRow; import com.fr.stable.ParameterProvider; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Dimension; import java.util.HashMap; import java.util.List; @@ -53,12 +53,18 @@ public class ChartHyperRelateCellLinkPane extends AbstractHyperLinkPane targetFrameComboBox = formHyperlinkEditors == null ? new UIComboBox() : new UIComboBox(getFormHyperlinkEditNames()); targetFrameComboBox.setRenderer(new DefaultListCellRenderer()); double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p}; + double[] rowSize = {p, p}; double[] columnSize = {p, TableLayout.FILL}; Component[][] components; if (!this.needRenamePane) { diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkPane.java index a9e209fc3d..f815094c3d 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkPane.java @@ -7,13 +7,13 @@ import com.fr.design.hyperlink.AbstractHyperLinkPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.ui.ElementCaseEditorProvider; - import com.fr.js.FormHyperlinkProvider; import com.fr.stable.ParameterProvider; import com.fr.stable.bridge.StableFactory; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; import java.util.HashMap; public class FormHyperlinkPane extends AbstractHyperLinkPane { @@ -35,13 +35,18 @@ public class FormHyperlinkPane extends AbstractHyperLinkPane{ private static final long serialVersionUID = 4740461028440155147L; private static final int TOP = -5; + private static final int TABLE_DATA_LABEL_LINE_WRAP_WIDTH = 65; + private static final int TABLE_DATA_PANE_WIDTH = 246; private DatabaseTableDataPane tableDataPane; private AbstractTableDataContentPane dataContentPane; @@ -36,8 +39,9 @@ public class TableDataPane extends FurtherBasicBeanPane{ } private void initDataPane() { - UILabel label = new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TableData")) ; - label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH,ChartDataPane.LABEL_HEIGHT)); + UILabel label = new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TableData")); + UIComponentUtils.setLineWrap(label, TABLE_DATA_LABEL_LINE_WRAP_WIDTH); + tableDataPane = new DatabaseTableDataPane(label) { @Override protected void userEvent() { @@ -46,7 +50,7 @@ public class TableDataPane extends FurtherBasicBeanPane{ } }; - tableDataPane.setPreferredSize(new Dimension(246 , 20)); + tableDataPane.setPreferredSize(new Dimension(TABLE_DATA_PANE_WIDTH , tableDataPane.getPreferredSize().height)); this.setBorder(BorderFactory.createEmptyBorder(TOP,0,0,0)); this.add(tableDataPane, BorderLayout.NORTH); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java index 8f450d2597..a0580ba468 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java @@ -8,9 +8,16 @@ import com.fr.design.dialog.BasicScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.ibutton.UIButtonGroup; -import javax.swing.*; +import javax.swing.JPanel; import javax.swing.border.Border; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.List; @@ -18,6 +25,7 @@ import java.util.List; public abstract class ThirdTabPane extends BasicBeanPane{ private static final long serialVersionUID = 2298609199400393886L; + private static final int MIN_TAB_HEIGHT = 25; protected UIButtonGroup tabPane; protected String[] nameArray; public JPanel centerPane; @@ -49,7 +57,12 @@ public abstract class ThirdTabPane extends BasicBeanPane{ if (!paneList.isEmpty()) { tabPane = new UIButtonGroup(nameArray); tabPane.setSelectedIndex(0); - tabPane.setPreferredSize(new Dimension(60 * nameArray.length, 25)); + int prefHeight = tabPane.getPreferredSize().height; + int prefWidth = tabPane.getPreferredSize().width + 20; // 暂且加一个偏移量 + int minWidth = 60 * nameArray.length; + tabPane.setPreferredSize( + new Dimension(prefWidth > minWidth ? prefWidth : minWidth, + prefHeight > MIN_TAB_HEIGHT ? prefHeight : MIN_TAB_HEIGHT)); tabPane.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java b/designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java index e8311cd2a8..bea3beba9a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java +++ b/designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java @@ -10,6 +10,7 @@ import com.fr.general.IOUtils; import com.fr.general.CloudCenter; import com.fr.general.http.HttpClient; import com.fr.plugin.chart.DownloadSourcesEvent; +import com.fr.stable.CommonUtils; import com.fr.stable.StableUtils; import com.fr.workspace.WorkContext; @@ -140,6 +141,7 @@ public class DownloadOnlineSourcesHelper implements DownloadSourcesEvent { if (result) { //安装文件 IOUtils.unZipFilesGBK(temp, StableUtils.pathJoin(WorkContext.getCurrent().getPath(), siteInfo.localDir)); + CommonUtils.deleteFile(file); } } else { result = false; diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java index a71babe8f9..12c42408f1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java @@ -11,7 +11,8 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; - +import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.design.widget.FRWidgetFactory; import com.fr.plugin.chart.base.AttrSeriesImageBackground; import com.fr.plugin.chart.column.VanChartColumnPlot; import com.fr.stable.Constants; @@ -91,8 +92,9 @@ public class VanChartColumnSeriesPane extends VanChartAbstractPlotSeriesPane { }; JPanel panel2 = TableLayout4VanChartHelper.createGapTableLayoutPane(components2, row, col); + UILabel fillImageLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Filled_With_Image")); Component[][] components3 = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Filled_With_Image")),isFillWithImage}, + new Component[]{fillImageLabel, UIComponentUtils.wrapWithBorderLayoutPane(isFillWithImage)}, }; JPanel panel3 = TableLayout4VanChartHelper.createGapTableLayoutPane(components3, row, col); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/TableLayout4VanChartHelper.java b/designer-chart/src/main/java/com/fr/van/chart/designer/TableLayout4VanChartHelper.java index da918bb792..f377cee917 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/TableLayout4VanChartHelper.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/TableLayout4VanChartHelper.java @@ -5,6 +5,8 @@ import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.design.widget.FRWidgetFactory; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -57,11 +59,11 @@ public class TableLayout4VanChartHelper { double f = TableLayout.FILL; double[] columnSize = {f, componentWidth}; double[] rowSize = {p, p}; - UILabel label = new UILabel(title); + UILabel label = FRWidgetFactory.createLineWrapLabel(title); label.setVerticalAlignment(SwingConstants.TOP); Component[][] components = new Component[][]{ new Component[]{null, null}, - new Component[]{label, component}, + new Component[]{label, UIComponentUtils.wrapWithBorderLayoutPane(component)}, }; return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, COMPONENT_INTERVAL, LayoutConstants.VGAP_LARGE); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java index 9e42722650..e6bee7c550 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java @@ -14,6 +14,7 @@ import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.utils.gui.UIComponentUtils; import com.fr.plugin.chart.base.VanChartHtmlLabel; import com.fr.van.chart.designer.style.VanChartStylePane; @@ -56,6 +57,7 @@ public class VanChartHtmlLabelPane extends JPanel{ public VanChartHtmlLabelPane() { useHtml = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Html")); + UIComponentUtils.setLineWrap(useHtml); JPanel widthAndHeightPane = createWidthAndHeightPane(); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java index 012677304a..78f93162f8 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java @@ -6,6 +6,8 @@ import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; +import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.design.widget.FRWidgetFactory; import com.fr.plugin.chart.base.VanChartAttrLine; import com.fr.plugin.chart.type.LineStyle; import com.fr.stable.Constants; @@ -52,7 +54,10 @@ public class VanChartLineTypePane extends BasicPane { Component[][] components = new Component[][]{ new Component[]{null,null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")),lineWidth}, + new Component[]{ + FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")), + UIComponentUtils.wrapWithBorderLayoutPane(lineWidth) + }, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Present")),lineStyle}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break")),nullValueBreak}, }; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java index ca28a6624c..134598bd71 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java @@ -13,6 +13,8 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.style.color.ColorSelectBox; +import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.design.widget.FRWidgetFactory; import com.fr.plugin.chart.base.TrendLineType; import com.fr.plugin.chart.base.VanChartAttrTrendLine; import com.fr.plugin.chart.base.VanChartConstants; @@ -65,7 +67,10 @@ public class VanChartTrendLinePane extends BasicPane{ Component[][] components = new Component[][]{ new Component[]{null, null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Name")), trendLineName}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")), trendLineStyle}, + new Component[]{ + FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")), + UIComponentUtils.wrapWithBorderLayoutPane(trendLineStyle) + }, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), trendLineColor}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Type")), trendLineType}, new Component[]{label, periodPane} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderPane.java index c90fef0a41..478929662d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderPane.java @@ -8,7 +8,8 @@ import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.style.color.ColorSelectBox; - +import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.design.widget.FRWidgetFactory; import com.fr.stable.CoreConstants; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -41,10 +42,13 @@ public class VanChartBorderPane extends BasicPane { } protected Component[][] getUseComponent() { + UILabel lineStyleLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")); + UILabel colorLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")); + return new Component[][]{ new Component[]{null,null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")),currentLineCombo}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")),currentLineColorPane}, + new Component[]{lineStyleLabel, UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo)}, + new Component[]{colorLabel, currentLineColorPane}, }; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithAlphaPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithAlphaPane.java index d185f735a1..e2ff67c911 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithAlphaPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithAlphaPane.java @@ -3,6 +3,8 @@ package com.fr.van.chart.designer.component.border; import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.design.widget.FRWidgetFactory; import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.base.AttrBorderWithAlpha; @@ -29,7 +31,10 @@ public class VanChartBorderWithAlphaPane extends VanChartBorderPane{ protected Component[][] getUseComponent() { return new Component[][]{ new Component[]{null,null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")),currentLineCombo}, + new Component[]{ + FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")), + UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo) + }, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")),currentLineColorPane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha")), transparent} }; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java index f23e0f01ec..63eff90477 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java @@ -4,6 +4,8 @@ import com.fr.chart.base.AttrBorder; import com.fr.chart.chartglyph.GeneralInfo; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.design.widget.FRWidgetFactory; import javax.swing.JSeparator; @@ -28,7 +30,10 @@ public class VanChartBorderWithRadiusPane extends VanChartBorderPane { protected Component[][] getUseComponent() { return new Component[][]{ new Component[]{null,null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")),currentLineCombo}, + new Component[]{ + FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")), + UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo) + }, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")),currentLineColorPane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Radius")),radius} } ; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java index fbe2d903e1..d3a437ef25 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java @@ -14,6 +14,7 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; +import com.fr.design.utils.gui.UIComponentUtils; import com.fr.plugin.chart.attr.VanChartLegend; import com.fr.stable.Constants; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -165,6 +166,7 @@ public class VanChartPlotLegendPane extends BasicPane { location.setAllToolTips(textArray); customFloatPositionButton = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Float_Position")); + UIComponentUtils.setLineWrap(customFloatPositionButton); customFloatPositionButton.setEventBannded(true); Component[][] components = new Component[][]{ diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java index 0fdd61f92b..39d0b8f1bd 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java @@ -4,7 +4,6 @@ package com.fr.van.chart.designer.style; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; - import com.fr.plugin.chart.attr.VanChartLegend; import com.fr.plugin.chart.range.VanChartRangeLegend; import com.fr.plugin.chart.type.LegendType; @@ -53,6 +52,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { gradualLegendPane.setParentPane(parent); //区域段图例面板 sectionLegendPane = createSectionLegendPane(); + sectionLegendPane.setParentPane(parent); JPanel panel = new JPanel(new CardLayout()){ @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java index 64d5fe357d..c99dccace9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java @@ -17,6 +17,7 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; +import com.fr.design.utils.gui.UIComponentUtils; import com.fr.plugin.chart.attr.VanChartTitle; import com.fr.plugin.chart.vanchart.VanChart; import com.fr.stable.Constants; @@ -129,6 +130,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { private JPanel createTitleContentPane(double[] row, double[] col){ titleContent = new TinyFormulaPane(); useHtml = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Html")); + UIComponentUtils.setLineWrap(useHtml); Component[][] components = new Component[][]{ new Component[]{null ,null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"), SwingConstants.LEFT), titleContent}, @@ -146,6 +148,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { alignmentPane = new UIButtonGroup(alignmentIconArray, alignment); customFloatPositionButton = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Float_Position")); + UIComponentUtils.setLineWrap(customFloatPositionButton); customFloatPositionButton.setEventBannded(true); Component[][] components = new Component[][]{ diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java index ca9419c427..ac88b9be4d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java @@ -20,7 +20,8 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.style.color.ColorSelectBox; - +import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.design.widget.FRWidgetFactory; import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.base.VanChartConstants; import com.fr.plugin.chart.type.AxisTickLineType; @@ -123,6 +124,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { titleAlignPane.setSelectedItem(Constants.CENTER); titleContent = new TinyFormulaPane(); titleUseHtml = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Html")); + UIComponentUtils.setLineWrap(titleUseHtml); titleTextAttrPane = new ChartTextAttrPane(); titleTextRotation = new UINumberDragPane(-ROTATION_MAX,ROTATION_MAX); if(isXAxis){ @@ -136,7 +138,10 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { new Component[]{null,titleUseHtml}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position")),titleAlignPane}, new Component[]{titleTextAttrPane,null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TextRotation")),titleTextRotation}, + new Component[]{ + FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TextRotation")), + UIComponentUtils.wrapWithBorderLayoutPane(titleTextRotation) + }, }; JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); @@ -168,7 +173,10 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { labelGapStyle = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Fixed")}); labelGapValue = new UITextField(); Component[][] gapComponents = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TextRotation")), labelTextRotation}, + new Component[]{ + FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TextRotation")), + UIComponentUtils.wrapWithBorderLayoutPane(labelTextRotation) + }, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Label_Interval")), labelGapStyle}, }; JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(gapComponents, row, col); @@ -250,7 +258,10 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { reversed = 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}); Component[][] components = new Component[][]{ new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Position")),position}, + new Component[]{ + FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Position")), + UIComponentUtils.wrapWithBorderLayoutPane(position) + }, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_AxisReversed")),reversed}, } ; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java index fe8b0f0321..e3f45a9c0a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java @@ -9,6 +9,8 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; +import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.design.widget.FRWidgetFactory; import com.fr.plugin.chart.base.AttrTooltip; import com.fr.van.chart.designer.PlotFactory; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -149,7 +151,7 @@ public class VanChartPlotTooltipPane extends BasicPane { double[] rowSize = { p,p,p}; Component[][] components = new Component[3][2]; components[0] = new Component[]{null,null}; - components[1] = new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Prompt_Box")),followMouse}; + components[1] = new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Prompt_Box")), UIComponentUtils.wrapWithBorderLayoutPane(followMouse)}; if(plot.isSupportTooltipSeriesType() && hasTooltipSeriesType()){ components[2] = new Component[]{showAllSeries,null}; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java index 68386f3095..b16c9237e1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java @@ -109,6 +109,7 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane{ resetTitleAttr(chart); //重置监控刷新选项 resetRefreshMoreLabelAttr((VanChart)chart); + resetFilterDefinition(chart); } @@ -118,6 +119,10 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane{ chart.setTitle(vanChartPlot.getDefaultTitle()); } + //重置数据配置 + protected void resetFilterDefinition(Chart chart){ + + } //重置监控刷新面板 protected void resetRefreshMoreLabelAttr(VanChart chart){ diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java index 76a47afd84..244660adf5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java @@ -6,10 +6,10 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.mainframe.chart.gui.type.ChartImagePane; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; - import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.map.MapIndependentVanChart; import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.map.data.VanMapDefinition; import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper; import com.fr.van.chart.designer.type.AbstractVanChartTypePane; @@ -129,6 +129,11 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane { } + @Override + protected void resetFilterDefinition(Chart chart) { + chart.setFilterDefinition(new VanMapDefinition()); + } + protected void resetAttr(Plot plot) { sourceChoosePane.resetComponentValue((VanChartMapPlot) plot); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionLegendPane.java index 0265a4f73a..828f40d733 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionLegendPane.java @@ -4,9 +4,9 @@ import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula; - import com.fr.plugin.chart.range.SectionLegend; import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -24,6 +24,10 @@ public class SectionLegendPane extends JPanel{ initComponents(); } + public void setParentPane(VanChartStylePane parent){ + labelFormPane.setParentPane(parent); + } + private void initComponents() { intervalConfigPane = createSectionIntervalConfigPane(this.parent); JPanel intervalConfigPaneWithTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Section_Config"), intervalConfigPane); diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/events/CreatorEventListenerTable.java b/designer-form/src/main/java/com/fr/design/designer/beans/events/CreatorEventListenerTable.java index 94665c02bf..2c0c285049 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/events/CreatorEventListenerTable.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/events/CreatorEventListenerTable.java @@ -1,10 +1,11 @@ package com.fr.design.designer.beans.events; -import java.util.ArrayList; - import com.fr.design.designer.creator.XComponent; import com.fr.general.ComparatorUtils; +import javax.swing.SwingUtilities; +import java.util.ArrayList; + public class CreatorEventListenerTable { protected ArrayList listeners; @@ -18,7 +19,7 @@ public class CreatorEventListenerTable { return; } for (int i = 0; i < listeners.size(); i++) { - if (ComparatorUtils.equals(listener,listeners.get(i))) { + if (ComparatorUtils.equals(listener, listeners.get(i))) { listeners.set(i, listener); return; } @@ -26,10 +27,15 @@ public class CreatorEventListenerTable { listeners.add(listener); } - private void fireCreatorModified(DesignerEvent evt) { + private void fireCreatorModified(final DesignerEvent evt) { for (int i = 0; i < listeners.size(); i++) { - DesignerEditListener listener = listeners.get(i); - listener.fireCreatorModified(evt); + final DesignerEditListener listener = listeners.get(i); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + listener.fireCreatorModified(evt); + } + }); } } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditListener.java b/designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditListener.java index fe170dc6d0..798c6090de 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditListener.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditListener.java @@ -4,11 +4,12 @@ import java.util.EventListener; /** * 界面设计组件触发的编辑处理器接口 - * @since 6.5.4 + * * @author richer + * @since 6.5.4 */ public interface DesignerEditListener extends EventListener { - void fireCreatorModified(DesignerEvent evt); - + void fireCreatorModified(DesignerEvent evt); + } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java index 62cea356d6..bac50642e0 100644 --- a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java @@ -3,21 +3,6 @@ */ package com.fr.design.form.parameter; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Image; -import java.awt.Insets; -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.swing.BorderFactory; -import javax.swing.JComponent; -import javax.swing.JPanel; - import com.fr.base.BaseUtils; import com.fr.base.Parameter; import com.fr.base.parameter.ParameterUI; @@ -39,7 +24,17 @@ import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.form.util.XCreatorConstants; -import com.fr.design.mainframe.*; +import com.fr.design.mainframe.AuthorityEditPane; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.EastRegionContainerPane; +import com.fr.design.mainframe.FormArea; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.FormDesignerModeForSpecial; +import com.fr.design.mainframe.FormParaPane; +import com.fr.design.mainframe.FormWidgetDetailPane; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.mainframe.WidgetToolBarPane; import com.fr.design.parameter.ParaDefinitePane; import com.fr.design.parameter.ParameterDesignerProvider; import com.fr.design.parameter.ParameterPropertyPane; @@ -51,9 +46,22 @@ import com.fr.form.ui.WidgetValue; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WParameterLayout; - import com.fr.stable.ArrayUtils; +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JPanel; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Insets; +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + /** * Created by IntelliJ IDEA. * User : Richer @@ -169,7 +177,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP this.getEditListenerTable().addListener(new DesignerEditListener() { @Override - public void fireCreatorModified(DesignerEvent evt) { + public void fireCreatorModified(final DesignerEvent evt) { if (evt.getCreatorEventID() != DesignerEvent.CREATOR_SELECTED) { paraDefinitePane.setParameterArray( paraDefinitePane.getNoRepeatParas(DesignModelAdapter.getCurrentModelAdapter().getParameters())); @@ -220,7 +228,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP /** * 刷新参数 * - * @param p 参数面板 + * @param p 参数面板 * @param jt 当前模版 */ public void refreshParameter(ParaDefinitePane p, JTemplate jt) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java index c2b8ff7f3d..3346f7d14e 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java @@ -18,7 +18,6 @@ import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; import com.fr.design.parameter.HierarchyTreePane; - import javax.swing.Action; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -37,112 +36,112 @@ import java.util.ArrayList; */ public class FormHierarchyTreePane extends FormDockView implements HierarchyTreePane { - private static final int NODE_LENGTH = 2; - private static final int PARA = 0; - private static final int BODY = 1; + private static final int NODE_LENGTH = 2; + private static final int PARA = 0; + private static final int BODY = 1; private static final int SHORTS_SEPARATOR_POS = 4; private static final int TOOLBAR_PADDING_RIGHT = 10; - private ShortCut4JControlPane[] shorts; - private ComponentTree componentTree; - - public static FormHierarchyTreePane getInstance() { - return HOLDER.singleton; - } - - public static FormHierarchyTreePane getInstance(FormDesigner editor) { - HOLDER.singleton.setEditingFormDesigner(editor); - HOLDER.singleton.refreshDockingView(); - return HOLDER.singleton; - } - - private static class HOLDER { - private static FormHierarchyTreePane singleton = new FormHierarchyTreePane(); - } - - private FormHierarchyTreePane() { - setLayout(new BorderLayout(0, 0)); - } - - @Override - public String getViewTitle() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Hierarchy_Tree"); - } - - @Override - public Icon getViewIcon() { - return BaseUtils.readIcon("/com/fr/design/images/m_report/tree.png"); - } - - public ComponentTree getComponentTree() { - return componentTree; - } - - /** - * 清除 - */ - public void clearDockingView() { - this.componentTree = null; - } - - @Override - /** - * 刷新 - */ - public void refreshDockingView() { - FormDesigner formDesigner = this.getEditingFormDesigner(); - removeAll(); - if(this.componentTree != null) { - this.componentTree.removeAll(); - } - if (formDesigner == null) { - clearDockingView(); - return; - } - componentTree = new ComponentTree(formDesigner); - formDesigner.addDesignerEditListener(new DesignerEditListener() { - @Override - public void fireCreatorModified(DesignerEvent evt) { - refreshComponentTree(); - } - }); - - ComponentTreeModel treeModel = (ComponentTreeModel) componentTree.getModel(); - XCreator root = (XCreator)treeModel.getRoot(); - int childCount = treeModel.getChildCount(root); - //按照节点添加para在下的,但这里需要para节点在上,调整一下位置 - if(childCount == NODE_LENGTH){ - adjustPosition(treeModel, formDesigner); - } - - add(getWidgetPane(), BorderLayout.CENTER); - - // 这里要刷新一下,否则控件树中没有任何一个控件处于选中状态 - refreshComponentTree(); - } - - private void refreshComponentTree() { - componentTree.setAndScrollSelectionPath(componentTree.getSelectedTreePath()); - componentTree.refreshUI(); - } - - private JPanel getWidgetPane() { - shorts = createShortcuts(); - - JPanel widgetPane = new JPanel(); - widgetPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - - widgetPane.add(getToolBarPane(), BorderLayout.CENTER); - UIScrollPane scrollPane = new UIScrollPane(componentTree); - scrollPane.setBorder(BorderFactory.createEmptyBorder()); - scrollPane.setPreferredSize(new Dimension(210, 170)); - widgetPane.add(scrollPane, BorderLayout.SOUTH); - return widgetPane; - } - - private JPanel getToolBarPane() { - UIToolbar toolBar = ToolBarDef.createJToolBar(); - toolBar.setUI(new UIToolBarUI(){ + private ShortCut4JControlPane[] shorts; + private ComponentTree componentTree; + + public static FormHierarchyTreePane getInstance() { + return HOLDER.singleton; + } + + public static FormHierarchyTreePane getInstance(FormDesigner editor) { + HOLDER.singleton.setEditingFormDesigner(editor); + HOLDER.singleton.refreshDockingView(); + return HOLDER.singleton; + } + + private static class HOLDER { + private static FormHierarchyTreePane singleton = new FormHierarchyTreePane(); + } + + private FormHierarchyTreePane() { + setLayout(new BorderLayout(0, 0)); + } + + @Override + public String getViewTitle() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Hierarchy_Tree"); + } + + @Override + public Icon getViewIcon() { + return BaseUtils.readIcon("/com/fr/design/images/m_report/tree.png"); + } + + public ComponentTree getComponentTree() { + return componentTree; + } + + /** + * 清除 + */ + public void clearDockingView() { + this.componentTree = null; + } + + @Override + /** + * 刷新 + */ + public void refreshDockingView() { + FormDesigner formDesigner = this.getEditingFormDesigner(); + removeAll(); + if (this.componentTree != null) { + this.componentTree.removeAll(); + } + if (formDesigner == null) { + clearDockingView(); + return; + } + componentTree = new ComponentTree(formDesigner); + formDesigner.addDesignerEditListener(new DesignerEditListener() { + @Override + public void fireCreatorModified(DesignerEvent evt) { + refreshComponentTree(); + } + }); + + ComponentTreeModel treeModel = (ComponentTreeModel) componentTree.getModel(); + XCreator root = (XCreator) treeModel.getRoot(); + int childCount = treeModel.getChildCount(root); + //按照节点添加para在下的,但这里需要para节点在上,调整一下位置 + if (childCount == NODE_LENGTH) { + adjustPosition(treeModel, formDesigner); + } + + add(getWidgetPane(), BorderLayout.CENTER); + + // 这里要刷新一下,否则控件树中没有任何一个控件处于选中状态 + refreshComponentTree(); + } + + private void refreshComponentTree() { + componentTree.setAndScrollSelectionPath(componentTree.getSelectedTreePath()); + componentTree.refreshUI(); + } + + private JPanel getWidgetPane() { + shorts = createShortcuts(); + + JPanel widgetPane = new JPanel(); + widgetPane.setLayout(FRGUIPaneFactory.createBorderLayout()); + + widgetPane.add(getToolBarPane(), BorderLayout.CENTER); + UIScrollPane scrollPane = new UIScrollPane(componentTree); + scrollPane.setBorder(BorderFactory.createEmptyBorder()); + scrollPane.setPreferredSize(new Dimension(210, 170)); + widgetPane.add(scrollPane, BorderLayout.SOUTH); + return widgetPane; + } + + private JPanel getToolBarPane() { + UIToolbar toolBar = ToolBarDef.createJToolBar(); + toolBar.setUI(new UIToolBarUI() { @Override public void paint(Graphics g, JComponent c) { Graphics2D g2 = (Graphics2D) g; @@ -157,80 +156,80 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree shorts[i].getShortCut().intoJToolBar(toolBar); } - JPanel toolBarPane = new JPanel(new BorderLayout()); - toolBarPane.add(toolBar, BorderLayout.CENTER); - toolBarPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.BARNOMAL)); - JPanel toolBarPaneWrapper = new JPanel(new BorderLayout()); - toolBarPaneWrapper.add(toolBarPane, BorderLayout.CENTER); - toolBarPaneWrapper.setBorder(BorderFactory.createEmptyBorder(1, 0, 2, TOOLBAR_PADDING_RIGHT)); - return toolBarPaneWrapper; - } + JPanel toolBarPane = new JPanel(new BorderLayout()); + toolBarPane.add(toolBar, BorderLayout.CENTER); + toolBarPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.BARNOMAL)); + JPanel toolBarPaneWrapper = new JPanel(new BorderLayout()); + toolBarPaneWrapper.add(toolBarPane, BorderLayout.CENTER); + toolBarPaneWrapper.setBorder(BorderFactory.createEmptyBorder(1, 0, 2, TOOLBAR_PADDING_RIGHT)); + return toolBarPaneWrapper; + } - protected ShortCut4JControlPane[] createShortcuts() { + protected ShortCut4JControlPane[] createShortcuts() { ArrayList shortCutList = new ArrayList<>(); FormDesigner designer = getEditingFormDesigner(); for (Action action : designer.getActions()) { - shortCutList.add(new WidgetEnableShortCut((UndoableAction)action)); + shortCutList.add(new WidgetEnableShortCut((UndoableAction) action)); } return shortCutList.toArray(new ShortCut4JControlPane[shortCutList.size()]); - } - - /** - * 调整结构树para和body的位置 - * - * @param treeModel - * @param formDesigner - */ - private void adjustPosition(ComponentTreeModel treeModel,FormDesigner formDesigner){ - XCreator root = (XCreator)treeModel.getRoot(); - XCreator firstChild = (XCreator)treeModel.getChild(root,PARA); - if(firstChild.acceptType(XWParameterLayout.class)){ - return; - } - // 绝对布局作为body的时候 - // 获取第一个子节点的方法中屏蔽了fit - // 这边另外处理一下 - else if (firstChild.acceptType(XWAbsoluteBodyLayout.class) && firstChild.getBackupParent() != null) { - firstChild = firstChild.getBackupParent(); - } - root.add(firstChild,BODY); - treeModel.setRoot(root); - componentTree = new ComponentTree(formDesigner,treeModel); - } - - /** - * 刷新树 - */ - public void refreshRoot() { - if (componentTree == null) { - return; - } - componentTree.refreshTreeRoot(); - } - - @Override - /** - * 位置 - * - * @return 位置 - */ - public Location preferredLocation() { - return Location.WEST_BELOW; - } - - private class WidgetEnableShortCut extends ShortCut4JControlPane { - public WidgetEnableShortCut(ShortCut shortCut) { - this.shortCut = shortCut; - } - - /** - * 检查是否可用 - */ - @Override - public void checkEnable() { - this.shortCut.setEnabled(false); - } - } + } + + /** + * 调整结构树para和body的位置 + * + * @param treeModel + * @param formDesigner + */ + private void adjustPosition(ComponentTreeModel treeModel, FormDesigner formDesigner) { + XCreator root = (XCreator) treeModel.getRoot(); + XCreator firstChild = (XCreator) treeModel.getChild(root, PARA); + if (firstChild.acceptType(XWParameterLayout.class)) { + return; + } + // 绝对布局作为body的时候 + // 获取第一个子节点的方法中屏蔽了fit + // 这边另外处理一下 + else if (firstChild.acceptType(XWAbsoluteBodyLayout.class) && firstChild.getBackupParent() != null) { + firstChild = firstChild.getBackupParent(); + } + root.add(firstChild, BODY); + treeModel.setRoot(root); + componentTree = new ComponentTree(formDesigner, treeModel); + } + + /** + * 刷新树 + */ + public void refreshRoot() { + if (componentTree == null) { + return; + } + componentTree.refreshTreeRoot(); + } + + @Override + /** + * 位置 + * + * @return 位置 + */ + public Location preferredLocation() { + return Location.WEST_BELOW; + } + + private class WidgetEnableShortCut extends ShortCut4JControlPane { + public WidgetEnableShortCut(ShortCut shortCut) { + this.shortCut = shortCut; + } + + /** + * 检查是否可用 + */ + @Override + public void checkEnable() { + this.shortCut.setEnabled(false); + } + } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index 76ae9926e3..f49f2859b2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -7,18 +7,29 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.widget.FRWidgetFactory; import com.fr.form.share.ShareLoader; import com.fr.form.ui.SharableWidgetBindInfo; -import com.fr.log.FineLoggerFactory; - import com.fr.general.CloudCenter; +import com.fr.log.FineLoggerFactory; import com.fr.share.ShareConstants; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.DefaultComboBoxModel; +import javax.swing.Icon; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.SwingWorker; import javax.swing.filechooser.FileNameExtensionFilter; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Desktop; +import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -35,27 +46,19 @@ import java.net.URISyntaxException; * Time: 下午8:18 */ public class FormWidgetDetailPane extends FormDockView{ + private static final int LOCAL_WIDGET_LABEL_WIDTH = 90; - private JPanel tabbedPane; private UIScrollPane downPane; private JPanel reuWidgetPanel; private UIComboBox comboBox; private SharableWidgetBindInfo[] elCaseBindInfoList; private UIButton deleteButton; - private UIButton resetButton; private JPanel editPanel; private JPanel resetPanel; - private JPanel menutPanel; private JPanel menutPanelNorthPane; - private static final int OFFSET_X = 140; - private static final int OFFSET_Y = 26; private SwingWorker sw; //组件面板是否可以编辑 private boolean isEdit; - private CardLayout card; - - private static final String REPORT_TAB = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Engine_Report"); - private static final String CHART_TAB = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_ToolBar_Chart"); public static FormWidgetDetailPane getInstance() { if (HOLDER.singleton == null) { @@ -135,14 +138,15 @@ public class FormWidgetDetailPane extends FormDockView{ * 初始化菜单栏面板 */ private void initMenuPanel() { - menutPanel = new JPanel(); + JPanel menutPanel = new JPanel(); menutPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); menutPanel.setBorder(BorderFactory.createEmptyBorder(3, 10, 10, 15)); -// menutPanel.setPreferredSize(new Dimension(240, 48)); menutPanelNorthPane = new JPanel(new BorderLayout()); - menutPanelNorthPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Local_Widget"), - SwingConstants.HORIZONTAL), BorderLayout.WEST); + UILabel localWidgetLabel = FRWidgetFactory.createLineWrapLabel( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Local_Widget"), + LOCAL_WIDGET_LABEL_WIDTH); + menutPanelNorthPane.add(localWidgetLabel, BorderLayout.WEST); menutPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); menutPanelNorthPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); @@ -174,7 +178,7 @@ public class FormWidgetDetailPane extends FormDockView{ */ private JPanel initResetButtonPane() { resetPanel = new JPanel(); - resetButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Reset")); + UIButton resetButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Reset")); resetPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); resetButton.setBackground(Color.white); resetButton.setForeground(new Color(0x333334)); diff --git a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java index b25f167522..a48d64fdc1 100644 --- a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java @@ -22,6 +22,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.widget.accessibles.AccessibleBackgroundEditor; +import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.ui.designer.AbstractDataModify; import com.fr.form.ui.container.WParameterLayout; import com.fr.general.Background; @@ -104,6 +105,7 @@ public class RootDesignDefinePane extends AbstractDataModify { JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); labelNameTextField = new UITextField(); displayReport = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Display_Nothing_Before_Query")); + UIComponentUtils.setLineWrap(displayReport); useParamsTemplate = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Use_Params_Template")); background = new AccessibleBackgroundEditor(); Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java index b983118651..cf435c1d0d 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java @@ -11,6 +11,7 @@ import com.fr.design.gui.style.FRFontPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.form.ui.Label; @@ -24,6 +25,7 @@ import java.awt.*; * Created by ibm on 2017/8/3. */ public class LabelDefinePane extends AbstractDataModify