diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 73da53d4b8..dba3141b73 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -4,7 +4,6 @@ package com.fr.design; import com.fr.base.BaseXMLUtils; -import com.fr.base.FRContext; import com.fr.base.Utils; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.constants.UIConstants; @@ -179,7 +178,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { try { XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile()); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } // james:如果没有env定义,要设置一个默认的 @@ -282,11 +281,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { Handler handler = new FileHandler(fileName, true); handler.setFormatter(new FRLogFormatter()); - FRContext.getLogger().addLogHandler(handler); + FineLoggerFactory.getLogger().addLogHandler(handler); } catch (SecurityException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } catch (IOException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } } @@ -323,7 +322,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } fileWriter.close(); } catch (IOException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -345,7 +344,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { try { XMLTools.readFileXML(designerEnvManager, prevEnvFile); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } // 清空前一个版本中的工作目录和最近打开 nameEnvMap = new ListMap(); @@ -626,7 +625,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { fout.flush(); fout.close(); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index e15d81c4ba..110b97563c 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -97,7 +97,6 @@ public class EnvChangeEntrance { }); return false; } - // 如果版本不一致,且确认 不继续 连接,这里返回 false. if (!versionCheckAndConfirm(selectedEnv)) { return false; @@ -225,6 +224,7 @@ public class EnvChangeEntrance { @Override public void doCancel() { envListDialog.dispose(); + // todo 断开了但是没选择新的环境,那么尝试重连旧环境,等接口 } }); envListDialog.setVisible(true); diff --git a/designer-base/src/main/java/com/fr/design/actions/community/UpAction.java b/designer-base/src/main/java/com/fr/design/actions/community/UpAction.java index d1baef84f0..157f775b8c 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/UpAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/UpAction.java @@ -1,16 +1,15 @@ package com.fr.design.actions.community; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; - import com.fr.general.CloudCenter; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.JOptionPane; +import javax.swing.KeyStroke; +import java.awt.Desktop; import java.awt.event.ActionEvent; import java.io.IOException; import java.net.URI; @@ -33,7 +32,7 @@ public class UpAction extends UpdateAction { String url = CloudCenter.getInstance().acquireUrlByKind("bbs.update"); if (StringUtils.isEmpty(url)) { - FRContext.getLogger().info("The URL is empty!"); + FineLoggerFactory.getLogger().info("The URL is empty!"); return; } try { diff --git a/designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java b/designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java index d50d4dc1b6..83aeaefe3d 100644 --- a/designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java +++ b/designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java @@ -1,6 +1,5 @@ package com.fr.design.actions.core; -import com.fr.base.FRContext; import com.fr.base.Utils; import com.fr.design.actions.UpdateAction; import com.fr.design.file.HistoryTemplateListPane; @@ -215,7 +214,7 @@ public class ActionFactory { c.setAccessible(true); return c.newInstance(); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } return null; } @@ -281,7 +280,7 @@ public class ActionFactory { Constructor c = (Constructor) clazz.getConstructor(cls); actions.add(c.newInstance(obj)); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } } @@ -301,7 +300,7 @@ public class ActionFactory { Constructor c = (Constructor) clazz.getConstructor(); actionNames.add(c.newInstance().getMenuKeySet()); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } } @@ -336,7 +335,7 @@ public class ActionFactory { Constructor c = (Constructor) clazz.getConstructor(cls); actions.add(c.newInstance(obj)); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } return actions.toArray(new UpdateAction[actions.size()]); @@ -355,7 +354,7 @@ public class ActionFactory { constructor.setAccessible(true); return constructor.newInstance(); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } return null; } diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index c6aebd2a28..9e4b7c2c00 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -23,6 +23,8 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; 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 com.fr.general.ComparatorUtils; import com.fr.general.FRFont; import com.fr.general.Inter; @@ -32,8 +34,17 @@ import com.fr.third.apache.log4j.Level; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.KeyStroke; +import javax.swing.SwingUtilities; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; @@ -61,6 +72,7 @@ public class PreferencePane extends BasicPane { private static final int CACHING_MAX = 10; private static final int CACHING_DEFAULT = 5; private static final int CACHING_GAP = 5; + private static final int MEMORY_TIP_LABEL_MAX_WIDTH = 230; private static final String TYPE = "pressed"; private static final String DISPLAY_TYPE = "+"; @@ -471,7 +483,8 @@ public class PreferencePane extends BasicPane { private JPanel createMemoryPane() { JPanel memoryPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Caching_Template")); UILabel memoryLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Max_Caching_Template")); - UILabel memoryTipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Caching_Template_Tip")); + UILabel memoryTipLabel = FRWidgetFactory.createLineWrapLabel( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Caching_Template_Tip"), MEMORY_TIP_LABEL_MAX_WIDTH); memoryTipLabel.setBorder(BorderFactory.createEmptyBorder(0, CACHING_GAP, 0, 0)); cachingTemplateSpinner = new UISpinner(0, CACHING_MAX, 1, CACHING_DEFAULT); JPanel memorySpace = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); diff --git a/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java b/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java index 5434abc092..de223e2ccc 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java @@ -1,6 +1,5 @@ package com.fr.design.actions.file; -import com.fr.base.extension.FileExtension; import com.fr.base.vcs.DesignerMode; import com.fr.design.fun.PreviewProvider; import com.fr.design.mainframe.DesignerContext; @@ -9,8 +8,8 @@ import com.fr.design.utils.DesignUtils; import com.fr.file.FILE; import com.fr.file.FileNodeFILE; import com.fr.general.GeneralUtils; +import com.fr.general.web.ParameterConstants; import com.fr.stable.project.ProjectConstants; -import com.fr.stable.web.AbstractWebletCreator; import javax.swing.JOptionPane; import java.util.Collections; @@ -26,7 +25,11 @@ public final class WebPreviewUtils { @SuppressWarnings("unchecked") public static void preview(JTemplate jt, PreviewProvider provider) { String baseRoute = jt.route(); - actionPerformed(jt, baseRoute, provider == null ? Collections.EMPTY_MAP : provider.parametersForPreview(), provider.getActionType()); + if (provider == null) { + actionPerformed(jt, baseRoute, Collections.EMPTY_MAP, ParameterConstants.VIEWLET); + } else { + actionPerformed(jt, baseRoute, provider.parametersForPreview(), provider.getActionType()); + } } private static void actionPerformed(JTemplate jt, String baseRoute, Map map, String actionType) { @@ -85,13 +88,6 @@ public final class WebPreviewUtils { java.util.List 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/actions/file/export/AbstractExportAction.java b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java index 536fc87ee5..17d19aab71 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java @@ -1,7 +1,7 @@ package com.fr.design.actions.file.export; -import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.JTemplateAction; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.gui.iprogressbar.FRProgressBar; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; @@ -9,6 +9,7 @@ import com.fr.design.mainframe.JTemplate; import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.file.FILE; import com.fr.file.FILEChooserPane; +import com.fr.file.RenameExportFILE; import com.fr.file.filter.ChooseFileFilter; import com.fr.io.exporter.DesignExportType; import com.fr.io.exporter.ExporterKey; @@ -92,12 +93,17 @@ public abstract class AbstractExportAction> extends JT int saveValue = fileChooserPane.showSaveDialog(DesignerContext.getDesignerFrame(), "." + this.getDefaultExtension()); if (saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION) { FILE target = fileChooserPane.getSelectedFILE(); + //rename 方式导出 + target = RenameExportFILE.create(target); try { target.mkfile(); } catch (Exception exp) { FineLoggerFactory.getLogger().error("Error In Make New File", exp); } - FineLoggerFactory.getLogger().info("\"" + target.getName() + "\"" + Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"); + FineLoggerFactory.getLogger().info( + "\"" + RenameExportFILE.recoverFileName(target.getName()) + "\"" + + Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!" + ); progressbar = new FRProgressBar( createExportWork(getSource(), target, para), @@ -124,7 +130,7 @@ public abstract class AbstractExportAction> extends JT private boolean processNotSaved() { //当前编辑的模板 E e = getEditingComponent(); - if (!e.isALLSaved() && !DesignerMode.isVcsMode()) { + if (!e.isALLSaved() && !DesignModeContext.isVcsMode()) { e.stopEditing(); int returnVal = JOptionPane.showConfirmDialog( DesignerContext.getDesignerFrame(), @@ -149,7 +155,7 @@ public abstract class AbstractExportAction> extends JT private SwingWorker createExportWork(final FILE source, final FILE target, final Map parameterMap) { final String path = source.getPath(); - final String name = target.getName(); + final String name = RenameExportFILE.recoverFileName(target.getName()); return new SwingWorker() { @@ -162,7 +168,6 @@ public abstract class AbstractExportAction> extends JT dealExporter(outputStream, path, parameterMap); this.setProgress(80); outputStream.flush(); - outputStream.close(); this.setProgress(100); FineLoggerFactory.getLogger().info("\"" + name + "\"" + Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!"); diff --git a/designer-base/src/main/java/com/fr/design/actions/help/FeedBackPane.java b/designer-base/src/main/java/com/fr/design/actions/help/FeedBackPane.java index 1aa8ea7d4d..4b1a701a23 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/FeedBackPane.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/FeedBackPane.java @@ -4,7 +4,6 @@ package com.fr.design.actions.help; -import com.fr.base.FRContext; import com.fr.base.FeedBackInfo; import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicDialog; @@ -23,7 +22,12 @@ import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import javax.swing.SwingWorker; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; import javax.swing.border.MatteBorder; @@ -31,7 +35,12 @@ import javax.swing.plaf.ColorUIResource; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.PlainDocument; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; @@ -299,7 +308,7 @@ public class FeedBackPane extends BasicPane { } catch (Exception e) { isSendSuccessful = false; if (!(e instanceof CancellationException)) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } } diff --git a/designer-base/src/main/java/com/fr/design/actions/help/ForumAction.java b/designer-base/src/main/java/com/fr/design/actions/help/ForumAction.java index 65ce1924c0..2d4814d2ed 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/ForumAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/ForumAction.java @@ -5,16 +5,15 @@ package com.fr.design.actions.help; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; - import com.fr.general.CloudCenter; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.JOptionPane; +import javax.swing.KeyStroke; +import java.awt.Desktop; import java.awt.event.ActionEvent; import java.io.IOException; import java.net.URI; @@ -42,7 +41,7 @@ public class ForumAction extends UpdateAction { public void actionPerformed(ActionEvent e) { String url = CloudCenter.getInstance().acquireUrlByKind("bbs"); if (StringUtils.isEmpty(url)) { - FRContext.getLogger().info("The URL is empty!"); + FineLoggerFactory.getLogger().info("The URL is empty!"); return; } try { diff --git a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java index 3c51f4bbd4..58221a03a8 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java @@ -1,13 +1,13 @@ package com.fr.design.actions.help; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.base.Utils; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; import com.fr.general.CloudCenter; import com.fr.general.GeneralContext; import com.fr.general.http.HttpToolbox; +import com.fr.log.FineLoggerFactory; import com.fr.stable.CommonUtils; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; @@ -38,11 +38,11 @@ public class TutorialAction extends UpdateAction { private void nativeExcuteMacInstallHomePrograms(String appName) { String installHome = StableUtils.getInstallHome(); if(installHome == null) { - FRContext.getLogger().error("Can not find the install home, please check it."); + FineLoggerFactory.getLogger().error("Can not find the install home, please check it."); } else { String appPath = StableUtils.pathJoin(new String[]{installHome, "bin", appName}); if(!(new File(appPath)).exists()) { - FRContext.getLogger().error(appPath + " can not be found."); + FineLoggerFactory.getLogger().error(appPath + " can not be found."); } String cmd = "open " + appPath; @@ -51,7 +51,7 @@ public class TutorialAction extends UpdateAction { try { runtime.exec(cmd); } catch (IOException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } diff --git a/designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java b/designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java index 188c330538..b76e3feed5 100644 --- a/designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java @@ -1,16 +1,18 @@ package com.fr.design.condition; -import com.fr.base.FRContext; import com.fr.design.actions.UpdateAction; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.menu.ToolBarDef; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.log.FineLoggerFactory; - -import javax.swing.*; +import javax.swing.BoxLayout; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JScrollPane; import java.awt.Dimension; import java.util.HashMap; import java.util.Iterator; @@ -88,9 +90,9 @@ public abstract class ConditionAttributesPane extends BasicBeanPane { try { return clazz.newInstance(); } catch (InstantiationException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } catch (IllegalAccessException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } return null; } diff --git a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java index 6dac67b1fc..bed0dc96b0 100644 --- a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java @@ -1,7 +1,6 @@ package com.fr.design.data; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.base.TableData; import com.fr.data.TableDataSource; import com.fr.data.api.StoreProcedureAssist; @@ -28,14 +27,17 @@ import com.fr.design.menu.LineSeparator; import com.fr.design.menu.MenuDef; import com.fr.general.ComparatorUtils; import com.fr.general.NameObject; +import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; -import javax.swing.*; +import javax.swing.DefaultCellEditor; +import javax.swing.Icon; +import javax.swing.JTree; import javax.swing.event.CellEditorListener; import javax.swing.event.ChangeEvent; import javax.swing.tree.TreeCellEditor; -import java.awt.*; +import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; @@ -413,7 +415,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp } } catch (Exception ex) { - FRContext.getLogger().error(ex.getMessage(), ex); + FineLoggerFactory.getLogger().error(ex.getMessage(), ex); } } diff --git a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java index ec1f69d98b..9c892de011 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java @@ -1,9 +1,9 @@ package com.fr.design.data; -import com.fr.base.FRContext; import com.fr.base.StoreProcedureParameter; import com.fr.base.TableData; import com.fr.data.TableDataSource; +import com.fr.data.TableDataSourceTailor; import com.fr.data.core.DataCoreXmlUtils; import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.storeproc.ProcedureDataModel; @@ -29,6 +29,7 @@ import com.fr.file.TableDataConfig; import com.fr.general.ComparatorUtils; import com.fr.general.data.DataModel; import com.fr.general.data.TableDataException; +import com.fr.log.FineLoggerFactory; import com.fr.script.Calculator; import com.fr.stable.ArrayUtils; import com.fr.stable.ParameterProvider; @@ -444,7 +445,7 @@ public abstract class DesignTableDataManager { parameter.setValue(parameterMap.get(parameter.getName())); } } - return DataOperator.getInstance().previewTableData(tableDataSource, tabledata, parameterMap, rowCount); + return DataOperator.getInstance().previewTableData(TableDataSourceTailor.extractTableData(tableDataSource), tabledata, parameterMap, rowCount); } catch (Exception e) { throw new TableDataException(e.getMessage(), e); } finally { @@ -488,7 +489,7 @@ public abstract class DesignTableDataManager { } rs.release(); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java index d004ba6af9..9ec67adb64 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java @@ -1,7 +1,6 @@ package com.fr.design.data.datapane; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.base.TableData; import com.fr.data.core.DataCoreUtils; import com.fr.data.core.db.DBUtils; @@ -33,12 +32,15 @@ import com.fr.design.mainframe.DesignerFrame; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.file.ConnectionConfig; import com.fr.general.ComparatorUtils; - import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; -import javax.swing.*; +import javax.swing.JList; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTree; +import javax.swing.SwingWorker; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.PopupMenuEvent; @@ -49,7 +51,9 @@ import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.ItemEvent; @@ -432,7 +436,7 @@ public class ChoosePane extends BasicBeanPane implements Refresha tree.expandPath(path); } } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -473,7 +477,7 @@ public class ChoosePane extends BasicBeanPane implements Refresha DesignerEnvManager.getEnvManager().getMaxNumberOrPreviewRow()); } catch (Exception e) { failedToFindTable(); - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -530,7 +534,7 @@ public class ChoosePane extends BasicBeanPane implements Refresha // daniel:增加参数 colNames = DataOperator.getInstance().getColumns(selectedDSName, paras.getSchemaName(), selectedTableObject); } catch (Exception e2) { - FRContext.getLogger().error(e2.getMessage(), e2); + FineLoggerFactory.getLogger().error(e2.getMessage(), e2); } if (colNames == null) { diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePaneSupportFormula.java b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePaneSupportFormula.java index 263d2de53a..0ca42c0f92 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePaneSupportFormula.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePaneSupportFormula.java @@ -1,7 +1,6 @@ package com.fr.design.data.datapane; import com.fr.base.BaseFormula; -import com.fr.base.FRContext; import com.fr.base.Parameter; import com.fr.base.ParameterHelper; import com.fr.base.ParameterMapNameSpace; @@ -15,9 +14,10 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.parameter.ParameterInputPane; import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; import com.fr.script.Calculator; -import javax.swing.*; +import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import java.awt.event.ItemEvent; @@ -113,7 +113,7 @@ public class ChoosePaneSupportFormula extends ChoosePane { selectedDSName = Utils.objectToString(ca.eval(BaseFormula.createFormulaBuilder().build(item))); // selectedDSName = ParameterHelper.analyzeCurrentContextTableData4Templatee(item, parameters); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } else { selectedDSName = item; @@ -156,7 +156,7 @@ public class ChoosePaneSupportFormula extends ChoosePane { dsName = dsItem.startsWith("=") ? Utils.objectToString(ca.eval(BaseFormula.createFormulaBuilder().build(dsItem))) : dsItem; tableName = tableItem.startsWith("=") ? Utils.objectToString(ca.eval(BaseFormula.createFormulaBuilder().build(tableItem))) : tableItem; } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } ori_ds_name = dsName; ori_table_name = tableName; diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataNameObjectCreator.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataNameObjectCreator.java index 1ec28a97c5..a90f7a1263 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataNameObjectCreator.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataNameObjectCreator.java @@ -1,21 +1,21 @@ package com.fr.design.data.datapane; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.data.impl.DBTableData; import com.fr.design.actions.tabledata.TableDataAction; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.icon.WarningIcon; import com.fr.general.ComparatorUtils; - +import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.Icon; +import java.awt.Image; import java.text.Collator; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; /** @@ -138,10 +138,10 @@ public class TableDataNameObjectCreator extends NameObjectCreator { try { return clazzOfInitCase.newInstance(); } catch (InstantiationException | IllegalAccessException e1) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } catch (IllegalAccessException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } return 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/datapane/preview/PreviewTableModel.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java index ffa79ba9c7..6be5657bbd 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java @@ -1,14 +1,13 @@ package com.fr.design.data.datapane.preview; -import com.fr.base.FRContext; import com.fr.cache.list.IntList; import com.fr.data.AbstractDataModel; import com.fr.data.impl.EmbeddedTableData.EmbeddedTDDataModel; import com.fr.data.impl.storeproc.ProcedureDataModel; import com.fr.design.utils.DesignUtils; - import com.fr.general.data.DataModel; import com.fr.general.data.TableDataException; +import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; @@ -35,7 +34,7 @@ public class PreviewTableModel extends AbstractTableModel { this.dataModel = createRowDataModel(rs, maxRowCount); } catch (TableDataException e) { // TODO Auto-generated catch block - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } else { this.dataModel = sourceResultSet; @@ -98,7 +97,7 @@ public class PreviewTableModel extends AbstractTableModel { try { return Integer.toString(column + 1) + ". " + dataModel.getColumnName(column) + checkType(column); } catch (TableDataException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); DesignUtils.errorMessage(e.getMessage()); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"); } @@ -108,7 +107,7 @@ public class PreviewTableModel extends AbstractTableModel { try { return this.dataModel.getRowCount(); } catch (TableDataException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); return 0; } } @@ -120,7 +119,7 @@ public class PreviewTableModel extends AbstractTableModel { } return dataModel.getColumnCount(); } catch (TableDataException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); DesignUtils.errorMessage(e.getMessage()); return 0; } @@ -130,7 +129,7 @@ public class PreviewTableModel extends AbstractTableModel { try { return dataModel.getValueAt(row, column); } catch (TableDataException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); DesignUtils.errorMessage(e.getMessage()); return ""; } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java index bfcba4aa2e..383a1f02aa 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java @@ -4,7 +4,6 @@ package com.fr.design.data.datapane.preview; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.base.TableData; import com.fr.data.TableDataSource; import com.fr.data.impl.DBTableData; @@ -308,7 +307,7 @@ public class PreviewTablePane extends BasicPane { int tatalColumn = Integer.parseInt(tatolColumnErrMessage.trim()); columnErrMessage = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Preview_Warn_Text", choiceColumn + 1, tatalColumn); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); return; } FineLoggerFactory.getLogger().error(exp.getMessage(), exp); @@ -402,7 +401,7 @@ public class PreviewTablePane extends BasicPane { fireLoadedListener(); } catch (Exception e) { if (!(e instanceof CancellationException)) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(), null, 0, UIManager.getIcon("OptionPane.errorIcon")); } @@ -447,7 +446,7 @@ public class PreviewTablePane extends BasicPane { } } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } previewTablePane.fireLoadedListener(); previewTablePane.showWindow(DesignerContext.getDesignerFrame()).setVisible(true); @@ -468,7 +467,7 @@ public class PreviewTablePane extends BasicPane { try { previewTablePane.populateStoreDataSQL(); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } tabPreviewpane.addTab(storeProcedureDataModels[i].getName(), previewTablePane); } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java index e475820a52..3241e0588b 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java @@ -1 +1 @@ -package com.fr.design.data.datapane.sqlpane; import com.fr.base.FRContext; import com.fr.data.core.DataCoreUtils; import com.fr.data.core.db.TableProcedure; import com.fr.design.actions.UpdateAction; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.general.ComparatorUtils; import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.*; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import java.awt.*; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.*; import java.awt.event.ActionEvent; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-5-2 * Time: 上午11:09 */ public class SQLEditPane extends RSyntaxTextArea { public static final boolean REQUEST_DROPTARGET = true; public static final boolean UNREQUEST_DROPTARGET = false; public SQLEditPane() { this(REQUEST_DROPTARGET); } public SQLEditPane(boolean requestDroptarget) { super(); setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL); setAnimateBracketMatching(true); setAntiAliasingEnabled(true); setAutoIndentEnabled(true); setCodeFoldingEnabled(true); setUseSelectedTextColor(true); setCloseCurlyBraces(true); setBracketMatchingEnabled(true); setAntiAliasingEnabled(true); setCloseMarkupTags(true); setLineWrap(true); if (requestDroptarget) { new SQLPaneDropTarget(this); } } private static class SQLPaneDropTarget extends DropTargetAdapter { private TableProcedure sqlTable; public SQLPaneDropTarget(SQLEditPane sqlTextPane) { new DropTarget(sqlTextPane, this); } public void dragEnter(DropTargetDragEvent dtde) { dtde.acceptDrag(dtde.getDropAction()); } public void dragOver(DropTargetDragEvent dtde) { dtde.acceptDrag(dtde.getDropAction()); } public void drop(DropTargetDropEvent dtde) { Point p = dtde.getLocation(); DropTargetContext dtc = dtde.getDropTargetContext(); SQLEditPane jTextPane = (SQLEditPane) dtc.getComponent(); try { Transferable tr = dtde.getTransferable(); DataFlavor[] flavors = tr.getTransferDataFlavors(); for (int i = 0; i < flavors.length; i++) { if (!tr.isDataFlavorSupported(flavors[i])) { continue; } dtde.acceptDrop(dtde.getDropAction()); Object userObj = tr.getTransferData(flavors[i]); if (userObj instanceof TableProcedure) { this.sqlTable = (TableProcedure) userObj; JPopupMenu popupMenu = new JPopupMenu(); popupMenu.add(new NameAction(jTextPane, sqlTable).createMenuItem()); if (ComparatorUtils.equals(sqlTable.getType(), TableProcedure.PROCEDURE)) { popupMenu.add(new CallAction(jTextPane, sqlTable).createMenuItem()); } else { popupMenu.add(new SelectAction(jTextPane, sqlTable).createMenuItem()); } GUICoreUtils.showPopupMenu(popupMenu, jTextPane, (int) p.getX() + 1, (int) p.getY() + 1); } dtde.dropComplete(true); } dtde.rejectDrop(); } catch (Exception e) { dtde.rejectDrop(); } } class NameAction extends UpdateAction { private SQLEditPane sqlTextPane; private TableProcedure sqlTable; public NameAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { this.sqlTextPane = sqlTextPane; this.sqlTable = sqlTable; this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name")); this.setMnemonic('N'); this.setSmallIcon(null); } public void actionPerformed(ActionEvent evt) { if (sqlTable != null) { insertStringTo(sqlTextPane, sqlTable.toString()); } } } class SelectAction extends UpdateAction { private SQLEditPane sqlTextPane; private TableProcedure sqlTable; public SelectAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { this.sqlTextPane = sqlTextPane; this.sqlTable = sqlTable; this.setName("SELECT *"); this.setMnemonic('s'); this.setSmallIcon(null); } public void actionPerformed(ActionEvent evt) { //daniel: 添加参数 insertStringTo(sqlTextPane, DataCoreUtils.createSelectSQL(sqlTable.getSchema(), sqlTable.getName(), sqlTable.getDialect())); } } class CallAction extends UpdateAction { private SQLEditPane sqlTextPane; private TableProcedure sqlTable; public CallAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { this.sqlTextPane = sqlTextPane; this.sqlTable = sqlTable; this.setName("CALL PROCEDURE "); this.setMnemonic('s'); this.setSmallIcon(null); } public void actionPerformed(ActionEvent evt) { StringBuffer sBuf = new StringBuffer(); sBuf.append("{call "); if (sqlTable != null) { sBuf.append(sqlTable.toString()).append("()"); } sBuf.append('}'); insertStringTo(sqlTextPane, sBuf.toString()); } } private void insertStringTo(SQLEditPane sqlTextPane, String str) { Document document = sqlTextPane.getDocument(); try { document.insertString(sqlTextPane.getCaretPosition(), str, null); } catch (BadLocationException badLocationException) { FRContext.getLogger().error(badLocationException.getMessage(), badLocationException); } sqlTextPane.requestFocus(); } } } \ No newline at end of file +package com.fr.design.data.datapane.sqlpane; import com.fr.data.core.DataCoreUtils; import com.fr.data.core.db.TableProcedure; import com.fr.design.actions.UpdateAction; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import javax.swing.JPopupMenu; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import java.awt.Point; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DropTarget; import java.awt.dnd.DropTargetAdapter; import java.awt.dnd.DropTargetContext; import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDropEvent; import java.awt.event.ActionEvent; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-5-2 * Time: 上午11:09 */ public class SQLEditPane extends RSyntaxTextArea { public static final boolean REQUEST_DROPTARGET = true; public static final boolean UNREQUEST_DROPTARGET = false; public SQLEditPane() { this(REQUEST_DROPTARGET); } public SQLEditPane(boolean requestDroptarget) { super(); setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL); setAnimateBracketMatching(true); setAntiAliasingEnabled(true); setAutoIndentEnabled(true); setCodeFoldingEnabled(true); setUseSelectedTextColor(true); setCloseCurlyBraces(true); setBracketMatchingEnabled(true); setAntiAliasingEnabled(true); setCloseMarkupTags(true); setLineWrap(true); if (requestDroptarget) { new SQLPaneDropTarget(this); } } private static class SQLPaneDropTarget extends DropTargetAdapter { private TableProcedure sqlTable; public SQLPaneDropTarget(SQLEditPane sqlTextPane) { new DropTarget(sqlTextPane, this); } public void dragEnter(DropTargetDragEvent dtde) { dtde.acceptDrag(dtde.getDropAction()); } public void dragOver(DropTargetDragEvent dtde) { dtde.acceptDrag(dtde.getDropAction()); } public void drop(DropTargetDropEvent dtde) { Point p = dtde.getLocation(); DropTargetContext dtc = dtde.getDropTargetContext(); SQLEditPane jTextPane = (SQLEditPane) dtc.getComponent(); try { Transferable tr = dtde.getTransferable(); DataFlavor[] flavors = tr.getTransferDataFlavors(); for (int i = 0; i < flavors.length; i++) { if (!tr.isDataFlavorSupported(flavors[i])) { continue; } dtde.acceptDrop(dtde.getDropAction()); Object userObj = tr.getTransferData(flavors[i]); if (userObj instanceof TableProcedure) { this.sqlTable = (TableProcedure) userObj; JPopupMenu popupMenu = new JPopupMenu(); popupMenu.add(new NameAction(jTextPane, sqlTable).createMenuItem()); if (ComparatorUtils.equals(sqlTable.getType(), TableProcedure.PROCEDURE)) { popupMenu.add(new CallAction(jTextPane, sqlTable).createMenuItem()); } else { popupMenu.add(new SelectAction(jTextPane, sqlTable).createMenuItem()); } GUICoreUtils.showPopupMenu(popupMenu, jTextPane, (int) p.getX() + 1, (int) p.getY() + 1); } dtde.dropComplete(true); } dtde.rejectDrop(); } catch (Exception e) { dtde.rejectDrop(); } } class NameAction extends UpdateAction { private SQLEditPane sqlTextPane; private TableProcedure sqlTable; public NameAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { this.sqlTextPane = sqlTextPane; this.sqlTable = sqlTable; this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name")); this.setMnemonic('N'); this.setSmallIcon(null); } public void actionPerformed(ActionEvent evt) { if (sqlTable != null) { insertStringTo(sqlTextPane, sqlTable.toString()); } } } class SelectAction extends UpdateAction { private SQLEditPane sqlTextPane; private TableProcedure sqlTable; public SelectAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { this.sqlTextPane = sqlTextPane; this.sqlTable = sqlTable; this.setName("SELECT *"); this.setMnemonic('s'); this.setSmallIcon(null); } public void actionPerformed(ActionEvent evt) { //daniel: 添加参数 insertStringTo(sqlTextPane, DataCoreUtils.createSelectSQL(sqlTable.getSchema(), sqlTable.getName(), sqlTable.getDialect())); } } class CallAction extends UpdateAction { private SQLEditPane sqlTextPane; private TableProcedure sqlTable; public CallAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { this.sqlTextPane = sqlTextPane; this.sqlTable = sqlTable; this.setName("CALL PROCEDURE "); this.setMnemonic('s'); this.setSmallIcon(null); } public void actionPerformed(ActionEvent evt) { StringBuffer sBuf = new StringBuffer(); sBuf.append("{call "); if (sqlTable != null) { sBuf.append(sqlTable.toString()).append("()"); } sBuf.append('}'); insertStringTo(sqlTextPane, sBuf.toString()); } } private void insertStringTo(SQLEditPane sqlTextPane, String str) { Document document = sqlTextPane.getDocument(); try { document.insertString(sqlTextPane.getCaretPosition(), str, null); } catch (BadLocationException badLocationException) { FineLoggerFactory.getLogger().error(badLocationException.getMessage(), badLocationException); } sqlTextPane.requestFocus(); } } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index d441d51160..85b8fbd7d3 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java @@ -29,6 +29,7 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ToolBarDef; @@ -211,10 +212,13 @@ public class DBTableDataPane extends AbstractTableDataPane { isShareCheckBox.setBackground(Color.WHITE); maxPanel = new MaxMemRowCountPanel(); maxPanel.setBorder(null); + JPanel wrapMaxPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + wrapMaxPanel.add(maxPanel); + wrapMaxPanel.setPreferredSize(new Dimension(250, 20)); UIToolbar editToolBar = ToolBarDef.createJToolBar(); toolBarDef.updateToolBar(editToolBar); editToolBar.add(isShareCheckBox); - editToolBar.add(maxPanel); + editToolBar.add(wrapMaxPanel); return editToolBar; } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DecoratedTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DecoratedTableDataPane.java index 42332f1cf2..1f3d60af02 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DecoratedTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DecoratedTableDataPane.java @@ -1,18 +1,17 @@ package com.fr.design.data.tabledata.tabledatapane; -import com.fr.base.FRContext; import com.fr.data.impl.DecoratedTableData; import com.fr.design.condition.DSColumnLiteConditionPane; import com.fr.design.gui.ilist.CheckBoxList; import com.fr.design.gui.ilist.CheckBoxList.CheckBoxListSelectionChangeListener; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.file.TableDataConfig; - import com.fr.general.data.DataModel; import com.fr.general.data.TableDataException; +import com.fr.log.FineLoggerFactory; import com.fr.script.Calculator; -import java.awt.*; +import java.awt.BorderLayout; public class DecoratedTableDataPane extends AbstractTableDataPane implements CheckBoxListSelectionChangeListener { private CheckBoxList availableTableDataNameList; @@ -85,7 +84,7 @@ public class DecoratedTableDataPane extends AbstractTableDataPane { private JTable dataJTable ; @@ -214,7 +211,7 @@ public class EmbeddedTableDataPane 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; @@ -218,7 +229,7 @@ public class FileTableDataPane extends AbstractTableDataPane { try { in = url.getSourceStream(params); } catch (Throwable e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } if (in == null) { JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"), @@ -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; @@ -895,7 +907,7 @@ public class FileTableDataPane extends AbstractTableDataPane { if (localFileRadioButton.isSelected()) { String localTextString = StringUtils.trimToNull(localText.getText()); if(StringUtils.isEmpty(localTextString)){ - FRContext.getLogger().info("The file path is empty."); + FineLoggerFactory.getLogger().info("The file path is empty."); loadedTreeModel(); return; } @@ -903,7 +915,7 @@ public class FileTableDataPane extends AbstractTableDataPane { } else { String urlTextString = StringUtils.trimToNull(urlText.getText()); if (StringUtils.isEmpty(urlTextString)){ - FRContext.getLogger().info("The url path is empty."); + FineLoggerFactory.getLogger().info("The url path is empty."); loadedTreeModel(); return; } @@ -920,13 +932,13 @@ public class FileTableDataPane extends AbstractTableDataPane { if (xmlReader != null) { xmlReader.readXMLObject(new XMLLayerReader(0)); } else { - FRContext.getLogger().info("The file is wrong or bad, can not create the XMLReader."); + FineLoggerFactory.getLogger().info("The file is wrong or bad, can not create the XMLReader."); loadedTreeModel(); } reader.close(); } } catch (Throwable e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); loadedTreeModel(); } if(treeModel.getChildCount(treeModel.getRoot()) == 1){ diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java index ae8fb5cf88..49c7dcd119 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java @@ -1,7 +1,6 @@ package com.fr.design.data.tabledata.wrapper; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.base.TableData; import com.fr.data.impl.storeproc.ProcedureDataModel; import com.fr.data.impl.storeproc.StoreProcedure; @@ -14,9 +13,11 @@ import com.fr.design.gui.iprogressbar.AutoProgressBar; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.mainframe.DesignerContext; import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; - -import javax.swing.*; +import javax.swing.Icon; +import javax.swing.JOptionPane; +import javax.swing.SwingWorker; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -146,7 +147,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { } return true; } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } return false; } @@ -217,7 +218,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { } } catch (Exception e) { if (!(e instanceof CancellationException)) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage()); } loadingBar.close(); diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureNameWrapper.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureNameWrapper.java index d620caef2f..a0d0182acd 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureNameWrapper.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureNameWrapper.java @@ -1,7 +1,6 @@ package com.fr.design.data.tabledata.wrapper; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.base.TableData; import com.fr.data.impl.storeproc.ProcedureDataModel; import com.fr.data.impl.storeproc.StoreProcedure; @@ -11,7 +10,7 @@ import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.log.FineLoggerFactory; import com.fr.workspace.WorkContext; -import javax.swing.*; +import javax.swing.Icon; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -77,7 +76,7 @@ public final class StoreProcedureNameWrapper implements TableDataWrapper { try { procedureDataModel = DesignTableDataManager.createLazyDataModel(storeProcedure, needLoadingBar)[0]; } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java index 28c6628a6c..adce85f3b6 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java @@ -1,6 +1,5 @@ package com.fr.design.data.tabledata.wrapper; -import com.fr.base.FRContext; import com.fr.base.TableData; import com.fr.data.TableDataSource; import com.fr.data.impl.ClassTableData; @@ -123,7 +122,7 @@ public abstract class TableDataFactory { } datapane.populateBean(tabledata); // August:不管tabledata是刚刚新建的还是原来的,一律populate进去,如果出错就是代码写的不好 } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } return datapane; 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/dialog/UIDialog.java b/designer-base/src/main/java/com/fr/design/dialog/UIDialog.java index 193a5ea07e..7de66602a0 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/UIDialog.java +++ b/designer-base/src/main/java/com/fr/design/dialog/UIDialog.java @@ -1,14 +1,28 @@ package com.fr.design.dialog; -import com.fr.base.FRContext; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; - - -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; +import com.fr.log.FineLoggerFactory; + +import javax.swing.AbstractAction; +import javax.swing.ActionMap; +import javax.swing.BorderFactory; +import javax.swing.InputMap; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.KeyStroke; +import java.awt.BorderLayout; +import java.awt.Dialog; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; import java.util.ArrayList; /** @@ -173,7 +187,7 @@ public abstract class UIDialog extends JDialog { l.doOk(); } catch (RuntimeException e) { isDoOKSucceed = false; - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } if (isDoOKSucceed) { diff --git a/designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java b/designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java index 24f1111f3b..3b1abe6f00 100644 --- a/designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java +++ b/designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java @@ -3,13 +3,13 @@ */ package com.fr.design.editor.editor; -import com.fr.base.FRContext; import com.fr.design.gui.date.UIDatePicker; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.GeneralContext; +import com.fr.log.FineLoggerFactory; -import javax.swing.*; -import java.awt.*; +import javax.swing.JComponent; +import java.awt.BorderLayout; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.text.ParseException; @@ -113,7 +113,7 @@ public class DateEditor extends Editor { try { return this.uiDatePicker.getSelectedDate(); } catch (ParseException parseException) { - FRContext.getLogger().error(parseException.getMessage(), parseException); + FineLoggerFactory.getLogger().error(parseException.getMessage(), parseException); return new Date(); } } @@ -132,7 +132,7 @@ public class DateEditor extends Editor { try { this.uiDatePicker.setSelectedDate(value); } catch (ParseException parseException) { - FRContext.getLogger().error(parseException.getMessage(), parseException); + FineLoggerFactory.getLogger().error(parseException.getMessage(), parseException); } } 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/PluginFromStorePane.java b/designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java index 3f7caf2fb9..0f78a562c5 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java @@ -1,11 +1,9 @@ package com.fr.design.extra; -import com.fr.base.FRContext; import com.fr.config.MarketConfig; import com.fr.design.extra.tradition.callback.UpdateOnlineCallback; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ilable.UILabel; - import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginMarker; @@ -15,7 +13,11 @@ import com.fr.plugin.manage.control.ProgressCallback; import com.fr.plugin.view.PluginView; import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.JComponent; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.SwingConstants; import javax.swing.filechooser.FileNameExtensionFilter; import java.io.File; import java.util.List; @@ -206,7 +208,7 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(new JSONObject(info))); threadPoolExecutor.submit(task); - } catch (JSONException e) { + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginsReaderFromStore.java b/designer-base/src/main/java/com/fr/design/extra/PluginsReaderFromStore.java index 8895e83e45..66341be1a2 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginsReaderFromStore.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginsReaderFromStore.java @@ -74,7 +74,7 @@ public class PluginsReaderFromStore { plugins.add(pluginView); } } - } catch (JSONException e) { + } catch (Exception e) { throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Read_Plugin_List_Error")); } } diff --git a/designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java b/designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java index a621d4ecf4..43b7b9614d 100644 --- a/designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java +++ b/designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java @@ -1,7 +1,8 @@ package com.fr.design.extra; -import com.fr.base.FRContext; -import com.fr.general.*; +import com.fr.general.CloudCenter; +import com.fr.general.ComparatorUtils; +import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; import javafx.application.Platform; import javafx.beans.property.BooleanProperty; @@ -25,12 +26,17 @@ import javafx.scene.paint.Color; import javafx.scene.web.WebEngine; import javafx.scene.web.WebEvent; import javafx.scene.web.WebView; -import javafx.stage.*; +import javafx.stage.Modality; +import javafx.stage.Screen; +import javafx.stage.Stage; +import javafx.stage.StageStyle; +import javafx.stage.WindowEvent; import javafx.util.Callback; import netscape.javascript.JSObject; -import javax.swing.*; -import java.awt.*; +import javax.swing.JOptionPane; +import javax.swing.SwingUtilities; +import java.awt.Toolkit; /** * Created by zhaohehe on 16/7/28. @@ -79,7 +85,7 @@ public class QQLoginWebPane extends JFXPanel { primaryStage.setY(Screen.getPrimary().getBounds().getHeight() + DEFAULT_PRIMARYSTAGE_HEIGHT); primaryStage.show(); } catch (Exception e) { - FRContext.getLogger().info(e.getMessage()); + FineLoggerFactory.getLogger().info(e.getMessage()); } webEngine.setConfirmHandler(new Callback() { @Override 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/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index bff2080e46..2cf6efa910 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -19,7 +19,6 @@ import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; - import com.fr.log.FineLoggerFactory; import com.fr.parser.FRLexer; import com.fr.parser.FRParser; @@ -28,7 +27,17 @@ import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.script.Expression; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.DefaultListCellRenderer; +import javax.swing.DefaultListModel; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JList; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.JTree; +import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.event.TreeSelectionEvent; @@ -38,7 +47,10 @@ import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.MutableTreeNode; import javax.swing.tree.TreePath; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; @@ -566,7 +578,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { try { expression = parser.parse(); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); // alex:继续往下面走,expression为null时告知不合法公式 } @@ -1035,6 +1047,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { buffer.append("|"); buffer.append("\n"); } - FRContext.getLogger().debug(buffer.toString()); + FineLoggerFactory.getLogger().debug(buffer.toString()); } } diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index eee75a2220..3d0460e868 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -1,6 +1,5 @@ package com.fr.design.formula; -import com.fr.base.FRContext; import com.fr.file.FunctionConfig; import com.fr.function.AVERAGE; import com.fr.function.CHAR; @@ -12,7 +11,6 @@ import com.fr.function.RANGE; import com.fr.function.SUM; import com.fr.function.TIME; import com.fr.general.ComparatorUtils; - import com.fr.general.GeneralUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.ExtraClassManager; @@ -25,23 +23,28 @@ import com.fr.stable.fun.mark.Mutable; import com.fr.stable.script.Function; import com.fr.stable.script.FunctionDef; +import javax.swing.DefaultListModel; import java.io.File; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URL; import java.net.URLDecoder; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.Enumeration; +import java.util.List; +import java.util.Set; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; -import javax.swing.DefaultListModel; - public final class FunctionConstants { public static FunctionGroup PLUGIN = getPluginFunctionGroup(); public static FunctionGroup CUSTOM = getCustomFunctionGroup(); - static NameAndFunctionList COMMON = getCommonFunctionList(); - static NameAndTypeAndFunctionList[] EMBFUNCTIONS = getEmbededFunctionListArray(); + public static NameAndFunctionList COMMON = getCommonFunctionList(); + public static NameAndTypeAndFunctionList[] EMBFUNCTIONS = getEmbededFunctionListArray(); public static FunctionGroup ALL = getAllFunctionGroup(); static { @@ -74,9 +77,9 @@ public final class FunctionConstants { try { classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); } catch (UnsupportedEncodingException e1) { - FRContext.getLogger().error(e1.getMessage(), e1); + FineLoggerFactory.getLogger().error(e1.getMessage(), e1); } - FRContext.getLogger().info("ClassFilePath:" + classFilePath); + FineLoggerFactory.getLogger().info("ClassFilePath:" + classFilePath); if (isCustomFormulaPath(classFilePath)) { continue; } @@ -117,7 +120,7 @@ public final class FunctionConstants { * 将函数分组插件中的函数添加到对应的列表中 * @param listModel */ - static void addFunctionGroupFromPlugins(DefaultListModel listModel){ + public static void addFunctionGroupFromPlugins(DefaultListModel listModel){ //hugh:自定义函数分组 Set containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); if(!containers.isEmpty()){ @@ -189,7 +192,7 @@ public final class FunctionConstants { classNameList.add(entryName.substring(classPath.length() + 1)); } } catch (IOException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } else { File dir = new File(filePath); diff --git a/designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java b/designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java index 6c99f24c68..597ddbfd66 100644 --- a/designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java @@ -8,7 +8,6 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.layout.FRGUIPaneFactory; - import com.fr.log.FineLoggerFactory; import com.fr.stable.EncodeConstants; import com.fr.stable.JavaCompileInfo; @@ -17,8 +16,13 @@ import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; -import javax.swing.*; -import java.awt.*; +import javax.swing.AbstractAction; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.SwingWorker; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.ByteArrayInputStream; @@ -51,7 +55,7 @@ public class JavaEditorPane extends BasicPane { try { return StableUtils.inputStream2String(in, EncodeConstants.ENCODING_UTF_8); } catch (IOException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } return null; @@ -115,7 +119,7 @@ public class JavaEditorPane extends BasicPane { try { return new ByteArrayInputStream(WorkContext.getWorkResource().readFully(StableUtils.pathJoin(ProjectConstants.CLASSES_NAME, javaPath))); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } return null; } diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/CommonShortCutHandlers.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/CommonShortCutHandlers.java index 42c0d2f2d0..c5d2a51dd9 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/CommonShortCutHandlers.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/CommonShortCutHandlers.java @@ -1,11 +1,11 @@ package com.fr.design.gui.controlpane; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.design.gui.ilist.JNameEdList; import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; @@ -71,7 +71,7 @@ public class CommonShortCutHandlers { listControlPane.addNameable(newNameable, listControlPane.getSelectedIndex() + 1); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } 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/core/CustomWidgetOption.java b/designer-base/src/main/java/com/fr/design/gui/core/CustomWidgetOption.java index 5cd22d6d49..e445e311f8 100644 --- a/designer-base/src/main/java/com/fr/design/gui/core/CustomWidgetOption.java +++ b/designer-base/src/main/java/com/fr/design/gui/core/CustomWidgetOption.java @@ -1,9 +1,9 @@ package com.fr.design.gui.core; -import javax.swing.Icon; - -import com.fr.base.FRContext; import com.fr.form.ui.Widget; +import com.fr.log.FineLoggerFactory; + +import javax.swing.Icon; public class CustomWidgetOption extends WidgetOption { private static final long serialVersionUID = -8144214820100962842L; @@ -23,9 +23,9 @@ public class CustomWidgetOption extends WidgetOption { Widget ins = cls.newInstance(); return ins ; } catch (InstantiationException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } catch (IllegalAccessException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } return null; diff --git a/designer-base/src/main/java/com/fr/design/gui/core/UITextComponent.java b/designer-base/src/main/java/com/fr/design/gui/core/UITextComponent.java new file mode 100644 index 0000000000..0cf2e1c3c1 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/core/UITextComponent.java @@ -0,0 +1,10 @@ +package com.fr.design.gui.core; + +/** + * 这个接口说明一个基本组件可以设置文本 + * Created by plough on 2019/1/11. + */ +public interface UITextComponent { + String getText(); + void setText(String text); +} diff --git a/designer-base/src/main/java/com/fr/design/gui/date/SingleObjectComboBoxModel.java b/designer-base/src/main/java/com/fr/design/gui/date/SingleObjectComboBoxModel.java index 193fe64196..788d1104e8 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/SingleObjectComboBoxModel.java +++ b/designer-base/src/main/java/com/fr/design/gui/date/SingleObjectComboBoxModel.java @@ -1,12 +1,11 @@ package com.fr.design.gui.date; -import java.text.SimpleDateFormat; -import java.util.Date; +import com.fr.log.FineLoggerFactory; import javax.swing.AbstractListModel; import javax.swing.ComboBoxModel; - -import com.fr.base.FRContext; +import java.text.SimpleDateFormat; +import java.util.Date; public class SingleObjectComboBoxModel extends AbstractListModel implements ComboBoxModel { private SimpleDateFormat dateFormat; @@ -35,7 +34,7 @@ public class SingleObjectComboBoxModel extends AbstractListModel implements Comb try { selectedDate = this.dateFormat.format((Date) anItem); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } else { try { diff --git a/designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java b/designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java index f01dd98630..aa9cabd498 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java +++ b/designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java @@ -1,19 +1,26 @@ package com.fr.design.gui.date; -import com.fr.base.FRContext; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxUI; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.general.ComparatorUtils; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.plaf.ComboBoxUI; import javax.swing.plaf.basic.BasicComboPopup; import javax.swing.plaf.basic.ComboPopup; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Cursor; +import java.awt.LayoutManager; import java.awt.event.MouseEvent; import java.io.Serializable; import java.text.ParseException; @@ -213,7 +220,7 @@ public class UIDatePicker extends UIComboBox implements Serializable { calendarPanel.updateHMS(); } } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } else if (ComparatorUtils.equals(oldValue, Boolean.TRUE) && ComparatorUtils.equals(newValue, Boolean.FALSE)) { //HIDE diff --git a/designer-base/src/main/java/com/fr/design/gui/demo/LoadingPaneDemo.java b/designer-base/src/main/java/com/fr/design/gui/demo/LoadingPaneDemo.java index ec59dd3f4b..2eb93ad3e0 100644 --- a/designer-base/src/main/java/com/fr/design/gui/demo/LoadingPaneDemo.java +++ b/designer-base/src/main/java/com/fr/design/gui/demo/LoadingPaneDemo.java @@ -3,16 +3,15 @@ */ package com.fr.design.gui.demo; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.JPanel; - -import com.fr.base.FRContext; +import com.fr.design.dialog.BasicDialog; import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.dialog.BasicDialog; +import com.fr.log.FineLoggerFactory; + +import javax.swing.JPanel; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; /** * Created by IntelliJ IDEA. @@ -35,7 +34,7 @@ public class LoadingPaneDemo extends JPanel { try { Thread.sleep(500); } catch (InterruptedException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } container.add(new UIButton(i + "adfadwdadawdwad")); } diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/LoadingBasicPaneTest.java b/designer-base/src/main/java/com/fr/design/gui/frpane/LoadingBasicPaneTest.java index 372a37be86..7c454ad715 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/LoadingBasicPaneTest.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/LoadingBasicPaneTest.java @@ -3,11 +3,11 @@ */ package com.fr.design.gui.frpane; -import javax.swing.JPanel; - -import com.fr.base.FRContext; -import com.fr.design.gui.ibutton.UIButton; import com.fr.design.dialog.BasicDialog; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.log.FineLoggerFactory; + +import javax.swing.JPanel; /** @@ -23,7 +23,7 @@ public class LoadingBasicPaneTest { try { Thread.sleep(500); } catch (InterruptedException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } container.add(new UIButton(i + "adfadwdadawdwad")); } diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java index 0a2325cebf..c41cc9f7ac 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java @@ -1,19 +1,32 @@ package com.fr.design.gui.frpane; -import java.awt.*; -import java.awt.event.AWTEventListener; -import java.awt.event.MouseEvent; - -import javax.swing.JComponent; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; - -import com.fr.base.FRContext; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.UIDialog; +import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.sun.awt.AWTUtilities; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import java.awt.AWTEvent; +import java.awt.BasicStroke; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.Polygon; +import java.awt.Rectangle; +import java.awt.Shape; +import java.awt.Stroke; +import java.awt.Toolkit; +import java.awt.Window; +import java.awt.event.AWTEventListener; +import java.awt.event.MouseEvent; + /** * @author Jerry * 非模态悬浮对话框,气泡形状 @@ -300,7 +313,7 @@ public abstract class UIBubbleFloatPane extends BasicBeanPane { try { AWTUtilities.setWindowShape(CustomShapedDialog.this, this.getCustomShap()); } catch (UnsupportedOperationException e) { - FRContext.getLogger().info("Not support"); + FineLoggerFactory.getLogger().info("Not support"); } final JPanel contentPane = (JPanel) this.getContentPane(); this.setLayout(null); diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java index 2af8c8f918..078bf692b9 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java @@ -6,22 +6,36 @@ import com.fr.base.GraphHelper; import com.fr.design.constants.UIConstants; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.core.UITextComponent; +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.Constants; import com.fr.stable.StringUtils; -import com.fr.design.utils.gui.GUICoreUtils; -import javax.swing.*; +import javax.swing.Action; +import javax.swing.Icon; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.ToolTipManager; import javax.swing.plaf.ButtonUI; -import java.awt.*; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; +import java.awt.Shape; +import java.awt.Stroke; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.geom.RoundRectangle2D; -public class UIButton extends JButton implements UIObserver { +public class UIButton extends JButton implements UIObserver, UITextComponent { + private static final int TOOLTIP_INIT_DELAY = 300; // 延迟 0.3s 显示提示文字 public static final int OTHER_BORDER = 1; public static final int NORMAL_BORDER = 2; - private static final int HEIGH = 20; + private static final int HEIGHT = 20; + private boolean isExtraPainted = true; private boolean isRoundBorder = true; private int rectDirection = Constants.NULL; @@ -36,7 +50,6 @@ public class UIButton extends JButton implements UIObserver { private CellBorderStyle border = null; protected UIObserverListener uiObserverListener; - private static final int TOOLTIP_INIT_DELAY = 300; // 延迟 0.3s 显示提示文字 public UIButton() { this(StringUtils.EMPTY); @@ -112,7 +125,7 @@ public class UIButton extends JButton implements UIObserver { public void set4ToolbarButton() { setNormalPainted(false); Dimension dim = getPreferredSize(); - dim.height = HEIGH; + dim.height = HEIGHT; setBackground(null); setOpaque(false); setSize(dim); @@ -170,7 +183,11 @@ public class UIButton extends JButton implements UIObserver { //@Override public Dimension getPreferredSize() { - return new Dimension(super.getPreferredSize().width, 20); + Dimension dim = super.getPreferredSize(); + if (isFixedHeight() || dim.height < HEIGHT) { + dim.height = HEIGHT; + } + return dim; } @@ -323,7 +340,16 @@ public class UIButton extends JButton implements UIObserver { this.isBorderPaintedOnlyWhenPressed = value; } - /** + private boolean isFixedHeight() { + String text = this.getText(); + if (StringUtils.isEmpty(text)) { + return true; + } + // 如果允许换行,需要放开按钮高度的限制 + return !text.startsWith(""); + } + + /** * 主函数 * @param args 入口参数 */ 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/ibutton/UIHeadGroup.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java index c1f5ed24e5..edbc013405 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java @@ -3,9 +3,15 @@ package com.fr.design.gui.ibutton; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.utils.gui.GUICoreUtils; - -import javax.swing.*; -import java.awt.*; +import com.fr.design.utils.gui.UIComponentUtils; + +import javax.swing.Icon; +import javax.swing.JFrame; +import javax.swing.JPanel; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.GridLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; @@ -13,6 +19,7 @@ import java.util.ArrayList; import java.util.List; public class UIHeadGroup extends JPanel { + private static final int MIN_HEIGHT = 25; protected List labelButtonList; private boolean isNeedLeftRightOutLine = true; protected int selectedIndex = -1; @@ -25,7 +32,6 @@ public class UIHeadGroup extends JPanel { labelButtonList = new ArrayList(textArray.length); this.setBackground(UIConstants.TREE_BACKGROUND); this.setLayout(new GridLayout(0, textArray.length, 0, 0)); -// this.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); for (int i = 0; i < textArray.length; i++) { final int index = i; String text = textArray[i]; @@ -50,7 +56,6 @@ public class UIHeadGroup extends JPanel { labelButtonList = new ArrayList(iconArray.length); this.setBackground(UIConstants.NORMAL_BACKGROUND); this.setLayout(new GridLayout(0, iconArray.length, 1, 0)); -// this.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); for (int i = 0; i < iconArray.length; i++) { final int index = i; Icon icon = iconArray[i]; @@ -99,7 +104,9 @@ public class UIHeadGroup extends JPanel { @Override public Dimension getPreferredSize() { Dimension dim = super.getPreferredSize(); - dim.height = 25; + if (dim.height < MIN_HEIGHT) { + dim.height = MIN_HEIGHT; + } return dim; } @@ -133,6 +140,7 @@ public class UIHeadGroup extends JPanel { labelButton.setRoundBorder(false); labelButton.setBorderPainted(false); labelButton.setPressedPainted(false); + UIComponentUtils.setLineWrap(labelButton); labelButtonList.add(labelButton); this.add(labelButton); } diff --git a/designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java b/designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java index 825dfc629f..7489b4f592 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java @@ -5,6 +5,7 @@ import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.core.UITextComponent; import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.stable.Constants; import sun.swing.SwingUtilities2; @@ -29,7 +30,7 @@ import java.awt.RenderingHints; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObserver { +public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObserver, UITextComponent { private UIObserverListener uiObserverListener; private GlobalNameListener globalNameListener = null; private String checkboxName = ""; diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/ExtendedComboBoxTest.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/ExtendedComboBoxTest.java index 8fdb3dafe3..ec6e0f7479 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/ExtendedComboBoxTest.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/ExtendedComboBoxTest.java @@ -1,18 +1,17 @@ package com.fr.design.gui.icombobox; -import java.awt.BorderLayout; +import com.fr.log.FineLoggerFactory; import javax.swing.JFrame; import javax.swing.UIManager; - -import com.fr.base.FRContext; +import java.awt.BorderLayout; public class ExtendedComboBoxTest { public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } final ExtendedComboBox cb = new ExtendedComboBox( diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBoxTest.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBoxTest.java index 157a6e8933..4016a263ce 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBoxTest.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBoxTest.java @@ -3,19 +3,18 @@ */ package com.fr.design.gui.icombobox; -import java.awt.BorderLayout; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.log.FineLoggerFactory; +import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; - -import com.fr.base.FRContext; -import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.FRGUIPaneFactory; -import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; +import java.awt.BorderLayout; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; /** * @author richer @@ -26,7 +25,7 @@ public class LazyComboBoxTest { try { UIManager.setLookAndFeel(new WindowsLookAndFeel()); } catch (UnsupportedLookAndFeelException e1) { - FRContext.getLogger().error(e1.getMessage(), e1); + FineLoggerFactory.getLogger().error(e1.getMessage(), e1); } JFrame f = new JFrame(); JPanel p = (JPanel) f.getContentPane(); @@ -40,7 +39,7 @@ public class LazyComboBoxTest { try { Thread.sleep(3000); } catch (InterruptedException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } return m; } diff --git a/designer-base/src/main/java/com/fr/design/gui/ilable/UILabel.java b/designer-base/src/main/java/com/fr/design/gui/ilable/UILabel.java index 6583e8d61f..d6a7952757 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ilable/UILabel.java +++ b/designer-base/src/main/java/com/fr/design/gui/ilable/UILabel.java @@ -1,9 +1,9 @@ package com.fr.design.gui.ilable; +import com.fr.design.gui.core.UITextComponent; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.StringUtils; -import com.fr.stable.StringUtils; import javax.swing.Icon; import javax.swing.JFrame; import javax.swing.JLabel; @@ -19,7 +19,7 @@ import java.awt.Dimension; * Date: 13-1-23 * Time: 下午3:15 */ -public class UILabel extends JLabel { +public class UILabel extends JLabel implements UITextComponent { private static final int HTML_SHIFT_HEIGHT = 3; public UILabel(String text, Icon image, int horizontalAlignment) { @@ -64,7 +64,6 @@ public class UILabel extends JLabel { return preferredSize; } - public static void main(String[] args) { // UILabel label = new UILabel("shishi",SwingConstants.LEFT); JFrame frame = new JFrame("Test"); 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..06a4f54800 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 @@ -1,11 +1,10 @@ package com.fr.design.gui.ilist; 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,11 +12,17 @@ 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.log.FineLoggerFactory; +import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.DefaultListCellRenderer; +import javax.swing.DefaultListModel; +import javax.swing.Icon; +import javax.swing.JList; +import javax.swing.ListSelectionModel; +import javax.swing.SwingWorker; +import java.awt.Component; import java.awt.dnd.DnDConstants; import java.awt.dnd.DragGestureEvent; import java.awt.dnd.DragGestureListener; @@ -111,7 +116,7 @@ public class TableViewList extends UIList { } catch (Exception e) { if (!(e instanceof InterruptedException) && !(e instanceof CancellationException)) { TableViewList.this.setModel(failed); - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } } @@ -138,21 +143,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 +182,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 +192,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/itableeditorpane/UITableModelAdapter.java b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java index aa44b14ac5..acea8dcc57 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java +++ b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java @@ -1,8 +1,8 @@ package com.fr.design.gui.itableeditorpane; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.design.mainframe.DesignerContext; +import com.fr.log.FineLoggerFactory; import javax.swing.JOptionPane; import javax.swing.JTable; @@ -166,7 +166,7 @@ public abstract class UITableModelAdapter extends AbstractTabl try { table.getCellEditor().stopCellEditing(); } catch (Exception ee) { - FRContext.getLogger().error(ee.getMessage(), ee); + FineLoggerFactory.getLogger().error(ee.getMessage(), ee); } } } @@ -241,7 +241,7 @@ public abstract class UITableModelAdapter extends AbstractTabl try { table.getCellEditor().stopCellEditing(); } catch (Exception ee) { - FRContext.getLogger().error(ee.getMessage(), ee); + FineLoggerFactory.getLogger().error(ee.getMessage(), ee); } } if (getRowCount() < 1 || selectedRow.length < 0) { diff --git a/designer-base/src/main/java/com/fr/design/gui/itooltip/MultiLineToolTipUI.java b/designer-base/src/main/java/com/fr/design/gui/itooltip/MultiLineToolTipUI.java index 0e94524a93..da32ae09a5 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itooltip/MultiLineToolTipUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/itooltip/MultiLineToolTipUI.java @@ -1,5 +1,12 @@ package com.fr.design.gui.itooltip; +import com.fr.base.GraphHelper; +import com.fr.log.FineLoggerFactory; + +import javax.swing.JComponent; +import javax.swing.JToolTip; +import javax.swing.SwingUtilities; +import javax.swing.plaf.ToolTipUI; import java.awt.Color; import java.awt.Dimension; import java.awt.FontMetrics; @@ -13,14 +20,6 @@ import java.io.StringReader; import java.util.Enumeration; import java.util.Vector; -import javax.swing.JComponent; -import javax.swing.JToolTip; -import javax.swing.SwingUtilities; -import javax.swing.plaf.ToolTipUI; - -import com.fr.base.FRContext; -import com.fr.base.GraphHelper; - public class MultiLineToolTipUI extends ToolTipUI { private String[] strs; @@ -65,7 +64,7 @@ public class MultiLineToolTipUI extends ToolTipUI { v.addElement(line); } } catch (IOException ex) { - FRContext.getLogger().error(ex.getMessage(), ex); + FineLoggerFactory.getLogger().error(ex.getMessage(), ex); } int lines = v.size(); if (lines < 1) { diff --git a/designer-base/src/main/java/com/fr/design/gui/itooltip/UIToolTip.java b/designer-base/src/main/java/com/fr/design/gui/itooltip/UIToolTip.java index 2918975558..8db73f8e66 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itooltip/UIToolTip.java +++ b/designer-base/src/main/java/com/fr/design/gui/itooltip/UIToolTip.java @@ -1,12 +1,22 @@ package com.fr.design.gui.itooltip; -import com.fr.base.FRContext; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JToolTip; +import javax.swing.ToolTipManager; +import java.awt.AWTException; +import java.awt.Container; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; /** * Created with IntelliJ IDEA. @@ -39,7 +49,7 @@ public class UIToolTip extends JToolTip{ } }); } catch (AWTException e) { - FRContext.getLogger().error(e.getMessage(),e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } this.addMouseWheelListener(new MouseWheelListener() { diff --git a/designer-base/src/main/java/com/fr/design/gui/itooltip/UIToolTipUI.java b/designer-base/src/main/java/com/fr/design/gui/itooltip/UIToolTipUI.java index dc6d2a6bc2..863ebaa2ca 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itooltip/UIToolTipUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/itooltip/UIToolTipUI.java @@ -1,11 +1,21 @@ package com.fr.design.gui.itooltip; -import com.fr.base.FRContext; import com.fr.base.GraphHelper; +import com.fr.log.FineLoggerFactory; -import javax.swing.*; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JComponent; +import javax.swing.JToolTip; +import javax.swing.SwingUtilities; import javax.swing.plaf.ToolTipUI; -import java.awt.*; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FontMetrics; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; import java.awt.geom.GeneralPath; import java.io.BufferedReader; import java.io.IOException; @@ -98,7 +108,7 @@ public class UIToolTipUI extends ToolTipUI { v.addElement(line); } } catch (IOException ex) { - FRContext.getLogger().error(ex.getMessage(), ex); + FineLoggerFactory.getLogger().error(ex.getMessage(), ex); } int lines = v.size(); if (lines < 1) { 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/icon/LockIcon.java b/designer-base/src/main/java/com/fr/design/icon/LockIcon.java index f0473c49b7..934d53b08e 100644 --- a/designer-base/src/main/java/com/fr/design/icon/LockIcon.java +++ b/designer-base/src/main/java/com/fr/design/icon/LockIcon.java @@ -1,17 +1,16 @@ package com.fr.design.icon; +import com.fr.base.BaseUtils; +import com.fr.log.FineLoggerFactory; + +import javax.swing.GrayFilter; +import javax.swing.ImageIcon; import java.awt.Component; import java.awt.Graphics; import java.awt.Image; import java.awt.MediaTracker; import java.awt.image.ImageObserver; -import javax.swing.GrayFilter; -import javax.swing.ImageIcon; - -import com.fr.base.BaseUtils; -import com.fr.base.FRContext; - public class LockIcon extends ImageIcon { private final static Image lockImage = BaseUtils.readImage("/com/fr/design/images/gui/locked.gif"); @@ -55,7 +54,7 @@ public class LockIcon extends ImageIcon { try { tracker.waitForID(0, 0); } catch (InterruptedException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } loadStatus = tracker.statusID(0, false); diff --git a/designer-base/src/main/java/com/fr/design/icon/WarningIcon.java b/designer-base/src/main/java/com/fr/design/icon/WarningIcon.java index 92b4b0d4ac..9b22b40358 100644 --- a/designer-base/src/main/java/com/fr/design/icon/WarningIcon.java +++ b/designer-base/src/main/java/com/fr/design/icon/WarningIcon.java @@ -1,17 +1,16 @@ package com.fr.design.icon; +import com.fr.base.BaseUtils; +import com.fr.log.FineLoggerFactory; + +import javax.swing.GrayFilter; +import javax.swing.ImageIcon; import java.awt.Component; import java.awt.Graphics; import java.awt.Image; import java.awt.MediaTracker; import java.awt.image.ImageObserver; -import javax.swing.GrayFilter; -import javax.swing.ImageIcon; - -import com.fr.base.BaseUtils; -import com.fr.base.FRContext; - /** * 警告图片 * @@ -59,7 +58,7 @@ public class WarningIcon extends ImageIcon { try { tracker.waitForID(0, 0); } catch (InterruptedException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } tracker.statusID(0, false); 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 e148a10407..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 @@ -38,7 +38,6 @@ import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.menu.MenuManager; import com.fr.design.menu.ShortCut; -import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.exception.DecryptTemplateException; import com.fr.file.FILE; @@ -68,6 +67,7 @@ import javax.swing.JLayeredPane; import javax.swing.JMenuBar; import javax.swing.JOptionPane; import javax.swing.JPanel; +import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.WindowConstants; import javax.swing.border.MatteBorder; @@ -413,7 +413,16 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta public void on(PluginEvent event) { refreshNorthEastPane(northEastPane, ad); - DesignUtils.refreshDesignerFrame(); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + if (DesignerContext.getDesignerFrame() == null) { + return; + } + DesignerContext.getDesignerFrame().refresh(); + DesignerContext.getDesignerFrame().repaint(); + } + }); } }, new PluginFilter() { @@ -815,14 +824,19 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 报表运行环境改变时,需要刷新某些面板 */ public void refreshEnv() { + refresh(); + DesignerFrameFileDealerPane.getInstance().refreshDockingView(); + TemplateTreePane.getInstance().refreshDockingView(); + } + /** + * 安装设计器相关插件时的刷新 + */ + public void refresh() { this.setTitle(); - DesignerFrameFileDealerPane.getInstance().refreshDockingView(); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); - TemplateTreePane.getInstance().refreshDockingView(); DesignTableDataManager.clearGlobalDs(); EastRegionContainerPane.getInstance().refreshDownPane(); - JTemplate template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (template != null) { template.refreshToolArea(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 7127c9763e..cef5c86a08 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -30,11 +30,18 @@ import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; +import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralContext; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.context.PluginContext; +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.StringUtils; import com.fr.third.org.apache.commons.io.FilenameUtils; @@ -68,6 +75,22 @@ import static javax.swing.JOptionPane.WARNING_MESSAGE; public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarStateChangeListener, ResponseDataSourceChange { + static { + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + + @Override + public void on(PluginEvent event) { + DesignUtils.refreshDesignerFrame(); + } + }, new PluginFilter() { + + @Override + public boolean accept(PluginContext context) { + return context.contain(PluginModule.ExtraDesign, ShortCut.TEMPLATE_TREE); + } + }); + } + private static final String FILE = "file"; private static volatile DesignerFrameFileDealerPane THIS; @@ -163,7 +186,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt * 刷新菜单 */ public void refreshDockingView() { - ToolBarDef toolbarDef = new ToolBarDef(); toolbarDef.addShortCut(newFolderAction, refreshTreeAction); if (WorkContext.getCurrent().isLocal()) { @@ -406,8 +428,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt String oldName = fnf.getName(); String suffix = fnf.isDirectory() ? StringUtils.EMPTY : oldName.substring(oldName.lastIndexOf(CoreConstants.DOT), oldName.length()); - oldName = oldName.replaceAll(suffix, StringUtils.EMPTY); - + oldName = oldName.replace(suffix, StringUtils.EMPTY); this.setLayout(new BorderLayout()); this.setModal(true); 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 7f5cab7448..415ff948c6 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 @@ -522,19 +522,6 @@ public abstract class JTemplate> if (editingFILE == null) { return false; } -// //检查一下连接是否成功 -// try { -// if (FRContext.getCommonOperator() != null && !FRContext.getCommonOperator().testServerConnectionWithOutShowMessagePane()) { -// //连接不成功,提示 -// JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), -// com.fr.design.i18n.Toolkit.i18nText(new String[]{"server_disconnected", "template_unsaved"}, new String[]{",", "!"}) -// , com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Error"), JOptionPane.ERROR_MESSAGE); -// return false; -// } -// } catch (Exception e) { -// FineLoggerFactory.getLogger().error(e.getMessage(), e); -// } - // 检查一下editingFILE是不是已存在的文件,如果不存在则用saveAs if (!editingFILE.exists()) { @@ -623,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; @@ -649,7 +636,7 @@ public abstract class JTemplate> try { file.mkfile(); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -679,7 +666,7 @@ public abstract class JTemplate> try { this.getTarget().export(editingFILE.asOutputStream()); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(), "Save Error", JOptionPane.ERROR_MESSAGE); return false; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/dnd/ArrayListTransferHandler.java b/designer-base/src/main/java/com/fr/design/mainframe/dnd/ArrayListTransferHandler.java index 48e52bb9a8..daf3f802fc 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/dnd/ArrayListTransferHandler.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/dnd/ArrayListTransferHandler.java @@ -3,18 +3,17 @@ */ package com.fr.design.mainframe.dnd; -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.Transferable; -import java.awt.datatransfer.UnsupportedFlavorException; -import java.io.IOException; -import java.util.ArrayList; +import com.fr.log.FineLoggerFactory; import javax.swing.DefaultListModel; import javax.swing.JComponent; import javax.swing.JList; import javax.swing.TransferHandler; - -import com.fr.base.FRContext; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.io.IOException; +import java.util.ArrayList; /** * Used for JList. @@ -33,7 +32,7 @@ public class ArrayListTransferHandler extends TransferHandler { try { localArrayListFlavor = new DataFlavor(localArrayListType); } catch (ClassNotFoundException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } serialArrayListFlavor = new DataFlavor(ArrayList.class, "ArrayList"); @@ -55,10 +54,10 @@ public class ArrayListTransferHandler extends TransferHandler { return false; } } catch (UnsupportedFlavorException ufe) { - FRContext.getLogger().error(ufe.getMessage(), ufe); + FineLoggerFactory.getLogger().error(ufe.getMessage(), ufe); return false; } catch (IOException ioe) { - FRContext.getLogger().error(ioe.getMessage(), ioe); + FineLoggerFactory.getLogger().error(ioe.getMessage(), ioe); return false; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/dnd/ArrayListTransferable.java b/designer-base/src/main/java/com/fr/design/mainframe/dnd/ArrayListTransferable.java index e50c40bc53..1a65467de0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/dnd/ArrayListTransferable.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/dnd/ArrayListTransferable.java @@ -1,13 +1,13 @@ package com.fr.design.mainframe.dnd; +import com.fr.log.FineLoggerFactory; + import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; import java.util.ArrayList; import java.util.List; -import com.fr.base.FRContext; - public class ArrayListTransferable implements Transferable { private DataFlavor localArrayListFlavor; private DataFlavor serialArrayListFlavor; @@ -21,7 +21,7 @@ public class ArrayListTransferable implements Transferable { try { localArrayListFlavor = new DataFlavor(localArrayListType); } catch (ClassNotFoundException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } serialArrayListFlavor = new DataFlavor(ArrayList.class, "ArrayList"); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java index bf815e1d74..54bb4addc3 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java @@ -14,7 +14,7 @@ import java.awt.event.MouseEvent; public class LogMessageBar extends JPanel { private UILabel messageLabel; private int width = 600; - public static volatile LogMessageBar THIS; + private static volatile LogMessageBar THIS; private JFrame dlg = new LogDetailPane().showDialog(); public static LogMessageBar getInstance() { @@ -69,8 +69,11 @@ public class LogMessageBar extends JPanel { return new Dimension(width, 24); } + /** + * 销毁内置的日志面板,外部插件会用到 + */ public void disposeLogDialog() { - if (dlg != null) { + if (dlg != null && dlg.isShowing()) { dlg.dispose(); } THIS = null; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java index c1ca5d6bb1..57ff2ce8a9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java @@ -7,10 +7,10 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.SiteCenterToken; +import com.fr.general.CloudCenter; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralUtils; import com.fr.general.IOUtils; -import com.fr.general.CloudCenter; import com.fr.general.http.HttpClient; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; @@ -132,11 +132,11 @@ public class TemplateInfoCollector implements Serializable, } xmlInputStream.close(); } catch (FileNotFoundException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } catch (IOException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } catch (XMLStreamException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } 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/mainframe/widget/renderer/IconCellRenderer.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/renderer/IconCellRenderer.java index 2f7fd272d7..12831a9f95 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/renderer/IconCellRenderer.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/renderer/IconCellRenderer.java @@ -1,11 +1,13 @@ package com.fr.design.mainframe.widget.renderer; -import java.awt.*; - -import com.fr.base.FRContext; import com.fr.base.Icon; import com.fr.base.IconManager; import com.fr.form.ui.WidgetInfoConfig; +import com.fr.log.FineLoggerFactory; + +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; public class IconCellRenderer extends GenericCellRenderer { private Image img; @@ -22,7 +24,7 @@ public class IconCellRenderer extends GenericCellRenderer { this.setImage(icon == null ? null : icon.getImage()); } catch (CloneNotSupportedException e) { this.setImage(null); - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } 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/module/DesignModuleFactory.java b/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java index 2a4342a7dc..22ea7aa359 100644 --- a/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java +++ b/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java @@ -1,6 +1,5 @@ package com.fr.design.module; -import com.fr.base.FRContext; import com.fr.base.chart.BaseChartCollection; import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.MiddleChartComponent; @@ -15,9 +14,12 @@ import com.fr.design.parameter.HierarchyTreePane; import com.fr.design.parameter.ParameterDesignerProvider; import com.fr.design.parameter.ParameterReader; import com.fr.form.ui.Widget; +import com.fr.log.FineLoggerFactory; import com.fr.stable.StableUtils; -import java.awt.*; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.Window; import java.lang.reflect.Constructor; import java.util.ArrayList; @@ -122,7 +124,7 @@ public class DesignModuleFactory { try { return instance.paraPropertyPane.newInstance(); } catch (Exception e) { - FRContext.getLogger().error("Error in Para PropertyPane"); + FineLoggerFactory.getLogger().error("Error in Para PropertyPane"); } } return null; @@ -137,7 +139,7 @@ public class DesignModuleFactory { try { return (ParameterDesignerProvider) instance.formParaDesigner.newInstance(); } catch (Exception e) { - FRContext.getLogger().error("error in form para designer"); + FineLoggerFactory.getLogger().error("error in form para designer"); } } return null; @@ -172,9 +174,9 @@ public class DesignModuleFactory { bcc = instance.chartComponentClass.newInstance(); bcc.populate(collection); } catch (InstantiationException e) { - FRContext.getLogger().error("Error in ChartComponent instant", e); + FineLoggerFactory.getLogger().error("Error in ChartComponent instant", e); } catch (IllegalAccessException e) { - FRContext.getLogger().error("Error in Access", e); + FineLoggerFactory.getLogger().error("Error in Access", e); } } return bcc; @@ -195,7 +197,7 @@ public class DesignModuleFactory { } return c.newInstance(window); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } return null; } 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/BorderPane.java b/designer-base/src/main/java/com/fr/design/style/BorderPane.java index a997b3673c..aa1185f5de 100644 --- a/designer-base/src/main/java/com/fr/design/style/BorderPane.java +++ b/designer-base/src/main/java/com/fr/design/style/BorderPane.java @@ -5,7 +5,6 @@ package com.fr.design.style; import com.fr.base.BaseUtils; import com.fr.base.CellBorderStyle; -import com.fr.base.FRContext; import com.fr.base.GraphHelper; import com.fr.base.Style; import com.fr.design.dialog.BasicPane; @@ -16,6 +15,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.style.color.ColorSelectBox; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.stable.CoreConstants; @@ -243,7 +243,7 @@ public class BorderPane extends BasicPane { this.cellBorderStyle = (CellBorderStyle)cellBorderStyle.clone(); } } catch (CloneNotSupportedException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } this.insideMode = insideMode; // ben 这里也有问题,CellBorderStyle的 linestyle和color很可能不止一种 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 53558f6fb7..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 @@ -1,24 +1,24 @@ package com.fr.design.style.background.gradient; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.ButtonGroup; - +import com.fr.base.background.GradientBackground; import com.fr.design.gui.ibutton.UIRadioButton; 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; +import javax.swing.ButtonGroup; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; - -import com.fr.base.background.GradientBackground; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.general.Background; - -import com.fr.design.style.background.BackgroundDetailPane; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; /** * 渐变色的面板,不是很pp,面板应用显得繁琐,有写可以写成控件类型,比如色彩选择的。。,可以做得花哨点 @@ -43,7 +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)); 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/BrowseUtils.java b/designer-base/src/main/java/com/fr/design/utils/BrowseUtils.java index 4de2705715..8a68593efe 100644 --- a/designer-base/src/main/java/com/fr/design/utils/BrowseUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/BrowseUtils.java @@ -1,6 +1,5 @@ package com.fr.design.utils; -import com.fr.base.FRContext; import com.fr.log.FineLoggerFactory; import com.fr.stable.OperatingSystem; import com.fr.stable.StringUtils; @@ -43,7 +42,7 @@ public class BrowseUtils { public static void browser(String url) { if (StringUtils.isEmpty(url)) { - FRContext.getLogger().info("The URL is empty!"); + FineLoggerFactory.getLogger().info("The URL is empty!"); return; } try { diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index 240176eef7..8687461a1c 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java @@ -1,7 +1,6 @@ package com.fr.design.utils; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.base.FeedBackInfo; import com.fr.base.ServerConfig; import com.fr.design.DesignerEnvManager; @@ -22,8 +21,11 @@ import com.fr.stable.StringUtils; import com.fr.start.ServerStarter; import com.fr.workspace.WorkContext; -import javax.swing.*; -import java.awt.*; +import javax.swing.JOptionPane; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import java.awt.Desktop; +import java.awt.Font; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; @@ -95,13 +97,13 @@ public class DesignUtils { writer.flush(); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } finally { try { writer.close(); socket.close(); } catch (IOException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } } @@ -237,7 +239,7 @@ public class DesignUtils { //比如想在中文或英文系统里用韩文设计器 guiFRFont = getNamedFont("Dialog"); if (!guiFRFont.canDisplay(displayChar)) { - FRContext.getLogger().error(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_SimSun_Not_Found")); + FineLoggerFactory.getLogger().error(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_SimSun_Not_Found")); } } } @@ -284,7 +286,7 @@ public class DesignUtils { String value = values[i].replaceAll("\\\\", "/"); segs[i] = URLEncoder.encode(CodeUtils.cjkEncode(names[i]), EncodeConstants.ENCODING_UTF_8) + "=" + URLEncoder.encode(CodeUtils.cjkEncode(value), "UTF-8"); } catch (UnsupportedEncodingException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } String postfixOfUri = (segs.length > 0 ? "?" + StableUtils.join(segs, "&") : StringUtils.EMPTY); @@ -294,7 +296,7 @@ public class DesignUtils { String urlPath = getWebBrowserPath(); Desktop.getDesktop().browse(new URI(urlPath + baseRoute + postfixOfUri)); } catch (Exception e) { - FRContext.getLogger().error("cannot open the url Successful", e); + FineLoggerFactory.getLogger().error("cannot open the url Successful", e); } } else { try { diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java index 21af9365dc..c8c0561c90 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java @@ -6,7 +6,13 @@ package com.fr.design.utils.gui; import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.base.background.ColorBackground; -import com.fr.data.util.function.*; +import com.fr.data.util.function.AverageFunction; +import com.fr.data.util.function.CountFunction; +import com.fr.data.util.function.DataFunction; +import com.fr.data.util.function.MaxFunction; +import com.fr.data.util.function.MinFunction; +import com.fr.data.util.function.NoneFunction; +import com.fr.data.util.function.SumFunction; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.core.ActionFactory; import com.fr.design.border.UITitledBorder; @@ -25,20 +31,48 @@ import com.fr.design.style.color.ColorFactory; import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectable; import com.fr.general.FRFont; - import com.fr.stable.Constants; import com.fr.stable.OperatingSystem; import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.AbstractButton; +import javax.swing.Action; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.DefaultListModel; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JFormattedTextField; +import javax.swing.JList; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.JSeparator; +import javax.swing.JSlider; +import javax.swing.JSpinner; +import javax.swing.JTree; +import javax.swing.SwingConstants; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; import javax.swing.border.Border; import javax.swing.border.LineBorder; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeListener; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; - -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.GridLayout; +import java.awt.Image; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Toolkit; +import java.awt.Window; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; @@ -48,16 +82,17 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public abstract class GUICoreUtils{ +// Noninstantiable utility class +public final class GUICoreUtils { private static final int WINDOW_GAP = 20; private static final int HEIGHT_GAP = 28; private static final int WIN_LOCATION_Y=23; private static final int CASE_FOUR = 4; - - + // 覆盖缺省构造器,不可实例化 private GUICoreUtils() { + throw new AssertionError(); } /** 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 new file mode 100644 index 0000000000..d2e9704658 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java @@ -0,0 +1,91 @@ +package com.fr.design.utils.gui; + +import com.fr.design.gui.core.UITextComponent; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralContext; +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; +import java.util.Locale; + +/** + * 包含 UI 组件相关的工具方法 + * Created by plough on 2019/1/11. + */ + +// Noninstantiable utility class +public class UIComponentUtils { + private static final String HTML_TAG_TPL = ""; + private static final String HTML_BODY_TAG = ""; + private static final String HTML_TAG = ""; + private static final int MIN_WIDTH = 10; + + // 覆盖缺省构造器,不可实例化 + private UIComponentUtils() { + throw new AssertionError(); + } + + /** + * 到达指定宽度后换行 + */ + public static void setLineWrap(UITextComponent comp, int width) { + if (width < MIN_WIDTH) { + width = MIN_WIDTH; + } + insertPrefixToText(comp, String.format(HTML_TAG_TPL, width)); + } + + /** + * 自动换行 + */ + public static void setLineWrap(UITextComponent comp) { + insertPrefixToText(comp, HTML_BODY_TAG); + } + + private static void insertPrefixToText(UITextComponent comp, String prefix) { + if (comp == null || ComparatorUtils.equals(Locale.CHINA, GeneralContext.getLocale())) { + // 最初是为了解决日文国际化显示不全,而增加的换行功能。中文不需要换行。 + // windows 下,字体为宋体时,对于 JLabel、JCheckBox、JButton 等控件,使用换行后,文字会下移,可能导致文字下半部分被截断。 + // 因此中文直接返回,不加换行逻辑。 + return; + } + + String text = comp.getText(); + if (StringUtils.isEmpty(text) || text.startsWith(HTML_TAG)) { + return; + } + comp.setText(prefix + text); + } + + /** + * 将一个组件包装到 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/web/CustomIconPane.java b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java index b85ac113d5..74a4990300 100644 --- a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java +++ b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java @@ -291,7 +291,7 @@ public class CustomIconPane extends BasicPane { Configurations.update(new WorkerFacade(WidgetInfoConfig.class) { @Override public void run() { - WidgetInfoConfig.getInstance().setIconManager(IconManager.getIconManager()); + WidgetInfoConfig.getInstance().setIconManager(iconManager); } }); diff --git a/designer-base/src/main/java/com/fr/design/widget/EventCreator.java b/designer-base/src/main/java/com/fr/design/widget/EventCreator.java index 38a55865ad..4fdfd7ed80 100644 --- a/designer-base/src/main/java/com/fr/design/widget/EventCreator.java +++ b/designer-base/src/main/java/com/fr/design/widget/EventCreator.java @@ -1,12 +1,12 @@ package com.fr.design.widget; -import com.fr.base.FRContext; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.controlpane.NameableSelfCreator; import com.fr.design.gui.controlpane.UnrepeatedNameHelper; import com.fr.design.gui.ilist.ListModelElement; import com.fr.form.event.Listener; import com.fr.general.NameObject; +import com.fr.log.FineLoggerFactory; import com.fr.report.web.util.ReportEngineEventMapping; import com.fr.stable.Nameable; @@ -43,7 +43,7 @@ public class EventCreator extends NameableSelfCreator { String localeKey = ReportEngineEventMapping.getLocaleName(eventName); return com.fr.design.i18n.Toolkit.i18nText(localeKey); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); return eventName; } } 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/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index d2953eeb6a..b0f3e9dd48 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -597,7 +597,7 @@ public class RemoteEnvPane extends BasicBeanPane { dialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(RemoteEnvPane.this), UIManager.getString("OptionPane.messageDialogTitle"), true); - dialog.setSize(new Dimension(268, 118)); + dialog.setSize(new Dimension(308, 132)); okButton.setEnabled(false); JPanel jp = new JPanel(); JPanel upPane = new JPanel(); diff --git a/designer-base/src/main/java/com/fr/file/AbstractFILE.java b/designer-base/src/main/java/com/fr/file/AbstractFILE.java new file mode 100644 index 0000000000..866ea2c2b1 --- /dev/null +++ b/designer-base/src/main/java/com/fr/file/AbstractFILE.java @@ -0,0 +1,93 @@ +package com.fr.file; + +import javax.swing.Icon; +import java.io.InputStream; +import java.io.OutputStream; + +public abstract class AbstractFILE implements FILE { + + @Override + public String prefix() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isDirectory() { + throw new UnsupportedOperationException(); + } + + @Override + public String getName() { + throw new UnsupportedOperationException(); + } + + @Override + public Icon getIcon() { + throw new UnsupportedOperationException(); + } + + @Override + public String getPath() { + throw new UnsupportedOperationException(); + } + + @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() { + throw new UnsupportedOperationException(); + } + + @Override + public void closeTemplate() throws Exception { + throw new UnsupportedOperationException(); + } + + @Override + public InputStream asInputStream() throws Exception { + throw new UnsupportedOperationException(); + } + + @Override + public OutputStream asOutputStream() throws Exception { + throw new UnsupportedOperationException(); + } + + @Override + public String getEnvFullName() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isMemFile() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isEnvFile() { + throw new UnsupportedOperationException(); + } +} 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..c4f58fa1a3 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, false); } catch (Exception e) { throw SessionLocalManager.createLogPackedException(e); } diff --git a/designer-base/src/main/java/com/fr/file/RenameExportFILE.java b/designer-base/src/main/java/com/fr/file/RenameExportFILE.java new file mode 100644 index 0000000000..8b03e943f6 --- /dev/null +++ b/designer-base/src/main/java/com/fr/file/RenameExportFILE.java @@ -0,0 +1,102 @@ +package com.fr.file; + +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; +import com.fr.third.org.apache.commons.io.FileUtils; +import com.fr.web.session.SessionLocalManager; + +import javax.swing.Icon; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +public class RenameExportFILE extends AbstractFILE { + + private static final String EXPORT_SUFFIX = ".FRExportTmp"; + + private FILE file; + + private RenameExportFILE(FILE file) { + this.file = new FileFILE(new File(file.getPath() + EXPORT_SUFFIX)); + } + + public static RenameExportFILE create(FILE file) { + return new RenameExportFILE(file); + } + + public static String recoverFileName(String fileName) { + if (StringUtils.isEmpty(fileName) || !fileName.endsWith(EXPORT_SUFFIX)) { + return fileName; + } + return fileName.substring(0, fileName.lastIndexOf(EXPORT_SUFFIX)); + } + + @Override + public String prefix() { + return file.prefix(); + } + + @Override + public boolean isDirectory() { + return false; + } + + @Override + public String getName() { + return file.getName(); + } + + @Override + public Icon getIcon() { + return null; + } + + @Override + public String getPath() { + return file.getPath(); + } + + + @Override + public FILE getParent() { + return file.getParent(); + } + + + @Override + public boolean mkfile() throws Exception { + return file.mkfile(); + } + + @Override + public boolean exists() { + return file.exists(); + } + + @Override + public OutputStream asOutputStream() throws Exception { + + final File localeFile = new File(file.getPath()); + OutputStream out; + try { + StableUtils.makesureFileExist(localeFile); + out = new FileOutputStream(localeFile, false) { + @Override + public void close() throws IOException { + super.close(); + String path = file.getPath(); + if (localeFile.exists()) { + FileUtils.copyFile(localeFile, new File(recoverFileName(path))); + if (localeFile.getPath().endsWith(EXPORT_SUFFIX)) { + FileUtils.forceDelete(localeFile); + } + } + } + }; + } catch (Exception e) { + throw SessionLocalManager.createLogPackedException(e); + } + return out; + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/file/StashedFILE.java b/designer-base/src/main/java/com/fr/file/StashedFILE.java index cacb1e9a90..181af28601 100644 --- a/designer-base/src/main/java/com/fr/file/StashedFILE.java +++ b/designer-base/src/main/java/com/fr/file/StashedFILE.java @@ -1,15 +1,13 @@ 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 { +public class StashedFILE extends AbstractFILE { private FILE file; private byte[] content; @@ -44,31 +42,6 @@ public class StashedFILE implements FILE { 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; @@ -84,11 +57,6 @@ public class StashedFILE implements FILE { return new ByteArrayInputStream(content); } - @Override - public OutputStream asOutputStream() throws Exception { - throw new NotSupportedException(); - } - @Override public String getEnvFullName() { return file.getEnvFullName(); @@ -103,4 +71,4 @@ public class StashedFILE implements FILE { public boolean isEnvFile() { return false; } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/start/Demo.java b/designer-base/src/main/java/com/fr/start/Demo.java index 7fb8c440b0..bac5a9b0f0 100644 --- a/designer-base/src/main/java/com/fr/start/Demo.java +++ b/designer-base/src/main/java/com/fr/start/Demo.java @@ -1,7 +1,7 @@ package com.fr.start; -import com.fr.base.FRContext; +import com.fr.log.FineLoggerFactory; import com.fr.stable.OperatingSystem; import com.fr.stable.StableUtils; @@ -11,7 +11,7 @@ public class Demo { public static void main(String[] args) { String installHome = StableUtils.getInstallHome(); if (installHome == null) { - FRContext.getLogger().error("Can not find the install home, please check it."); + FineLoggerFactory.getLogger().error("Can not find the install home, please check it."); return; } @@ -29,7 +29,7 @@ public class Demo { try { builder.start(); } catch (IOException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } else { // ProcessBuilder这种方式在window下报错:系统找不到指定文件 @@ -37,7 +37,7 @@ public class Demo { try { rt.exec(executorPath); } catch (IOException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } diff --git a/designer-base/src/main/java/com/fr/start/StartDocURL.java b/designer-base/src/main/java/com/fr/start/StartDocURL.java index fdf7f5f916..58de885656 100644 --- a/designer-base/src/main/java/com/fr/start/StartDocURL.java +++ b/designer-base/src/main/java/com/fr/start/StartDocURL.java @@ -1,11 +1,11 @@ package com.fr.start; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.StableUtils; + import java.awt.Desktop; import java.net.URI; -import com.fr.base.FRContext; -import com.fr.stable.StableUtils; - /** * 从windows开始菜单点击exe文件启动html格式的帮助文档, @@ -20,7 +20,7 @@ public class StartDocURL { public static void main(String[] args) { //p:必须有路径的URL存在 if(args == null || args.length < 1) { - FRContext.getLogger().error( + FineLoggerFactory.getLogger().error( "Can not find the install home, please check it."); return; } @@ -33,7 +33,7 @@ public class StartDocURL { } else { String iHome = StableUtils.getInstallHome(); if (iHome == null) { - FRContext.getLogger().error( + FineLoggerFactory.getLogger().error( "Can not find the install home, please check it."); return; } @@ -42,7 +42,7 @@ public class StartDocURL { Desktop.getDesktop().open(new java.io.File(iHome + args[0])); } } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/start/server/ServerManageFrame.java b/designer-base/src/main/java/com/fr/start/server/ServerManageFrame.java index 3b15071790..ff183b7547 100644 --- a/designer-base/src/main/java/com/fr/start/server/ServerManageFrame.java +++ b/designer-base/src/main/java/com/fr/start/server/ServerManageFrame.java @@ -1,17 +1,20 @@ package com.fr.start.server; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.log.FineLoggerFactory; - -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -32,7 +35,7 @@ public class ServerManageFrame extends JFrame { try { serverManageFrame.checkButtonEnabled(); } catch(Exception exp) { - FRContext.getLogger().error(exp.getMessage()); + FineLoggerFactory.getLogger().error(exp.getMessage()); } return serverManageFrame; @@ -77,7 +80,7 @@ public class ServerManageFrame extends JFrame { FineEmbedServer.start(); checkButtonEnabled(); } catch(Exception exp) { - FRContext.getLogger().error(exp.getMessage()); + FineLoggerFactory.getLogger().error(exp.getMessage()); } } }); @@ -94,7 +97,7 @@ public class ServerManageFrame extends JFrame { FineEmbedServer.stop(); checkButtonEnabled(); } catch(Exception exp) { - FRContext.getLogger().error(exp.getMessage()); + FineLoggerFactory.getLogger().error(exp.getMessage()); } } }); @@ -120,7 +123,7 @@ public class ServerManageFrame extends JFrame { // try { // desktop.open(); // } catch(Exception exp) { -// FRContext.getLogger().error(exp.getMessage()); +// FineLoggerFactory.getLogger().error(exp.getMessage()); // } // } // }); diff --git a/designer-base/src/main/java/com/fr/start/server/ServerTray.java b/designer-base/src/main/java/com/fr/start/server/ServerTray.java index 01cfc53fc6..f6dede2955 100644 --- a/designer-base/src/main/java/com/fr/start/server/ServerTray.java +++ b/designer-base/src/main/java/com/fr/start/server/ServerTray.java @@ -1,13 +1,17 @@ package com.fr.start.server; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.ListenerAdaptor; - - -import java.awt.*; +import com.fr.log.FineLoggerFactory; + +import java.awt.AWTException; +import java.awt.Image; +import java.awt.MenuItem; +import java.awt.PopupMenu; +import java.awt.SystemTray; +import java.awt.TrayIcon; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -61,7 +65,7 @@ public class ServerTray { try { FineEmbedServer.start(); } catch (Exception exp) { - FRContext.getLogger().error(exp.getMessage(), exp); + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); } } }; @@ -72,7 +76,7 @@ public class ServerTray { try { FineEmbedServer.stop(); } catch (Throwable exp) { - FRContext.getLogger().error(exp.getMessage(), exp); + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); } } }; @@ -168,7 +172,7 @@ public class ServerTray { serverManageFrame.repaint(); } } catch (Exception exp) { - FRContext.getLogger().error(exp.getMessage(), exp); + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); } } diff --git a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/contextPath.txt b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/contextPath.txt index 2faf5629e5..a9a21e7e71 100644 --- a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/contextPath.txt +++ b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/contextPath.txt @@ -1 +1 @@ -contextPath是指绝对路径的服务器别名,即虚拟目录.假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,contextPath是/WebReport \ No newline at end of file +contextPath是指绝对路径的服务器别名,即虚拟目录.假如访问:http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,contextPath是/webroot/decision/view \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/formletName.txt b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/formletName.txt index c9921354ad..b6595d02f5 100644 --- a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/formletName.txt +++ b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/formletName.txt @@ -1 +1 @@ -表单名字假如访问:http://localhost:8080/WebReport/ReportServer?formlet=Form1.frm,formName就是Form1.frm \ No newline at end of file +表单名字假如访问:http://localhost:8075/webroot/decision/view/form?viewlet=Form1.frm,formName就是Form1.frm \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/reportName.txt b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/reportName.txt index d2bb66ad34..aadcc74d2c 100644 --- a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/reportName.txt +++ b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/reportName.txt @@ -1 +1 @@ -报表名字假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,reportName就是WorkBook1.cpt \ No newline at end of file +报表名字假如访问:http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,reportName就是WorkBook1.cpt \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/serverName.txt b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/serverName.txt index d6fca71888..4511f6ac87 100644 --- a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/serverName.txt +++ b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/serverName.txt @@ -1 +1 @@ -serverName,是指服务器地址或名称.假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,serverName指的是:localhost,即访问机子的IP \ No newline at end of file +serverName,是指服务器地址或名称.假如访问:http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,serverName指的是:localhost,即访问机子的IP \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/serverSchema.txt b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/serverSchema.txt index 15bcc7e9fb..b069665a0f 100644 --- a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/serverSchema.txt +++ b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/serverSchema.txt @@ -1 +1 @@ -serverSchema,是指协议名称.假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,serverSchema指的是:http \ No newline at end of file +serverSchema,是指协议名称.假如访问:http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,serverSchema指的是:http \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/serverURL.txt b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/serverURL.txt index 02c7db49f2..cba9e2ebde 100644 --- a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/serverURL.txt +++ b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/serverURL.txt @@ -1 +1 @@ -serverURL是指访问服务的URL假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,serverURL就是http://localhost:8080 \ No newline at end of file +serverURL是指访问服务的URL假如访问:http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,serverURL就是http://localhost:8075 \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/servletURL.txt b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/servletURL.txt index 2a1e5dfd49..81dc88965f 100644 --- a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/servletURL.txt +++ b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/servletURL.txt @@ -1 +1 @@ -假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,servletURL指的是:/WebReport/ReportServer \ No newline at end of file +假如访问的是http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,servletURL指的是:/webroot/decision/view/report \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/contextPath.txt b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/contextPath.txt index 7c62560355..59acbbae2f 100644 --- a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/contextPath.txt +++ b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/contextPath.txt @@ -1 +1 @@ -absolute path of the serverhttp://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,contextPath is /WebReport \ No newline at end of file +absolute path of the server http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,contextPath is /webroot/decision/view \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/formletName.txt b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/formletName.txt index 48e90583c7..f7a281424f 100644 --- a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/formletName.txt +++ b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/formletName.txt @@ -1 +1 @@ -form namehttp://localhost:8080/WebReport/ReportServer?formlet=Form1.frm,formName is Form1.frm \ No newline at end of file +form name http://localhost:8075/webroot/decision/view/form?viewlet=Form1.frm,formName is Form1.frm \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/reportName.txt b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/reportName.txt index 88afaad378..ece7e13d4f 100644 --- a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/reportName.txt +++ b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/reportName.txt @@ -1 +1 @@ -report namehttp://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,reportName is WorkBook1.cpt \ No newline at end of file +report name http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,reportName is WorkBook1.cpt \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/serverName.txt b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/serverName.txt index 265bd4ad02..515756dfd2 100644 --- a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/serverName.txt +++ b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/serverName.txt @@ -1 +1 @@ -address or name of the serverhttp://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,serverName means localhost \ No newline at end of file +address or name of the server http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,serverName means localhost \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/serverSchema.txt b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/serverSchema.txt index 85072e652c..f36e3c6e02 100644 --- a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/serverSchema.txt +++ b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/serverSchema.txt @@ -1 +1 @@ -serverSchemahttp://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,serverSchema is http \ No newline at end of file +serverSchema http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,serverSchema is http \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/serverURL.txt b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/serverURL.txt index f14f925834..78bbf7122e 100644 --- a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/serverURL.txt +++ b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/serverURL.txt @@ -1 +1 @@ -URL of the serverhttp://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,serverURL is http://localhost:8080 \ No newline at end of file +URL of the server http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,serverURL is http://localhost:8075 \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/servletURL.txt b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/servletURL.txt index b9149deff3..d8704ba82a 100644 --- a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/servletURL.txt +++ b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/servletURL.txt @@ -1 +1 @@ -http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,servletURL is /WebReport/ReportServer \ No newline at end of file +http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,servletURL is /webroot/decision/view/report \ No newline at end of file diff --git a/designer-base/src/test/java/com/fr/design/utils/gui/UIComponentUtilsTest.java b/designer-base/src/test/java/com/fr/design/utils/gui/UIComponentUtilsTest.java new file mode 100644 index 0000000000..256abeeca8 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/utils/gui/UIComponentUtilsTest.java @@ -0,0 +1,109 @@ +package com.fr.design.utils.gui; + +import com.fr.design.gui.core.UITextComponent; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.stable.StringUtils; +import org.junit.Before; +import org.junit.Test; + +import javax.swing.Icon; + +import java.awt.Component; +import java.awt.Graphics; + +import static org.junit.Assert.*; + +/** + * Created by plough on 2019/1/11. + */ +public class UIComponentUtilsTest { + private static final String HTML_TAG_TPL = ""; + private static final String HTML_TAG = ""; + private UIButton textButton; + private UIButton emptyTextButton; + private UIButton iconButton; + + private UILabel textLabel; + private UILabel emptyTextLabel; + private UILabel iconLabel; + + @Before + public void setUp() { + textButton = new UIButton("hello"); + emptyTextButton = new UIButton(StringUtils.EMPTY); + iconButton = new UIButton(createMockIcon()); + + textLabel = new UILabel("hello"); + emptyTextLabel = new UILabel(StringUtils.EMPTY); + iconLabel = new UILabel(createMockIcon()); + } + + @Test + public void testSetLineWrap() { + UITextComponent[] noWrapComps = {emptyTextButton, emptyTextLabel, iconButton, iconLabel}; + UITextComponent[] wrapComps = {textLabel, textButton}; + + for (UITextComponent comp : wrapComps) { + UIComponentUtils.setLineWrap(comp); + assertTrue(isLineWrapped(comp)); + } + + for (UITextComponent comp : noWrapComps) { + UIComponentUtils.setLineWrap(comp); + assertFalse(isLineWrapped(comp)); + } + } + + @Test + public void testSetLineWrapWithLineWidth() { + UILabel label1 = new UILabel("l1"); + UILabel label2 = new UILabel("l2"); + UILabel label3 = new UILabel("l3"); + UIComponentUtils.setLineWrap(label1, 50); + assertTrue(isLineWrappedWithLineWidth(label1, 50)); + + UIComponentUtils.setLineWrap(label2, 0); + assertTrue(isLineWrappedWithLineWidth(label2, 10)); + + UIComponentUtils.setLineWrap(label3, -10); + assertTrue(isLineWrappedWithLineWidth(label3, 10)); + } + + @Test + public void testAddHtmlTwice() { + UIComponentUtils.setLineWrap(textLabel, 50); + UIComponentUtils.setLineWrap(textLabel, 20); // 第二次应该不生效 + assertTrue(isLineWrappedWithLineWidth(textLabel, 50)); + } + + private boolean isLineWrapped(UITextComponent comp) { + String text = comp.getText(); + return StringUtils.isNotEmpty(text) && text.startsWith(HTML_TAG); + } + + private boolean isLineWrappedWithLineWidth(UITextComponent comp, int width) { + String text = comp.getText(); + return StringUtils.isNotEmpty(text) && text.startsWith(String.format(HTML_TAG_TPL, width)); + } + + + private Icon createMockIcon() { + return new Icon() { + @Override + public void paintIcon(Component c, Graphics g, int x, int y) { + // do nothing + } + + @Override + public int getIconWidth() { + return 0; + } + + @Override + public int getIconHeight() { + return 0; + } + }; + } +} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartAxisFactory.java b/designer-chart/src/main/java/com/fr/design/chart/ChartAxisFactory.java index 81a7d77159..178bca370a 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartAxisFactory.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartAxisFactory.java @@ -1,12 +1,17 @@ package com.fr.design.chart; -import com.fr.base.FRContext; import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.CategoryAxis; import com.fr.chart.chartattr.RadarAxis; import com.fr.chart.chartattr.ValueAxis; -import com.fr.design.mainframe.chart.gui.style.axis.*; +import com.fr.design.mainframe.chart.gui.style.axis.ChartAxisUsePane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartCategoryPane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartPercentValuePane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartRadarPane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartSecondValuePane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartValuePane; import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; import java.util.HashMap; import java.util.Map; @@ -45,10 +50,8 @@ public class ChartAxisFactory { Class cls = map.get(clsName); try { return cls.newInstance(); - } catch (InstantiationException e) { - FRContext.getLogger().error(e.getMessage(), e); - } catch (IllegalAccessException e) { - FRContext.getLogger().error(e.getMessage(), e); + } catch (InstantiationException | IllegalAccessException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } return new ChartCategoryPane(); } diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartPlotFactory.java b/designer-chart/src/main/java/com/fr/design/chart/ChartPlotFactory.java index e9c475c5bb..82244e0a0d 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartPlotFactory.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartPlotFactory.java @@ -1,10 +1,55 @@ package com.fr.design.chart; -import com.fr.base.FRContext; -import com.fr.chart.chartattr.*; -import com.fr.design.chart.axis.*; -import com.fr.design.chart.series.SeriesCondition.dlp.*; -import com.fr.design.mainframe.chart.gui.style.axis.*; +import com.fr.chart.chartattr.Area3DPlot; +import com.fr.chart.chartattr.AreaPlot; +import com.fr.chart.chartattr.Bar2DPlot; +import com.fr.chart.chartattr.Bar3DPlot; +import com.fr.chart.chartattr.BubblePlot; +import com.fr.chart.chartattr.CustomPlot; +import com.fr.chart.chartattr.FunnelPlot; +import com.fr.chart.chartattr.GanttPlot; +import com.fr.chart.chartattr.LinePlot; +import com.fr.chart.chartattr.MapPlot; +import com.fr.chart.chartattr.MeterBluePlot; +import com.fr.chart.chartattr.MeterPlot; +import com.fr.chart.chartattr.Pie3DPlot; +import com.fr.chart.chartattr.PiePlot; +import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartattr.RadarPlot; +import com.fr.chart.chartattr.RangePlot; +import com.fr.chart.chartattr.StockPlot; +import com.fr.chart.chartattr.XYScatterPlot; +import com.fr.design.chart.axis.BinaryChartStyleAxisPane; +import com.fr.design.chart.axis.ChartStyleAxisPane; +import com.fr.design.chart.axis.CustomChartStyleAxisPane; +import com.fr.design.chart.axis.GanntChartStyleAxisPane; +import com.fr.design.chart.axis.RadarChartStyleAxisPane; +import com.fr.design.chart.axis.TernaryChartStyleAxisPane; +import com.fr.design.chart.axis.ValueChartStyleAxisPane; +import com.fr.design.chart.axis.XYChartStyleAxisPane; +import com.fr.design.chart.series.SeriesCondition.dlp.AreaDataLabelPane; +import com.fr.design.chart.series.SeriesCondition.dlp.Bar2DDataLabelPane; +import com.fr.design.chart.series.SeriesCondition.dlp.BubbleDataLabelPane; +import com.fr.design.chart.series.SeriesCondition.dlp.DataLabelPane; +import com.fr.design.chart.series.SeriesCondition.dlp.FunnelDataLabelPane; +import com.fr.design.chart.series.SeriesCondition.dlp.LineDataLabelPane; +import com.fr.design.chart.series.SeriesCondition.dlp.MapDataLabelPane; +import com.fr.design.chart.series.SeriesCondition.dlp.MeterDataLabelPane; +import com.fr.design.chart.series.SeriesCondition.dlp.PieDataLabelPane; +import com.fr.design.chart.series.SeriesCondition.dlp.RadarDataLabelPane; +import com.fr.design.chart.series.SeriesCondition.dlp.RangeDataLabelPane; +import com.fr.design.chart.series.SeriesCondition.dlp.StockDataLabelPane; +import com.fr.design.chart.series.SeriesCondition.dlp.XYDataLabelPane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartAxisUsePane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartCategoryNoFormulaPane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartCategoryPane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartPercentValueNoFormulaPane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartPercentValuePane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartSecondValueNoFormulaPane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartSecondValuePane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartValueNoFormulaPane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartValuePane; +import com.fr.log.FineLoggerFactory; import java.lang.reflect.Constructor; import java.util.HashMap; @@ -91,7 +136,7 @@ public class ChartPlotFactory { Constructor c = factoryObject.getAxisPaneClass().getConstructor(Plot.class); return c.newInstance(plot); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } return new BinaryChartStyleAxisPane(plot); @@ -109,7 +154,7 @@ public class ChartPlotFactory { Constructor c = factoryObject.getDataLabelPaneClass().getConstructor(); return (DataLabelPane) c.newInstance(); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } return new DataLabelPane(); @@ -122,7 +167,7 @@ public class ChartPlotFactory { Constructor c = aClass.getConstructor(); return (ChartAxisUsePane) c.newInstance(); }catch (Exception e){ - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java index 5cc3c8d50c..de7d08a2b0 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java @@ -4,7 +4,6 @@ package com.fr.design.chart; * */ -import com.fr.base.FRContext; import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; @@ -17,6 +16,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.license.exception.RegistEditionException; import com.fr.license.function.VT4FR; +import com.fr.log.FineLoggerFactory; import javax.swing.BorderFactory; import javax.swing.DefaultListCellRenderer; @@ -51,7 +51,7 @@ public class ChartTypePane extends ChartCommonWizardPane { charts4Icon[i][j].getPlot().setLegend(null); } } catch (CloneNotSupportedException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } } @@ -172,7 +172,7 @@ public class ChartTypePane extends ChartCommonWizardPane { try { oldChart.changePlotInNewType((Plot) chart.getPlot().clone()); } catch (CloneNotSupportedException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } } @@ -195,7 +195,7 @@ public class ChartTypePane extends ChartCommonWizardPane { chart4Update = (Chart)chart.clone(); cc.addChart(chart4Update); }catch (CloneNotSupportedException ex){ - FRContext.getLogger().error(ex.getMessage(), ex); + FineLoggerFactory.getLogger().error(ex.getMessage(), ex); } } diff --git a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java index 1766d1d75b..769218c7fa 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java +++ b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java @@ -1,6 +1,5 @@ package com.fr.design.chart.gui; -import com.fr.base.FRContext; import com.fr.base.ScreenResolution; import com.fr.base.chart.BaseChart; import com.fr.base.chart.BaseChartCollection; @@ -15,10 +14,19 @@ import com.fr.design.chart.gui.active.ActiveGlyph; import com.fr.design.chart.gui.active.ChartActiveGlyph; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.chart.MiddleChartComponent; +import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.core.PropertyChangeListener; -import java.awt.*; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Paint; +import java.awt.Point; +import java.awt.RenderingHints; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; @@ -122,7 +130,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene this.chartCollection4Design = (ChartCollection)cc; // this.chartCollection4Design = (ChartCollection)cc.clone(); } catch (Exception e) { - FRContext.getLogger().error("ChartCollection clone is Error"); + FineLoggerFactory.getLogger().error("ChartCollection clone is Error"); } reset(); } diff --git a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java index 783bfdd6a6..f621c545f5 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java +++ b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java @@ -1,11 +1,11 @@ package com.fr.design.chart.gui; -import com.fr.base.FRContext; import com.fr.chart.chartattr.Chart; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.gui.core.WidgetOption; import com.fr.form.ui.ChartEditor; import com.fr.form.ui.Widget; +import com.fr.log.FineLoggerFactory; import javax.swing.Icon; @@ -42,11 +42,11 @@ public class ChartWidgetOption extends WidgetOption { widget.addChart((Chart) chart.clone()); return widget; } catch (InstantiationException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } catch (IllegalAccessException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } catch (CloneNotSupportedException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } return null; diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapCustomPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapCustomPane.java index cae449c05e..d3c8cc41ce 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapCustomPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapCustomPane.java @@ -1,6 +1,5 @@ package com.fr.design.chart.series.PlotSeries; -import com.fr.base.FRContext; import com.fr.base.TableData; import com.fr.base.Utils; import com.fr.chart.base.MapSvgAttr; @@ -16,13 +15,17 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralUtils; - import com.fr.general.data.DataModel; +import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import org.apache.batik.swing.svg.SVGFileFilter; -import javax.swing.*; -import java.awt.*; +import javax.swing.JFileChooser; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -143,7 +146,7 @@ refreshAreaNameBox(); try { embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tableDataWrappe.getTableData(), TableData.RESULT_ALL, false); } catch (Exception ee) { - FRContext.getLogger().error(ee.getMessage(), ee); + FineLoggerFactory.getLogger().error(ee.getMessage(), ee); } if(embeddedTableData == null){ diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ConditionTrendLinePane.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ConditionTrendLinePane.java index 348455bad2..a5b53f20f7 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ConditionTrendLinePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ConditionTrendLinePane.java @@ -1,29 +1,27 @@ package com.fr.design.chart.series.SeriesCondition; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.text.ParseException; - -import javax.swing.ButtonGroup; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.SpinnerNumberModel; - -import com.fr.base.FRContext; import com.fr.base.Utils; import com.fr.chart.base.ChartEquationType; import com.fr.chart.base.ConditionTrendLine; -import com.fr.design.chart.comp.BorderAttriPane; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.comp.BorderAttriPane; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; - import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.log.FineLoggerFactory; + +import javax.swing.ButtonGroup; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.SpinnerNumberModel; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.ParseException; public class ConditionTrendLinePane extends BasicBeanPane { private static final long serialVersionUID = 3867164332100351117L; @@ -197,7 +195,7 @@ public class ConditionTrendLinePane extends BasicBeanPane { try { maSpinner.commitEdit(); } catch (ParseException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } trendLine.getLine().setTrendLineName(nameLabel.getText()); diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/DataSeriesConditionPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/DataSeriesConditionPane.java index e1274aa4b9..90982ded53 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/DataSeriesConditionPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/DataSeriesConditionPane.java @@ -1,6 +1,5 @@ package com.fr.design.chart.series.SeriesCondition; -import com.fr.base.FRContext; import com.fr.chart.base.AttrAlpha; import com.fr.chart.base.AttrBackground; import com.fr.chart.base.AttrContents; @@ -12,10 +11,12 @@ import com.fr.data.condition.ListCondition; import com.fr.design.condition.ConditionAttrSingleConditionPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.log.FineLoggerFactory; - -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Dimension; import java.util.Iterator; /** @@ -114,9 +115,9 @@ public class DataSeriesConditionPane extends ConditionAttributesPane 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 +40,10 @@ 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(Toolkit.i18nText("Fine-Design_Chart_Table_Data")); + UIComponentUtils.setLineWrap(label, TABLE_DATA_LABEL_LINE_WRAP_WIDTH); + UIComponentUtils.setPreferedWidth(label, ChartDataPane.LABEL_WIDTH); + tableDataPane = new DatabaseTableDataPane(label) { @Override protected void userEvent() { @@ -46,7 +52,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); } @@ -81,7 +87,7 @@ public class TableDataPane extends FurtherBasicBeanPane{ * @return 返回标题. */ public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TableData"); + return Toolkit.i18nText("Fine-Design_Chart_TableData"); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/Factory4TableDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/Factory4TableDataContentPane.java index e02e0ba80a..0ce9afcf83 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/Factory4TableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/Factory4TableDataContentPane.java @@ -1,9 +1,17 @@ package com.fr.design.mainframe.chart.gui.data.table; -import com.fr.base.FRContext; -import com.fr.chart.chartattr.*; +import com.fr.chart.chartattr.BubblePlot; +import com.fr.chart.chartattr.GanttPlot; +import com.fr.chart.chartattr.MeterBluePlot; +import com.fr.chart.chartattr.MeterPlot; +import com.fr.chart.chartattr.Pie3DPlot; +import com.fr.chart.chartattr.PiePlot; +import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartattr.SimpleMeterPlot; +import com.fr.chart.chartattr.StockPlot; +import com.fr.chart.chartattr.XYScatterPlot; import com.fr.design.mainframe.chart.gui.ChartDataPane; -import com.fr.design.mainframe.chart.gui.style.axis.*; +import com.fr.log.FineLoggerFactory; import java.lang.reflect.Constructor; import java.util.HashMap; @@ -50,10 +58,8 @@ public class Factory4TableDataContentPane { }else{ return new CategoryPlotTableDataContentPane(parentPane); } - } catch (InstantiationException e) { - FRContext.getLogger().error(e.getMessage(), e); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } return new CategoryPlotTableDataContentPane(parentPane); } 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/design/mainframe/chart/gui/style/series/UIColorPickerPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java index 7a1567bf9e..c9a6caf80a 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java @@ -531,12 +531,16 @@ public class UIColorPickerPane extends BasicPane implements UIObserver { double forValue = Double.MAX_VALUE; double backValue = -Double.MAX_VALUE; for(int i = 0, size = textFieldList.size(); i < size; i++) {// check 是否合格, 然后检查 是否改变颜色, + //backNumber是否是公式形式 + boolean formulaBackNumber = false; if(i == size - 1) { backValue = -Double.MAX_VALUE; } else { Number backNumber = ChartBaseUtils.formula2Number(BaseFormula.createFormulaBuilder().build(getValue4Index(i+1))); if(backNumber != null){ backValue = backNumber.doubleValue(); + } else { + formulaBackNumber = true; } } @@ -544,7 +548,7 @@ public class UIColorPickerPane extends BasicPane implements UIObserver { if(number != null) { double value = number.doubleValue(); - if(value < forValue && value > backValue) { + if ((value < forValue && value > backValue) || formulaBackNumber) { setBackgroundUIColor(i,Color.WHITE); } else { setBackgroundUIColor(i, Color.red); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java index a4e47914eb..27f4266820 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java @@ -2,7 +2,6 @@ package com.fr.design.mainframe.chart.gui.type; import com.fr.base.ChartColorMatching; import com.fr.base.ChartPreStyleConfig; -import com.fr.base.FRContext; import com.fr.base.background.ColorBackground; import com.fr.chart.base.AttrContents; import com.fr.chart.base.AttrFillStyle; @@ -26,7 +25,6 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; - import com.fr.js.NameJavaScriptGroup; import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; @@ -309,7 +307,7 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane{ try { newPlot.setHotHyperLink((NameJavaScriptGroup)hotHyper.clone()); } catch (CloneNotSupportedException e) { - FRContext.getLogger().error("Error in Hyperlink, Please Check it.", e); + FineLoggerFactory.getLogger().error("Error in Hyperlink, Please Check it.", e); } } newPlot.setConditionCollection(oldPlot.getConditionCollection()); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java index 661dba7590..6f9a55ab56 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java @@ -1,6 +1,5 @@ package com.fr.design.mainframe.chart.gui.type; -import com.fr.base.FRContext; import com.fr.chart.base.ChartConstants; import com.fr.chart.base.ChartEnumDefinitions; import com.fr.chart.chartattr.Chart; @@ -11,10 +10,10 @@ import com.fr.chart.charttypes.MapIndependentChart; import com.fr.design.chart.series.PlotSeries.MapGroupExtensionPane; import com.fr.design.chart.series.PlotStyle.ChartSelectDemoPane; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.log.FineLoggerFactory; - -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; public class MapPlotPane extends AbstractChartTypePane { @@ -88,7 +87,7 @@ public class MapPlotPane extends AbstractChartTypePane { try{ plot = (MapPlot)chart.getPlot().clone(); } catch (CloneNotSupportedException e){ - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } plot.setMapName(groupExtensionPane.updateBean(plot));// 名字问题 diff --git a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java index e42707a62a..b8758b9f5e 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java @@ -12,8 +12,8 @@ import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPa import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingConstants; -import java.awt.Component; import java.awt.BorderLayout; +import java.awt.Component; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -92,38 +92,53 @@ public abstract class AbstractExtendedChartReportDataPane fieldList = new ArrayList(); + if (hasCustomFieldPane()) { + fieldList.add(new ExtendedField(seriesPane.updateBean())); + fieldList.add(new ExtendedField(valuePane.updateBean())); + } + dataConfig.setCustomFields(fieldList); + + return dataSet; + } + @Override public void updateBean(ChartCollection ob) { if (ob != null) { Chart chart = ob.getSelectedChart(); if (chart != null) { - ExtendedReportDataSet dataSet = new ExtendedReportDataSet(); - - AbstractDataConfig dataConfig = update(); - dataSet.setDataConfig(dataConfig); - - List fieldList = new ArrayList(); - if (hasCustomFieldPane()) { - fieldList.add(new ExtendedField(seriesPane.updateBean())); - fieldList.add(new ExtendedField(valuePane.updateBean())); - } - dataConfig.setCustomFields(fieldList); - chart.setFilterDefinition(dataSet); + chart.setFilterDefinition(updateDataSet()); } } } diff --git a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java index 0771b749a5..ac1799e745 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java @@ -93,17 +93,40 @@ public abstract class AbstractExtendedChartTableDataPane { 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/AxisPaneFactory.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/AxisPaneFactory.java index 52493858e1..e5133659a9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/AxisPaneFactory.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/AxisPaneFactory.java @@ -1,6 +1,6 @@ package com.fr.van.chart.designer.style.axis; -import com.fr.base.FRContext; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.area.VanChartAreaPlot; import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; import com.fr.plugin.chart.column.VanChartColumnPlot; @@ -64,7 +64,7 @@ public class AxisPaneFactory { try { return paneClass.newInstance(); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); return null; } } 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/label/VanChartPlotLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java index 9a26a87116..012c410a89 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java @@ -143,7 +143,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { protected JPanel getLabelPositionPane (Component[][] comps, double[] row, double[] col){ JPanel panel = TableLayoutHelper.createTableLayoutPane(comps,row,col); - return createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout"), panel); + return createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout"), panel); } 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/gantt/designer/data/VanChartGanttDataAndLinkPane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/data/VanChartGanttDataAndLinkPane.java index 08b50d6e11..150f9c913d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/data/VanChartGanttDataAndLinkPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/data/VanChartGanttDataAndLinkPane.java @@ -1,6 +1,5 @@ package com.fr.van.chart.gantt.designer.data; -import com.fr.base.FRContext; import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; @@ -11,7 +10,7 @@ import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.NormalChartDataPane; import com.fr.design.mainframe.chart.gui.data.ReportDataPane; import com.fr.design.mainframe.chart.gui.data.TableDataPane; - +import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.gantt.data.VanGanttDefinition; import com.fr.van.chart.gantt.designer.data.link.GanttLinkReportDataPane; import com.fr.van.chart.gantt.designer.data.link.GanttLinkTableDataPane; @@ -116,7 +115,7 @@ public class VanChartGanttDataAndLinkPane extends MultiTabPane return cloneCollection; } catch (Exception e){ - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); return collection; } } @@ -133,7 +132,7 @@ public class VanChartGanttDataAndLinkPane extends MultiTabPane return cloneCollection; } catch (Exception e){ - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); return collection; } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/data/data/component/GanttTableDataProjectPane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/data/data/component/GanttTableDataProjectPane.java index c1cb298276..a7b9955406 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/data/data/component/GanttTableDataProjectPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/data/data/component/GanttTableDataProjectPane.java @@ -1,13 +1,12 @@ package com.fr.van.chart.gantt.designer.data.data.component; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartdata.TopDefinition; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; - +import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.gantt.data.VanGanttTableDefinition; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; @@ -247,7 +246,7 @@ public class GanttTableDataProjectPane extends AbstractTableDataContentPane impl try { comboBoxList.add(StableUtils.cloneObject(columnNameList.get(i))); } catch (CloneNotSupportedException e) { - FRContext.getLogger().info(e.getMessage()); + FineLoggerFactory.getLogger().info(e.getMessage()); } } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/MapDataPaneHelper.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/MapDataPaneHelper.java index ea82dbc034..158f9dbf1b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/MapDataPaneHelper.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/MapDataPaneHelper.java @@ -1,10 +1,10 @@ package com.fr.van.chart.map.designer.data; -import com.fr.base.FRContext; import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; import com.fr.plugin.chart.drillmap.data.DrillMapDefinition; import com.fr.plugin.chart.map.VanChartMapPlot; @@ -33,7 +33,7 @@ public class MapDataPaneHelper { } return cloneCollection; } catch (Exception e){ - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); return chartCollection; } } @@ -54,7 +54,7 @@ public class MapDataPaneHelper { } return cloneCollection; } catch (Exception e){ - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); return chartCollection; } } @@ -76,7 +76,7 @@ public class MapDataPaneHelper { } return cloneCollection; } catch (Exception e){ - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); return chartCollection; } } @@ -99,7 +99,7 @@ public class MapDataPaneHelper { } return cloneCollection; } catch (Exception e){ - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); return chartCollection; } } @@ -126,7 +126,7 @@ public class MapDataPaneHelper { } return cloneCollection; } catch (Exception e){ - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); return chartCollection; } } 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..1c8b102b34 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 @@ -1,15 +1,14 @@ package com.fr.van.chart.map.designer.type; -import com.fr.base.FRContext; import com.fr.chart.chartattr.Chart; 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; @@ -67,7 +66,7 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane { try { sourceChoosePane = createSourceChoosePane(); } catch (Exception e){ - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } return new Component[][]{ new Component[]{typePane}, @@ -129,6 +128,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/GradualIntervalConfigPane.java b/designer-chart/src/main/java/com/fr/van/chart/range/component/GradualIntervalConfigPane.java index b930c689d0..1a0413ffaa 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/range/component/GradualIntervalConfigPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/range/component/GradualIntervalConfigPane.java @@ -4,7 +4,6 @@ import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.layout.TableLayout; import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent; - import com.fr.plugin.chart.range.GradualIntervalConfig; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.axis.component.MinMaxValuePaneWithOutTick; @@ -23,7 +22,7 @@ public class GradualIntervalConfigPane extends JPanel{ //主题颜色 private ColorSelectBoxWithOutTransparent colorSelectBox; //划分阶段 - UINumberDragPane numberDragPane; + private UINumberDragPane numberDragPane; //渐变色编辑器 private LegendGradientBar legendGradientBar; @@ -58,7 +57,7 @@ public class GradualIntervalConfigPane extends JPanel{ double[] col = new double[]{f, e}; double[] row = new double[]{p, p, p, p}; - Component[][] components = getPaneComponents(); + Component[][] components = getPaneComponents(minMaxValuePane, colorSelectBox, numberDragPane, legendGradientBar); //控件承载面板 JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components,row,col); @@ -70,7 +69,10 @@ public class GradualIntervalConfigPane extends JPanel{ return new LegendGradientBar(); } - protected Component[][] getPaneComponents(){ + protected Component[][] getPaneComponents(MinMaxValuePaneWithOutTick minMaxValuePane, + ColorSelectBoxWithOutTransparent colorSelectBox, + UINumberDragPane numberDragPane, + LegendGradientBar legendGradientBar) { return new Component[][]{ new Component[]{minMaxValuePane, null}, new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Subject_Color")), colorSelectBox}, @@ -79,14 +81,6 @@ public class GradualIntervalConfigPane extends JPanel{ }; } - protected Component[][] getPaneComponentsWithOutTheme(){ - return new Component[][]{ - new Component[]{minMaxValuePane, null}, - new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")), numberDragPane}, - new Component[]{null, legendGradientBar}, - }; - } - public void populate(GradualIntervalConfig intervalConfig){ minMaxValuePane.populate(intervalConfig.getMinAndMaxValue()); 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/adapters/component/CompositeComponentAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/component/CompositeComponentAdapter.java index af1aaa12dd..5fdc8f3de7 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/component/CompositeComponentAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/component/CompositeComponentAdapter.java @@ -1,6 +1,5 @@ package com.fr.design.designer.beans.adapters.component; -import com.fr.base.FRContext; import com.fr.design.actions.UpdateAction; import com.fr.design.beans.GroupModel; import com.fr.design.designer.beans.ComponentAdapter; @@ -17,11 +16,18 @@ import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.Button; import com.fr.form.ui.Widget; +import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.stable.core.PropertyChangeAdapter; -import javax.swing.*; -import java.awt.*; +import javax.swing.Action; +import javax.swing.JComponent; +import javax.swing.JPopupMenu; +import java.awt.AlphaComposite; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.event.MouseEvent; import java.beans.IntrospectionException; import java.util.ArrayList; @@ -176,7 +182,7 @@ public class CompositeComponentAdapter implements ComponentAdapter { try { return xCreator.getPropertyDescriptorCreator().supportedDescriptor(); } catch (IntrospectionException ex) { - FRContext.getLogger().error(ex.getMessage(), ex); + FineLoggerFactory.getLogger().error(ex.getMessage(), ex); return new CRPropertyDescriptor[0]; } } 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/designer/creator/CRPropertyDescriptorPane.java b/designer-form/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptorPane.java index 882c216f03..be4a81d4ec 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptorPane.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptorPane.java @@ -1,6 +1,5 @@ package com.fr.design.designer.creator; -import com.fr.base.FRContext; import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.gui.icheckbox.UICheckBox; @@ -13,6 +12,8 @@ import com.fr.design.mainframe.widget.editors.ExtendedPropertyEditor; import com.fr.design.mainframe.widget.editors.StringEditor; import com.fr.form.ui.Widget; import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; + import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.Component; @@ -103,7 +104,7 @@ public class CRPropertyDescriptorPane { } }); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } return component; } @@ -115,7 +116,7 @@ public class CRPropertyDescriptorPane { propertyEditor.setValue(value); isPopulate = false; } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -126,7 +127,7 @@ public class CRPropertyDescriptorPane { Object value = m.invoke(widget); return value; } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); return null; } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/ErrorCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/ErrorCreator.java index 54a679fe14..b9a29c041d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/ErrorCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/ErrorCreator.java @@ -1,7 +1,7 @@ package com.fr.design.designer.creator; -import com.fr.form.ui.ErrorMarker; import com.fr.form.ui.Widget; +import com.fr.form.ui.WidgetErrorMarker; import com.fr.stable.StringUtils; import java.awt.*; @@ -18,7 +18,7 @@ public class ErrorCreator extends NullCreator { @Override protected String showText() { - ErrorMarker marker = (ErrorMarker)toData(); + WidgetErrorMarker marker = (WidgetErrorMarker)toData(); String text = marker.getWidgetValue().getDisplayValue(); if (StringUtils.isEmpty(text)) { return super.showText(); diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index 774010136c..f51f6710bc 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -26,7 +26,6 @@ import com.fr.form.ui.ComboCheckBox; import com.fr.form.ui.DateEditor; import com.fr.form.ui.EditorHolder; import com.fr.form.ui.ElementCaseEditor; -import com.fr.form.ui.ErrorMarker; import com.fr.form.ui.FileEditor; import com.fr.form.ui.FreeButton; import com.fr.form.ui.IframeEditor; @@ -42,6 +41,7 @@ import com.fr.form.ui.TextEditor; import com.fr.form.ui.TreeComboBoxEditor; import com.fr.form.ui.TreeEditor; import com.fr.form.ui.Widget; +import com.fr.form.ui.WidgetErrorMarker; import com.fr.form.ui.container.WAbsoluteBodyLayout; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WBorderLayout; @@ -160,7 +160,7 @@ public class XCreatorUtils { objectMap.put(NameWidget.class, XNameWidget.class); objectMap.put(CardSwitchButton.class, XCardSwitchButton.class); objectMap.put(CardAddButton.class, XCardAddButton.class); - objectMap.put(ErrorMarker.class, ErrorCreator.class); + objectMap.put(WidgetErrorMarker.class, ErrorCreator.class); } private static void reInitExtra() { diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java b/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java index edf6018989..45764e7464 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java @@ -3,7 +3,6 @@ */ package com.fr.design.designer.creator; -import com.fr.base.FRContext; import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.form.layout.FRLayoutManager; import com.fr.design.form.util.XCreatorConstants; @@ -15,11 +14,14 @@ import com.fr.design.parameter.ParameterBridge; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WLayout; import com.fr.general.Background; +import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.core.PropertyChangeAdapter; -import javax.swing.*; -import java.awt.*; +import javax.swing.JComponent; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.LayoutManager; import java.awt.event.ContainerEvent; import java.awt.event.ContainerListener; import java.beans.IntrospectionException; @@ -298,7 +300,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme if (layout instanceof FRLayoutManager) { return (FRLayoutManager) layout; } - FRContext.getLogger().error("FRLayoutManager isn't exsit!"); + FineLoggerFactory.getLogger().error("FRLayoutManager isn't exsit!"); return null; } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWidgetCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWidgetCreator.java index 2e53dd2772..4835ec16bf 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWidgetCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWidgetCreator.java @@ -4,16 +4,27 @@ package com.fr.design.designer.creator; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.FormDesigner; import com.fr.form.ui.Widget; - +import com.fr.log.FineLoggerFactory; import com.fr.stable.core.PropertyChangeAdapter; -import javax.swing.*; -import java.awt.*; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Composite; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.Image; +import java.awt.MediaTracker; +import java.awt.Transparency; import java.beans.IntrospectionException; /** @@ -139,7 +150,7 @@ public abstract class XWidgetCreator extends XCreator { this.setRolloverIcon(new ImageIcon(image1)); this.setPressedIcon(new ImageIcon(image));//按下去的图标 } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/BodyAppRelayoutTable.java b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/BodyAppRelayoutTable.java index 2abbfd12f8..b51b6e756f 100644 --- a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/BodyAppRelayoutTable.java +++ b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/BodyAppRelayoutTable.java @@ -1,18 +1,19 @@ package com.fr.design.designer.properties.mobile; -import java.awt.event.MouseEvent; -import java.beans.IntrospectionException; -import java.util.ArrayList; - -import com.fr.base.FRContext; import com.fr.design.designer.beans.events.DesignerEvent; -import com.fr.design.designer.creator.*; +import com.fr.design.designer.creator.CRPropertyDescriptor; +import com.fr.design.designer.creator.XCreator; import com.fr.design.gui.itable.AbstractPropertyTable; import com.fr.design.gui.itable.PropertyGroup; import com.fr.design.gui.xtable.ReportAppPropertyGroupModel; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.widget.editors.InChangeBooleanEditor; +import com.fr.log.FineLoggerFactory; + +import java.awt.event.MouseEvent; +import java.beans.IntrospectionException; +import java.util.ArrayList; /** @@ -50,7 +51,7 @@ public class BodyAppRelayoutTable extends AbstractPropertyTable { try { propertyTableEditor = supportedDescriptor(); }catch (IntrospectionException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } groups.add(new PropertyGroup(new ReportAppPropertyGroupModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Properties_Mobile"), xCreator, propertyTableEditor, designer))); diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java index 40fb08d7dd..72181c766e 100644 --- a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java +++ b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java @@ -1,6 +1,5 @@ package com.fr.design.designer.properties.mobile; -import com.fr.base.FRContext; import com.fr.base.mobile.MobileFitAttrState; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.CRPropertyDescriptor; @@ -14,7 +13,7 @@ import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.widget.editors.InChangeBooleanEditor; import com.fr.design.mainframe.widget.editors.RefinedDoubleEditor; import com.fr.form.ui.ElementCaseEditor; - +import com.fr.log.FineLoggerFactory; import javax.swing.table.TableModel; import java.beans.IntrospectionException; @@ -92,7 +91,7 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{ try { propertyTableEditor = supportedDescriptor(); } catch (IntrospectionException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } diff --git a/designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeModel.java b/designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeModel.java index c626fea8ce..01f64e509b 100644 --- a/designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeModel.java @@ -1,6 +1,5 @@ package com.fr.design.designer.treeview; -import com.fr.base.FRContext; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; @@ -9,6 +8,7 @@ import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWidgetCreator; import com.fr.design.mainframe.FormDesigner; import com.fr.form.ui.Widget; +import com.fr.log.FineLoggerFactory; import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; @@ -142,7 +142,7 @@ public class ComponentTreeModel implements TreeModel { m.invoke(listener, evt); } } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } 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/gui/xtable/AbstractPropertyGroupModel.java b/designer-form/src/main/java/com/fr/design/gui/xtable/AbstractPropertyGroupModel.java index 30be1e1851..8e48316436 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xtable/AbstractPropertyGroupModel.java +++ b/designer-form/src/main/java/com/fr/design/gui/xtable/AbstractPropertyGroupModel.java @@ -3,18 +3,17 @@ */ package com.fr.design.gui.xtable; -import java.beans.PropertyEditor; +import com.fr.design.beans.GroupModel; +import com.fr.design.designer.creator.CRPropertyDescriptor; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.mainframe.widget.editors.PropertyCellEditor; +import com.fr.design.mainframe.widget.renderer.PropertyCellRenderer; +import com.fr.log.FineLoggerFactory; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; - -import com.fr.base.FRContext; -import com.fr.design.beans.GroupModel; -import com.fr.design.mainframe.widget.editors.PropertyCellEditor; -import com.fr.design.mainframe.widget.renderer.PropertyCellRenderer; -import com.fr.design.designer.creator.CRPropertyDescriptor; -import com.fr.design.designer.creator.XCreator; +import java.beans.PropertyEditor; /** * @author richer @@ -53,7 +52,7 @@ public abstract class AbstractPropertyGroupModel implements GroupModel, Comparab try { initRenderer(row); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } return renderers[row]; @@ -65,7 +64,7 @@ public abstract class AbstractPropertyGroupModel implements GroupModel, Comparab try { initEditor(row); } catch (Exception ex) { - FRContext.getLogger().error(ex.getMessage(), ex); + FineLoggerFactory.getLogger().error(ex.getMessage(), ex); } } return editors[row]; diff --git a/designer-form/src/main/java/com/fr/design/gui/xtable/PropertyGroupModel.java b/designer-form/src/main/java/com/fr/design/gui/xtable/PropertyGroupModel.java index b5a7e548a6..f125ce3e21 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xtable/PropertyGroupModel.java +++ b/designer-form/src/main/java/com/fr/design/gui/xtable/PropertyGroupModel.java @@ -1,6 +1,5 @@ package com.fr.design.gui.xtable; -import com.fr.base.FRContext; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.CRPropertyDescriptor; import com.fr.design.designer.creator.XCreator; @@ -8,7 +7,7 @@ import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.widget.editors.ExtendedPropertyEditor; import com.fr.design.mainframe.widget.editors.PropertyCellEditor; import com.fr.general.ComparatorUtils; - +import com.fr.log.FineLoggerFactory; import com.fr.report.stable.FormConstants; import java.beans.PropertyChangeEvent; @@ -35,7 +34,7 @@ public class PropertyGroupModel extends AbstractPropertyGroupModel { Method m = properties[row].getReadMethod(); return m.invoke(dealCreatorData()); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); return null; } } @@ -59,7 +58,7 @@ public class PropertyGroupModel extends AbstractPropertyGroupModel { properties[row].firePropertyChanged(); return true; } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); return false; } } diff --git a/designer-form/src/main/java/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java b/designer-form/src/main/java/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java index 2f2eafd01f..b577bd8bbc 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java +++ b/designer-form/src/main/java/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java @@ -1,10 +1,10 @@ package com.fr.design.gui.xtable; -import com.fr.base.FRContext; import com.fr.design.designer.creator.CRPropertyDescriptor; import com.fr.design.designer.creator.XCreator; import com.fr.design.mainframe.FormDesigner; import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; import com.fr.report.stable.FormConstants; import javax.swing.JOptionPane; @@ -47,7 +47,7 @@ public class ReportAppPropertyGroupModel extends PropertyGroupModel { properties[row].firePropertyChanged(); return true; } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); return false; } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index 5dd42de8d9..99883fff38 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -1,6 +1,5 @@ package com.fr.design.mainframe; -import com.fr.base.FRContext; import com.fr.base.Parameter; import com.fr.base.ScreenResolution; import com.fr.base.vcs.DesignerMode; @@ -63,6 +62,7 @@ import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WFitLayout; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; +import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.bridge.StableFactory; import com.fr.third.javax.annotation.Nullable; @@ -1208,7 +1208,7 @@ public class FormDesigner extends TargetComponent
implements TreeSelection } } } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerDropTarget.java index a16ec5f170..4e7ea5ae6c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerDropTarget.java @@ -1,5 +1,14 @@ package com.fr.design.mainframe; +import com.fr.design.designer.creator.XCreator; +import com.fr.form.data.DataBinding; +import com.fr.form.ui.DataControl; +import com.fr.form.ui.IframeEditor; +import com.fr.form.ui.Widget; +import com.fr.form.ui.WidgetValue; +import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; + import java.awt.Point; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; @@ -11,15 +20,6 @@ import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDropEvent; import java.io.IOException; -import com.fr.base.FRContext; -import com.fr.design.designer.creator.XCreator; -import com.fr.form.data.DataBinding; -import com.fr.form.ui.DataControl; -import com.fr.form.ui.IframeEditor; -import com.fr.form.ui.Widget; -import com.fr.form.ui.WidgetValue; -import com.fr.general.ComparatorUtils; - public class FormDesignerDropTarget extends DropTargetAdapter { private FormDesigner designer; @@ -84,9 +84,9 @@ public class FormDesignerDropTarget extends DropTargetAdapter { creator.rebuid(); designer.getSelectionModel().setSelectedCreator(creator); } catch (UnsupportedFlavorException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } catch (IOException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } 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..6822422b29 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,12 +18,12 @@ 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; import javax.swing.JComponent; import javax.swing.JPanel; +import javax.swing.SwingUtilities; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; @@ -37,112 +37,117 @@ 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()); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + 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 +162,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/FormSelection.java b/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java index ff79beccdb..8d223c2452 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java @@ -1,10 +1,5 @@ package com.fr.design.mainframe; -import java.awt.LayoutManager; -import java.awt.Rectangle; -import java.util.ArrayList; - -import com.fr.base.FRContext; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.location.Direction; @@ -16,9 +11,14 @@ import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; -import com.fr.form.ui.Widget; import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; +import com.fr.form.ui.Widget; +import com.fr.log.FineLoggerFactory; + +import java.awt.LayoutManager; +import java.awt.Rectangle; +import java.util.ArrayList; public class FormSelection { @@ -322,7 +322,7 @@ public class FormSelection { creator.setBounds(root.getBounds()); clipBoard.selection.add(creator); } catch (CloneNotSupportedException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java index f88b9e5400..b3b07efd73 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java @@ -1,6 +1,5 @@ package com.fr.design.mainframe; -import com.fr.base.FRContext; import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.AbstractLayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRTabFitLayoutAdapter; @@ -19,6 +18,7 @@ import com.fr.form.ui.Widget; import com.fr.form.ui.container.WTitleLayout; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; + import java.awt.Component; import java.awt.Point; import java.awt.Rectangle; @@ -112,7 +112,7 @@ public class FormSelectionUtils { designer.getSelectionModel().getSelection().addSelectedCreator(copiedCreator); } } catch (CloneNotSupportedException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } rebuildSelection(designer); 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..c32abb2ffc 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 @@ -1,24 +1,34 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.design.gui.ibutton.UIButton; 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 +45,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 +137,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 +177,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)); @@ -300,7 +303,7 @@ public class FormWidgetDetailPane extends FormDockView{ public void actionPerformed(ActionEvent e) { String url = CloudCenter.getInstance().acquireUrlByKind("reuse.url"); if (StringUtils.isEmpty(url)) { - FRContext.getLogger().info("The URL is empty!"); + FineLoggerFactory.getLogger().info("The URL is empty!"); return; } try { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/TreeTransferHandler.java b/designer-form/src/main/java/com/fr/design/mainframe/TreeTransferHandler.java index 4242890de9..90c14c944f 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/TreeTransferHandler.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/TreeTransferHandler.java @@ -1,22 +1,21 @@ package com.fr.design.mainframe; -import java.awt.Component; -import java.awt.Container; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.datatransfer.DataFlavor; - -import javax.swing.JComponent; -import javax.swing.SwingUtilities; -import javax.swing.TransferHandler; -import javax.swing.tree.TreePath; - -import com.fr.base.FRContext; import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.utils.gui.LayoutUtils; +import com.fr.log.FineLoggerFactory; + +import javax.swing.JComponent; +import javax.swing.SwingUtilities; +import javax.swing.TransferHandler; +import javax.swing.tree.TreePath; +import java.awt.Component; +import java.awt.Container; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.datatransfer.DataFlavor; public class TreeTransferHandler extends TransferHandler { @@ -59,7 +58,7 @@ public class TreeTransferHandler extends TransferHandler { return canPathAccept(tree, newpath, draggedComponent, p); } } catch (Exception ex) { - FRContext.getLogger().error(ex.getMessage(), ex); + FineLoggerFactory.getLogger().error(ex.getMessage(), ex); return false; } } else { @@ -131,7 +130,7 @@ public class TreeTransferHandler extends TransferHandler { return true; } catch (Exception ex) { - FRContext.getLogger().error(ex.getMessage(), ex); + FineLoggerFactory.getLogger().error(ex.getMessage(), ex); return false; } diff --git a/designer-form/src/main/java/com/fr/design/parameter/FormParameterReader.java b/designer-form/src/main/java/com/fr/design/parameter/FormParameterReader.java index dbceb3ee34..24378daeec 100644 --- a/designer-form/src/main/java/com/fr/design/parameter/FormParameterReader.java +++ b/designer-form/src/main/java/com/fr/design/parameter/FormParameterReader.java @@ -1,9 +1,9 @@ package com.fr.design.parameter; -import com.fr.base.FRContext; import com.fr.base.Parameter; import com.fr.form.main.Form; import com.fr.form.main.FormIO; +import com.fr.log.FineLoggerFactory; /** * @author richie @@ -20,7 +20,7 @@ public class FormParameterReader extends AbstractParameterReader { Form form = FormIO.readForm(tplPath); return form.getParameters(); } catch (Exception e1) { - FRContext.getLogger().error(e1.getMessage(), e1); + FineLoggerFactory.getLogger().error(e1.getMessage(), e1); } return new Parameter[0]; } 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