From 1de6733c9b96c348bffc2b8e2fa21c407339aca0 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Wed, 12 Jul 2017 15:57:47 +0800 Subject: [PATCH 01/32] update --- .../design/cell/editor/RichTextToolBar.java | 2 +- .../fr/design/expand/ExpandFatherPane.java | 16 +- .../mainframe/CellElementPropertyPane.java | 62 +++++- .../design/mainframe/bbs/UserInfoLabel.java | 2 +- .../mainframe/cell/CellElementEditPane.java | 49 ++++- .../mainframe/cell/QuickEditorRegion.java | 2 +- .../cell/settingpane/CellExpandAttrPane.java | 77 +++++++- .../cell/settingpane/CellOtherSetPane.java | 3 +- .../cell/settingpane/CellPresentPane.java | 21 ++- .../cell/settingpane/CellStylePane.java | 18 +- .../src/com/fr/design/DesignerEnvManager.java | 2 +- .../fr/design/foldablepane/HeaderPane.java | 111 +++++++++++ .../design/foldablepane/UIExpandablePane.java | 95 ++++++++++ .../gui/icontainer/UIResizableContainer.java | 177 ++++++++++++++--- .../fr/design/gui/style/BackgroundPane.java | 24 ++- .../com/fr/design/gui/style/BorderPane.java | 69 +++++-- .../com/fr/design/gui/style/FRFontPane.java | 88 +++++---- .../com/fr/design/gui/style/FormatPane.java | 178 ++++++++++-------- .../src/com/fr/design/menu/MenuManager.java | 12 +- .../series/PlotSeries/MapCustomPane.java | 4 +- 20 files changed, 797 insertions(+), 215 deletions(-) create mode 100644 designer_base/src/com/fr/design/foldablepane/HeaderPane.java create mode 100644 designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java diff --git a/designer/src/com/fr/design/cell/editor/RichTextToolBar.java b/designer/src/com/fr/design/cell/editor/RichTextToolBar.java index 1bf8a2f56..0b5721975 100644 --- a/designer/src/com/fr/design/cell/editor/RichTextToolBar.java +++ b/designer/src/com/fr/design/cell/editor/RichTextToolBar.java @@ -81,7 +81,7 @@ public class RichTextToolBar extends BasicPane{ private void initAllButton(){ fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); fontNameComboBox.setPreferredSize(new Dimension(144, 20)); - fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); + fontSizeComboBox = new UIComboBox(FRFontPane.getFontSizes()); colorSelectPane = new UIToolbarColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/foreground.png")); colorSelectPane.set4Toolbar(); diff --git a/designer/src/com/fr/design/expand/ExpandFatherPane.java b/designer/src/com/fr/design/expand/ExpandFatherPane.java index aeaf427d7..88aeb44c3 100644 --- a/designer/src/com/fr/design/expand/ExpandFatherPane.java +++ b/designer/src/com/fr/design/expand/ExpandFatherPane.java @@ -22,6 +22,8 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; public abstract class ExpandFatherPane extends JPanel implements GlobalNameObserver { @@ -33,6 +35,7 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser private String expandFatherName = ""; private GlobalNameListener globalNameListener = null; private boolean isAlreadyAddListener = false; + private final JPanel customPane; public ExpandFatherPane() { this.setLayout(new BorderLayout(0, LayoutConstants.VGAP_SMALL)); @@ -41,7 +44,7 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser Inter.getLocText("Default"), Inter.getLocText("Custom")}); final CardLayout cardLayout = new CardLayout(); - final JPanel customPane = new JPanel(cardLayout); + customPane = new JPanel(cardLayout); customParentColumnRowPane = new ColumnRowPane() { @Override @@ -63,13 +66,22 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser cc.add(imageButton, BorderLayout.EAST); customPane.add(cc, "content"); customPane.add(new JPanel(), "none"); + customPane.setPreferredSize(new Dimension(0, 0) ); this.add(comboBox, BorderLayout.NORTH); this.add(customPane, BorderLayout.CENTER); + comboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { - cardLayout.show(customPane, comboBox.getSelectedIndex() == 2 ? "content" : "none"); + if(comboBox.getSelectedIndex() == 2){ + customPane.setPreferredSize(new Dimension(100, 20) ); + cardLayout.show(customPane,"content"); + }else { + cardLayout.show(customPane,"none"); + customPane.setPreferredSize(new Dimension(0, 0) ); + } +// cardLayout.show(customPane, comboBox.getSelectedIndex() == 2 ? "content" : "none"); if (globalNameListener != null && shouldResponseNameListener()) { globalNameListener.setGlobalName(expandFatherName); } diff --git a/designer/src/com/fr/design/mainframe/CellElementPropertyPane.java b/designer/src/com/fr/design/mainframe/CellElementPropertyPane.java index 55235c5c9..6785b17f9 100644 --- a/designer/src/com/fr/design/mainframe/CellElementPropertyPane.java +++ b/designer/src/com/fr/design/mainframe/CellElementPropertyPane.java @@ -3,11 +3,21 @@ */ package com.fr.design.mainframe; +import java.awt.*; + +import javax.swing.*; + import com.fr.base.BaseUtils; +import com.fr.design.fun.CellAttributeProvider; +import com.fr.design.fun.PresentKindProvider; import com.fr.design.gui.frpane.UITitlePanel; +import com.fr.design.gui.ibutton.UIHeadGroup; +import com.fr.design.gui.ibutton.UISideGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itabpane.TitleChangeListener; import com.fr.design.mainframe.cell.CellElementEditPane; +import com.fr.design.mainframe.cell.settingpane.AbstractCellAttrPane; +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.GeneralContext; import com.fr.general.Inter; import com.fr.grid.selection.CellSelection; @@ -22,9 +32,6 @@ import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.Elem; import com.fr.report.elementcase.TemplateElementCase; -import javax.swing.*; -import java.awt.*; - /** * 所有组件一次全部加载,不存在延迟加载。 原因:设计器打开第一张模板的时候,会初始化许多许多东西。这个过程需要很长时间(快的3-5s)。 @@ -35,7 +42,7 @@ import java.awt.*; * @since 2012-5-24下午1:50:21 */ public class CellElementPropertyPane extends DockingView { - + static { GeneralContext.listenPluginRunningChanged(new PluginEventListener() { @@ -43,7 +50,7 @@ public class CellElementPropertyPane extends DockingView { public void on(PluginEvent event) { synchronized (CellElementPropertyPane.class) { - singleton = null; + singleton = new CellElementPropertyPane(); } } }, new PluginFilter() { @@ -51,11 +58,13 @@ public class CellElementPropertyPane extends DockingView { @Override public boolean accept(PluginContext context) { - return context.contain(PluginModule.ExtraDesign); + return context.contain(PluginModule.ExtraDesign, PresentKindProvider.MARK_STRING) || + context.contain(PluginModule.ExtraDesign, CellAttributeProvider.MARK_STRING); } }); } + public synchronized static CellElementPropertyPane getInstance() { if (singleton == null) { singleton = new CellElementPropertyPane(); @@ -78,6 +87,43 @@ public class CellElementPropertyPane extends DockingView { } }; + public static void main(String[] args){ + JFrame jf = new JFrame("test"); + jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + GUICoreUtils.centerWindow(jf); + final JPanel jPanel = (JPanel) jf.getContentPane(); + jPanel.setLayout(new BorderLayout()); + final CardLayout card = new CardLayout(); + final JPanel center = new JPanel(); + center.setLayout( new CardLayout()); + + final JPanel content = new JPanel(); + content.setLayout(new BorderLayout()); + final CellElementPropertyPane pane = new CellElementPropertyPane(); + content.add(new CellElementPropertyPane(), BorderLayout.CENTER); + Icon[] iconArray = new Icon[2]; + iconArray[0] = BaseUtils.readIcon("/com/fr/design/images/expand/vertical.png"); + center.add(content,content.getUIClassID()); + iconArray[1] = BaseUtils.readIcon("/com/fr/design/images/expand/vertical.png"); + center.add(new JPanel(),""); +// for (int i = 0; i < 4; i++) { +// iconArray[0] = BaseUtils.readIcon("/com/fr/design/images/expand/vertical.png"); +// center.add(content,content.getUIClassID()); +// } + + + final TitleChangeListener titleChangeListener = null; + UISideGroup tabsHeaderIconPane = new UISideGroup(iconArray) { + }; + JPanel j1 = new JPanel(); + j1.setLayout(new GridLayout(10,1)); + j1.add(tabsHeaderIconPane); + tabsHeaderIconPane.setNeedLeftRightOutLine(false); + jPanel.add(j1, BorderLayout.WEST); + jPanel.add(center,BorderLayout.CENTER); + jf.setSize(500, 500); + jf.setVisible(true); + } private CellElementPropertyPane() { this.setLayout(new BorderLayout()); @@ -97,7 +143,7 @@ public class CellElementPropertyPane extends DockingView { title.setVerticalAlignment(SwingConstants.CENTER); titlePane.add(title, BorderLayout.CENTER); titlePane.setBorder(BorderFactory.createEmptyBorder(0,0,1,0)); - this.add(titlePane, BorderLayout.NORTH); +// this.add(titlePane, BorderLayout.NORTH); this.add(cellElementEditPane, BorderLayout.CENTER); } @@ -130,7 +176,7 @@ public class CellElementPropertyPane extends DockingView { public void reInit(ElementCasePane ePane) { if (titlePane.getParent() == null) { // 如果处于隐藏状态,则让其显示 - this.add(titlePane, BorderLayout.NORTH); +// this.add(titlePane, BorderLayout.NORTH); this.add(cellElementEditPane, BorderLayout.CENTER); } cellElementEditPane.populate(ePane); diff --git a/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java b/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java index 4d58b3db6..2630c2702 100644 --- a/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java +++ b/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java @@ -265,7 +265,7 @@ public class UserInfoLabel extends UILabel { UIMenuItem closeOther = new UIMenuItem(Inter.getLocText("FR-Designer-BBSLogin_Switch-Account")); closeOther.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { - BBSPluginLogin.getInstance().logOut(); +// BBSPluginLogin.getInstance().logOut(); UserLoginContext.fireLoginContextListener(); } diff --git a/designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java b/designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java index 3da7406c6..8d3980a48 100644 --- a/designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java +++ b/designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java @@ -1,21 +1,24 @@ package com.fr.design.mainframe.cell; -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Dimension; +import java.awt.*; import java.util.*; +import java.util.List; -import javax.swing.Icon; -import javax.swing.JPanel; +import javax.swing.*; import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.fun.CellAttributeProvider; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.ibutton.UIHeadGroup; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itabpane.TitleChangeListener; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.EastTopArrow; import com.fr.design.mainframe.cell.settingpane.*; import com.fr.design.dialog.BasicPane; +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.design.mainframe.ElementCasePane; @@ -44,21 +47,33 @@ public class CellElementEditPane extends BasicPane { private int PaneListIndex; private CardLayout card; private JPanel center; - + private JPanel downTitle; + private JPanel title; + private UILabel titlename; private TitleChangeListener titleChangeListener = null; private CellAttributeProvider cellAttributeProvider = null; + public static void main(String[] args){ + JFrame jf = new JFrame("test"); + jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + JPanel content = (JPanel)jf.getContentPane(); + content.setLayout(new BorderLayout()); + content.add(new CellElementEditPane(),BorderLayout.CENTER); + GUICoreUtils.centerWindow(jf); + jf.setSize(270, 400); + jf.setVisible(true); + } public CellElementEditPane() { setLayout(new BorderLayout()); initPaneList(); - Icon[] iconArray = new Icon[paneList.size()]; + String[] iconArray = new String[paneList.size()]; card = new CardLayout(); center = new JPanel(card); for (int i = 0; i < paneList.size(); i++) { AbstractCellAttrPane pane = paneList.get(i); - iconArray[i] = BaseUtils.readIcon(pane.getIconPath()); + iconArray[i] = pane.getIconPath(); center.add(pane, pane.title4PopupWindow()); } @@ -74,8 +89,22 @@ public class CellElementEditPane extends BasicPane { } }; tabsHeaderIconPane.setNeedLeftRightOutLine(false); - this.add(tabsHeaderIconPane, BorderLayout.NORTH); - this.add(center, BorderLayout.CENTER); + + titlename = new UILabel(Inter.getLocText("Cell-Cell_Attributes")); + titlename.setFont(new Font("Dialog", 1, 14)); + titlename.setForeground(new Color(30,190,245)); + title = new JPanel(); + title.setLayout(new BorderLayout()); + title.add(titlename, BorderLayout.NORTH); + + downTitle = new JPanel(); + downTitle.setLayout(new BorderLayout()); + downTitle.add(tabsHeaderIconPane, BorderLayout.NORTH); + downTitle.add(center, BorderLayout.CENTER); + + this.add(title, BorderLayout.NORTH); + this.add(downTitle, BorderLayout.CENTER); + } diff --git a/designer/src/com/fr/design/mainframe/cell/QuickEditorRegion.java b/designer/src/com/fr/design/mainframe/cell/QuickEditorRegion.java index 7ac79975a..f105ad479 100644 --- a/designer/src/com/fr/design/mainframe/cell/QuickEditorRegion.java +++ b/designer/src/com/fr/design/mainframe/cell/QuickEditorRegion.java @@ -35,7 +35,7 @@ public class QuickEditorRegion extends JPanel { private static QuickEditorRegion singleton = new QuickEditorRegion(); private static JPanel EMPTY; - private QuickEditorRegion() { + public QuickEditorRegion() { this.setLayout(new BorderLayout()); } diff --git a/designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java b/designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java index 1b95b8569..d6a5a9bef 100644 --- a/designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java +++ b/designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java @@ -10,6 +10,8 @@ import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.report.cell.DefaultTemplateCellElement; @@ -31,6 +33,9 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { private UICheckBox horizontalExpandableCheckBox; private UICheckBox verticalExpandableCheckBox; private SortExpandAttrPane sortAfterExpand; + private JPanel layoutPane; + private JPanel basicPane; + private JPanel seniorPane; /** * @@ -56,6 +61,17 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { } + public static void main(String[] args){ + JFrame jf = new JFrame("test"); + jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + JPanel content = (JPanel) jf.getContentPane(); + content.setLayout(new BorderLayout()); + content.add(new CellExpandAttrPane().layoutPane(), BorderLayout.CENTER); + GUICoreUtils.centerWindow(jf); + jf.setSize(290, 400); + jf.setVisible(true); + } + private void initAllNames() { expandDirectionButton.setGlobalName(Inter.getLocText("ExpandD-Expand_Direction")); leftFatherPane.setGlobalName(Inter.getLocText("LeftParent")); @@ -65,24 +81,63 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { } private JPanel layoutPane() { + layoutPane = new JPanel(new BorderLayout()); + basicPane = new JPanel(); + seniorPane = new JPanel(); + basicPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"),290,20,basicPane()); + seniorPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"),290,20,seniorPane()); + layoutPane.add(basicPane,BorderLayout.NORTH); + layoutPane.add(seniorPane,BorderLayout.CENTER); + return layoutPane; +// double f = TableLayout.FILL; +// double p = TableLayout.PREFERRED; +// Component[][] components = new Component[][]{ +// new Component[]{new UILabel(Inter.getLocText("ExpandD-Expand_Direction") + ":", SwingConstants.RIGHT), expandDirectionButton}, +// new Component[]{new UILabel(Inter.getLocText("LeftParent") + ":", SwingConstants.RIGHT), leftFatherPane}, +// new Component[]{new UILabel(Inter.getLocText("ExpandD-Up_Father_Cell") + ":", SwingConstants.RIGHT), rightFatherPane}, +// new Component[]{new JSeparator(), null}, +// new Component[]{new UILabel(Inter.getLocText("ExpandD-Expandable") + ":", SwingConstants.RIGHT), horizontalExpandableCheckBox}, +// new Component[]{null, verticalExpandableCheckBox}, +// new Component[]{new UILabel(Inter.getLocText("ExpandD-Sort_After_Expand") + ":", SwingConstants.RIGHT), sortAfterExpand}, +// }; +// double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p, p, p}; +// double[] columnSize = {p, f}; +// int[][] rowCount = {{1, 1}, {1, 3}, {1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 3}}; +// return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); + } + + private JPanel basicPane(){ + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + Component[][] components = new Component[][]{ + new Component[]{null,null}, + new Component[]{new UILabel(" "+Inter.getLocText("ExpandD-Expand_Direction")+" ", SwingConstants.LEFT), expandDirectionButton}, + new Component[]{new UILabel(" "+Inter.getLocText("LeftParent"), SwingConstants.LEFT), leftFatherPane}, + new Component[]{new UILabel(" "+Inter.getLocText("ExpandD-Up_Father_Cell"), SwingConstants.LEFT), rightFatherPane}, + }; + double[] rowSize = {p, p, p, p, p, p}; + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1},{1, 1}, {1, 3}, {1, 3}}; + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); + } + + private JPanel seniorPane() { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{new UILabel(Inter.getLocText("ExpandD-Expand_Direction") + ":", SwingConstants.RIGHT), expandDirectionButton}, - new Component[]{new UILabel(Inter.getLocText("LeftParent") + ":", SwingConstants.RIGHT), leftFatherPane}, - new Component[]{new UILabel(Inter.getLocText("ExpandD-Up_Father_Cell") + ":", SwingConstants.RIGHT), rightFatherPane}, - new Component[]{new JSeparator(), null}, - new Component[]{new UILabel(Inter.getLocText("ExpandD-Expandable") + ":", SwingConstants.RIGHT), horizontalExpandableCheckBox}, - new Component[]{null, verticalExpandableCheckBox}, - new Component[]{new UILabel(Inter.getLocText("ExpandD-Sort_After_Expand") + ":", SwingConstants.RIGHT), sortAfterExpand}, + new Component[]{null,null}, + new Component[]{horizontalExpandableCheckBox, null}, + new Component[]{verticalExpandableCheckBox, null}, + new Component[]{new UILabel(" "+Inter.getLocText("ExpandD-Sort_After_Expand") + Inter.getLocText("FR-Action_Sort"), SwingConstants.RIGHT), sortAfterExpand}, }; - double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p, p, p}; + double[] rowSize = {p, p, p, p, p, p, p, p}; double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 3}, {1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 3}}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 3}, {1, 3}}; return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); } + @Override protected void populateBean() { this.leftFatherPane.setElementCasePane(elementCasePane); @@ -120,9 +175,11 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { @Override public String getIconPath() { - return "com/fr/design/images/expand/cellAttr.gif"; +// return "com/fr/design/images/expand/cellAttr.gif"; + return Inter.getLocText("Expand"); } + @Override public void updateBean(TemplateCellElement cellElement) { CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); diff --git a/designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java b/designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java index 0e45a1e97..c5d7af1b1 100644 --- a/designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java +++ b/designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java @@ -214,7 +214,8 @@ public class CellOtherSetPane extends AbstractCellAttrPane { @Override public String getIconPath() { - return "com/fr/design/images/m_format/cellstyle/otherset.png"; +// return "com/fr/design/images/m_format/cellstyle/otherset.png"; + return Inter.getLocText("Other"); } @Override diff --git a/designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java b/designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java index 0c357e30d..d0f13c5d2 100644 --- a/designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java +++ b/designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java @@ -25,21 +25,22 @@ public class CellPresentPane extends AbstractCellAttrPane { */ public JPanel createContentPane() { presentPane = new PresentPane(); - JPanel content = new JPanel(new BorderLayout()); - content.add(presentPane, BorderLayout.CENTER); - presentPane.addTabChangeListener(new ItemListener() { + JPanel content = new JPanel(new BorderLayout()); + content.add(presentPane, BorderLayout.CENTER); + presentPane.addTabChangeListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - adjustValues(); - } - }); - return content; + @Override + public void itemStateChanged(ItemEvent e) { + adjustValues(); + } + }); + return content; } @Override public String getIconPath() { - return "com/fr/design/images/data/source/dataDictionary.png"; +// return "com/fr/design/images/data/source/dataDictionary.png"; + return Inter.getLocText("Present"); } @Override diff --git a/designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java b/designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java index 563b26bba..2d508c4f3 100644 --- a/designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java +++ b/designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java @@ -2,12 +2,13 @@ package com.fr.design.mainframe.cell.settingpane; import java.awt.*; -import javax.swing.JPanel; +import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import com.fr.base.Style; import com.fr.design.mainframe.cell.settingpane.style.StylePane; +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.Inter; import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.TemplateCellElement; @@ -40,11 +41,24 @@ public class CellStylePane extends AbstractCellAttrPane { return content; } + public static void main(String[] args){ + JFrame jf = new JFrame("test"); + jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + JPanel content = (JPanel) jf.getContentPane(); + content.setLayout(new BorderLayout()); + content.add(new CellStylePane().createContentPane(), BorderLayout.CENTER); + GUICoreUtils.centerWindow(jf); + jf.setSize(290, 400); + jf.setVisible(true); + } + @Override public String getIconPath() { - return "com/fr/design/images/m_format/cell.png"; +// return "com/fr/design/images/m_format/cell.png"; + return Inter.getLocText("FR-Designer_Style"); } + @Override public void updateBean(TemplateCellElement cellElement) { cellElement.setStyle(stylePane.updateBean()); diff --git a/designer_base/src/com/fr/design/DesignerEnvManager.java b/designer_base/src/com/fr/design/DesignerEnvManager.java index 5658a318d..a5d58ffc0 100644 --- a/designer_base/src/com/fr/design/DesignerEnvManager.java +++ b/designer_base/src/com/fr/design/DesignerEnvManager.java @@ -1802,7 +1802,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } writer.startTAG("Env"); - writer.classAttr(env.getClass()); +// writer.classAttr(env.getClass()); writer.attr("name", name); env.writeXML(writer); diff --git a/designer_base/src/com/fr/design/foldablepane/HeaderPane.java b/designer_base/src/com/fr/design/foldablepane/HeaderPane.java new file mode 100644 index 000000000..b136d4b77 --- /dev/null +++ b/designer_base/src/com/fr/design/foldablepane/HeaderPane.java @@ -0,0 +1,111 @@ +package com.fr.design.foldablepane; + +import com.fr.design.constants.UIConstants; + +import java.awt.*; +import java.awt.image.BufferedImage; +import javax.swing.JPanel; + +/** + * Created by MoMeak on 2017/7/5. + */ +public class HeaderPane extends JPanel { + private static final long serialVersionUID = 1L; + private int headWidth = 280; + private int headHeight = 25; + private Color bgColor; + private boolean isShow; + private String title; + private Image image; + private int fontSize = 13; + public void setShow(boolean isShow) { + this.isShow = isShow; + } + + public void setTitle(String title) + { + this.title = title; + } + + public void setHeadWidth(int headwidth){ + this.headWidth = headwidth; + } + + public void setheadHeight(int headHeight){ + this.headHeight = headHeight; + } + + public void setFontSize(int fontSize){ + this.fontSize = fontSize; + } + + + @Override + protected void paintComponent(Graphics g) { + Graphics2D g2d = (Graphics2D) g.create(); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + BufferedImage panelImage = createPanelImage(); + g2d.drawImage(panelImage, null, 0, 0); + } + + private BufferedImage createPanelImage() { + BufferedImage panelImage = new BufferedImage(getWidth(), headHeight, BufferedImage.TYPE_INT_ARGB); + Graphics2D g2d = panelImage.createGraphics(); + + g2d.fillRect(0, 0, headWidth, headHeight); + g2d.drawImage(UIConstants.DRAG_BAR, 0, 0, headWidth, headHeight, null); + g2d.setFont(new Font("SimSun", 0, fontSize)); + g2d.setPaint(bgColor); +// g2d.drawString(this.title, fontSize/2, headHeight-fontSize/3); + g2d.drawString(this.title, 0, headHeight-fontSize/3); + if(this.isShow) + { + image = UIConstants.DRAG_DOWN_PRESS; + g2d.drawImage(image, title.length() * fontSize, headHeight/2-1, null); + } + else + { + image = UIConstants.DRAG_RIGHT_PRESS; + g2d.drawImage(image, title.length() * fontSize, headHeight/3, null); + } + + + return panelImage; + } + + @Override + public Dimension getPreferredSize() { + return new Dimension(this.getWidth(), headHeight); + } + + @Override + public Dimension getSize() { + return new Dimension(this.getWidth(), headHeight); + } + + public HeaderPane(Color bgColor) { + this.bgColor = bgColor; + this.isShow = true; + + } + + public HeaderPane(Color bgColor, String title , int headWidth, int headHeight) { + this(bgColor); + this.title = title; + this.headHeight = headHeight; + this.headWidth = headWidth; + } + + public static void main(String[] args) + { +// JFrame mainFrame = new JFrame("UI Demo - Gloomyfish"); +// mainFrame.getContentPane().setLayout(new BorderLayout()); +// mainFrame.getContentPane().add(new HeaderPane(Color.black, "基本",280,25), BorderLayout.CENTER); +// mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); +// mainFrame.pack(); +// mainFrame.setSize(280, 400); +// mainFrame.setVisible(true); + } + +} diff --git a/designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java b/designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java new file mode 100644 index 000000000..b6a908d33 --- /dev/null +++ b/designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java @@ -0,0 +1,95 @@ +package com.fr.design.foldablepane; + +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +import javax.swing.*; + + +/** + * Created by MoMeak on 2017/7/5. + */ +public class UIExpandablePane extends JPanel { + private static final long serialVersionUID = 1L; + private HeaderPane headerPanel; + private JPanel contentPanel; + private Color color = Color.black; + private String title; + private int headWidth; + private int headHeight; + + + public UIExpandablePane(String title,int headWidth,int headHeight,JPanel contentPanel) + { + super(); + this.title = title; + this.headWidth = headWidth; + this.headHeight = headHeight; + this.contentPanel = contentPanel; + initComponents(); + } + + private void initComponents() { + this.setLayout(new BorderLayout()); + + headerPanel = new HeaderPane(color, title,headWidth,headHeight); + headerPanel.addMouseListener(new PanelAction()); + this.add(headerPanel, BorderLayout.NORTH); + this.add(contentPanel, BorderLayout.CENTER); + setOpaque(false); + } + + class PanelAction extends MouseAdapter + { + public void mousePressed(MouseEvent e) + { + HeaderPane hp = (HeaderPane)e.getSource(); + if(contentPanel.isShowing()) + { + contentPanel.setVisible(false); + hp.setShow(false); + } + else + { + contentPanel.setVisible(true); + hp.setShow(true); + } + hp.getParent().validate(); + hp.getParent().repaint(); + } + } + + + public static void main(String[] args) + { +// JFrame jf = new JFrame("test"); +// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); +// JPanel content = (JPanel) jf.getContentPane(); +// content.setLayout(new BorderLayout()); +// +// JPanel myPanel = new JPanel(); +// myPanel.setLayout(new BorderLayout()); +// JPanel Panel = new JPanel(); +// Panel.setBackground(Color.blue); +// myPanel.add(new UIExpandablePane("基本",280,25,Panel),BorderLayout.CENTER); +//// myPanel.setLayout(new GridBagLayout()); +//// myPanel.add(new JExpandablePanel()); +//// GridBagConstraints gbc = new GridBagConstraints(); +//// JPanel[] panels = new JPanel[4]; // +//// gbc.insets = new Insets(1,3,0,3); +//// gbc.weightx = 1.0; +//// gbc.fill = GridBagConstraints.HORIZONTAL; +//// gbc.gridwidth = GridBagConstraints.REMAINDER; +//// for(int j = 0; j < panels.length; j++) +//// { +//// panels[j] = new JExpandablePanel(); +//// myPanel.add(panels[j], gbc); +//// } +// content.add(myPanel, BorderLayout.CENTER); +// GUICoreUtils.centerWindow(jf); +// jf.setSize(280, 400); +// jf.setVisible(true); + } + +} diff --git a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java index 96eccfc59..0c8633fbd 100644 --- a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -5,7 +5,6 @@ import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.DesignerContext; import com.fr.stable.Constants; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.stable.collections.utils.MathUtils; import javax.swing.*; import java.awt.*; @@ -19,7 +18,9 @@ public class UIResizableContainer extends JPanel { private int containerWidth = 240; private int preferredWidth = 240; private int toolPaneY = 300; + private int toolPaneHeightRight = 20; private int toolPaneHeight = 10; + private int clickToolPaneHeight = 40; private int bottomHeight = 30; private JComponent upPane; @@ -28,7 +29,7 @@ public class UIResizableContainer extends JPanel { private JComponent parameterPane = new JPanel(); private HorizotalToolPane horizontToolPane; - private VerticalToolPane verticalToolPane; + private VerticalToolPaneRight verticalToolPane; private int direction; private boolean hasParameterPane; @@ -45,7 +46,7 @@ public class UIResizableContainer extends JPanel { private boolean isDownPaneVisible = true ; private int paraHeight; - public UIResizableContainer(int direction) { + public UIResizableContainer(int direction) { this(new JPanel(), new JPanel(), direction); } @@ -79,13 +80,12 @@ public class UIResizableContainer extends JPanel { public UIResizableContainer(JComponent upPane, JComponent downPane, int direction) { setBackground(UIConstants.NORMAL_BACKGROUND); - this.upPane = upPane; this.direction = direction; this.downPane = downPane; this.horizontToolPane = new HorizotalToolPane(); - this.verticalToolPane = new VerticalToolPane(); + this.verticalToolPane = new VerticalToolPaneRight(); setLayout(containerLayout); add(upPane); @@ -94,6 +94,23 @@ public class UIResizableContainer extends JPanel { add(verticalToolPane); } + public static void main(String... args) { + JFrame jf = new JFrame("test"); + jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + JPanel content = (JPanel) jf.getContentPane(); + content.setLayout(new BorderLayout()); + + UIResizableContainer bb = new UIResizableContainer(1); + JPanel cc = new JPanel(); + cc.setBackground(Color.white); + + content.add(bb, BorderLayout.EAST); + content.add(cc, BorderLayout.CENTER); + GUICoreUtils.centerWindow(jf); + jf.setSize(500, 500); + jf.setVisible(true); + } + public UIResizableContainer(JComponent upPane, int direction) { setBackground(UIConstants.NORMAL_BACKGROUND); @@ -101,17 +118,17 @@ public class UIResizableContainer extends JPanel { this.direction = direction; this.horizontToolPane = new HorizotalToolPane(); + setLayout(containerLayout); add(upPane); add(horizontToolPane); - } public void setDownPane(JComponent downPane) { if (this.downPane != null){ return; } - this.verticalToolPane = new VerticalToolPane(); + this.verticalToolPane = new VerticalToolPaneRight(); this.downPane = downPane; add(downPane); add(verticalToolPane); @@ -232,6 +249,11 @@ public class UIResizableContainer extends JPanel { upPane.setBounds(toolPaneHeight, getParameterPaneHeight(), containerWidth - toolPaneHeight, getHeight() - getParameterPaneHeight()); verticalToolPane.setBounds(0, 0, toolPaneHeight, getHeight()); } + }else { + parameterPane.setBounds(20, 0, 230, getParameterPaneHeight());//10,0,230,462 + upPane.setBounds(0, toolPaneHeightRight, containerWidth, getHeight() - toolPaneHeightRight);//20,0,230,0 + verticalToolPane.setBounds(0, 0, containerWidth, toolPaneHeightRight);//0,0,10,462 + } } @@ -488,6 +510,7 @@ public class UIResizableContainer extends JPanel { public void paint(Graphics g) { Image button; if (direction == Constants.RIGHT) { +// g.drawImage(UIConstants.DRAG_BAR, 0, 0, toolPaneHeight, getHeight(), null); g.drawImage(UIConstants.DRAG_BAR, 0, 0, toolPaneHeight, getHeight(), null); if (containerWidth == toolPaneHeight) { if (model == UIConstants.MODEL_NORMAL) { @@ -526,22 +549,134 @@ public class UIResizableContainer extends JPanel { } } + private class VerticalToolPaneRight extends JPanel { + private int model = UIConstants.MODEL_NORMAL; + + public VerticalToolPaneRight() { + super(); + addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent e) { + if (e.getY() <= ARROW_RANGE_VERTICAL) { + setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + model = UIConstants.MODEL_PRESS; + } else if (isLeftRightDragEnabled) { + setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR)); + } + repaint(); + } + + @Override + public void mouseDragged(MouseEvent e) { + if (!isLeftRightDragEnabled) { + return; + } + upPane.setVisible(true); + downPane.setVisible(true); + if (direction == Constants.RIGHT) { + containerWidth = e.getXOnScreen() - UIResizableContainer.this.getLocationOnScreen().x; + } else if (direction == Constants.LEFT) { + containerWidth = UIResizableContainer.this.getWidth() + (UIResizableContainer.this.getLocationOnScreen().x - e.getXOnScreen()); + } + + containerWidth = containerWidth > MAX_WIDTH ? MAX_WIDTH : containerWidth; + containerWidth = containerWidth < MIN_WIDTH ? MIN_WIDTH : containerWidth; + if (containerWidth < MIN_WIDTH) { + upPane.setVisible(false); + downPane.setVisible(false); + containerWidth = toolPaneHeight; + } + refreshContainer(); + if (BaseUtils.isAuthorityEditing()) { + DesignerContext.getDesignerFrame().doResize(); + } + + + } + }); + addMouseListener(new MouseAdapter() { + @Override + public void mouseEntered(MouseEvent e) { + if (!isLeftRightDragEnabled) { + return; + } + setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR)); + } + + @Override + public void mouseExited(MouseEvent e) { + setCursor(Cursor.getDefaultCursor()); + model = UIConstants.MODEL_NORMAL; + repaint(); + } + + @Override + public void mouseClicked(MouseEvent e) { + if (e.getY() <= ARROW_RANGE_VERTICAL) { + if (containerWidth == clickToolPaneHeight) { + containerWidth = preferredWidth; + } else { + setPreferredWidth(containerWidth); + containerWidth = clickToolPaneHeight; + } + refreshContainer(); + if (BaseUtils.isAuthorityEditing()) { + DesignerContext.getDesignerFrame().doResize(); + } + } + } + }); + } + + @Override + public void paint(Graphics g) { + Image button; + if (direction == Constants.RIGHT) { + g.drawImage(UIConstants.DRAG_BAR, 0, 0, toolPaneHeight, getHeight(), null); + if (containerWidth == toolPaneHeight) { + if (model == UIConstants.MODEL_NORMAL) { + button = UIConstants.DRAG_RIGHT_NORMAL; + } else { + button = UIConstants.DRAG_RIGHT_PRESS; + } + } else { + if (model == UIConstants.MODEL_NORMAL) { + button = UIConstants.DRAG_LEFT_NORMAL; + } else { + button = UIConstants.DRAG_LEFT_PRESS; + } + } + g.drawImage(button, 3, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null); + if (isLeftRightDragEnabled) { + g.drawImage(UIConstants.DRAG_DOT_VERTICAL, 2, getHeight() / 2, 5, toolPaneHeight, null); + } + } else { + g.drawImage(UIConstants.DRAG_BAR, 0, 0, containerWidth, toolPaneHeightRight, null); +// g.drawImage(UIConstants.DRAG_BAR, 0, 0, toolPaneHeight, getHeight(), null); + if (containerWidth == clickToolPaneHeight) { + if (model == UIConstants.MODEL_NORMAL) { + button = UIConstants.DRAG_LEFT_NORMAL; + } else { + button = UIConstants.DRAG_LEFT_PRESS; + } + } else { + if (model == UIConstants.MODEL_NORMAL) { + button = UIConstants.DRAG_RIGHT_NORMAL; + } else { + button = UIConstants.DRAG_RIGHT_PRESS; + } + } +// g.drawImage(button, 2, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null); + g.drawImage(button, 14, 7, 5, 5, null); + } + + } + } + /** * 主函数 * @param args 参数 */ - public static void main(String... args) { - JFrame jf = new JFrame("test"); - jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - JPanel content = (JPanel) jf.getContentPane(); - content.setLayout(new BorderLayout()); - UIResizableContainer bb = new UIResizableContainer(Constants.RIGHT); - JPanel cc = new JPanel(); - cc.setBackground(Color.blue); - content.add(bb, BorderLayout.EAST); - content.add(cc, BorderLayout.CENTER); - GUICoreUtils.centerWindow(jf); - jf.setSize(500, 500); - jf.setVisible(true); - } + } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/gui/style/BackgroundPane.java b/designer_base/src/com/fr/design/gui/style/BackgroundPane.java index 440d8fcef..ced48d50d 100644 --- a/designer_base/src/com/fr/design/gui/style/BackgroundPane.java +++ b/designer_base/src/com/fr/design/gui/style/BackgroundPane.java @@ -1,9 +1,15 @@ package com.fr.design.gui.style; +import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.constants.LayoutConstants; import com.fr.design.fun.BackgroundQuickUIProvider; +import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.backgroundpane.*; import com.fr.general.Background; import com.fr.general.Inter; @@ -35,7 +41,7 @@ public class BackgroundPane extends AbstractBasicStylePane { this.setLayout(new BorderLayout(0, 6)); typeComboBox = new UIComboBox(); final CardLayout cardlayout = new CardLayout(); - this.add(typeComboBox, BorderLayout.NORTH); +// this.add(typeComboBox, BorderLayout.NORTH); paneList = supportKindsOfBackgroundUI(); @@ -50,7 +56,7 @@ public class BackgroundPane extends AbstractBasicStylePane { typeComboBox.addItem(pane.title4PopupWindow()); centerPane.add(pane, pane.title4PopupWindow()); } - this.add(centerPane, BorderLayout.CENTER); +// this.add(centerPane, BorderLayout.CENTER); typeComboBox.addItemListener(new ItemListener() { @Override @@ -59,6 +65,20 @@ public class BackgroundPane extends AbstractBasicStylePane { fireStateChanged(); } }); + + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + Component[][] components = new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Inter.getLocText("FR-Chart-Shape_Fill") + " ", SwingConstants.LEFT),typeComboBox}, + new Component[]{null, centerPane} + }; + double[] rowSize = {p, p, p}; + double[] columnSize = {p,f}; + int[][] rowCount = {{1, 1},{1, 1},{1, 1}}; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); + this.add(panel, BorderLayout.CENTER); + } protected BackgroundQuickPane[] supportKindsOfBackgroundUI() { diff --git a/designer_base/src/com/fr/design/gui/style/BorderPane.java b/designer_base/src/com/fr/design/gui/style/BorderPane.java index cb37f1c1a..43238c348 100644 --- a/designer_base/src/com/fr/design/gui/style/BorderPane.java +++ b/designer_base/src/com/fr/design/gui/style/BorderPane.java @@ -9,8 +9,11 @@ import java.awt.Color; import java.awt.Component; import java.awt.GridLayout; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ilable.UILabel; -import javax.swing.JPanel; + +import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -21,6 +24,7 @@ import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.Inter; import com.fr.stable.Constants; import com.fr.stable.CoreConstants; @@ -45,22 +49,28 @@ public class BorderPane extends AbstractBasicStylePane { private LineComboBox currentLineCombo; private NewColorSelectBox currentLineColorPane; + private JPanel panel; + private JPanel borderPanel; + private JPanel backgroundPanel; + private BackgroundPane backgroundPane; public BorderPane() { this.initComponents(); } + public static void main(String[] args){ + JFrame jf = new JFrame("test"); + jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + JPanel content = (JPanel) jf.getContentPane(); + content.setLayout(new BorderLayout()); + content.add(new BorderPane(), BorderLayout.CENTER); + GUICoreUtils.centerWindow(jf); + jf.setSize(290, 400); + jf.setVisible(true); + } protected void initComponents() { initButtonsWithIcon(); this.setLayout(new BorderLayout(0, 6)); - double p = TableLayout.PREFERRED, f = TableLayout.FILL; - double[] columnSize1 = {p, f}, rowSize1 = {p, p}; - Component[][] components1 = new Component[][]{ - new Component[]{new UILabel(Inter.getLocText("FR-Designer_Style") + ":"), currentLineCombo}, - new Component[]{new UILabel(Inter.getLocText("FR-Designer_Color") + ":"), currentLineColorPane}, - }; - JPanel northPane = TableLayoutHelper.createTableLayoutPane(components1, rowSize1, columnSize1); - double[] columnSize2 = {p, f}, rowSize2 = {p, p}; JPanel externalPane = new JPanel(new GridLayout(0, 4)); externalPane.add(topToggleButton); externalPane.add(leftToggleButton); @@ -69,14 +79,32 @@ public class BorderPane extends AbstractBasicStylePane { JPanel insidePane = new JPanel(new GridLayout(0, 2)); insidePane.add(horizontalToggleButton); insidePane.add(verticalToggleButton); - Component[][] components2 = new Component[][]{ - new Component[]{outerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/out.png")), innerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/in.png"))}, - new Component[]{externalPane, insidePane,} + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + Component[][] components = new Component[][]{ + new Component[]{null,null}, + new Component[]{new UILabel(Inter.getLocText("FR-Designer_Style") + " ", SwingConstants.LEFT), currentLineCombo}, + new Component[]{null,null}, + new Component[]{new UILabel(Inter.getLocText("FR-Designer_Color") + " ", SwingConstants.LEFT), currentLineColorPane}, + new Component[]{null,null}, + new Component[]{new UILabel("外边框 ", SwingConstants.LEFT),outerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/out.png"))}, + new Component[]{null,externalPane}, + new Component[]{null,null}, + new Component[]{new UILabel("内边框 ", SwingConstants.LEFT),innerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/in.png"))}, + new Component[]{null,insidePane}, + new Component[]{null,null} }; - JPanel centerPane = TableLayoutHelper.createTableLayoutPane(components2, rowSize2, columnSize2); - this.setLayout(new BorderLayout(0, 6)); - this.add(northPane, BorderLayout.NORTH); - this.add(centerPane, BorderLayout.CENTER); + double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p}; + double[] columnSize = {p,f}; + int[][] rowCount = {{1, 1},{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; + panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); + borderPanel = new UIExpandablePane(Inter.getLocText("FR-Designer_Border"),280,20,panel); + this.add(borderPanel,BorderLayout.NORTH); + + backgroundPane = new BackgroundPane(); + backgroundPanel = new UIExpandablePane(Inter.getLocText("FR-Designer_Background"),280,20,backgroundPane); + this.add(backgroundPanel,BorderLayout.CENTER); + outerToggleButton.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { @@ -113,7 +141,8 @@ public class BorderPane extends AbstractBasicStylePane { return Inter.getLocText("FR-Designer_Border"); } - public void populate(Style style) { + @Override + public void populateBean(Style style) { if (style == null) { style = Style.DEFAULT_STYLE; } @@ -127,8 +156,9 @@ public class BorderPane extends AbstractBasicStylePane { cellBorderStyle.setBottomColor(style.getBorderBottomColor()); cellBorderStyle.setRightStyle(style.getBorderRight()); cellBorderStyle.setRightColor(style.getBorderRightColor()); - + this.backgroundPane.populateBean(style.getBackground()); this.populateBean(cellBorderStyle, false, style.getBorderTop(), style.getBorderTopColor()); + } public void populateBean(CellBorderStyle cellBorderStyle, boolean insideMode, int currentStyle, Color currentColor) { @@ -151,10 +181,10 @@ public class BorderPane extends AbstractBasicStylePane { this.innerToggleButton.setEnabled(this.insideMode); this.horizontalToggleButton.setEnabled(this.insideMode); this.verticalToggleButton.setEnabled(this.insideMode); - } public Style update(Style style) { +// style = style.deriveBackground(backgroundPane.update()); if (style == null) { style = Style.DEFAULT_STYLE; } @@ -163,7 +193,6 @@ public class BorderPane extends AbstractBasicStylePane { style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(), cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor()); - return style; } diff --git a/designer_base/src/com/fr/design/gui/style/FRFontPane.java b/designer_base/src/com/fr/design/gui/style/FRFontPane.java index 2dafb005d..bfe86801f 100644 --- a/designer_base/src/com/fr/design/gui/style/FRFontPane.java +++ b/designer_base/src/com/fr/design/gui/style/FRFontPane.java @@ -7,6 +7,7 @@ package com.fr.design.gui.style; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.Vector; import javax.swing.*; import javax.swing.event.ChangeEvent; @@ -37,12 +38,15 @@ import com.fr.design.utils.gui.GUICoreUtils; * Pane to edit Font. */ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObserver { + private static final int MAX_FONT_SIZE = 100; public static Integer[] FONT_SIZES = {new Integer(6), new Integer(8), new Integer(9), new Integer(10), new Integer(11), new Integer(12), new Integer(14), new Integer(16), new Integer(18), new Integer(20), new Integer(22), new Integer(24), new Integer(26), new Integer(28), new Integer(36), new Integer(48), new Integer(72)}; - private static final Dimension BUTTON_SIZE = new Dimension(24, 20); + private static final Dimension BUTTON_SIZE = new Dimension(20, 18); + private final String[] fontSizeStyles = {Inter.getLocText("FRFont-plain"), Inter.getLocText("FRFont-bold"), Inter.getLocText("FRFont-italic"), Inter.getLocText("FRFont-bolditalic")}; private JPanel buttonPane; private JPanel isSuperOrSubPane; private UIComboBox fontNameComboBox; + private UIComboBox fontSizeStyleComboBox; private UIComboBox fontSizeComboBox; private UIToggleButton bold; private UIToggleButton italic; @@ -58,11 +62,24 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse private UIToggleButton superPane; private UIToggleButton subPane; private JPanel linePane; + private int italic_bold; public FRFontPane() { this.initComponents(); } + public static void main(String[] args){ + JFrame jf = new JFrame("test"); + jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + JPanel content = (JPanel) jf.getContentPane(); + content.setLayout(new BorderLayout()); + content.add(new FRFontPane(), BorderLayout.CENTER); + GUICoreUtils.centerWindow(jf); + jf.setSize(290, 400); + jf.setVisible(true); + } + + @Override protected String title4PopupWindow() { return Inter.getLocText("Sytle-FRFont"); @@ -73,7 +90,8 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse */ public void populateBean(FRFont frFont) { fontNameComboBox.setSelectedItem(frFont.getFamily()); - fontSizeComboBox.setSelectedItem(frFont.getSize()); + fontSizeStyleComboBox.setSelectedIndex(frFont.getStyle()); + fontSizeComboBox.setSelectedItem(Utils.round5(frFont.getSize2D())); bold.setSelected(frFont.isBold()); italic.setSelected(frFont.isItalic()); @@ -115,8 +133,11 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Family"))) { frFont = frFont.applyName((String) fontNameComboBox.getSelectedItem()); } + if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Style"))) { + frFont = frFont.applyStyle(fontSizeStyleComboBox.getSelectedIndex()); + } if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Size"))) { - frFont = frFont.applySize((Integer) fontSizeComboBox.getSelectedItem()); + frFont = frFont.applySize(Float.parseFloat(fontSizeComboBox.getSelectedItem().toString())); } if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Foreground"))) { frFont = frFont.applyForeground(this.colorSelectPane.getColor()); @@ -147,7 +168,6 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse private FRFont updateOthers(FRFont frFont) { - frFont = updateItalicBold(frFont); frFont = updateSubSuperscript(frFont); return frFont; } @@ -176,29 +196,6 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse return frFont; } - private FRFont updateItalicBold(FRFont frFont) { - int italic_bold = frFont.getStyle(); - boolean isItalic = italic_bold == Font.ITALIC || italic_bold == (Font.BOLD + Font.ITALIC); - boolean isBold = italic_bold == Font.BOLD || italic_bold == (Font.BOLD + Font.ITALIC); - if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-italic"))) { - if (italic.isSelected() && !isItalic) { - italic_bold += Font.ITALIC; - } else if (!italic.isSelected() && isItalic) { - italic_bold -= Font.ITALIC; - } - frFont = frFont.applyStyle(italic_bold); - } - if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-bold"))) { - if (bold.isSelected() && !isBold) { - italic_bold += Font.BOLD; - } else if (!bold.isSelected() && isBold) { - italic_bold -= Font.BOLD; - } - frFont = frFont.applyStyle(italic_bold); - } - return frFont; - } - @Override public void populateBean(Style style) { this.populateBean(style.getFRFont()); @@ -212,10 +209,20 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse return style.deriveFRFont(frFont); } + public static Vector getFontSizes(){ + Vector FONT_SIZES = new Vector(); + for (int i = 1; i < MAX_FONT_SIZE; i++) { + FONT_SIZES.add(i); + } + return FONT_SIZES; + } + protected void initComponents() { + fontSizeStyleComboBox = new UIComboBox(fontSizeStyles); fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); fontNameComboBox.setPreferredSize(new Dimension(144, 20)); - fontSizeComboBox = new UIComboBox(FONT_SIZES); + fontSizeComboBox = new UIComboBox(getFontSizes()); + fontSizeComboBox.setEditable(true); this.underlineCombo = new LineComboBox(UIConstants.BORDER_LINE_STYLE_ARRAY); colorSelectPane = new UIColorButton(); bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); @@ -229,26 +236,31 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse isShadowCheckBox = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/shadow.png")); isShadowCheckBox.setPreferredSize(BUTTON_SIZE); superPane = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/sup.png")); - superPane.setPreferredSize(new Dimension(22, 18)); + superPane.setPreferredSize(BUTTON_SIZE); subPane = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/sub.png")); - subPane.setPreferredSize(new Dimension(22, 18)); + subPane.setPreferredSize(BUTTON_SIZE); isSuperOrSubPane = new TwoButtonPane(superPane, subPane); +// Component[] components_font = new Component[]{ +// colorSelectPane, italic, bold, underline, isStrikethroughCheckBox, isShadowCheckBox +// }; Component[] components_font = new Component[]{ - colorSelectPane, italic, bold, underline, isStrikethroughCheckBox, isShadowCheckBox + colorSelectPane, underline, isStrikethroughCheckBox, isShadowCheckBox }; buttonPane = new JPanel(new BorderLayout()); buttonPane.add(GUICoreUtils.createFlowPane(components_font, FlowLayout.LEFT, LayoutConstants.HGAP_SMALL)); - buttonPane.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); +// buttonPane.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); linePane = new JPanel(new CardLayout()); initAllNames(); setToolTips(); this.setLayout(new BorderLayout()); + this.add(fontNameComboBox, BorderLayout.NORTH); this.add(createPane(), BorderLayout.CENTER); DefaultValues defaultValues = FRContext.getDefaultValues(); populateBean(defaultValues.getFRFont()); } private void initAllNames() { + fontSizeStyleComboBox.setGlobalName(Inter.getLocText("FRFont-Style")); fontNameComboBox.setGlobalName(Inter.getLocText("FRFont-Family")); fontSizeComboBox.setGlobalName(Inter.getLocText("FRFont-Size")); colorSelectPane.setGlobalName(Inter.getLocText("FRFont-Foreground")); @@ -292,10 +304,11 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse private JPanel createLeftPane() { double p = TableLayout.PREFERRED; - double[] columnSize = {p}; + double f = TableLayout.FILL; + double[] columnSize = {f}; double[] rowSize = {p, p, p}; Component[][] components = new Component[][]{ - new Component[]{fontNameComboBox}, + new Component[]{fontSizeStyleComboBox}, new Component[]{buttonPane}, new Component[]{createLinePane()} }; @@ -317,9 +330,10 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse private JPanel createPane() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p}; + double[] columnSize = {f, f}; + double[] rowSize = {p,p}; Component[][] components = new Component[][]{ + new Component[]{null, null}, new Component[]{createLeftPane(), createRightPane()}, }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); @@ -349,7 +363,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse public TwoButtonPane(UIToggleButton leftButton, UIToggleButton rightButton) { this.leftButton = leftButton; this.rightButton = rightButton; - this.setLayout(new FlowLayout(FlowLayout.RIGHT, 1, 0)); + this.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0)); this.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); initButton(leftButton); initButton(rightButton); diff --git a/designer_base/src/com/fr/design/gui/style/FormatPane.java b/designer_base/src/com/fr/design/gui/style/FormatPane.java index c426bbed2..7dc5f108f 100644 --- a/designer_base/src/com/fr/design/gui/style/FormatPane.java +++ b/designer_base/src/com/fr/design/gui/style/FormatPane.java @@ -7,27 +7,24 @@ import com.fr.base.TextFormat; import com.fr.data.core.FormatField; import com.fr.data.core.FormatField.FormatContents; import com.fr.design.border.UIRoundedBorder; +import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxRenderer; -import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; -import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; import javax.swing.*; import javax.swing.border.Border; import javax.swing.border.TitledBorder; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; import java.awt.*; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; +import java.awt.event.*; import java.text.Format; import java.text.SimpleDateFormat; @@ -37,7 +34,7 @@ import java.text.SimpleDateFormat; * @author zhou * @since 2012-5-24上午10:57:00 */ -public class FormatPane extends AbstractBasicStylePane { +public class FormatPane extends AbstractBasicStylePane{ private static final long serialVersionUID = 724330854437726751L; private static final int LABLE_X = 4; @@ -54,13 +51,16 @@ public class FormatPane extends AbstractBasicStylePane { private Format format; private UIComboBox typeComboBox; + private UIComboBox textField; private UILabel sampleLabel; - - private FormatePaneNumField patternTextField = null; - private JList patternList = null; + private JPanel contentPane; + private JPanel txtCenterPane; private JPanel centerPane; + private JPanel formatFontPane; + private FRFontPane frFontPane; private boolean isRightFormate; private boolean isDate = false; + private boolean isFormat = false; /** * Constructor. */ @@ -68,40 +68,70 @@ public class FormatPane extends AbstractBasicStylePane { this.initComponents(TYPES); } + public static void main(String[] args){ + JFrame jf = new JFrame("test"); + jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + JPanel content = (JPanel) jf.getContentPane(); + content.setLayout(new BorderLayout()); + content.add(new FormatPane(), BorderLayout.CENTER); + GUICoreUtils.centerWindow(jf); + jf.setSize(290, 400); + jf.setVisible(true); + } + protected void initComponents(Integer[] types) { this.setLayout(new BorderLayout(0, 4)); iniSampleLable(); - JPanel contentPane = new JPanel(new BorderLayout(0, 4)) { + contentPane = new JPanel(new BorderLayout(0, 4)) { @Override public Dimension getPreferredSize() { - return new Dimension(super.getPreferredSize().width, 185); + return new Dimension(super.getPreferredSize().width, 70); } - }; typeComboBox = new UIComboBox(types); + UIComboBoxRenderer render = createComBoxRender(); typeComboBox.setRenderer(render); typeComboBox.addItemListener(itemListener); contentPane.add(sampleLabel, BorderLayout.NORTH); - this.add(typeComboBox, BorderLayout.NORTH); +// this.add(typeComboBox, BorderLayout.NORTH); centerPane = new JPanel(new CardLayout()); centerPane.add(new JPanel(), "hide"); + centerPane.setPreferredSize(new Dimension(0, 0) ); centerPane.add(contentPane, "show"); - this.add(centerPane, BorderLayout.CENTER); + + formatFontPane = new JPanel(new BorderLayout()); + formatFontPane.add(centerPane, BorderLayout.NORTH); + formatFontPane.add(new FRFontPane(), BorderLayout.CENTER); + +// this.add(formatFontPane, BorderLayout.CENTER); // content pane. - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - contentPane.add(centerPane, BorderLayout.CENTER); - patternTextField = new FormatePaneNumField(); - centerPane.add(patternTextField, BorderLayout.NORTH); - patternTextField.getDocument().addDocumentListener(patternTextDocumentListener); - patternList = new JList(new DefaultListModel()); - centerPane.add(new UIScrollPane(patternList), BorderLayout.CENTER); - patternList.addListSelectionListener(patternListSelectionListener); - patternList.setSelectionBackground(UIConstants.LIGHT_BLUE); - patternList.setSelectionForeground(Color.black); - // init values. + txtCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + contentPane.add(txtCenterPane, BorderLayout.CENTER); + + textField = new UIComboBox(FormatField.getInstance().getFormatArray(getFormatContents())); + textField.addItemListener(textFieldItemListener); + textField.setEditable(true); + txtCenterPane.add(textField, BorderLayout.NORTH); + + frFontPane = new FRFontPane(); + + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + Component[][] components = new Component[][]{ + new Component[]{null,null}, + new Component[]{new UILabel(Inter.getLocText("FR-Base_Format")+" ", SwingConstants.LEFT), typeComboBox }, + new Component[]{null,centerPane}, + new Component[]{new UILabel(Inter.getLocText("FR-Designer_FRFont"), SwingConstants.LEFT), frFontPane}, + new Component[]{null,null} + }; + double[] rowSize = {p, p, p, p, p}; + double[] columnSize = {p,f}; + int[][] rowCount = {{1, 1},{1, 1}, {1, 1}, {1, 3}, {1, 1}}; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); + this.add(panel,BorderLayout.CENTER); } @@ -187,7 +217,6 @@ public class FormatPane extends AbstractBasicStylePane { } else { setPatternComboBoxAndList(FormatContents.NUMBER, pattern); } - patternTextField.setText(pattern); } else if (format instanceof SimpleDateFormat) { // date and time String pattern = ((SimpleDateFormat) format).toPattern(); if (!isTimeType(pattern)) { @@ -195,7 +224,6 @@ public class FormatPane extends AbstractBasicStylePane { } else { setPatternComboBoxAndList(FormatContents.TIME, pattern); } - patternTextField.setText(pattern); } else if (format instanceof TextFormat) { // Text this.typeComboBox.setSelectedItem(FormatContents.TEXT); } @@ -224,9 +252,9 @@ public class FormatPane extends AbstractBasicStylePane { this.typeComboBox.setSelectedItem(formatStyle); int i = isArrayContainPattern(FormatField.getInstance().getFormatArray(formatStyle), pattern); if (i == -1) { - this.patternList.setSelectedIndices(ArrayUtils.EMPTY_INT_ARRAY); + this.textField.setSelectedIndex(0); } else { - this.patternList.setSelectedIndex(i); + this.textField.setSelectedIndex(i); } } @@ -238,7 +266,7 @@ public class FormatPane extends AbstractBasicStylePane { * update */ public Format update() { - String patternString = patternTextField.getText(); + String patternString = String.valueOf(textField.getSelectedItem()); if (getFormatContents() == FormatContents.TEXT) { return FormatField.getInstance().getFormat(getFormatContents(), patternString); } @@ -262,10 +290,10 @@ public class FormatPane extends AbstractBasicStylePane { this.sampleLabel.setForeground(UIManager.getColor("Label.foreground")); try { isRightFormate = true; - if (StringUtils.isEmpty(patternTextField.getText())) { + if (StringUtils.isEmpty(String.valueOf(textField.getSelectedItem()))) { return; } - this.sampleLabel.setText(FormatField.getInstance().getFormatValue(getFormatContents(), patternTextField.getText())); + this.sampleLabel.setText(FormatField.getInstance().getFormatValue(getFormatContents(), String.valueOf(textField.getSelectedItem()))); } catch (Exception e) { this.sampleLabel.setForeground(Color.red); this.sampleLabel.setText(e.getMessage()); @@ -285,55 +313,37 @@ public class FormatPane extends AbstractBasicStylePane { @Override public void itemStateChanged(ItemEvent e) { - int contents = getFormatContents(); - CardLayout cardLayout = (CardLayout) centerPane.getLayout(); - if (isTextOrNull()) { - cardLayout.show(centerPane, "hide"); - patternTextField.setText(""); - } else { - cardLayout.show(centerPane, "show"); - } - - String[] patternArray = FormatField.getInstance().getFormatArray(contents, false); - // - DefaultListModel patternModel = (DefaultListModel) patternList.getModel(); - patternModel.removeAllElements(); - - for (int i = 0; i < patternArray.length; i++) { - patternModel.addElement(patternArray[i]); + if(e.getStateChange() == ItemEvent.SELECTED){ + int contents = getFormatContents(); + String[] items = FormatField.getInstance().getFormatArray(contents); + CardLayout cardLayout = (CardLayout) centerPane.getLayout(); + + if (isTextOrNull()) { + centerPane.setPreferredSize(new Dimension(0, 0) ); + cardLayout.show(centerPane, "hide"); + } else { + textField.removeAllItems(); + long begin = System.currentTimeMillis(); + for (int i = 0; i < items.length; i++) { + textField.addItem(items[i]); + } + long end = System.currentTimeMillis(); + System.out.println(end-begin+"ms"); + centerPane.setPreferredSize(new Dimension(270, 70) ); + cardLayout.show(centerPane, "show"); + } + isFormat = true; } - if (patternModel.size() > 0) { - patternList.setSelectedIndex(0); - } } - }; - /** - * text pattern document listener. - */ - DocumentListener patternTextDocumentListener = new DocumentListener() { - - public void insertUpdate(DocumentEvent evt) { - refreshPreviewLabel(); - } - - public void removeUpdate(DocumentEvent evt) { - refreshPreviewLabel(); - } - - public void changedUpdate(DocumentEvent evt) { - refreshPreviewLabel(); - } - }; - /** - * Pattern list selection listener. - */ - ListSelectionListener patternListSelectionListener = new ListSelectionListener() { - public void valueChanged(ListSelectionEvent evt) { - if (!evt.getValueIsAdjusting()) { - patternTextField.setText((String) patternList.getSelectedValue()); + ItemListener textFieldItemListener = new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if(e.getStateChange() == ItemEvent.SELECTED){ + isFormat = true; + refreshPreviewLabel(); } } }; @@ -344,6 +354,8 @@ public class FormatPane extends AbstractBasicStylePane { */ public void populateBean(Style style) { this.populateBean(style.getFormat()); + isFormat = false; + this.frFontPane.populateBean(style.getFRFont()); } @Override @@ -351,7 +363,12 @@ public class FormatPane extends AbstractBasicStylePane { * update */ public Style update(Style style) { - return style.deriveFormat(this.update()); + if (isFormat){ + isFormat = false; + return style.deriveFormat(this.update()); + } else { + return style.deriveFRFont(this.frFontPane.update(style.getFRFont())); + } } /** @@ -401,4 +418,5 @@ public class FormatPane extends AbstractBasicStylePane { } } } + } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/menu/MenuManager.java b/designer_base/src/com/fr/design/menu/MenuManager.java index 18d6b0e02..0f1401ace 100644 --- a/designer_base/src/com/fr/design/menu/MenuManager.java +++ b/designer_base/src/com/fr/design/menu/MenuManager.java @@ -138,12 +138,12 @@ public class MenuManager extends XMLFileManager { if (name.isEmpty()) { return; } - try { - MenuAction action = (MenuAction) reader.getAttrAsClass().newInstance(); - menu.addShortCut(action); - } catch (Exception exp) { - FRLogger.getLogger().error(exp.getMessage(), exp); - } +// try { +// MenuAction action = (MenuAction) reader.getAttrAsClass().newInstance(); +// menu.addShortCut(action); +// } catch (Exception exp) { +// FRLogger.getLogger().error(exp.getMessage(), exp); +// } } else if (reader.getTagName().equals("Menu")) { final MenuDef submenu = new MenuDef(); String tmpVal = StringUtils.EMPTY; diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java index d844631c0..21a778f1a 100644 --- a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java @@ -19,7 +19,7 @@ import com.fr.general.GeneralUtils; import com.fr.general.Inter; import com.fr.general.data.DataModel; import com.fr.stable.StringUtils; -import org.apache.batik.swing.svg.SVGFileFilter; +//import org.apache.batik.swing.svg.SVGFileFilter; import javax.swing.*; import java.awt.*; @@ -107,7 +107,7 @@ refreshAreaNameBox(); public void actionPerformed(ActionEvent evt) { JFileChooser svgFileChooser = new JFileChooser(); - svgFileChooser.addChoosableFileFilter(new SVGFileFilter()); +// svgFileChooser.addChoosableFileFilter(new SVGFileFilter()); if (StringUtils.isNotBlank(lastSelectPath)) { svgFileChooser.setSelectedFile(new File(lastSelectPath)); } From 202f482b7e0b533fa63d8512f420f673642ca08f Mon Sep 17 00:00:00 2001 From: MoMeak Date: Wed, 12 Jul 2017 16:07:45 +0800 Subject: [PATCH 02/32] update --- .../mainframe/CellElementPropertyPane.java | 41 ------------------- .../mainframe/cell/CellElementEditPane.java | 3 -- .../com/fr/design/gui/style/BorderPane.java | 2 +- 3 files changed, 1 insertion(+), 45 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/CellElementPropertyPane.java b/designer/src/com/fr/design/mainframe/CellElementPropertyPane.java index 6785b17f9..96ca02a5e 100644 --- a/designer/src/com/fr/design/mainframe/CellElementPropertyPane.java +++ b/designer/src/com/fr/design/mainframe/CellElementPropertyPane.java @@ -11,13 +11,9 @@ import com.fr.base.BaseUtils; import com.fr.design.fun.CellAttributeProvider; import com.fr.design.fun.PresentKindProvider; import com.fr.design.gui.frpane.UITitlePanel; -import com.fr.design.gui.ibutton.UIHeadGroup; -import com.fr.design.gui.ibutton.UISideGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itabpane.TitleChangeListener; import com.fr.design.mainframe.cell.CellElementEditPane; -import com.fr.design.mainframe.cell.settingpane.AbstractCellAttrPane; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.GeneralContext; import com.fr.general.Inter; import com.fr.grid.selection.CellSelection; @@ -87,43 +83,6 @@ public class CellElementPropertyPane extends DockingView { } }; - public static void main(String[] args){ - JFrame jf = new JFrame("test"); - jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - GUICoreUtils.centerWindow(jf); - final JPanel jPanel = (JPanel) jf.getContentPane(); - jPanel.setLayout(new BorderLayout()); - final CardLayout card = new CardLayout(); - final JPanel center = new JPanel(); - center.setLayout( new CardLayout()); - - final JPanel content = new JPanel(); - content.setLayout(new BorderLayout()); - final CellElementPropertyPane pane = new CellElementPropertyPane(); - content.add(new CellElementPropertyPane(), BorderLayout.CENTER); - Icon[] iconArray = new Icon[2]; - iconArray[0] = BaseUtils.readIcon("/com/fr/design/images/expand/vertical.png"); - center.add(content,content.getUIClassID()); - iconArray[1] = BaseUtils.readIcon("/com/fr/design/images/expand/vertical.png"); - center.add(new JPanel(),""); -// for (int i = 0; i < 4; i++) { -// iconArray[0] = BaseUtils.readIcon("/com/fr/design/images/expand/vertical.png"); -// center.add(content,content.getUIClassID()); -// } - - - final TitleChangeListener titleChangeListener = null; - UISideGroup tabsHeaderIconPane = new UISideGroup(iconArray) { - }; - JPanel j1 = new JPanel(); - j1.setLayout(new GridLayout(10,1)); - j1.add(tabsHeaderIconPane); - tabsHeaderIconPane.setNeedLeftRightOutLine(false); - jPanel.add(j1, BorderLayout.WEST); - jPanel.add(center,BorderLayout.CENTER); - jf.setSize(500, 500); - jf.setVisible(true); - } private CellElementPropertyPane() { this.setLayout(new BorderLayout()); diff --git a/designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java b/designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java index 8d3980a48..07f95d54f 100644 --- a/designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java +++ b/designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java @@ -13,9 +13,6 @@ import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itabpane.TitleChangeListener; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.EastTopArrow; import com.fr.design.mainframe.cell.settingpane.*; import com.fr.design.dialog.BasicPane; import com.fr.design.utils.gui.GUICoreUtils; diff --git a/designer_base/src/com/fr/design/gui/style/BorderPane.java b/designer_base/src/com/fr/design/gui/style/BorderPane.java index 43238c348..d214198a8 100644 --- a/designer_base/src/com/fr/design/gui/style/BorderPane.java +++ b/designer_base/src/com/fr/design/gui/style/BorderPane.java @@ -184,7 +184,7 @@ public class BorderPane extends AbstractBasicStylePane { } public Style update(Style style) { -// style = style.deriveBackground(backgroundPane.update()); + style = style.deriveBackground(backgroundPane.update()); if (style == null) { style = Style.DEFAULT_STYLE; } From 4659e8e3120d2c06dfff3f4e18387d39ea30d190 Mon Sep 17 00:00:00 2001 From: plough Date: Thu, 13 Jul 2017 10:37:03 +0800 Subject: [PATCH 03/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E5=88=9D=E6=AD=A5?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E5=A4=96=E6=A1=86=E6=9E=B6=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../icontainer/UIEastResizableContainer.java | 299 ++++++++++++++++++ .../mainframe/EastRegionContainerPane.java | 247 ++++++++++++++- 2 files changed, 539 insertions(+), 7 deletions(-) create mode 100644 designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java diff --git a/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java b/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java new file mode 100644 index 000000000..e1a1c2a16 --- /dev/null +++ b/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java @@ -0,0 +1,299 @@ +package com.fr.design.gui.icontainer; + +import com.fr.base.BaseUtils; +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.stable.Constants; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; + +/** + * Created by plough on 2017/7/7. + */ +public class UIEastResizableContainer extends JPanel { + private static final long serialVersionUID = 1854340560790476907L; + private int containerWidth = 240; + private int preferredWidth = 240; + private int topToolPaneHeight = 20; + private int leftPaneWidth = 40; + + private JComponent leftPane; + private JComponent rightPane; + + // private HorizotalToolPane horizontToolPane; + private TopToolPane topToolPane; + + + private static final int ARROW_MARGIN = 15; + private static final int ARROW_RANGE = 35; + + private boolean isRightPaneVisible = true; + + public UIEastResizableContainer() { + this(new JPanel(), new JPanel()); + } + + /** + * 设置面板宽度 + * + * @param width + */ + public void setContainerWidth(int width) { + this.containerWidth = width; + this.preferredWidth = width; + } + + + public void setRightPaneVisible(boolean isVisible){ + this.isRightPaneVisible = isVisible; + } + + private void setPreferredWidth(int width) { + this.preferredWidth = width; + } + + public UIEastResizableContainer(JComponent leftPane, JComponent rightPane) { + setBackground(UIConstants.NORMAL_BACKGROUND); + this.leftPane = leftPane; + this.rightPane = rightPane; + + this.topToolPane = new TopToolPane(); + + setLayout(containerLayout); + add(topToolPane); + add(leftPane); + add(rightPane); + } + + public static void main(String... args) { + JFrame jf = new JFrame("test"); + jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + JPanel content = (JPanel) jf.getContentPane(); + content.setLayout(new BorderLayout()); + + JPanel leftPane = new JPanel(); + leftPane.setBackground(Color.yellow); + JPanel rightPane = new JPanel(); + rightPane.setBackground(Color.green); + + UIButton b1, b2; + b1 = new UIButton("b1"); + b2 = new UIButton("b2"); + b1.setPreferredSize(new Dimension(40, 40)); + b2.setPreferredSize(new Dimension(40, 40)); + leftPane.add(b1); + leftPane.add(b2); + + + UIEastResizableContainer bb = new UIEastResizableContainer(leftPane, rightPane); + + JPanel cc = new JPanel(); + cc.setBackground(Color.white); + + content.add(bb, BorderLayout.EAST); + content.add(cc, BorderLayout.CENTER); + GUICoreUtils.centerWindow(jf); + jf.setSize(500, 500); + jf.setVisible(true); + } + + /** + * 将面板设置成最佳的宽度 + */ + public void setWindow2PreferWidth() { + if (containerWidth == leftPaneWidth) { + containerWidth = preferredWidth; + refreshContainer(); + } + } + + /** + * 得到容器的宽度 + * + * @return + */ + public int getContainerWidth() { + return this.containerWidth; + } + + /** + * 设置关闭设计器前最后一次面板的宽度 + * + * @param containerWidth + */ + public void setLastContainerWidth(int containerWidth) { + this.containerWidth = containerWidth; + } + + private LayoutManager containerLayout = new LayoutManager() { + + @Override + public void removeLayoutComponent(Component comp) { + // TODO Auto-generated method stub + + } + + @Override + public Dimension preferredLayoutSize(Container parent) { + return parent.getPreferredSize(); + } + + @Override + public Dimension minimumLayoutSize(Container parent) { + return null; + } + + @Override + public void layoutContainer(Container parent) { + if (topToolPane == null || rightPane == null) { + return; + } + + topToolPane.setBounds(0, 0, containerWidth, topToolPaneHeight);//0,0,10,462 + leftPane.setBounds(0, topToolPaneHeight, leftPaneWidth, getHeight() - topToolPaneHeight); + +// parameterPane.setBounds(20, 0, 230, getParameterPaneHeight());//10,0,230,462 + rightPane.setBounds(leftPaneWidth, topToolPaneHeight, containerWidth-leftPaneWidth, getHeight() - topToolPaneHeight);//20,0,230,0 + } + + @Override + public void addLayoutComponent(String name, Component comp) { + } + }; + + @Override + /** + * 得到最佳大小 + */ + public Dimension getPreferredSize() { + return new Dimension(containerWidth, 400); + } + + /** + * 替换左子面板 + * + * @param pane 面板 + */ + public void replaceLeftPane(JComponent pane) { + remove(pane); + remove(this.leftPane); + add(this.leftPane = pane); + refreshContainer(); + } + + + /** + * 替换右子面板 + * + * @param pane 面板 + */ + public void replaceRightPane(JComponent pane) { + remove(pane); + remove(this.rightPane); + add(this.rightPane = pane); + refreshContainer(); + } + + /** + * 得到左子面板 + * + * @return + */ + public JComponent getLeftPane() { + return this.leftPane; + } + + /** + * 得到右子面板 + * + * @return + */ + public JComponent getRightPane() { + return this.rightPane; + } + + private void refreshContainer() { + validate(); + repaint(); + revalidate(); + } + + private class TopToolPane extends JPanel { + private int model = UIConstants.MODEL_NORMAL; + + public TopToolPane() { + super(); + addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent e) { + if (e.getX() <= ARROW_RANGE) { + setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + model = UIConstants.MODEL_PRESS; + } else { + setCursor(Cursor.getDefaultCursor()); + model = UIConstants.MODEL_NORMAL; + } + repaint(); + } + + @Override + public void mouseDragged(MouseEvent e) { + } + }); + addMouseListener(new MouseAdapter() { + @Override + public void mouseExited(MouseEvent e) { + setCursor(Cursor.getDefaultCursor()); + model = UIConstants.MODEL_NORMAL; + repaint(); + } + + @Override + public void mouseClicked(MouseEvent e) { + if (e.getX() <= ARROW_RANGE) { + if (containerWidth == leftPaneWidth) { + containerWidth = preferredWidth; + } else { + setPreferredWidth(containerWidth); + containerWidth = leftPaneWidth; + } + refreshContainer(); + if (BaseUtils.isAuthorityEditing()) { + DesignerContext.getDesignerFrame().doResize(); + } + } + } + }); + } + + @Override + public void paint(Graphics g) { + Image button; + + g.drawImage(UIConstants.DRAG_BAR, 0, 0, containerWidth, topToolPaneHeight, null); + if (containerWidth == leftPaneWidth) { + if (model == UIConstants.MODEL_NORMAL) { + button = UIConstants.DRAG_LEFT_NORMAL; + } else { + button = UIConstants.DRAG_LEFT_PRESS; + } + } else { + if (model == UIConstants.MODEL_NORMAL) { + button = UIConstants.DRAG_RIGHT_NORMAL; + } else { + button = UIConstants.DRAG_RIGHT_PRESS; + } + } +// g.drawImage(button, 2, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null); + g.drawImage(button, 20, 7, 5, 5, null); + } + } + +} \ No newline at end of file diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index e792cba10..99cf14517 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -1,11 +1,28 @@ package com.fr.design.mainframe; +import com.fr.base.BaseUtils; import com.fr.design.DesignerEnvManager; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icontainer.UIEastResizableContainer; import com.fr.design.gui.icontainer.UIResizableContainer; +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.Constants; -public class EastRegionContainerPane extends UIResizableContainer { +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +public class EastRegionContainerPane extends UIEastResizableContainer { private static EastRegionContainerPane THIS; + private List propertyItemList; + private CardLayout propertyCard; + private JPanel leftPane; + private JPanel rightPane; + private static final int CONTAINER_WIDTH = 260; + private static final int BUTTON_WIDTH = 40; /** * 得到实例 @@ -15,24 +32,240 @@ public class EastRegionContainerPane extends UIResizableContainer { public static final EastRegionContainerPane getInstance() { if (THIS == null) { THIS = new EastRegionContainerPane(); - THIS.setLastToolPaneY(DesignerEnvManager.getEnvManager().getLastEastRegionToolPaneY()); +// THIS.setLastToolPaneY(DesignerEnvManager.getEnvManager().getLastEastRegionToolPaneY()); THIS.setLastContainerWidth(DesignerEnvManager.getEnvManager().getLastEastRegionContainerWidth()); } return THIS; } public EastRegionContainerPane() { - super(Constants.LEFT); - setVerticalDragEnabled(false); + super(); +// setVerticalDragEnabled(false); + initPropertyItemList(); + initRightPane(); + initLeftPane(); +// super(leftPane, rightPane); setContainerWidth(260); } + private void initPropertyItemList() { + propertyItemList = new ArrayList<>(); + + // 单元格元素 + PropertyItem cellElement = new PropertyItem("cellElement", "/com/fr/design/images/buttonicon/add.png"); + // 单元格属性 + PropertyItem cellAttr = new PropertyItem("cellAttr", "com/fr/design/images/toolbarbtn/close.png"); + // 悬浮元素 + PropertyItem floatElement = new PropertyItem("floatElement", "com/fr/design/images/toolbarbtn/close.png"); + // 控件设置 + PropertyItem widgetSettings = new PropertyItem("widgetSettings", "com/fr/design/images/toolbarbtn/close.png"); + // 条件属性 + PropertyItem conditionAttr = new PropertyItem("conditionAttr", "com/fr/design/images/toolbarbtn/close.png"); + // 超级链接 + PropertyItem hyperlink = new PropertyItem("hyperlink", "com/fr/design/images/toolbarbtn/close.png"); + // 组件库 + PropertyItem widgetLib = new PropertyItem("widgetLib", "com/fr/design/images/toolbarbtn/close.png"); + propertyItemList.add(cellElement); + propertyItemList.add(cellAttr); + propertyItemList.add(floatElement); + propertyItemList.add(widgetSettings); + propertyItemList.add(conditionAttr); + propertyItemList.add(hyperlink); + propertyItemList.add(widgetLib); + } + + // 右侧属性面板 + private void initRightPane() { + rightPane = new JPanel(); + propertyCard = new CardLayout(); + rightPane.setBackground(Color.green); + rightPane.setLayout(propertyCard); + for (PropertyItem item : propertyItemList) { + rightPane.add(item.getName(), item.getPropertyPanel()); + } + + replaceRightPane(rightPane); + } + + // 左侧按钮面板 + private void initLeftPane() { + leftPane = new JPanel(); + for (PropertyItem item : propertyItemList) { + leftPane.add(item.getButton()); + } + +// leftPane.setLayout(new BoxLayout(leftPane, BoxLayout.Y_AXIS)); + leftPane.setBackground(Color.yellow); + replaceLeftPane(leftPane); + } + + public EastRegionContainerPane(JPanel leftPane, JPanel rightPane) { + super(leftPane, rightPane); +// setVerticalDragEnabled(false); +// setContainerWidth(260); + } + + public void replaceUpPane(JComponent pane) { + propertyItemList.get(0).replaceContentPane(pane); + } + + public void replaceDownPane(JComponent pane) { + propertyItemList.get(1).replaceContentPane(pane); + } + + public JComponent getUpPane() { + return propertyItemList.get(0).getContentPane(); + } + + public JComponent getDownPane() { + return propertyItemList.get(1).getContentPane(); + } + + public void addParameterPane(JComponent paraPane) { + propertyItemList.get(2).replaceContentPane(paraPane); + } + + public void setParameterHeight(int height) { + // stub + } + + public static void main(String[] args){ + JFrame jf = new JFrame("test"); + jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JPanel cc = new JPanel(); + cc.setBackground(Color.white); +// JPanel leftPane = new JPanel(); +// leftPane.setBackground(Color.yellow); +// JPanel rightPane = new JPanel(); +// rightPane.setBackground(Color.green); +// +// JButton b1, b2; +// b1 = new JButton("b1"); +// b2 = new JButton("b2"); +// b1.setPreferredSize(new Dimension(40, 40)); +// b2.setPreferredSize(new Dimension(40, 40)); +// leftPane.add(b1); +// leftPane.add(b2); +// leftPane.setLayout(new BoxLayout(leftPane, BoxLayout.Y_AXIS)); + + JPanel content = (JPanel)jf.getContentPane(); +// content.setLayout(null); + content.add(cc, BorderLayout.CENTER); + content.add(new EastRegionContainerPane(), BorderLayout.EAST); + GUICoreUtils.centerWindow(jf); + jf.setSize(400, 400); + jf.setVisible(true); + } + + public void removeParameterPane() { + + } + /** - * 刷新下面板 + * 刷新右面板 */ + public void refreshRightPane() { + if (this.getRightPane() instanceof DockingView) { + ((DockingView) this.getRightPane()).refreshDockingView(); + } + } + public void refreshDownPane() { - if (this.getDownPane() instanceof DockingView) { - ((DockingView) this.getDownPane()).refreshDockingView(); + JComponent pane = propertyItemList.get(1).getContentPane(); + if (pane instanceof DockingView) { + ((DockingView) pane).refreshDockingView(); + } + } + + public int getToolPaneY() { + return 0; + } + + + + class PropertyItem { + // private UIButton button; + private JButton button; + private String name; + private JPanel propertyPanel; + private JComponent contentPane; + private int x, y; // 弹出框的坐标 + private int height; // 弹出框的高度 + private boolean isPoppedOut; // 是否弹出 + + public PropertyItem(String name, String btnUrl) { + this.name = name; + initButton(btnUrl); + initPropertyPanel(); + } + + // 选项不可用 + public void setEnabled(boolean enabled) { + button.setEnabled(enabled); + } + + private void initPropertyPanel() { + propertyPanel = new JPanel(); + propertyPanel.setBackground(Color.pink); +// propertyPanel.setPreferredSize(getPreferredSize()); +// JPanel titlePanel = new JPanel(); +// titlePanel.setPreferredSize(new Dimension(propertyPanel.getPreferredSize().width, 20)); +// titlePanel + JButton testBtn = new JButton(name); + testBtn.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + setEnabled(!button.isEnabled()); + } + }); + contentPane = new JPanel(); + contentPane.add(testBtn); + propertyPanel.setLayout(new BorderLayout()); + propertyPanel.add(contentPane, BorderLayout.CENTER); + } + + public void replaceContentPane(JComponent pane) { +// remove(pane); + propertyPanel.remove(this.contentPane); + propertyPanel.add(this.contentPane = pane); + refreshContainer(); + } + + public JComponent getContentPane() { + return contentPane; + } + + private void refreshContainer() { + propertyPanel.validate(); + propertyPanel.repaint(); + propertyPanel.revalidate(); + } + + private void initButton(String btnUrl) { + button = new JButton(BaseUtils.readIcon(btnUrl)); +// button = new UIButton("btnd\nssdg"); +// button.set4LargeToolbarButton(); + button.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_WIDTH)); + button.setContentAreaFilled(false); + button.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + propertyCard.show(rightPane, name); + } + }); + } + + public JButton getButton() { + return button; + } + + public String getName() { + return name; + } + + public JPanel getPropertyPanel() { + return propertyPanel; } } } \ No newline at end of file From 85de7e321207eed770938d8b1a55f8c6fb54597d Mon Sep 17 00:00:00 2001 From: MoMeak Date: Thu, 13 Jul 2017 10:43:09 +0800 Subject: [PATCH 04/32] =?UTF-8?q?rollback=E7=BC=96=E8=AF=91=E4=B8=8D?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E7=9A=84=E6=B3=A8=E9=87=8A=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/bbs/UserInfoLabel.java | 2 +- .../src/com/fr/design/DesignerEnvManager.java | 2 +- .../src/com/fr/design/menu/MenuManager.java | 12 ++++++------ .../chart/series/PlotSeries/MapCustomPane.java | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java b/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java index 2630c2702..4d58b3db6 100644 --- a/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java +++ b/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java @@ -265,7 +265,7 @@ public class UserInfoLabel extends UILabel { UIMenuItem closeOther = new UIMenuItem(Inter.getLocText("FR-Designer-BBSLogin_Switch-Account")); closeOther.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { -// BBSPluginLogin.getInstance().logOut(); + BBSPluginLogin.getInstance().logOut(); UserLoginContext.fireLoginContextListener(); } diff --git a/designer_base/src/com/fr/design/DesignerEnvManager.java b/designer_base/src/com/fr/design/DesignerEnvManager.java index a5d58ffc0..5658a318d 100644 --- a/designer_base/src/com/fr/design/DesignerEnvManager.java +++ b/designer_base/src/com/fr/design/DesignerEnvManager.java @@ -1802,7 +1802,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } writer.startTAG("Env"); -// writer.classAttr(env.getClass()); + writer.classAttr(env.getClass()); writer.attr("name", name); env.writeXML(writer); diff --git a/designer_base/src/com/fr/design/menu/MenuManager.java b/designer_base/src/com/fr/design/menu/MenuManager.java index 0f1401ace..18d6b0e02 100644 --- a/designer_base/src/com/fr/design/menu/MenuManager.java +++ b/designer_base/src/com/fr/design/menu/MenuManager.java @@ -138,12 +138,12 @@ public class MenuManager extends XMLFileManager { if (name.isEmpty()) { return; } -// try { -// MenuAction action = (MenuAction) reader.getAttrAsClass().newInstance(); -// menu.addShortCut(action); -// } catch (Exception exp) { -// FRLogger.getLogger().error(exp.getMessage(), exp); -// } + try { + MenuAction action = (MenuAction) reader.getAttrAsClass().newInstance(); + menu.addShortCut(action); + } catch (Exception exp) { + FRLogger.getLogger().error(exp.getMessage(), exp); + } } else if (reader.getTagName().equals("Menu")) { final MenuDef submenu = new MenuDef(); String tmpVal = StringUtils.EMPTY; diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java index 21a778f1a..d844631c0 100644 --- a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java @@ -19,7 +19,7 @@ import com.fr.general.GeneralUtils; import com.fr.general.Inter; import com.fr.general.data.DataModel; import com.fr.stable.StringUtils; -//import org.apache.batik.swing.svg.SVGFileFilter; +import org.apache.batik.swing.svg.SVGFileFilter; import javax.swing.*; import java.awt.*; @@ -107,7 +107,7 @@ refreshAreaNameBox(); public void actionPerformed(ActionEvent evt) { JFileChooser svgFileChooser = new JFileChooser(); -// svgFileChooser.addChoosableFileFilter(new SVGFileFilter()); + svgFileChooser.addChoosableFileFilter(new SVGFileFilter()); if (StringUtils.isNotBlank(lastSelectPath)) { svgFileChooser.setSelectedFile(new File(lastSelectPath)); } From d6d632aedc8bfe8eb321a7f3d5dcf58968b6dcab Mon Sep 17 00:00:00 2001 From: plough Date: Thu, 13 Jul 2017 14:48:23 +0800 Subject: [PATCH 05/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E4=BD=BF=E7=94=A8UI?= =?UTF-8?q?Button=E4=BD=9C=E4=B8=BA=E7=AB=96=E5=90=91tab=E7=9A=84=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../icontainer/UIEastResizableContainer.java | 12 ++++--- .../mainframe/EastRegionContainerPane.java | 33 +++++++++++++++---- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java b/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java index e1a1c2a16..ae7c92fd9 100644 --- a/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java +++ b/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java @@ -33,7 +33,7 @@ public class UIEastResizableContainer extends JPanel { private static final int ARROW_MARGIN = 15; private static final int ARROW_RANGE = 35; - private boolean isRightPaneVisible = true; +// private boolean isRightPaneVisible = true; public UIEastResizableContainer() { this(new JPanel(), new JPanel()); @@ -49,11 +49,15 @@ public class UIEastResizableContainer extends JPanel { this.preferredWidth = width; } - - public void setRightPaneVisible(boolean isVisible){ - this.isRightPaneVisible = isVisible; + public boolean isRightPaneVisible() { + return containerWidth > leftPaneWidth; } + +// public void setRightPaneVisible(boolean isVisible){ +// this.isRightPaneVisible = isVisible; +// } + private void setPreferredWidth(int width) { this.preferredWidth = width; } diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index 99cf14517..117a257b0 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -5,6 +5,7 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIEastResizableContainer; import com.fr.design.gui.icontainer.UIResizableContainer; +import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.Constants; @@ -90,6 +91,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { // 左侧按钮面板 private void initLeftPane() { leftPane = new JPanel(); + leftPane.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0)); for (PropertyItem item : propertyItemList) { leftPane.add(item.getButton()); } @@ -186,7 +188,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { class PropertyItem { // private UIButton button; - private JButton button; + private UIButton button; private String name; private JPanel propertyPanel; private JComponent contentPane; @@ -243,20 +245,33 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } private void initButton(String btnUrl) { - button = new JButton(BaseUtils.readIcon(btnUrl)); + button = new UIButton(BaseUtils.readIcon(btnUrl)) { + public Dimension getPreferredSize() { + return new Dimension(BUTTON_WIDTH, BUTTON_WIDTH); + } + }; // button = new UIButton("btnd\nssdg"); // button.set4LargeToolbarButton(); - button.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_WIDTH)); - button.setContentAreaFilled(false); +// button.setBorder(BorderFactory.createEmptyBorder(0, 40, 0, 0)); +// button.setMargin(null); +// button.setOpaque(false); + button.set4LargeToolbarButton(); +// button.setSize(new Dimension(BUTTON_WIDTH, BUTTON_WIDTH)); +// button.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_WIDTH)); +// button.setContentAreaFilled(false); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - propertyCard.show(rightPane, name); + if (isRightPaneVisible()) { + propertyCard.show(rightPane, name); + } else { + popOut(); + } } }); } - public JButton getButton() { + public UIButton getButton() { return button; } @@ -267,5 +282,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public JPanel getPropertyPanel() { return propertyPanel; } + + // 弹出对话框 + public void popOut() { + JDialog dialog = new JDialog(); + dialog.setVisible(true); + } } } \ No newline at end of file From 0569a1ff26f51ccd824c62de50456e8bd579a73e Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 14 Jul 2017 11:05:18 +0800 Subject: [PATCH 06/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E6=94=B6=E8=B5=B7=E7=8A=B6=E6=80=81=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E7=82=B9=E5=87=BB=E7=AB=96=E5=90=91tab=EF=BC=8C?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E5=B1=9E=E6=80=A7=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../icontainer/UIEastResizableContainer.java | 7 ++ .../mainframe/EastRegionContainerPane.java | 80 ++++++++++++++----- 2 files changed, 66 insertions(+), 21 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java b/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java index ae7c92fd9..3a24e3902 100644 --- a/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java +++ b/designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java @@ -228,6 +228,12 @@ public class UIEastResizableContainer extends JPanel { revalidate(); } + /** + * 伸缩右子面板时,触发此方法 + */ + public void onResize() { + } + private class TopToolPane extends JPanel { private int model = UIConstants.MODEL_NORMAL; @@ -268,6 +274,7 @@ public class UIEastResizableContainer extends JPanel { setPreferredWidth(containerWidth); containerWidth = leftPaneWidth; } + onResize(); refreshContainer(); if (BaseUtils.isAuthorityEditing()) { DesignerContext.getDesignerFrame().doResize(); diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index 117a257b0..5f7960665 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -6,6 +6,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIEastResizableContainer; import com.fr.design.gui.icontainer.UIResizableContainer; import com.fr.design.layout.VerticalFlowLayout; +import com.fr.design.style.AbstractPopBox; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.Constants; @@ -46,7 +47,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { initRightPane(); initLeftPane(); // super(leftPane, rightPane); - setContainerWidth(260); + setContainerWidth(CONTAINER_WIDTH); } private void initPropertyItemList() { @@ -101,6 +102,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer { replaceLeftPane(leftPane); } + @Override + public void onResize() { + for (PropertyItem item : propertyItemList) { + item.onResize(); + } + } + public EastRegionContainerPane(JPanel leftPane, JPanel rightPane) { super(leftPane, rightPane); // setVerticalDragEnabled(false); @@ -192,9 +200,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private String name; private JPanel propertyPanel; private JComponent contentPane; + private PropertyFixedPopupPane popupPane; // 左侧固定弹出框 private int x, y; // 弹出框的坐标 private int height; // 弹出框的高度 private boolean isPoppedOut; // 是否弹出 + private Dimension fixedSize; public PropertyItem(String name, String btnUrl) { this.name = name; @@ -210,10 +220,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private void initPropertyPanel() { propertyPanel = new JPanel(); propertyPanel.setBackground(Color.pink); -// propertyPanel.setPreferredSize(getPreferredSize()); -// JPanel titlePanel = new JPanel(); -// titlePanel.setPreferredSize(new Dimension(propertyPanel.getPreferredSize().width, 20)); -// titlePanel + contentPane = generateContentPane(); + propertyPanel.setLayout(new BorderLayout()); + propertyPanel.add(contentPane, BorderLayout.CENTER); + } + + public JComponent generateContentPane() { + JComponent contentPane = new JPanel(); JButton testBtn = new JButton(name); testBtn.addActionListener(new ActionListener() { @Override @@ -221,14 +234,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer { setEnabled(!button.isEnabled()); } }); - contentPane = new JPanel(); contentPane.add(testBtn); - propertyPanel.setLayout(new BorderLayout()); - propertyPanel.add(contentPane, BorderLayout.CENTER); + return contentPane; } public void replaceContentPane(JComponent pane) { -// remove(pane); propertyPanel.remove(this.contentPane); propertyPanel.add(this.contentPane = pane); refreshContainer(); @@ -238,6 +248,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer { return contentPane; } + public void onResize() { + if (isRightPaneVisible()) { + replaceContentPane(contentPane); + } else if(popupPane != null) { + popupPane.replaceContentPane(contentPane); + } + } + private void refreshContainer() { propertyPanel.validate(); propertyPanel.repaint(); @@ -250,22 +268,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer { return new Dimension(BUTTON_WIDTH, BUTTON_WIDTH); } }; -// button = new UIButton("btnd\nssdg"); -// button.set4LargeToolbarButton(); -// button.setBorder(BorderFactory.createEmptyBorder(0, 40, 0, 0)); -// button.setMargin(null); -// button.setOpaque(false); button.set4LargeToolbarButton(); -// button.setSize(new Dimension(BUTTON_WIDTH, BUTTON_WIDTH)); -// button.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_WIDTH)); -// button.setContentAreaFilled(false); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (isRightPaneVisible()) { propertyCard.show(rightPane, name); } else { - popOut(); + popupFixedPane(); } } }); @@ -284,9 +294,37 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } // 弹出对话框 - public void popOut() { - JDialog dialog = new JDialog(); - dialog.setVisible(true); + public void popupFixedPane() { + if (popupPane == null) { + popupPane = new PropertyFixedPopupPane(contentPane); + } + GUICoreUtils.showPopupMenu(popupPane, button, -popupPane.getPreferredSize().width, 0); + } + } + + private class PropertyFixedPopupPane extends JPopupMenu { + private JComponent contentPane; + PropertyFixedPopupPane(JComponent contentPane) { + this.contentPane = contentPane; + this.add(contentPane); + this.setPreferredSize(new Dimension(CONTAINER_WIDTH - BUTTON_WIDTH, getPreferredSize().height)); + } + + public JComponent getContentPane() { + return contentPane; + } + + public void replaceContentPane(JComponent pane) { +// remove(pane); + this.remove(this.contentPane); + this.add(this.contentPane = pane); + refreshContainer(); + } + + private void refreshContainer() { + validate(); + repaint(); + revalidate(); } } } \ No newline at end of file From 6ee7cee67153785f80ecb7001a44019c3e0413be Mon Sep 17 00:00:00 2001 From: plough Date: Sat, 15 Jul 2017 07:01:05 +0800 Subject: [PATCH 07/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E6=A1=86=E7=9A=84=E5=88=9D=E6=AD=A5=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=EF=BC=9B=E8=B0=83=E6=95=B4=E5=BC=B9=E5=85=A5=E3=80=81?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E5=B7=A5=E5=85=B7=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 177 ++++++++++++++++-- 1 file changed, 165 insertions(+), 12 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index 5f7960665..b73ff02ef 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -2,18 +2,22 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.design.DesignerEnvManager; +import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIEastResizableContainer; import com.fr.design.gui.icontainer.UIResizableContainer; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.style.AbstractPopBox; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.FRFont; import com.fr.stable.Constants; +import com.fr.stable.StringUtils; import javax.swing.*; +import javax.swing.border.EmptyBorder; import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; +import java.awt.event.*; import java.util.ArrayList; import java.util.List; @@ -24,7 +28,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private JPanel leftPane; private JPanel rightPane; private static final int CONTAINER_WIDTH = 260; - private static final int BUTTON_WIDTH = 40; + private static final int TAB_WIDTH = 40; + private static final int CONTENT_WIDTH = CONTAINER_WIDTH - TAB_WIDTH; + private static final int POPUP_TOOLPANE_HEIGHT = 25; + private static final int ARROW_RANGE_START = CONTENT_WIDTH - 30; /** * 得到实例 @@ -176,6 +183,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { * 刷新右面板 */ public void refreshRightPane() { + if (this.getRightPane() instanceof DockingView) { ((DockingView) this.getRightPane()).refreshDockingView(); } @@ -188,6 +196,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } } + private void refreshContainer() { + validate(); + repaint(); + revalidate(); + } + public int getToolPaneY() { return 0; } @@ -198,9 +212,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer { // private UIButton button; private UIButton button; private String name; - private JPanel propertyPanel; + private JComponent propertyPanel; private JComponent contentPane; private PropertyFixedPopupPane popupPane; // 左侧固定弹出框 + private PopupToolPane popupToolPane; // 弹出工具条 private int x, y; // 弹出框的坐标 private int height; // 弹出框的高度 private boolean isPoppedOut; // 是否弹出 @@ -221,7 +236,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyPanel = new JPanel(); propertyPanel.setBackground(Color.pink); contentPane = generateContentPane(); + popupToolPane = new PopupToolPane(contentPane, PopupToolPane.UP_BUTTON); propertyPanel.setLayout(new BorderLayout()); + propertyPanel.add(popupToolPane, BorderLayout.NORTH); propertyPanel.add(contentPane, BorderLayout.CENTER); } @@ -256,16 +273,16 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } } - private void refreshContainer() { - propertyPanel.validate(); - propertyPanel.repaint(); - propertyPanel.revalidate(); - } +// private void refreshContainer() { +// propertyPanel.validate(); +// propertyPanel.repaint(); +// propertyPanel.revalidate(); +// } private void initButton(String btnUrl) { button = new UIButton(BaseUtils.readIcon(btnUrl)) { public Dimension getPreferredSize() { - return new Dimension(BUTTON_WIDTH, BUTTON_WIDTH); + return new Dimension(TAB_WIDTH, TAB_WIDTH); } }; button.set4LargeToolbarButton(); @@ -289,7 +306,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { return name; } - public JPanel getPropertyPanel() { + public JComponent getPropertyPanel() { return propertyPanel; } @@ -307,7 +324,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { PropertyFixedPopupPane(JComponent contentPane) { this.contentPane = contentPane; this.add(contentPane); - this.setPreferredSize(new Dimension(CONTAINER_WIDTH - BUTTON_WIDTH, getPreferredSize().height)); + this.setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, getPreferredSize().height)); } public JComponent getContentPane() { @@ -327,4 +344,140 @@ public class EastRegionContainerPane extends UIEastResizableContainer { revalidate(); } } + + // 弹出属性面板的工具条 + private class PopupToolPane extends JPanel { + private int model = UIConstants.MODEL_NORMAL; + private String title = "单元格元素"; + private JComponent contentPane; + private String buttonType; + private static final String NO_BUTTON = "NoButton"; + private static final String UP_BUTTON = "UpButton"; + private static final String DOWN_BUTTON = "DownButton"; + + public PopupToolPane(JComponent contentPane) { + this(contentPane, NO_BUTTON); + } + + public PopupToolPane(JComponent contentPane, String buttonType) { + super(); + this.contentPane = contentPane; + setLayout(new BorderLayout()); + UILabel label = new UILabel(title); + label.setForeground(new Color(69, 135, 255)); + add(label, BorderLayout.WEST); + setBorder(new EmptyBorder(5, 10, 0, 0)); + + initToolButton(buttonType); + } + + private void initToolButton(String buttonType) { + this.buttonType = buttonType; + if (buttonType.equals(NO_BUTTON)) { + return; + } + + if (buttonType.equals(UP_BUTTON)) { + + } else if (buttonType.equals(DOWN_BUTTON)) { + + } else { + throw new IllegalArgumentException("unknown button type: " + buttonType); + } + + addMouseMotionListener(new MouseMotionListener() { + @Override + public void mouseMoved(MouseEvent e) { + if (e.getX() >= ARROW_RANGE_START) { + setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + model = UIConstants.MODEL_PRESS; + } else { + setCursor(Cursor.getDefaultCursor()); + model = UIConstants.MODEL_NORMAL; + } + repaint(); + } + + @Override + public void mouseDragged(MouseEvent e) { + } + }); + addMouseListener(new MouseAdapter() { + @Override + public void mouseExited(MouseEvent e) { + setCursor(Cursor.getDefaultCursor()); + model = UIConstants.MODEL_NORMAL; + repaint(); + } + + @Override + public void mouseClicked(MouseEvent e) { + if (e.getX() >= ARROW_RANGE_START) { + popupDialog(); + } + } + }); + } + + public void popupDialog() { + new PopupDialog(contentPane); + } + + @Override + public Dimension getPreferredSize() { + return new Dimension(super.getPreferredSize().width, POPUP_TOOLPANE_HEIGHT); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + Image button; + g.setColor(new Color(69, 135, 255)); + g.setFont(FRFont.getInstance().applySize(14)); +// g.drawString(title, 5, 20); +// g.drawImage(UIConstants.DRAG_BAR, 0, 0, CONTENT_WIDTH, POPUP_TOOLPANE_HEIGHT, null); + + if (buttonType.equals(NO_BUTTON)) { + return; + } + if (buttonType.equals(UP_BUTTON)) { + if (model == UIConstants.MODEL_NORMAL) { + button = UIConstants.DRAG_LEFT_NORMAL; + } else { + button = UIConstants.DRAG_LEFT_PRESS; + } + } else { + if (model == UIConstants.MODEL_NORMAL) { + button = UIConstants.DRAG_RIGHT_NORMAL; + } else { + button = UIConstants.DRAG_RIGHT_PRESS; + } + } +// g.drawImage(button, 2, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null); + g.drawImage(button, ARROW_RANGE_START + 12, 7, 5, 5, null); + } + } + + private class PopupDialog extends JDialog { + public PopupDialog(JComponent contentPane) { +// setUndecorated(true); +// JPanel pane = new JPanel(); +// pane.setBackground(Color.yellow); +// pane.setPreferredSize(new Dimension(100, 100)); +// +// getContentPane().add(pane); +// setSize(CONTENT_WIDTH, pane.getPreferredSize().height); + getContentPane().add(contentPane); + setSize(CONTENT_WIDTH, contentPane.getPreferredSize().height); + validate(); + + this.setVisible(true); + } + + private void refreshContainer() { + validate(); + repaint(); + revalidate(); + } + } } \ No newline at end of file From 0a9708d434538dfd28bf0c27ac7bbb4592c5b813 Mon Sep 17 00:00:00 2001 From: plough Date: Sat, 15 Jul 2017 11:35:53 +0800 Subject: [PATCH 08/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E6=A1=86=E5=8F=AF=E6=8B=96=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 93 ++++++++++++++----- 1 file changed, 72 insertions(+), 21 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index b73ff02ef..76f552dc0 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -51,8 +51,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { super(); // setVerticalDragEnabled(false); initPropertyItemList(); - initRightPane(); - initLeftPane(); + initContentPane(); // super(leftPane, rightPane); setContainerWidth(CONTAINER_WIDTH); } @@ -83,6 +82,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyItemList.add(widgetLib); } + private void initContentPane() { + initRightPane(); + initLeftPane(); + } + // 右侧属性面板 private void initRightPane() { rightPane = new JPanel(); @@ -109,6 +113,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer { replaceLeftPane(leftPane); } + // 弹出面板时,更新框架内容 + private void removeItem(PropertyItem propertyItem) { + leftPane.remove(propertyItem.getButton()); + rightPane.remove(propertyItem.getPropertyPanel()); + refreshContainer(); + } + @Override public void onResize() { for (PropertyItem item : propertyItemList) { @@ -236,12 +247,16 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyPanel = new JPanel(); propertyPanel.setBackground(Color.pink); contentPane = generateContentPane(); - popupToolPane = new PopupToolPane(contentPane, PopupToolPane.UP_BUTTON); + popupToolPane = new PopupToolPane(this, PopupToolPane.UP_BUTTON); propertyPanel.setLayout(new BorderLayout()); propertyPanel.add(popupToolPane, BorderLayout.NORTH); propertyPanel.add(contentPane, BorderLayout.CENTER); } + public void setIsPoppedOut(boolean isPoppedOut) { + this.isPoppedOut = isPoppedOut; + } + public JComponent generateContentPane() { JComponent contentPane = new JPanel(); JButton testBtn = new JButton(name); @@ -350,18 +365,24 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private int model = UIConstants.MODEL_NORMAL; private String title = "单元格元素"; private JComponent contentPane; + private PropertyItem propertyItem; private String buttonType; + private JDialog parentDialog; // 如果不在对话框中,值为null + private boolean isMovable = false; + private Point mouseDownCompCoords; // 存储按下左键的位置,移动对话框时会用到 + private static final String NO_BUTTON = "NoButton"; private static final String UP_BUTTON = "UpButton"; private static final String DOWN_BUTTON = "DownButton"; - public PopupToolPane(JComponent contentPane) { - this(contentPane, NO_BUTTON); + public PopupToolPane(PropertyItem propertyItem) { + this(propertyItem, NO_BUTTON); } - public PopupToolPane(JComponent contentPane, String buttonType) { + public PopupToolPane(PropertyItem propertyItem, String buttonType) { super(); - this.contentPane = contentPane; + this.propertyItem = propertyItem; + this.contentPane = propertyItem.getContentPane(); setLayout(new BorderLayout()); UILabel label = new UILabel(title); label.setForeground(new Color(69, 135, 255)); @@ -371,7 +392,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer { initToolButton(buttonType); } - private void initToolButton(String buttonType) { + public void setParentDialog(JDialog parentDialog) { + this.parentDialog = parentDialog; + isMovable = true; + } + + private void initToolButton(final String buttonType) { this.buttonType = buttonType; if (buttonType.equals(NO_BUTTON)) { return; @@ -400,6 +426,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer { @Override public void mouseDragged(MouseEvent e) { + if (isMovable && e.getX() < ARROW_RANGE_START) { + Point currCoords = e.getLocationOnScreen(); + parentDialog.setLocation(currCoords.x - mouseDownCompCoords.x, currCoords.y - mouseDownCompCoords.y); + } } }); addMouseListener(new MouseAdapter() { @@ -413,14 +443,35 @@ public class EastRegionContainerPane extends UIEastResizableContainer { @Override public void mouseClicked(MouseEvent e) { if (e.getX() >= ARROW_RANGE_START) { - popupDialog(); + onPop(); } } + + @Override + public void mouseReleased(MouseEvent e) { + mouseDownCompCoords = null; + } + @Override + public void mousePressed(MouseEvent e) { + mouseDownCompCoords = e.getPoint(); + } + }); } - public void popupDialog() { - new PopupDialog(contentPane); + // 触发弹入、弹出 + private void onPop() { + if (buttonType.equals(UP_BUTTON)) { + popUpDialog(); + } + } + + public void popUpDialog() { + propertyItem.setIsPoppedOut(true); + new PopupDialog(propertyItem); +// initContentPane(); +// refreshContainer(); + removeItem(propertyItem); } @Override @@ -459,25 +510,25 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } private class PopupDialog extends JDialog { - public PopupDialog(JComponent contentPane) { -// setUndecorated(true); + private Container container; + public PopupDialog(PropertyItem propertyItem) { + container = getContentPane(); + setUndecorated(true); // JPanel pane = new JPanel(); // pane.setBackground(Color.yellow); // pane.setPreferredSize(new Dimension(100, 100)); // // getContentPane().add(pane); // setSize(CONTENT_WIDTH, pane.getPreferredSize().height); - getContentPane().add(contentPane); - setSize(CONTENT_WIDTH, contentPane.getPreferredSize().height); + PopupToolPane popupToolPane = new PopupToolPane(propertyItem, PopupToolPane.DOWN_BUTTON); + popupToolPane.setParentDialog(this); + JComponent contentPane = propertyItem.getContentPane(); + container.add(popupToolPane, BorderLayout.NORTH); + container.add(contentPane, BorderLayout.CENTER); + setSize(CONTENT_WIDTH, container.getPreferredSize().height); validate(); this.setVisible(true); } - - private void refreshContainer() { - validate(); - repaint(); - revalidate(); - } } } \ No newline at end of file From dadb31b82e43544deb44f8986a14c6e2535482a2 Mon Sep 17 00:00:00 2001 From: plough Date: Sat, 15 Jul 2017 23:22:39 +0800 Subject: [PATCH 09/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E5=8F=AF=E5=BC=B9?= =?UTF-8?q?=E5=87=BA=E3=80=81=E5=BC=B9=E5=85=A5=E5=AF=B9=E8=AF=9D=E6=A1=86?= =?UTF-8?q?=EF=BC=9B=E9=99=90=E5=88=B6=E5=AF=B9=E8=AF=9D=E6=A1=86=E5=8F=AF?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E5=8C=BA=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 61 +++++++++++++++---- 1 file changed, 48 insertions(+), 13 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index 76f552dc0..baef0d069 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -5,14 +5,10 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIEastResizableContainer; -import com.fr.design.gui.icontainer.UIResizableContainer; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.VerticalFlowLayout; -import com.fr.design.style.AbstractPopBox; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; -import com.fr.stable.Constants; -import com.fr.stable.StringUtils; import javax.swing.*; import javax.swing.border.EmptyBorder; @@ -225,11 +221,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private String name; private JComponent propertyPanel; private JComponent contentPane; - private PropertyFixedPopupPane popupPane; // 左侧固定弹出框 + private FixedPopupPane popupPane; // 左侧固定弹出框 private PopupToolPane popupToolPane; // 弹出工具条 private int x, y; // 弹出框的坐标 private int height; // 弹出框的高度 - private boolean isPoppedOut; // 是否弹出 + private boolean isPoppedOut = false; // 是否弹出 private Dimension fixedSize; public PropertyItem(String name, String btnUrl) { @@ -328,15 +324,15 @@ public class EastRegionContainerPane extends UIEastResizableContainer { // 弹出对话框 public void popupFixedPane() { if (popupPane == null) { - popupPane = new PropertyFixedPopupPane(contentPane); + popupPane = new FixedPopupPane(contentPane); } GUICoreUtils.showPopupMenu(popupPane, button, -popupPane.getPreferredSize().width, 0); } } - private class PropertyFixedPopupPane extends JPopupMenu { + private class FixedPopupPane extends JPopupMenu { private JComponent contentPane; - PropertyFixedPopupPane(JComponent contentPane) { + FixedPopupPane(JComponent contentPane) { this.contentPane = contentPane; this.add(contentPane); this.setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, getPreferredSize().height)); @@ -371,6 +367,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private boolean isMovable = false; private Point mouseDownCompCoords; // 存储按下左键的位置,移动对话框时会用到 + private static final int MIN_X = -150; + private static final int MIN_Y_SHIFT = 50; + private static final int MAX_X_SHIFT = 50; + private static final int MAX_Y_SHIFT = 50; + + private static final String NO_BUTTON = "NoButton"; private static final String UP_BUTTON = "UpButton"; private static final String DOWN_BUTTON = "DownButton"; @@ -426,9 +428,28 @@ public class EastRegionContainerPane extends UIEastResizableContainer { @Override public void mouseDragged(MouseEvent e) { - if (isMovable && e.getX() < ARROW_RANGE_START) { + if (isMovable && mouseDownCompCoords != null) { Point currCoords = e.getLocationOnScreen(); - parentDialog.setLocation(currCoords.x - mouseDownCompCoords.x, currCoords.y - mouseDownCompCoords.y); + int x = currCoords.x - mouseDownCompCoords.x; + int y = currCoords.y - mouseDownCompCoords.y; + //屏幕可用区域 + Rectangle screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); + + int minY = screen.y; + int maxX = Toolkit.getDefaultToolkit().getScreenSize().width - MAX_X_SHIFT; + int maxY = Toolkit.getDefaultToolkit().getScreenSize().height - MAX_Y_SHIFT; + if (x < MIN_X) { + x = MIN_X; + } else if (x > maxX) { + x = maxX; + } + if (y < minY) { + y = minY; + } else if (y > maxY) { + y = maxY; + } + // 移动到屏幕边缘时,需要校正位置 + parentDialog.setLocation(x, y); } } }); @@ -453,7 +474,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } @Override public void mousePressed(MouseEvent e) { - mouseDownCompCoords = e.getPoint(); + if (e.getX() < ARROW_RANGE_START) { + mouseDownCompCoords = e.getPoint(); + } } }); @@ -463,6 +486,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private void onPop() { if (buttonType.equals(UP_BUTTON)) { popUpDialog(); + } else if (buttonType.equals(DOWN_BUTTON)) { + popToFrame(); } } @@ -474,6 +499,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer { removeItem(propertyItem); } + public void popToFrame() { + propertyItem.setIsPoppedOut(false); + parentDialog.dispose(); + initContentPane(); + onResize(); + refreshContainer(); + } + @Override public Dimension getPreferredSize() { return new Dimension(super.getPreferredSize().width, POPUP_TOOLPANE_HEIGHT); @@ -526,8 +559,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer { container.add(popupToolPane, BorderLayout.NORTH); container.add(contentPane, BorderLayout.CENTER); setSize(CONTENT_WIDTH, container.getPreferredSize().height); - validate(); + validate(); + Point btnCoords = propertyItem.getButton().getLocationOnScreen(); + this.setLocation(btnCoords.x - CONTENT_WIDTH, btnCoords.y); this.setVisible(true); } } From 73a01b1730612509dafb3ee0b16bde398f3b15ca Mon Sep 17 00:00:00 2001 From: MoMeak Date: Mon, 17 Jul 2017 09:09:14 +0800 Subject: [PATCH 10/32] =?UTF-8?q?=E7=BC=A9=E6=94=BE=E6=9D=A1panel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/JSliderPane.java | 256 ++++++++++++++++++ .../series/PlotSeries/MapCustomPane.java | 4 +- 2 files changed, 258 insertions(+), 2 deletions(-) create mode 100644 designer_base/src/com/fr/design/mainframe/JSliderPane.java diff --git a/designer_base/src/com/fr/design/mainframe/JSliderPane.java b/designer_base/src/com/fr/design/mainframe/JSliderPane.java new file mode 100644 index 000000000..40808db99 --- /dev/null +++ b/designer_base/src/com/fr/design/mainframe/JSliderPane.java @@ -0,0 +1,256 @@ +package com.fr.design.mainframe; + +import com.fr.base.BaseUtils; +import com.fr.design.file.MutilTempalteTabPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.islider.UISlider; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.utils.gui.GUICoreUtils; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import javax.swing.plaf.basic.BasicSliderUI; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * Created by MoMeak on 2017/7/13. + */ +public class JSliderPane extends JPanel { + + private final int KERNING = 2; + private static JSliderPane THIS; + private UITextField showVal; + private UISlider slider; + private int times; + private int sliderValue; + private UIButton downButton; + private UIButton upButton; + private int showValue; + //拖动条处理和button、直接输入不一样 + private boolean isButtonOrIsTxt = true; + + + public JSliderPane() { + this.setLayout(new BorderLayout()); + slider = new UISlider(0,100,50); + slider.setUI(new JSliderPaneUI(slider)); + slider.addChangeListener(listener); + + showVal = new UITextField(); + showVal.setText("100%"); + + showVal.getDocument().addDocumentListener(showValDocumentListener); + + downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveDown.png")); + upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveUp.png")); + downButton.setActionCommand("less"); + upButton.setActionCommand("more"); + downButton.addActionListener(buttonActionListener); + upButton.addActionListener(buttonActionListener); + +// double f = TableLayout.FILL; +// double p = TableLayout.PREFERRED; +// Component[][] components = new Component[][]{ +// new Component[]{downButton, slider, upButton, showVal}, +// }; +// double[] rowSize = {p}; +// double[] columnSize = {p,p,p,p}; +// JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + + JPanel panel = new JPanel(new FlowLayout(1,1,0)); + + panel.add(downButton); + panel.add(slider); + panel.add(upButton); + panel.add(showVal); + +// JPanel panel = new JPanel(null); +// panel.add(downButton); +// panel.add(slider); +// panel.add(upButton); +// panel.add(showVal); +// downButton.setBounds(0,0,16,16); +// slider.setBounds(16+KERNING,0,160,16); +// upButton.setBounds(176+KERNING*2,0,16,16); +// showVal.setBounds(192+KERNING*3,0,40,16); + this.add(panel,BorderLayout.NORTH); + this.setBounds(0,0,260,16); + } + + public static final JSliderPane getInstance() { + if (THIS == null) { + THIS = new JSliderPane(); + } + return THIS; + } + + + + //定义一个监听器,用于监听所有滑动条 + ChangeListener listener = new ChangeListener() + { + public void stateChanged( ChangeEvent event) { + //取出滑动条的值,并在文本中显示出来 + if (!isButtonOrIsTxt){ + JSlider source = (JSlider) event.getSource(); + EventQueue.invokeLater(new Runnable() { + public void run() { + sliderValue = slider.getValue(); + getTimes(sliderValue); + showVal.setText(times + "%"); + } + }); + }else { + isButtonOrIsTxt = false; + } + } + }; + + DocumentListener showValDocumentListener = new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + isButtonOrIsTxt = true; + refreshSlider(); + } + + @Override + public void removeUpdate(DocumentEvent e) { +// refreshSlider(); + } + + @Override + public void changedUpdate(DocumentEvent e) { +// refreshSlider(); + } + }; + + private void refreshSlider(){ + showValue = Integer.parseInt(showVal.getText().substring(0, showVal.getText().indexOf("%"))); + if (showValue >100){ + slider.setValue((int)(showValue+200)/6); + }else if (showValue <100){ + slider.setValue((int)((showValue-10)/1.8)); + }else if (showValue == 100){ + slider.setValue(50); + } + } + + ActionListener buttonActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + showValue = Integer.parseInt(showVal.getText().substring(0, showVal.getText().indexOf("%"))); + isButtonOrIsTxt = true; + if(e.getActionCommand().equals("less")){ + int newDownVal = showValue - 10; + if (newDownVal >= 10 ){ + showVal.setText(newDownVal + "%"); + }else { + showVal.setText(10 + "%"); + } + } + if(e.getActionCommand().equals("more")){ + int newUpVal = showValue + 10; + if (newUpVal <= 400 ){ + showVal.setText(newUpVal + "%"); + }else { + showVal.setText(400 + "%"); + } + } + isButtonOrIsTxt = true; + } + }; + + private void getTimes(int value){ + if (value == 50){ + times=100; + }else if (value < 50){ + times = (int) Math.round(1.8*value + 10); + }else { + times = (int) (6*value - 200); + } + } + + + public static void main(String[] args) + { + JFrame jf = new JFrame("test"); + jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + JPanel content = (JPanel)jf.getContentPane(); + content.setLayout(new BorderLayout()); + content.add(JSliderPane.getInstance(),BorderLayout.CENTER); + GUICoreUtils.centerWindow(jf); + jf.setSize(320, 80); + jf.setVisible(true); + + } +} + +class JSliderPaneUI extends BasicSliderUI { + + public JSliderPaneUI(UISlider b) { + super(b); + } + + /** */ + /** + * 绘制指示物 + */ + + public Dimension getThumbSize() { + Dimension size = new Dimension(); + + if ( slider.getOrientation() == JSlider.VERTICAL ) { + size.width = 11; + size.height = 16; + } + else { + size.width = 11; + size.height = 16; + } + + return size; + } + + public void paintThumb(Graphics g) { + Rectangle knobBounds = thumbRect; + int w = knobBounds.width; + int h = knobBounds.height; + + g.translate(knobBounds.x, knobBounds.y); + if ( slider.isEnabled() ) { + g.setColor(slider.getBackground()); + } + else { + g.setColor(slider.getBackground().darker()); + } + g.setColor(Color.darkGray); + g.fillRect(0, 1, w-6, h+1); + } + + /** */ + /** + * 绘制刻度轨迹 + */ + public void paintTrack(Graphics g) { + int cy, cw; + Rectangle trackBounds = trackRect; + if (slider.getOrientation() == UISlider.HORIZONTAL) { + Graphics2D g2 = (Graphics2D) g; + cy = (trackBounds.height / 2); + cw = trackBounds.width; + g.setColor(Color.lightGray); + g.drawLine(0, cy, cw+5, cy); + g.drawLine(5+cw/2, cy-4, 5+cw/2, cy+4); + } else { + super.paintTrack(g); + } + } + +} diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java index d844631c0..21a778f1a 100644 --- a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java @@ -19,7 +19,7 @@ import com.fr.general.GeneralUtils; import com.fr.general.Inter; import com.fr.general.data.DataModel; import com.fr.stable.StringUtils; -import org.apache.batik.swing.svg.SVGFileFilter; +//import org.apache.batik.swing.svg.SVGFileFilter; import javax.swing.*; import java.awt.*; @@ -107,7 +107,7 @@ refreshAreaNameBox(); public void actionPerformed(ActionEvent evt) { JFileChooser svgFileChooser = new JFileChooser(); - svgFileChooser.addChoosableFileFilter(new SVGFileFilter()); +// svgFileChooser.addChoosableFileFilter(new SVGFileFilter()); if (StringUtils.isNotBlank(lastSelectPath)) { svgFileChooser.setSelectedFile(new File(lastSelectPath)); } From 37459e61bc4d6e717a22ce7509cb2be72ea8c319 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Mon, 17 Jul 2017 09:15:17 +0800 Subject: [PATCH 11/32] =?UTF-8?q?rollback=E7=BC=96=E8=AF=91=E4=B8=8D?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E7=9A=84=E6=B3=A8=E9=87=8A=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/chart/series/PlotSeries/MapCustomPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java index 21a778f1a..d844631c0 100644 --- a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java @@ -19,7 +19,7 @@ import com.fr.general.GeneralUtils; import com.fr.general.Inter; import com.fr.general.data.DataModel; import com.fr.stable.StringUtils; -//import org.apache.batik.swing.svg.SVGFileFilter; +import org.apache.batik.swing.svg.SVGFileFilter; import javax.swing.*; import java.awt.*; @@ -107,7 +107,7 @@ refreshAreaNameBox(); public void actionPerformed(ActionEvent evt) { JFileChooser svgFileChooser = new JFileChooser(); -// svgFileChooser.addChoosableFileFilter(new SVGFileFilter()); + svgFileChooser.addChoosableFileFilter(new SVGFileFilter()); if (StringUtils.isNotBlank(lastSelectPath)) { svgFileChooser.setSelectedFile(new File(lastSelectPath)); } From 4eda8b556646482f41b9ecf11138ee0a2021c7d5 Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 17 Jul 2017 09:59:41 +0800 Subject: [PATCH 12/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E5=BC=B9=E7=AA=97=E7=9A=84=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/EastRegionContainerPane.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index baef0d069..97d6cc28b 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -9,6 +9,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; +import ij.gui.Toolbar; import javax.swing.*; import javax.swing.border.EmptyBorder; @@ -324,7 +325,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { // 弹出对话框 public void popupFixedPane() { if (popupPane == null) { - popupPane = new FixedPopupPane(contentPane); + popupPane = new FixedPopupPane(this); } GUICoreUtils.showPopupMenu(popupPane, button, -popupPane.getPreferredSize().width, 0); } @@ -332,9 +333,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private class FixedPopupPane extends JPopupMenu { private JComponent contentPane; - FixedPopupPane(JComponent contentPane) { - this.contentPane = contentPane; + FixedPopupPane(PropertyItem propertyItem) { + contentPane = propertyItem.getContentPane(); + this.add(new PopupToolPane(propertyItem)); this.add(contentPane); + this.setOpaque(false); this.setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, getPreferredSize().height)); } From e5c2b0afd8ddef21ff76de08ad87c4fbd96e048b Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 17 Jul 2017 13:54:45 +0800 Subject: [PATCH 13/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E6=A1=86=E5=8F=AF=E8=B0=83=E6=95=B4=E9=AB=98?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 64 ++++++++++++++++--- 1 file changed, 56 insertions(+), 8 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index 97d6cc28b..1db206f5d 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -547,26 +547,74 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private class PopupDialog extends JDialog { private Container container; + private static final int RESIZE_RANGE = 4; + private Cursor originCursor; + private Cursor southResizeCursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR); + private Point mouseDownCompCoords; + private int minHeight; // 对话框最小高度 public PopupDialog(PropertyItem propertyItem) { container = getContentPane(); setUndecorated(true); -// JPanel pane = new JPanel(); -// pane.setBackground(Color.yellow); -// pane.setPreferredSize(new Dimension(100, 100)); -// -// getContentPane().add(pane); -// setSize(CONTENT_WIDTH, pane.getPreferredSize().height); PopupToolPane popupToolPane = new PopupToolPane(propertyItem, PopupToolPane.DOWN_BUTTON); popupToolPane.setParentDialog(this); JComponent contentPane = propertyItem.getContentPane(); container.add(popupToolPane, BorderLayout.NORTH); container.add(contentPane, BorderLayout.CENTER); - setSize(CONTENT_WIDTH, container.getPreferredSize().height); - + minHeight = container.getPreferredSize().height; + setSize(CONTENT_WIDTH, minHeight); validate(); Point btnCoords = propertyItem.getButton().getLocationOnScreen(); this.setLocation(btnCoords.x - CONTENT_WIDTH, btnCoords.y); + + initListener(); this.setVisible(true); } + private void initListener() { + addMouseMotionListener(new MouseMotionListener() { + @Override + public void mouseDragged(MouseEvent e) { + if (mouseDownCompCoords != null) { + Rectangle bounds = getBounds(); + Point currCoords = e.getLocationOnScreen(); + bounds.height = currCoords.y - mouseDownCompCoords.y + bounds.height; + // 校正位置 + if (bounds.height < minHeight) { + bounds.height = minHeight; + } + mouseDownCompCoords.y = currCoords.y; + setBounds(bounds); + } + } + + @Override + public void mouseMoved(MouseEvent e) { + if (originCursor == null) { // 记录最初的光标 + originCursor = getCursor(); + } + if (e.getY() > getHeight() - RESIZE_RANGE) { + setCursor(southResizeCursor); + } else { + // 还原 + if (mouseDownCompCoords == null && getCursor().equals(southResizeCursor)) { + setCursor(originCursor); + } + } + + repaint(); + } + }); + addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + if (getCursor().equals(southResizeCursor)) { + mouseDownCompCoords = e.getLocationOnScreen(); + } + } + @Override + public void mouseReleased(MouseEvent e) { + mouseDownCompCoords = null; + } + }); + } } } \ No newline at end of file From c5e83b3b132246af4094ba465eb257c6fe20d9c5 Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 17 Jul 2017 16:31:47 +0800 Subject: [PATCH 14/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=BC=B9=E7=AA=97bug=EF=BC=9A1=E3=80=81=E5=A4=B1=E7=84=A6?= =?UTF-8?q?=E5=90=8E=E8=A2=AB=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=A6=86=E7=9B=96?= =?UTF-8?q?=EF=BC=9B2=E3=80=81=E5=BC=B9=E5=87=BA=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E4=B8=8D=E5=90=8C=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=EF=BC=8C=E9=9D=A2=E6=9D=BF=E6=B2=A1=E6=9C=89=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=EF=BC=9B3=E3=80=81=E5=BC=B9=E5=87=BA=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E4=B8=8D=E5=90=8C=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=EF=BC=8C=E5=BC=B9=E5=9B=9E=EF=BC=8C=E9=9D=A2=E6=9D=BF=E6=B6=88?= =?UTF-8?q?=E5=A4=B1=EF=BC=9B4=E3=80=81=E5=88=87=E6=8D=A2=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E6=97=B6=EF=BC=8C=E5=86=85=E5=AE=B9=E4=B8=8D=E5=BA=94?= =?UTF-8?q?=E8=A2=AB=E9=81=AE=E6=8C=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 102 +++++++++++++----- 1 file changed, 76 insertions(+), 26 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index 1db206f5d..27a012783 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -9,7 +9,6 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; -import ij.gui.Toolbar; import javax.swing.*; import javax.swing.border.EmptyBorder; @@ -156,6 +155,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public static void main(String[] args){ JFrame jf = new JFrame("test"); +// jf = new JFrame("test"); + jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel cc = new JPanel(); @@ -224,6 +225,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private JComponent contentPane; private FixedPopupPane popupPane; // 左侧固定弹出框 private PopupToolPane popupToolPane; // 弹出工具条 + private PopupDialog popupDialog; // 弹出框 private int x, y; // 弹出框的坐标 private int height; // 弹出框的高度 private boolean isPoppedOut = false; // 是否弹出 @@ -270,6 +272,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void replaceContentPane(JComponent pane) { propertyPanel.remove(this.contentPane); propertyPanel.add(this.contentPane = pane); + if (popupDialog != null && isPoppedOut) { + popupDialog.replaceContentPane(contentPane); + } + if (popupPane != null && !isRightPaneVisible()) { + popupPane.replaceContentPane(contentPane); + } + refreshContainer(); } @@ -322,23 +331,62 @@ public class EastRegionContainerPane extends UIEastResizableContainer { return propertyPanel; } - // 弹出对话框 + // 固定弹窗 public void popupFixedPane() { if (popupPane == null) { popupPane = new FixedPopupPane(this); } GUICoreUtils.showPopupMenu(popupPane, button, -popupPane.getPreferredSize().width, 0); } + + // 弹出对话框 + public void popupDialog() { +// setIsPoppedOut(true); + if (isPoppedOut) { + return; + } + isPoppedOut = true; + if (popupDialog == null) { + popupDialog = new PopupDialog(this); + } else { + popupDialog.replaceContentPane(contentPane); + popupDialog.setVisible(true); + } +// initContentPane(); +// refreshContainer(); + removeItem(this); + } + + public void popToFrame() { + if (isPoppedOut) { + isPoppedOut = false; +// popupDialog.dispose(); + popupDialog.setVisible(false); + initContentPane(); + onResize(); + refreshContainer(); + } + } } private class FixedPopupPane extends JPopupMenu { private JComponent contentPane; +// private PopupToolPane popupToolPane; + private int fixedHeight; FixedPopupPane(PropertyItem propertyItem) { contentPane = propertyItem.getContentPane(); - this.add(new PopupToolPane(propertyItem)); - this.add(contentPane); + this.setLayout(new BorderLayout()); +// popupToolPane = ; + this.add(new PopupToolPane(propertyItem), BorderLayout.NORTH); + this.add(contentPane, BorderLayout.CENTER); this.setOpaque(false); - this.setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, getPreferredSize().height)); + fixedHeight = getPreferredSize().height - contentPane.getPreferredSize().height; + updateSize(); + } + + private void updateSize() { + int newHeight = fixedHeight + contentPane.getPreferredSize().height; + this.setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, newHeight)); } public JComponent getContentPane() { @@ -349,6 +397,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { // remove(pane); this.remove(this.contentPane); this.add(this.contentPane = pane); + updateSize(); refreshContainer(); } @@ -371,7 +420,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private Point mouseDownCompCoords; // 存储按下左键的位置,移动对话框时会用到 private static final int MIN_X = -150; - private static final int MIN_Y_SHIFT = 50; private static final int MAX_X_SHIFT = 50; private static final int MAX_Y_SHIFT = 50; @@ -488,28 +536,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer { // 触发弹入、弹出 private void onPop() { if (buttonType.equals(UP_BUTTON)) { - popUpDialog(); + propertyItem.popupDialog(); } else if (buttonType.equals(DOWN_BUTTON)) { - popToFrame(); + propertyItem.popToFrame(); } } - public void popUpDialog() { - propertyItem.setIsPoppedOut(true); - new PopupDialog(propertyItem); -// initContentPane(); -// refreshContainer(); - removeItem(propertyItem); - } - - public void popToFrame() { - propertyItem.setIsPoppedOut(false); - parentDialog.dispose(); - initContentPane(); - onResize(); - refreshContainer(); - } - @Override public Dimension getPreferredSize() { return new Dimension(super.getPreferredSize().width, POPUP_TOOLPANE_HEIGHT); @@ -552,23 +584,41 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private Cursor southResizeCursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR); private Point mouseDownCompCoords; private int minHeight; // 对话框最小高度 + private JComponent contentPane; public PopupDialog(PropertyItem propertyItem) { + super(DesignerContext.getDesignerFrame()); container = getContentPane(); setUndecorated(true); PopupToolPane popupToolPane = new PopupToolPane(propertyItem, PopupToolPane.DOWN_BUTTON); popupToolPane.setParentDialog(this); - JComponent contentPane = propertyItem.getContentPane(); + contentPane = propertyItem.getContentPane(); container.add(popupToolPane, BorderLayout.NORTH); container.add(contentPane, BorderLayout.CENTER); minHeight = container.getPreferredSize().height; setSize(CONTENT_WIDTH, minHeight); - validate(); +// validate(); Point btnCoords = propertyItem.getButton().getLocationOnScreen(); this.setLocation(btnCoords.x - CONTENT_WIDTH, btnCoords.y); initListener(); this.setVisible(true); } + public void replaceContentPane(JComponent contentPane) { + container.remove(this.contentPane); + container.add(this.contentPane = contentPane); +// pack(); + if (getSize().height < container.getPreferredSize().height) { + setSize(CONTENT_WIDTH, container.getPreferredSize().height); + } + refreshContainer(); + } + + private void refreshContainer() { + validate(); + repaint(); + revalidate(); + } + private void initListener() { addMouseMotionListener(new MouseMotionListener() { @Override From 1d44dc94db43896a37c21727e5a88c66e3c631e5 Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 17 Jul 2017 17:15:02 +0800 Subject: [PATCH 15/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/locale/designer.properties | 5 +++- .../design/locale/designer_en_US.properties | 5 +++- .../design/locale/designer_ja_JP.properties | 6 +++- .../design/locale/designer_ko_KR.properties | 7 +++-- .../design/locale/designer_zh_CN.properties | 4 +++ .../design/locale/designer_zh_TW.properties | 4 +++ .../mainframe/EastRegionContainerPane.java | 28 ++++++++++++------- 7 files changed, 44 insertions(+), 15 deletions(-) diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 3c6d79d4d..9365dec33 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -2001,8 +2001,11 @@ FR-Designer_AlphaFine_Latest=Latest FR-Designer_AlphaFine_ShowLess=show less FR-Designer_Alphafine=AlphaFine FR-Designer-Alphafine_No_Remind= -<<<<<<< HEAD FR-Designer_AlphaFine_NoResult=no results FR-Designer_ConnectionFailed=connection failed FR-Designer_NoResult=No results FR-Designer-AlphaFine_SetShortcuts= +FR-Designer_Cell_Element=Cell Element +FR-Designer_Cell_Attributes=Cell Attributes +FR-Designer_Float_Element=Float Element +FR-Designer_Widget_Library=Widget Library diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties index 1d11d02d1..de3112979 100644 --- a/designer_base/src/com/fr/design/locale/designer_en_US.properties +++ b/designer_base/src/com/fr/design/locale/designer_en_US.properties @@ -1998,7 +1998,6 @@ FR-Designer_AlphaFine_ShowAll=Show all FR-Designer_AlphaFine_Latest=Recent FR-Designer_AlphaFine_ShowLess=Show less FR-Designer_Alphafine=AlphaFine -<<<<<<< HEAD FR-Designer-Alphafine_No_Remind=don't remind FR-Designer_AlphaFine_NoResult=No results FR-Designer_ConnectionFailed=Connection failed @@ -2006,3 +2005,7 @@ FR-Designer_AlphaFine_EnableAlphaFine=Enable AlphaFine FR-Designer_AlphaFine_EnableInternet=Internet FR-Designer_NoResult=No results FR-Designer-AlphaFine_SetShortcuts=please press two key to set shortcut +FR-Designer_Cell_Element=Cell Element +FR-Designer_Cell_Attributes=Cell Attributes +FR-Designer_Float_Element=Float Element +FR-Designer_Widget_Library=Widget Library diff --git a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties index 5b7316040..e17d249f5 100644 --- a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties +++ b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties @@ -1981,4 +1981,8 @@ FR-Designer_Edit_String_To_Formula=\u30AD\u30E3\u30E9\u30AF\u30BF\u30FC\u6587\u5 FR-Base_UnSignIn=\ \u672A\u30ED\u30B0\u30A4\u30F3 Every=\u6BCF CellWrite-Preview_Cell_Content=\u30BB\u30EB\u306E\u5185\u5BB9\u3092\u30D7\u30EC\u30D3\u30E5\u30FC\u3059\u308B -FormulaD-Data_Fields=\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9 \ No newline at end of file +FormulaD-Data_Fields=\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9 +FR-Designer_Cell_Element=\u30BB\u30EB\u8981\u7D20 +FR-Designer_Cell_Attributes=\u30BB\u30EB\u5C5E\u6027 +FR-Designer_Float_Element=\u30D5\u30ED\u30FC\u30C8\u8981\u7D20 +FR-Designer_Widget_Library= \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties index 43c9eb1bc..dfa6a7d32 100644 --- a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties +++ b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties @@ -446,7 +446,6 @@ FR-Designer_WLayout-Absolute-ToolTips=\uC790\uC720\uC2DD\uB808\uC774\uC544\uC6C3 FR-Designer_Add_all=\uBAA8\uB450\uCD94\uAC00 FR-Designer_Reset= FR-Designer_Language_Change_Successful= -FR-Designer_Template_Web_Attributes= FR-Designer_Basic=\uAE30\uBCF8 FR-Designer_Printers(Server)=\uD504\uB9B0\uD130(\uC11C\uBC84) FR-Designer_Pagination_Setting=\uD398\uC774\uC9C0\uB098\uB204\uAE30\uBBF8\uB9AC\uBCF4\uAE30\uC124\uC815 @@ -1982,4 +1981,8 @@ FR-Designer_Edit_String_To_Formula=\uBB38\uC790\uC5F4\uC744\uC218\uC2DD\uC73C\uB FR-Base_UnSignIn=\uC544\uC9C1 \uB4F1\uB85D Every=\uAC01 CellWrite-Preview_Cell_Content=\uC140\uB0B4\uC6A9\uBBF8\uB9AC\uBCF4\uAE30 -FormulaD-Data_Fields=\uB370\uC774\uD130\uD56D\uBAA9 \ No newline at end of file +FormulaD-Data_Fields=\uB370\uC774\uD130\uD56D\uBAA9 +FR-Designer_Cell_Element=\uC140\uC694\uC18C +FR-Designer_Cell_Attributes=\uC140\uC18D\uC131 +FR-Designer_Float_Element=\uD638\uBC84\uC694\uC18C +FR-Designer_Widget_Library= \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index 9e5a80bfa..8060abc14 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -2003,3 +2003,7 @@ FR-Designer_AlphaFine_NoResult=\u6682\u65E0\u76F8\u5173\u5185\u5BB9 FR-Designer_ConnectionFailed=\u94FE\u63A5\u5931\u8D25 FR-Designer_NoResult=\u6682\u4E0D\u652F\u6301\u663E\u793A FR-Designer-AlphaFine_SetShortcuts=\u8BF7\u76F4\u63A5\u5728\u952E\u76D8\u4E0A\u6309\u4E24\u4E2A\u7EC4\u5408\u952E +FR-Designer_Cell_Element=\u5355\u5143\u683C\u5143\u7D20 +FR-Designer_Cell_Attributes=\u5355\u5143\u683C\u5C5E\u6027 +FR-Designer_Float_Element=\u60AC\u6D6E\u5143\u7D20 +FR-Designer_Widget_Library=\u7EC4\u4EF6\u5E93 diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index 313e86740..6eea2a1fe 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties @@ -2004,3 +2004,7 @@ FR-Designer_AlphaFine_NoResult=\u66AB\u7121\u76F8\u95DC\u5167\u5BB9 FR-Designer_ConnectionFailed=\u93C8\u63A5\u5931\u6557 FR-Designer_NoResult=\u66AB\u4E0D\u652F\u6301\u986F\u793A FR-Designer-AlphaFine_SetShortcuts=\u8ACB\u76F4\u63A5\u5728\u9375\u76E4\u4E0A\u6309\u5169\u500B\u7D44\u5408\u9375 +FR-Designer_Cell_Element=\u5132\u5B58\u683C\u5143\u7D20 +FR-Designer_Cell_Attributes=\u5132\u5B58\u683C\u5C6C\u6027 +FR-Designer_Float_Element=\u61F8\u6D6E\u5143\u7D20 +FR-Designer_Widget_Library=\u7D44\u4EF6\u5EAB diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index 27a012783..73c1d9631 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -9,6 +9,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; +import com.fr.general.Inter; import javax.swing.*; import javax.swing.border.EmptyBorder; @@ -56,19 +57,19 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyItemList = new ArrayList<>(); // 单元格元素 - PropertyItem cellElement = new PropertyItem("cellElement", "/com/fr/design/images/buttonicon/add.png"); + PropertyItem cellElement = new PropertyItem("cellElement", Inter.getLocText("FR-Designer_Cell_Element"), "/com/fr/design/images/buttonicon/add.png"); // 单元格属性 - PropertyItem cellAttr = new PropertyItem("cellAttr", "com/fr/design/images/toolbarbtn/close.png"); + PropertyItem cellAttr = new PropertyItem("cellAttr", Inter.getLocText("FR-Designer_Cell_Attributes"), "com/fr/design/images/toolbarbtn/close.png"); // 悬浮元素 - PropertyItem floatElement = new PropertyItem("floatElement", "com/fr/design/images/toolbarbtn/close.png"); + PropertyItem floatElement = new PropertyItem("floatElement", Inter.getLocText("FR-Designer_Float_Element"), "com/fr/design/images/toolbarbtn/close.png"); // 控件设置 - PropertyItem widgetSettings = new PropertyItem("widgetSettings", "com/fr/design/images/toolbarbtn/close.png"); + PropertyItem widgetSettings = new PropertyItem("widgetSettings", Inter.getLocText("FR-Designer-Widget_Settings"), "com/fr/design/images/toolbarbtn/close.png"); // 条件属性 - PropertyItem conditionAttr = new PropertyItem("conditionAttr", "com/fr/design/images/toolbarbtn/close.png"); + PropertyItem conditionAttr = new PropertyItem("conditionAttr", Inter.getLocText("FR-Designer_Condition_Attributes"), "com/fr/design/images/toolbarbtn/close.png"); // 超级链接 - PropertyItem hyperlink = new PropertyItem("hyperlink", "com/fr/design/images/toolbarbtn/close.png"); + PropertyItem hyperlink = new PropertyItem("hyperlink", Inter.getLocText("FR-Designer_Hyperlink"), "com/fr/design/images/toolbarbtn/close.png"); // 组件库 - PropertyItem widgetLib = new PropertyItem("widgetLib", "com/fr/design/images/toolbarbtn/close.png"); + PropertyItem widgetLib = new PropertyItem("widgetLib", Inter.getLocText("FR-Designer_Widget_Library"), "com/fr/design/images/toolbarbtn/close.png"); propertyItemList.add(cellElement); propertyItemList.add(cellAttr); propertyItemList.add(floatElement); @@ -220,7 +221,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { class PropertyItem { // private UIButton button; private UIButton button; - private String name; + private String name; // 用于 card 切换 + private String title; // 用于显示 private JComponent propertyPanel; private JComponent contentPane; private FixedPopupPane popupPane; // 左侧固定弹出框 @@ -231,8 +233,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private boolean isPoppedOut = false; // 是否弹出 private Dimension fixedSize; - public PropertyItem(String name, String btnUrl) { + public PropertyItem(String name, String title, String btnUrl) { this.name = name; + this.title = title; initButton(btnUrl); initPropertyPanel(); } @@ -327,6 +330,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer { return name; } + public String getTitle() { + return title; + } + public JComponent getPropertyPanel() { return propertyPanel; } @@ -411,7 +418,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { // 弹出属性面板的工具条 private class PopupToolPane extends JPanel { private int model = UIConstants.MODEL_NORMAL; - private String title = "单元格元素"; + private String title; private JComponent contentPane; private PropertyItem propertyItem; private String buttonType; @@ -435,6 +442,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public PopupToolPane(PropertyItem propertyItem, String buttonType) { super(); this.propertyItem = propertyItem; + this.title = propertyItem.getTitle(); this.contentPane = propertyItem.getContentPane(); setLayout(new BorderLayout()); UILabel label = new UILabel(title); From a914c629617666cff46db37ea2162c990694f720 Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 17 Jul 2017 19:30:04 +0800 Subject: [PATCH 16/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E7=BA=A2=E8=89=B2?= =?UTF-8?q?=E6=A0=87=E5=87=BA=E5=8F=AF=E6=8B=96=E5=8A=A8=E5=8C=BA=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/EastRegionContainerPane.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index 73c1d9631..3b23f293a 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -423,6 +423,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private PropertyItem propertyItem; private String buttonType; private JDialog parentDialog; // 如果不在对话框中,值为null + private Color originColor; // 初始背景 private boolean isMovable = false; private Point mouseDownCompCoords; // 存储按下左键的位置,移动对话框时会用到 @@ -444,6 +445,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { this.propertyItem = propertyItem; this.title = propertyItem.getTitle(); this.contentPane = propertyItem.getContentPane(); + originColor = getBackground(); setLayout(new BorderLayout()); UILabel label = new UILabel(title); label.setForeground(new Color(69, 135, 255)); @@ -478,6 +480,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer { if (e.getX() >= ARROW_RANGE_START) { setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); model = UIConstants.MODEL_PRESS; + } else if (isMovable) { + setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); + setBackground(Color.pink); } else { setCursor(Cursor.getDefaultCursor()); model = UIConstants.MODEL_NORMAL; @@ -516,6 +521,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer { @Override public void mouseExited(MouseEvent e) { setCursor(Cursor.getDefaultCursor()); + if (mouseDownCompCoords == null) { + setBackground(originColor); + } model = UIConstants.MODEL_NORMAL; repaint(); } @@ -530,6 +538,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer { @Override public void mouseReleased(MouseEvent e) { mouseDownCompCoords = null; + if (!getBounds().contains(e.getPoint())) { + setBackground(originColor); + } } @Override public void mousePressed(MouseEvent e) { From abba21658758d3e87d9f3d897e92e025e8ebee3d Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 17 Jul 2017 19:36:46 +0800 Subject: [PATCH 17/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E4=BA=A4=E6=8D=A2?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E5=B7=A5=E5=85=B7=E6=9D=A1=E7=9A=84=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/EastRegionContainerPane.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index 3b23f293a..983ddffa8 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -249,7 +249,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyPanel = new JPanel(); propertyPanel.setBackground(Color.pink); contentPane = generateContentPane(); - popupToolPane = new PopupToolPane(this, PopupToolPane.UP_BUTTON); + popupToolPane = new PopupToolPane(this, PopupToolPane.DOWN_BUTTON); propertyPanel.setLayout(new BorderLayout()); propertyPanel.add(popupToolPane, BorderLayout.NORTH); propertyPanel.add(contentPane, BorderLayout.CENTER); @@ -466,9 +466,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer { return; } - if (buttonType.equals(UP_BUTTON)) { + if (buttonType.equals(DOWN_BUTTON)) { - } else if (buttonType.equals(DOWN_BUTTON)) { + } else if (buttonType.equals(UP_BUTTON)) { } else { throw new IllegalArgumentException("unknown button type: " + buttonType); @@ -554,9 +554,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer { // 触发弹入、弹出 private void onPop() { - if (buttonType.equals(UP_BUTTON)) { + if (buttonType.equals(DOWN_BUTTON)) { propertyItem.popupDialog(); - } else if (buttonType.equals(DOWN_BUTTON)) { + } else if (buttonType.equals(UP_BUTTON)) { propertyItem.popToFrame(); } } @@ -578,7 +578,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { if (buttonType.equals(NO_BUTTON)) { return; } - if (buttonType.equals(UP_BUTTON)) { + if (buttonType.equals(DOWN_BUTTON)) { if (model == UIConstants.MODEL_NORMAL) { button = UIConstants.DRAG_LEFT_NORMAL; } else { @@ -608,7 +608,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { super(DesignerContext.getDesignerFrame()); container = getContentPane(); setUndecorated(true); - PopupToolPane popupToolPane = new PopupToolPane(propertyItem, PopupToolPane.DOWN_BUTTON); + PopupToolPane popupToolPane = new PopupToolPane(propertyItem, PopupToolPane.UP_BUTTON); popupToolPane.setParentDialog(this); contentPane = propertyItem.getContentPane(); container.add(popupToolPane, BorderLayout.NORTH); From 64474ba90568a22fd72ac43e6f1f83d031813f31 Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 17 Jul 2017 20:00:34 +0800 Subject: [PATCH 18/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E6=89=80=E6=9C=89ta?= =?UTF-8?q?b=E5=BC=B9=E5=87=BA=E5=90=8E=EF=BC=8C=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E2=80=9C=E6=97=A0=E5=8F=AF=E7=94=A8=E9=85=8D=E7=BD=AE=E9=A1=B9?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/locale/designer.properties | 1 + .../design/locale/designer_en_US.properties | 1 + .../design/locale/designer_ja_JP.properties | 3 ++- .../design/locale/designer_ko_KR.properties | 3 ++- .../design/locale/designer_zh_CN.properties | 1 + .../design/locale/designer_zh_TW.properties | 1 + .../mainframe/EastRegionContainerPane.java | 20 +++++++++++++++++++ 7 files changed, 28 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 9365dec33..cf38d99b5 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -2009,3 +2009,4 @@ FR-Designer_Cell_Element=Cell Element FR-Designer_Cell_Attributes=Cell Attributes FR-Designer_Float_Element=Float Element FR-Designer_Widget_Library=Widget Library +FR-Designer_No_Settings_Available=No Settings Available! diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties index de3112979..83ac59ba1 100644 --- a/designer_base/src/com/fr/design/locale/designer_en_US.properties +++ b/designer_base/src/com/fr/design/locale/designer_en_US.properties @@ -2009,3 +2009,4 @@ FR-Designer_Cell_Element=Cell Element FR-Designer_Cell_Attributes=Cell Attributes FR-Designer_Float_Element=Float Element FR-Designer_Widget_Library=Widget Library +FR-Designer_No_Settings_Available=No Settings Available! diff --git a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties index e17d249f5..3d037b05e 100644 --- a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties +++ b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties @@ -1985,4 +1985,5 @@ FormulaD-Data_Fields=\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9 FR-Designer_Cell_Element=\u30BB\u30EB\u8981\u7D20 FR-Designer_Cell_Attributes=\u30BB\u30EB\u5C5E\u6027 FR-Designer_Float_Element=\u30D5\u30ED\u30FC\u30C8\u8981\u7D20 -FR-Designer_Widget_Library= \ No newline at end of file +FR-Designer_Widget_Library= +FR-Designer_No_Settings_Available= \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties index dfa6a7d32..a561e99a6 100644 --- a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties +++ b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties @@ -1985,4 +1985,5 @@ FormulaD-Data_Fields=\uB370\uC774\uD130\uD56D\uBAA9 FR-Designer_Cell_Element=\uC140\uC694\uC18C FR-Designer_Cell_Attributes=\uC140\uC18D\uC131 FR-Designer_Float_Element=\uD638\uBC84\uC694\uC18C -FR-Designer_Widget_Library= \ No newline at end of file +FR-Designer_Widget_Library= +FR-Designer_No_Settings_Available= \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index 8060abc14..c487655cb 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -2007,3 +2007,4 @@ FR-Designer_Cell_Element=\u5355\u5143\u683C\u5143\u7D20 FR-Designer_Cell_Attributes=\u5355\u5143\u683C\u5C5E\u6027 FR-Designer_Float_Element=\u60AC\u6D6E\u5143\u7D20 FR-Designer_Widget_Library=\u7EC4\u4EF6\u5E93 +FR-Designer_No_Settings_Available=\u65E0\u53EF\u7528\u914D\u7F6E\u9879\uFF01 diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index 6eea2a1fe..848b2f05e 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties @@ -2008,3 +2008,4 @@ FR-Designer_Cell_Element=\u5132\u5B58\u683C\u5143\u7D20 FR-Designer_Cell_Attributes=\u5132\u5B58\u683C\u5C6C\u6027 FR-Designer_Float_Element=\u61F8\u6D6E\u5143\u7D20 FR-Designer_Widget_Library=\u7D44\u4EF6\u5EAB +FR-Designer_No_Settings_Available=\u7121\u53EF\u7528\u914D\u5BD8\u9805\uFF01 diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index 983ddffa8..c787ed959 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -79,6 +79,15 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyItemList.add(widgetLib); } + // "无可用配置项"面板 + private JPanel getDefaultPane() { + JPanel defaultPane = new JPanel(); + UILabel label = new UILabel(Inter.getLocText("FR-Designer_No_Settings_Available")); + defaultPane.setLayout(new BorderLayout()); + defaultPane.add(label, BorderLayout.CENTER); + return defaultPane; + } + private void initContentPane() { initRightPane(); initLeftPane(); @@ -91,8 +100,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer { rightPane.setBackground(Color.green); rightPane.setLayout(propertyCard); for (PropertyItem item : propertyItemList) { + if (item.isPoppedOut()) { + continue; + } rightPane.add(item.getName(), item.getPropertyPanel()); } + rightPane.add(getDefaultPane()); replaceRightPane(rightPane); } @@ -102,6 +115,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer { leftPane = new JPanel(); leftPane.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0)); for (PropertyItem item : propertyItemList) { + if (item.isPoppedOut()) { + continue; + } leftPane.add(item.getButton()); } @@ -259,6 +275,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer { this.isPoppedOut = isPoppedOut; } + public boolean isPoppedOut() { + return isPoppedOut; + } + public JComponent generateContentPane() { JComponent contentPane = new JPanel(); JButton testBtn = new JButton(name); From 57954b2e8bc22fd412a938b6899a7dab603fd04e Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 18 Jul 2017 11:13:50 +0800 Subject: [PATCH 19/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>propertyItemList=20?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=20propertyItemMap=EF=BC=88=E6=9C=89=E5=BA=8F?= =?UTF-8?q?map=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/ElementCasePaneDelegate.java | 4 +- .../mainframe/EastRegionContainerPane.java | 104 ++++++++++++------ .../form/parameter/FormParaDesigner.java | 4 +- 3 files changed, 76 insertions(+), 36 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java index a3df2ba3e..7fb3132bc 100644 --- a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java +++ b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java @@ -56,8 +56,8 @@ public class ElementCasePaneDelegate extends ElementCasePane { QuickEditorRegion.getInstance().populate(getCurrentEditor()); JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (editingTemplate != null && !editingTemplate.isUpMode()) { - EastRegionContainerPane.getInstance().replaceDownPane(CellElementPropertyPane.getInstance()); - EastRegionContainerPane.getInstance().replaceUpPane(QuickEditorRegion.getInstance()); + EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance()); + EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); } } diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index c787ed959..131ed25d2 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -16,11 +16,12 @@ import javax.swing.border.EmptyBorder; import java.awt.*; import java.awt.event.*; import java.util.ArrayList; -import java.util.List; +import java.util.LinkedHashMap; +import java.util.Map; public class EastRegionContainerPane extends UIEastResizableContainer { private static EastRegionContainerPane THIS; - private List propertyItemList; + private Map propertyItemMap; private CardLayout propertyCard; private JPanel leftPane; private JPanel rightPane; @@ -29,6 +30,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private static final int CONTENT_WIDTH = CONTAINER_WIDTH - TAB_WIDTH; private static final int POPUP_TOOLPANE_HEIGHT = 25; private static final int ARROW_RANGE_START = CONTENT_WIDTH - 30; + private static final String KEY_CELL_ELEMENT = "cellElement"; + private static final String KEY_CELL_ATTR = "cellAttr"; + private static final String KEY_FLOAT_ELEMENT = "floatElement"; + private static final String KEY_WIDGET_SETTINGS = "widgetSettings"; + private static final String KEY_CONDITION_ATTR = "conditionAttr"; + private static final String KEY_HYPERLINK = "hyperlink"; + private static final String KEY_WIDGET_LIB = "widgetLib"; /** * 得到实例 @@ -54,29 +62,29 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } private void initPropertyItemList() { - propertyItemList = new ArrayList<>(); + propertyItemMap = new LinkedHashMap<>(); // 有序map // 单元格元素 - PropertyItem cellElement = new PropertyItem("cellElement", Inter.getLocText("FR-Designer_Cell_Element"), "/com/fr/design/images/buttonicon/add.png"); + PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, Inter.getLocText("FR-Designer_Cell_Element"), "/com/fr/design/images/buttonicon/add.png"); // 单元格属性 - PropertyItem cellAttr = new PropertyItem("cellAttr", Inter.getLocText("FR-Designer_Cell_Attributes"), "com/fr/design/images/toolbarbtn/close.png"); + PropertyItem cellAttr = new PropertyItem(KEY_CELL_ATTR, Inter.getLocText("FR-Designer_Cell_Attributes"), "com/fr/design/images/toolbarbtn/close.png"); // 悬浮元素 - PropertyItem floatElement = new PropertyItem("floatElement", Inter.getLocText("FR-Designer_Float_Element"), "com/fr/design/images/toolbarbtn/close.png"); + PropertyItem floatElement = new PropertyItem(KEY_FLOAT_ELEMENT, Inter.getLocText("FR-Designer_Float_Element"), "com/fr/design/images/toolbarbtn/close.png"); // 控件设置 - PropertyItem widgetSettings = new PropertyItem("widgetSettings", Inter.getLocText("FR-Designer-Widget_Settings"), "com/fr/design/images/toolbarbtn/close.png"); + PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, Inter.getLocText("FR-Designer-Widget_Settings"), "com/fr/design/images/toolbarbtn/close.png"); // 条件属性 - PropertyItem conditionAttr = new PropertyItem("conditionAttr", Inter.getLocText("FR-Designer_Condition_Attributes"), "com/fr/design/images/toolbarbtn/close.png"); + PropertyItem conditionAttr = new PropertyItem(KEY_CONDITION_ATTR, Inter.getLocText("FR-Designer_Condition_Attributes"), "com/fr/design/images/toolbarbtn/close.png"); // 超级链接 - PropertyItem hyperlink = new PropertyItem("hyperlink", Inter.getLocText("FR-Designer_Hyperlink"), "com/fr/design/images/toolbarbtn/close.png"); + PropertyItem hyperlink = new PropertyItem(KEY_HYPERLINK, Inter.getLocText("FR-Designer_Hyperlink"), "com/fr/design/images/toolbarbtn/close.png"); // 组件库 - PropertyItem widgetLib = new PropertyItem("widgetLib", Inter.getLocText("FR-Designer_Widget_Library"), "com/fr/design/images/toolbarbtn/close.png"); - propertyItemList.add(cellElement); - propertyItemList.add(cellAttr); - propertyItemList.add(floatElement); - propertyItemList.add(widgetSettings); - propertyItemList.add(conditionAttr); - propertyItemList.add(hyperlink); - propertyItemList.add(widgetLib); + PropertyItem widgetLib = new PropertyItem(KEY_WIDGET_LIB, Inter.getLocText("FR-Designer_Widget_Library"), "com/fr/design/images/toolbarbtn/close.png"); + propertyItemMap.put(KEY_CELL_ELEMENT, cellElement); + propertyItemMap.put(KEY_CELL_ATTR, cellAttr); + propertyItemMap.put(KEY_FLOAT_ELEMENT, floatElement); + propertyItemMap.put(KEY_WIDGET_SETTINGS, widgetSettings); + propertyItemMap.put(KEY_CONDITION_ATTR, conditionAttr); + propertyItemMap.put(KEY_HYPERLINK, hyperlink); + propertyItemMap.put(KEY_WIDGET_LIB, widgetLib); } // "无可用配置项"面板 @@ -99,7 +107,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyCard = new CardLayout(); rightPane.setBackground(Color.green); rightPane.setLayout(propertyCard); - for (PropertyItem item : propertyItemList) { + for (PropertyItem item : propertyItemMap.values()) { if (item.isPoppedOut()) { continue; } @@ -114,7 +122,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private void initLeftPane() { leftPane = new JPanel(); leftPane.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0)); - for (PropertyItem item : propertyItemList) { + for (PropertyItem item : propertyItemMap.values()) { if (item.isPoppedOut()) { continue; } @@ -135,7 +143,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { @Override public void onResize() { - for (PropertyItem item : propertyItemList) { + for (PropertyItem item : propertyItemMap.values()) { item.onResize(); } } @@ -147,23 +155,55 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } public void replaceUpPane(JComponent pane) { - propertyItemList.get(0).replaceContentPane(pane); + replaceCellElementPane(pane); } public void replaceDownPane(JComponent pane) { - propertyItemList.get(1).replaceContentPane(pane); + replaceCellAttrPane(pane); } public JComponent getUpPane() { - return propertyItemList.get(0).getContentPane(); + return getCellElementPane(); } public JComponent getDownPane() { - return propertyItemList.get(1).getContentPane(); + return getCellAttrPane(); + } + + public void replaceCellElementPane(JComponent pane) { + propertyItemMap.get(KEY_CELL_ELEMENT).replaceContentPane(pane); + } + + public JComponent getCellElementPane() { + return propertyItemMap.get(KEY_CELL_ELEMENT).getContentPane(); + } + + public void replaceCellAttrPane(JComponent pane) { + propertyItemMap.get(KEY_CELL_ATTR).replaceContentPane(pane); + } + + public JComponent getCellAttrPane() { + return propertyItemMap.get(KEY_CELL_ATTR).getContentPane(); + } + + public void replaceWidgetSettingsPane(JComponent pane) { + propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceContentPane(pane); + } + + public JComponent getWidgetSettingsPane() { + return propertyItemMap.get(KEY_WIDGET_SETTINGS).getContentPane(); + } + + public void replaceWidgetLibPane(JComponent pane) { + propertyItemMap.get(KEY_WIDGET_LIB).replaceContentPane(pane); + } + + public JComponent getWidgetLibPane() { + return propertyItemMap.get(KEY_WIDGET_LIB).getContentPane(); } public void addParameterPane(JComponent paraPane) { - propertyItemList.get(2).replaceContentPane(paraPane); + propertyItemMap.get(KEY_HYPERLINK).replaceContentPane(paraPane); } public void setParameterHeight(int height) { @@ -210,16 +250,16 @@ public class EastRegionContainerPane extends UIEastResizableContainer { */ public void refreshRightPane() { - if (this.getRightPane() instanceof DockingView) { - ((DockingView) this.getRightPane()).refreshDockingView(); - } +// if (this.getRightPane() instanceof DockingView) { +// ((DockingView) this.getRightPane()).refreshDockingView(); +// } } public void refreshDownPane() { - JComponent pane = propertyItemList.get(1).getContentPane(); - if (pane instanceof DockingView) { - ((DockingView) pane).refreshDockingView(); - } +// JComponent pane = propertyItemList.get(1).getContentPane(); +// if (pane instanceof DockingView) { +// ((DockingView) pane).refreshDockingView(); +// } } private void refreshContainer() { diff --git a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java index 589be7e83..1327823bb 100644 --- a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java @@ -109,12 +109,12 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP */ public void initBeforeUpEdit() { WidgetToolBarPane.getInstance(this); - EastRegionContainerPane.getInstance().replaceDownPane( + EastRegionContainerPane.getInstance().replaceWidgetLibPane( FormWidgetDetailPane.getInstance(this)); if (!BaseUtils.isAuthorityEditing()) { EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(this)); EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(this).getPreferredSize().height); - EastRegionContainerPane.getInstance().replaceUpPane( + EastRegionContainerPane.getInstance().replaceWidgetSettingsPane( WidgetPropertyPane.getInstance(this)); } else { EastRegionContainerPane.getInstance().removeParameterPane(); From 7173e76d4c179039189babe90bf0716d5b737004 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Tue, 18 Jul 2017 14:11:45 +0800 Subject: [PATCH 20/32] =?UTF-8?q?REPORT-2897=209.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E4=BF=AE=E6=94=B9=20=E7=BC=A9=E6=94=BE=E6=9D=A1?= =?UTF-8?q?=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/ElementCasePane.java | 18 ++-- .../com/fr/design/mainframe/JWorkBook.java | 39 ++++++++- .../mainframe/ReportComponentComposite.java | 28 +++++-- designer/src/com/fr/grid/Grid.java | 12 ++- designer/src/com/fr/grid/GridColumn.java | 13 ++- designer/src/com/fr/grid/GridColumnUI.java | 11 ++- designer/src/com/fr/grid/GridHeader.java | 4 +- .../src/com/fr/grid/GridMouseAdapter.java | 38 +++++---- designer/src/com/fr/grid/GridRow.java | 15 +++- designer/src/com/fr/grid/GridRowUI.java | 36 ++++---- designer/src/com/fr/grid/GridUI.java | 7 +- designer/src/com/fr/grid/GridUtils.java | 82 ++++++++++++++++++- .../fr/design/mainframe/DesignerFrame.java | 5 ++ .../com/fr/design/mainframe/JSliderPane.java | 59 +++++++++---- .../com/fr/design/mainframe/JTemplate.java | 4 + .../src/com/fr/design/mainframe/FormArea.java | 62 ++++++++++---- .../src/com/fr/design/mainframe/JForm.java | 10 +++ 17 files changed, 350 insertions(+), 93 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/ElementCasePane.java b/designer/src/com/fr/design/mainframe/ElementCasePane.java index 52bbc6393..20fbeb802 100644 --- a/designer/src/com/fr/design/mainframe/ElementCasePane.java +++ b/designer/src/com/fr/design/mainframe/ElementCasePane.java @@ -11,12 +11,9 @@ import java.awt.Rectangle; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.InputEvent; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; +import java.awt.event.*; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.lang.reflect.Constructor; import java.util.Set; @@ -191,7 +188,7 @@ public abstract class ElementCasePane extends Tar /** * Constructor. */ - public ElementCasePane(T t) { + public ElementCasePane(T t) { super(t); // marks:能触发processEvent,不管是否给component增加listener。这里是使在reportPane中的任意位置滑动鼠标轮都能 // 下拉grid。 @@ -213,6 +210,7 @@ public abstract class ElementCasePane extends Tar protected void initComponents() { this.setLayout(new RGridLayout()); + //todo 直接修改分辨率 this.resolution = ScreenResolution.getScreenResolution(); this.initGridComponent(); @@ -231,7 +229,7 @@ public abstract class ElementCasePane extends Tar verScrollBar = new DynamicScrollBar(Adjustable.VERTICAL, this, this.resolution); horScrollBar = new DynamicScrollBar(Adjustable.HORIZONTAL, this, this.resolution); this.add(RGridLayout.VerticalBar, this.verScrollBar); - // this.add(RGridLayout.HorizontalBar, this.horScrollBar); +// this.add(RGridLayout.HorizontalBar, this.horScrollBar); // Init input/action map defaultly. initInputActionMap(); @@ -1049,7 +1047,7 @@ public abstract class ElementCasePane extends Tar ElementCase elementCase = this.getEditingElementCase(); boolean cancel = false; - ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(this, evt.getX(), evt.getY()); + ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(this, evt.getX(), evt.getY(), this.resolution); ReportPageAttrProvider reportPageAttr = elementCase.getReportPageAttr(); ElementCase report = this.getEditingElementCase(); if (reportPageAttr != null) { @@ -1142,7 +1140,7 @@ public abstract class ElementCasePane extends Tar HeadColumnAction headcolumnAction = new HeadColumnAction(this); FootColumnAction footcolumnAction = new FootColumnAction(this); - ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(this, evt.getX(), evt.getY()); + ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(this, evt.getX(), evt.getY(),this.resolution); ElementCase elementCase = this.getEditingElementCase(); boolean cancel = false; ReportPageAttrProvider reportPageAttr = elementCase.getReportPageAttr(); diff --git a/designer/src/com/fr/design/mainframe/JWorkBook.java b/designer/src/com/fr/design/mainframe/JWorkBook.java index fd4cd7b0d..4ac0c2ae1 100644 --- a/designer/src/com/fr/design/mainframe/JWorkBook.java +++ b/designer/src/com/fr/design/mainframe/JWorkBook.java @@ -1,9 +1,9 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.DynamicUnitList; import com.fr.base.FRContext; import com.fr.base.Parameter; -import com.fr.base.parameter.ParameterUI; import com.fr.design.DesignModelAdapter; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.AllowAuthorityEditAction; @@ -51,16 +51,17 @@ import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.general.ModuleContext; import com.fr.general.web.ParameterConsts; +import com.fr.grid.Grid; +import com.fr.grid.GridUtils; import com.fr.io.exporter.EmbeddedTableDataExporter; import com.fr.main.TemplateWorkBook; import com.fr.main.impl.WorkBook; import com.fr.main.parameter.ReportParameterAttr; import com.fr.poly.PolyDesigner; import com.fr.privilege.finegrain.WorkSheetPrivilegeControl; -import com.fr.report.cellcase.CellCase; +import com.fr.report.ReportHelper; +import com.fr.report.elementcase.ElementCase; import com.fr.report.elementcase.TemplateElementCase; -import com.fr.report.poly.PolyWorkSheet; -import com.fr.report.report.Report; import com.fr.report.worksheet.WorkSheet; import com.fr.stable.ArrayUtils; import com.fr.stable.StableUtils; @@ -86,6 +87,7 @@ public class JWorkBook extends JTemplate { private UIModeControlContainer centerPane; private ReportComponentComposite reportComposite; private ParameterDefinitePane parameterPane; + private int resolution; public JWorkBook() { super(new WorkBook(new WorkSheet()), "WorkBook"); @@ -159,6 +161,7 @@ public class JWorkBook extends JTemplate { } } + /** * 无条件取消格式刷 */ @@ -317,6 +320,34 @@ public class JWorkBook extends JTemplate { parameterPane.getParaDesigner().removeSelection(); } + /** + * 缩放条 + */ + @Override + public void setScale(int resolution) { + //更新resolution + this.resolution = resolution; + reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution); + reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().setResolution(resolution); + //更新Grid + Grid grid = reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid(); + DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(reportComposite.centerCardPane.editingComponet.elementCasePane.getEditingElementCase()); + DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(reportComposite.centerCardPane.editingComponet.elementCasePane.getEditingElementCase()); + grid.setVerticalExtent(GridUtils.getExtentValue(0, rowHeightList, grid.getHeight(), resolution)); + grid.setHorizontalExtent(GridUtils.getExtentValue(0, columnWidthList, grid.getWidth(), resolution)); + reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().updateUI(); + //更新Column和Row + reportComposite.centerCardPane.editingComponet.elementCasePane.getGridColumn().setResolution(resolution); + reportComposite.centerCardPane.editingComponet.elementCasePane.getGridColumn().updateUI(); + reportComposite.centerCardPane.editingComponet.elementCasePane.getGridRow().setResolution(resolution); + reportComposite.centerCardPane.editingComponet.elementCasePane.getGridRow().updateUI(); + } + + @Override + public int getScale() { + return this.resolution; + } + public int getToolBarHeight() { return TOOLBARPANEDIMHEIGHT; } diff --git a/designer/src/com/fr/design/mainframe/ReportComponentComposite.java b/designer/src/com/fr/design/mainframe/ReportComponentComposite.java index 533de694a..0b47214a9 100644 --- a/designer/src/com/fr/design/mainframe/ReportComponentComposite.java +++ b/designer/src/com/fr/design/mainframe/ReportComponentComposite.java @@ -36,11 +36,12 @@ public class ReportComponentComposite extends JComponent { private JPanel hbarContainer; + private JPanel jSliderContainer; + /** * Constructor with workbook.. * - * @param workBook the current workbook. */ public ReportComponentComposite(JWorkBook jwb) { this.parent = jwb; @@ -52,7 +53,7 @@ public class ReportComponentComposite extends JComponent { this.add(CellElementRegion, BorderLayout.NORTH); this.add(createSouthControlPane(), BorderLayout.SOUTH); } - + protected void doBeforeChange(int oldIndex) { if (oldIndex >= 0) { templateStateList.set(oldIndex, centerCardPane.editingComponet.createEditingState()); @@ -153,13 +154,30 @@ public class ReportComponentComposite extends JComponent { } private JComponent createSouthControlPane() { +// hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); +// hbarContainer.add(createSouthControlPaneWithJSliderPane()); hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); hbarContainer.add(centerCardPane.editingComponet.getHorizontalScrollBar()); - JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, hbarContainer); +// JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, hbarContainer); + JPanel southPane = new JPanel(new BorderLayout()); + JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, JSliderPane.getInstance()); splitpane.setBorder(null); splitpane.setDividerSize(3); - splitpane.setResizeWeight(0.6); - return splitpane; + splitpane.setResizeWeight(1); + southPane.add(hbarContainer,BorderLayout.NORTH); + southPane.add(splitpane,BorderLayout.CENTER); + return southPane; + } + + private JComponent createSouthControlPaneWithJSliderPane() { + hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); + hbarContainer.add(centerCardPane.editingComponet.getHorizontalScrollBar()); + JSplitPane splitWithJSliderPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, hbarContainer, JSliderPane.getInstance()); + splitWithJSliderPane.setBorder(null); + splitWithJSliderPane.setDividerLocation(0.9); + splitWithJSliderPane.setDividerSize(3); + splitWithJSliderPane.setResizeWeight(1); + return splitWithJSliderPane; } public void setSelectedIndex(int selectedIndex) { diff --git a/designer/src/com/fr/grid/Grid.java b/designer/src/com/fr/grid/Grid.java index 178cd085e..6bade0e2e 100644 --- a/designer/src/com/fr/grid/Grid.java +++ b/designer/src/com/fr/grid/Grid.java @@ -114,6 +114,7 @@ public class Grid extends BaseGridComponent { private int resolution; // 判断SmartJTablePane是否显示,做为动态虚线标识符 private boolean notShowingTableSelectPane = true; + private GridMouseAdapter gridMouseAdapter; public Grid(int resolution) { this.resolution = resolution; @@ -121,7 +122,7 @@ public class Grid extends BaseGridComponent { enableEvents(AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK); GridKeyAction.initGridInputActionMap(this); - GridMouseAdapter gridMouseAdapter = new GridMouseAdapter(this); + gridMouseAdapter = new GridMouseAdapter(this); this.addMouseListener(gridMouseAdapter); this.addMouseMotionListener(gridMouseAdapter); @@ -136,6 +137,10 @@ public class Grid extends BaseGridComponent { this.updateUI(); } + public void setResolution(int resolution) { + this.resolution = resolution; + } + /** * 应用界面设置 * @@ -149,6 +154,7 @@ public class Grid extends BaseGridComponent { setUI(localComponentUI); } + /** * 是否显示格子线 * @@ -173,6 +179,10 @@ public class Grid extends BaseGridComponent { this.getElementCasePane().repaint(); } + public GridMouseAdapter getGridMouseAdapter(){ + return this.gridMouseAdapter; + } + /** * Gets grid line color. * diff --git a/designer/src/com/fr/grid/GridColumn.java b/designer/src/com/fr/grid/GridColumn.java index e2366c9bc..eedf8bcaf 100644 --- a/designer/src/com/fr/grid/GridColumn.java +++ b/designer/src/com/fr/grid/GridColumn.java @@ -6,9 +6,14 @@ package com.fr.grid; import java.awt.Dimension; import com.fr.base.GraphHelper; +import com.fr.base.ScreenResolution; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.fun.GridUIProcessor; import com.fr.design.mainframe.ElementCasePane; import com.fr.stable.StableUtils; +import javax.swing.plaf.ComponentUI; + /** * GridColumn used to paint and edit grid column. * @@ -17,6 +22,8 @@ import com.fr.stable.StableUtils; */ public class GridColumn extends GridHeader { + private int resolution = ScreenResolution.getScreenResolution(); + @Override protected void initByConstructor() { GridColumnMouseHandler gridColumnMouseHandler = new GridColumnMouseHandler(this); @@ -32,7 +39,11 @@ public class GridColumn extends GridHeader { @Override public void updateUI() { - this.setUI(new GridColumnUI()); + this.setUI(new GridColumnUI(resolution)); + } + + public void setResolution(int resolution) { + this.resolution = resolution; } /** diff --git a/designer/src/com/fr/grid/GridColumnUI.java b/designer/src/com/fr/grid/GridColumnUI.java index 52df97693..eb625eabe 100644 --- a/designer/src/com/fr/grid/GridColumnUI.java +++ b/designer/src/com/fr/grid/GridColumnUI.java @@ -16,6 +16,8 @@ import com.fr.base.ScreenResolution; import com.fr.cache.list.IntList; import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.mainframe.GridScaleEdit; +import com.fr.design.mainframe.JSliderPane; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.grid.selection.Selection; import com.fr.privilege.finegrain.ColumnRowPrivilegeControl; @@ -29,7 +31,14 @@ import com.fr.report.elementcase.ElementCase; public class GridColumnUI extends ComponentUI { protected Color withoutDetailsBackground = Color.lightGray; - protected int resolution = ScreenResolution.getScreenResolution(); + private int resolution ; + + public GridColumnUI(int resolution){ + if (resolution == 0){ + resolution = ScreenResolution.getScreenResolution(); + } + this.resolution = resolution; + } @Override public void paint(Graphics g, JComponent c) { diff --git a/designer/src/com/fr/grid/GridHeader.java b/designer/src/com/fr/grid/GridHeader.java index 3b331d270..754257e2f 100644 --- a/designer/src/com/fr/grid/GridHeader.java +++ b/designer/src/com/fr/grid/GridHeader.java @@ -6,7 +6,7 @@ import java.awt.Color; public abstract class GridHeader extends BaseGridComponent { public final static int SIZE_ADJUST = 4; - + //属性 private Color separatorLineColor = new Color(172, 168, 153); //separator lines private Color selectedForeground = Color.black; @@ -22,7 +22,7 @@ public abstract class GridHeader extends BaseGridComponent { initByConstructor(); } - + protected abstract void initByConstructor(); protected abstract T getDisplay(int index) ; diff --git a/designer/src/com/fr/grid/GridMouseAdapter.java b/designer/src/com/fr/grid/GridMouseAdapter.java index 8a4053353..14256de55 100644 --- a/designer/src/com/fr/grid/GridMouseAdapter.java +++ b/designer/src/com/fr/grid/GridMouseAdapter.java @@ -7,6 +7,8 @@ import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.mainframe.GridScaleEdit; +import com.fr.design.mainframe.JSliderPane; import com.fr.design.present.CellWriteAttrPane; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.grid.selection.CellSelection; @@ -71,6 +73,8 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous private int ECBlockGap = 40; + private int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes); + protected GridMouseAdapter(Grid grid) { this.grid = grid; } @@ -101,7 +105,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous // 用户没有按住Shift键时,tempOldSelectedCell是一直变化的。如果一直按住shift,是不变的 ElementCasePane ePane = grid.getElementCasePane(); if (!evt.isShiftDown() && ePane.getSelection() instanceof CellSelection) { - tempOldSelectedCell = GridUtils.getAdjustEventColumnRow(ePane, oldEvtX, oldEvtY); + tempOldSelectedCell = GridUtils.getAdjustEventColumnRow_withresolution(ePane, oldEvtX, oldEvtY,resolution); } } @@ -118,7 +122,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous int horizentalScrollValue = grid.getHorizontalValue(); int verticalScrollValue = grid.getVerticalValue(); - int resolution = ScreenResolution.getScreenResolution(); +// int resolution = ScreenResolution.getScreenResolution(); FU evtX_fu = FU.valueOfPix(this.oldEvtX, resolution); FU evtY_fu = FU.valueOfPix(this.oldEvtY, resolution); @@ -142,7 +146,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous FloatElement selectedFloatElement = (FloatElement) tmpFloatElementCursor[0]; reportPane.setSelection(new FloatSelection(selectedFloatElement.getName())); } else { - ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, this.oldEvtX, this.oldEvtY); + ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, this.oldEvtX, this.oldEvtY, this.resolution); if (!reportPane.getSelection().containsColumnRow(selectedCellPoint)) { GridUtils.doSelectCell(reportPane, selectedCellPoint.getColumn(), selectedCellPoint.getRow()); } @@ -187,7 +191,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous // peter:选择GridSelection,支持Shift doOneClickSelection(this.oldEvtX, this.oldEvtY, isShiftDown, isControlDown); // 得到点击所在的column and row - ColumnRow columnRow = GridUtils.getEventColumnRow(reportPane, this.oldEvtX, this.oldEvtY); + ColumnRow columnRow = GridUtils.getEventColumnRow_withresolution(reportPane, this.oldEvtX, this.oldEvtY, this.resolution); TemplateCellElement cellElement = report.getTemplateCellElement(columnRow.getColumn(), columnRow.getRow()); if (clickCount >= 2 && !BaseUtils.isAuthorityEditing()) { grid.startEditing(); @@ -206,7 +210,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous */ private void showWidetWindow(TemplateCellElement cellElement, TemplateElementCase report) { - int resolution = ScreenResolution.getScreenResolution(); +// int resolution = ScreenResolution.getScreenResolution(); DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report); DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report); double fixed_pos_x = this.oldEvtX - columnWidthList.getRangeValue(grid.getHorizontalValue(), cellElement.getColumn()).toPixD(resolution); @@ -223,6 +227,10 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous && cell_width - fixed_pos_x < WIDGET_WIDTH && cell_height - fixed_pos_y < WIDGET_WIDTH; } + public void setResolution(int resolution) { + this.resolution = resolution; + } + /** * @param evt */ @@ -372,7 +380,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous doWithCellElementDragged(evtX, evtY, (CellSelection) selection); } else if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION && !BaseUtils.isAuthorityEditing()) { // peter:获得调整过的Selected Column Row. - ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, evtX, evtY); + ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution); if (selectedCellPoint.getColumn() != grid.getDragRectangle().x || selectedCellPoint.getRow() != grid.getDragRectangle().y) { grid.getDragRectangle().x = selectedCellPoint.getColumn(); grid.getDragRectangle().y = selectedCellPoint.getRow(); @@ -393,7 +401,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous private void doWithFloatElementDragged(int evtX, int evtY, FloatSelection fs) { ElementCase report = grid.getElementCasePane().getEditingElementCase(); - int resolution = ScreenResolution.getScreenResolution(); +// int resolution = ScreenResolution.getScreenResolution(); String floatName = fs.getSelectedFloatName(); FloatElement floatElement = report.getFloatElement(floatName); int cursorType = grid.getCursor().getType(); @@ -453,7 +461,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous ElementCasePane reportPane = grid.getElementCasePane(); java.awt.Rectangle cellRectangle = cs.toRectangle(); - ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, evtX, evtY); + ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution); if (cellRectangle.contains(selectedCellPoint.getColumn(), selectedCellPoint.getRow())) { grid.getDragRectangle().setBounds(cellRectangle); } else { @@ -507,7 +515,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous if (s instanceof FloatSelection) { return; } - ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, evtX, evtY); + ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution); int selectedCellPointX = selectedCellPoint.getColumn(); int selectedCellPointY = selectedCellPoint.getRow(); CellSelection gridSelection = ((CellSelection) s).clone(); @@ -543,7 +551,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous return; } - ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, evtX, evtY); + ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution); //拷贝,而不是直接强制使用以监听单元格选择变化 CellSelection gridSelection = ((CellSelection) s).clone(); gridSelection.setSelectedType(((CellSelection) s).getSelectedType()); @@ -606,7 +614,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous } else { grid.setCursor(UIConstants.CELL_DEFAULT_CURSOR); } - ColumnRow selectedCellColumnRow = GridUtils.getEventColumnRow(reportPane, evtX, evtY); + ColumnRow selectedCellColumnRow = GridUtils.getEventColumnRow_withresolution(reportPane, evtX, evtY, resolution); TemplateCellElement curCellElement = report.getTemplateCellElement(selectedCellColumnRow.getColumn(), selectedCellColumnRow.getRow()); if (curCellElement != null) { @@ -630,7 +638,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous * @param report */ private void setCursorAndToolTips(TemplateCellElement curCellElement, TemplateElementCase report) { - int resolution = ScreenResolution.getScreenResolution(); +// int resolution = ScreenResolution.getScreenResolution(); // 计算相对Grid的显示位置. DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report); DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report); @@ -674,7 +682,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report); DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report); - int resolution = ScreenResolution.getScreenResolution(); +// int resolution = ScreenResolution.getScreenResolution(); double leftColDistance = columnWidthList.getRangeValue(grid.getHorizontalValue(), cs.getColumn()).toPixD(resolution); double rightColDistance = columnWidthList.getRangeValue(grid.getHorizontalValue(), cs.getColumn() + cs.getColumnSpan()).toPixD(resolution); @@ -725,7 +733,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous } else if (isControlDown) { doControlSelectCell(evtX, evtY); } else { - ColumnRow selectedCellPoint = GridUtils.getEventColumnRow(reportPane, evtX, evtY); + ColumnRow selectedCellPoint = GridUtils.getEventColumnRow_withresolution(reportPane, evtX, evtY, resolution); int type = reportPane.ensureColumnRowVisible(selectedCellPoint.getColumn(), selectedCellPoint.getRow()); if (type == ElementCasePane.NO_OVER) { GridUtils.doSelectCell(reportPane, selectedCellPoint.getColumn(), selectedCellPoint.getRow()); @@ -766,7 +774,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous this.oldEvtX = evtX; this.oldEvtY = evtY; FloatElement el = report.getFloatElement(floatName); - int resolution = ScreenResolution.getScreenResolution(); +// int resolution = ScreenResolution.getScreenResolution(); int verticalValue = grid.getVerticalValue(); int horizentalValue = grid.getHorizontalValue(); DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report); diff --git a/designer/src/com/fr/grid/GridRow.java b/designer/src/com/fr/grid/GridRow.java index 5301d5b58..c111c7188 100644 --- a/designer/src/com/fr/grid/GridRow.java +++ b/designer/src/com/fr/grid/GridRow.java @@ -6,8 +6,13 @@ package com.fr.grid; import java.awt.Dimension; import com.fr.base.GraphHelper; +import com.fr.base.ScreenResolution; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.fun.GridUIProcessor; import com.fr.design.mainframe.ElementCasePane; +import javax.swing.plaf.ComponentUI; + /** * GridRow used to paint and edit grid row. * @@ -15,6 +20,9 @@ import com.fr.design.mainframe.ElementCasePane; * @since 2012-3-22下午6:12:03 */ public class GridRow extends GridHeader { + + private int resolution = ScreenResolution.getScreenResolution(); + @Override protected void initByConstructor() { GridRowMouseHandler gridRowMouseHandler = new GridRowMouseHandler(this); @@ -30,9 +38,14 @@ public class GridRow extends GridHeader { @Override public void updateUI() { - this.setUI(new GridRowUI()); + this.setUI(new GridRowUI(resolution)); } + public void setResolution(int resolution) { + this.resolution = resolution; + } + + /** * Gets the preferred size. */ diff --git a/designer/src/com/fr/grid/GridRowUI.java b/designer/src/com/fr/grid/GridRowUI.java index 1bf3c38c4..07df407a7 100644 --- a/designer/src/com/fr/grid/GridRowUI.java +++ b/designer/src/com/fr/grid/GridRowUI.java @@ -15,6 +15,8 @@ import com.fr.base.ScreenResolution; import com.fr.cache.list.IntList; import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.mainframe.GridScaleEdit; +import com.fr.design.mainframe.JSliderPane; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.grid.selection.Selection; import com.fr.privilege.finegrain.ColumnRowPrivilegeControl; @@ -27,6 +29,14 @@ import com.fr.report.elementcase.ElementCase; */ public class GridRowUI extends ComponentUI { private Color detailsBackground = Color.lightGray; + private int resolution ; + + GridRowUI(int resolution){ + if (resolution == 0){ + resolution = ScreenResolution.getScreenResolution(); + } + this.resolution = resolution; + } @Override public void paint(Graphics g, JComponent c) { @@ -49,7 +59,6 @@ public class GridRowUI extends ComponentUI { // paint more rows(double extent), for dragging. int verticalEndValue = verticalValue + verticalExtent + 1; double horizontalLineHeight = size.getHeight(); - int resolution = ScreenResolution.getScreenResolution(); // use background to paint first. // denny: 用来标识已有数据 @@ -149,23 +158,20 @@ public class GridRowUI extends ComponentUI { float fmAscent = GraphHelper.getFontMetrics(gridRow.getFont()).getAscent(); double stringWidth = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getWidth(); double stringHeight = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getHeight(); - // AUGUST:如果高度太小了就不画了 - if (stringHeight <= tmpIncreaseHeight + 2) { - - if (isSelectedBounds) { - g2d.setColor(gridRow.getSelectedForeground()); + if (isSelectedBounds) { + g2d.setColor(gridRow.getSelectedForeground()); + } else { + // p:检查eanbled + if (gridRow.isEnabled()) { + g2d.setColor(gridRow.getForeground()); } else { - // p:检查eanbled - if (gridRow.isEnabled()) { - g2d.setColor(gridRow.getForeground()); - } else { - g2d.setPaint(UIManager.getColor("controlShadow")); - } + g2d.setPaint(UIManager.getColor("controlShadow")); } - - GraphHelper.drawString(g2d, paintText, (size.width - stringWidth) / 2, tmpHeight1 + (tmpIncreaseHeight - stringHeight) / 2 + GridHeader.SIZE_ADJUST / 2 + fmAscent - - 2); } + + GraphHelper.drawString(g2d, paintText, (size.width - stringWidth) / 2, tmpHeight1 + (tmpIncreaseHeight - stringHeight) / 2 + GridHeader.SIZE_ADJUST / 2 + fmAscent + - 2); + } } \ No newline at end of file diff --git a/designer/src/com/fr/grid/GridUI.java b/designer/src/com/fr/grid/GridUI.java index 526f0f074..93ca03f81 100644 --- a/designer/src/com/fr/grid/GridUI.java +++ b/designer/src/com/fr/grid/GridUI.java @@ -429,6 +429,7 @@ public class GridUI extends ComponentUI { this.calculateForcedPagingOfCellElement(reportPane, tmpCellElement, hideWidth, hideHeight); storeFatherLocation(selectedCellElement, tmpCellElement); // element bounds + // TODO: 2017/7/13 tmpRectangle : 72*19 this.caculateScrollVisibleBounds(this.tmpRectangle, tmpCellElement.getColumn(), tmpCellElement.getRow(), tmpCellElement.getColumnSpan(), tmpCellElement.getRowSpan()); @@ -455,8 +456,9 @@ public class GridUI extends ComponentUI { paintCellElementList.add(tmpCellElement); paintCellElementRectangleList.add(this.tmpRectangle.clone()); - int cellWidth = (int) this.tmpRectangle.getWidth(), cellHeight = (int) this.tmpRectangle - .getHeight(); + + int cellWidth = (int) this.tmpRectangle.getWidth(); + int cellHeight = (int) this.tmpRectangle.getHeight(); // denny_Grid: 画Grid中单元格的内容(包括单元格的背景Content + Background), 不包括边框 painter.paintBackground(g2d, report, tmpCellElement, cellWidth, cellHeight); @@ -1077,6 +1079,7 @@ public class GridUI extends ComponentUI { grid.ajustEditorComponentBounds(); // refresh size } + private void dealWithSizeBeforePaint(Grid grid, TemplateElementCase elementCase) { // 取出所有的行高和列宽的List this.rowHeightList = ReportHelper.getRowHeightList(elementCase); diff --git a/designer/src/com/fr/grid/GridUtils.java b/designer/src/com/fr/grid/GridUtils.java index e04c92e20..415f01638 100644 --- a/designer/src/com/fr/grid/GridUtils.java +++ b/designer/src/com/fr/grid/GridUtils.java @@ -6,6 +6,8 @@ import com.fr.design.cell.clipboard.CellElementsClip; import com.fr.design.cell.clipboard.ElementsTransferable; import com.fr.design.cell.clipboard.FloatElementsClip; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.mainframe.GridScaleEdit; +import com.fr.design.mainframe.JSliderPane; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.grid.selection.CellSelection; @@ -48,6 +50,7 @@ public class GridUtils { //peter:下面这几个量是在Drag列的时候用. public final static int DRAG_CELL_SIZE = 1; //peter:drag的时候改变格子的宽度. public final static int DRAG_SELECT_UNITS = 2; //peter:drag的时候,选中单元格. +// public static int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes); /** * Is above float element.(the return may be null).
@@ -67,7 +70,8 @@ public class GridUtils { double[] floatArray = caculateFloatElementLocations(tmpFloatElement, ReportHelper.getColumnWidthList(report), ReportHelper.getRowHeightList(report), reportPane.getGrid().getVerticalValue(), reportPane.getGrid().getHorizontalValue()); - int resolution = ScreenResolution.getScreenResolution(); +// int resolution = ScreenResolution.getScreenResolution(); + int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes); //peter:悬浮元素的范围. Rectangle2D floatElementRect = new Rectangle2D.Double(floatArray[0], floatArray[1], tmpFloatElement.getWidth().toPixD(resolution), tmpFloatElement.getHeight().toPixD(resolution)); //peter:不是当前选中的悬浮元素,不支持六个改变大小的点. @@ -123,8 +127,8 @@ public class GridUtils { */ public static double[] caculateFloatElementLocations(FloatElement floatElement, DynamicUnitList columnWidthList, DynamicUnitList rowHeightList, int verticalValue, int horizentalValue) { - int resolution = ScreenResolution.getScreenResolution(); - +// int resolution = ScreenResolution.getScreenResolution(); + int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes); double floatX = columnWidthList.getRangeValue(horizentalValue, 0).toPixD(resolution) + floatElement.getLeftDistance().toPixD(resolution); double floatY = rowHeightList.getRangeValue(verticalValue, 0).toPixD(resolution) + floatElement.getTopDistance().toPixD(resolution); @@ -166,7 +170,66 @@ public class GridUtils { private static int cc_selected_column_or_row(double mouseEvtPosition, int beginValue, int value, DynamicUnitList sizeList) { double tmpIntIndex = 0; int selectedCellIndex = 0; - int resolution = ScreenResolution.getScreenResolution(); +// int resolution = ScreenResolution.getScreenResolution(); + int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes); + if (mouseEvtPosition < 0) { + selectedCellIndex = value; + for (; true; selectedCellIndex--) { + if (tmpIntIndex < mouseEvtPosition) { + break; + } + tmpIntIndex -= sizeList.get(selectedCellIndex).toPixD(resolution); + + } + } else { + boolean isInnerFrozen = false; + for (int i = beginValue; i < 0; i++) { + tmpIntIndex += sizeList.get(i).toPixD(resolution); + + if (tmpIntIndex > mouseEvtPosition) { + selectedCellIndex = i; + isInnerFrozen = true; + break; + } + } + + if (!isInnerFrozen) { + selectedCellIndex = value; + for (; true; selectedCellIndex++) { + tmpIntIndex += sizeList.get(selectedCellIndex).toPixD(resolution); + if (tmpIntIndex > mouseEvtPosition) { + break; + } + } + } + } + + return selectedCellIndex; + } + + public static ColumnRow getEventColumnRow_withresolution(ElementCasePane reportPane, double evtX, double evtY, int resolution) { + ElementCase report = reportPane.getEditingElementCase(); + + // Width and height list. + DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report); + DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report); + + int verticalValue = reportPane.getGrid().getVerticalValue(); + int horizentalValue = reportPane.getGrid().getHorizontalValue(); + + // denny: get verticalBeginValue and horizontalBeginValue; + int verticalBeginValue = reportPane.getGrid().getVerticalBeginValue(); + int horizontalBeginValue = reportPane.getGrid().getHorizontalBeginValue(); + return ColumnRow.valueOf( + cc_selected_column_or_row_withresolution(evtX, horizontalBeginValue, horizentalValue, columnWidthList, resolution), + cc_selected_column_or_row_withresolution(evtY, verticalBeginValue, verticalValue, rowHeightList, resolution) + ); + } + + private static int cc_selected_column_or_row_withresolution(double mouseEvtPosition, int beginValue, int value, DynamicUnitList sizeList, int resolution) { + double tmpIntIndex = 0; + int selectedCellIndex = 0; +// int resolution = ScreenResolution.getScreenResolution(); if (mouseEvtPosition < 0) { selectedCellIndex = value; for (; true; selectedCellIndex--) { @@ -222,6 +285,16 @@ public class GridUtils { return ColumnRow.valueOf(col, row); } + public static ColumnRow getAdjustEventColumnRow_withresolution(ElementCasePane reportPane, double evtX, double evtY, int resolution) { + ColumnRow selectedCellPoint = GridUtils.getEventColumnRow_withresolution(reportPane, evtX, evtY, resolution); + + int col = Math.max(selectedCellPoint.getColumn(), 0); + int row = Math.max(selectedCellPoint.getRow(), 0); + + + return ColumnRow.valueOf(col, row); + } + /** * 是否可将当前单元格变为可见的格子 */ @@ -395,4 +468,5 @@ public class GridUtils { } } + } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java index 91f9c12fb..ae3b8711b 100644 --- a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java +++ b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java @@ -255,6 +255,11 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta basePane.add(centerPane, BorderLayout.CENTER); laoyoutWestPane(); +// JPanel eastRegionPane = new JPanel(new BorderLayout()); +// eastRegionPane.add(EastRegionContainerPane.getInstance(), BorderLayout.CENTER); +// eastRegionPane.add(JSliderPane.getInstance(), BorderLayout.SOUTH); +// basePane.add(eastRegionPane, BorderLayout.EAST); + basePane.add(EastRegionContainerPane.getInstance(), BorderLayout.EAST); basePane.setBounds(0, 0, contentWidth, contentHeight); diff --git a/designer_base/src/com/fr/design/mainframe/JSliderPane.java b/designer_base/src/com/fr/design/mainframe/JSliderPane.java index 40808db99..e45d6a0a8 100644 --- a/designer_base/src/com/fr/design/mainframe/JSliderPane.java +++ b/designer_base/src/com/fr/design/mainframe/JSliderPane.java @@ -1,23 +1,32 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.ScreenResolution; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.MutilTempalteTabPane; +import com.fr.design.fun.GridUIProcessor; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.islider.UISlider; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.grid.DefaultGridUIProcessor; +import com.fr.grid.Grid; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; +import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicSliderUI; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.math.BigDecimal; +import java.util.Observable; /** * Created by MoMeak on 2017/7/13. @@ -25,6 +34,8 @@ import java.awt.event.ActionListener; public class JSliderPane extends JPanel { private final int KERNING = 2; + public int showValue = 100; + public double resolutionTimes = 1.0; private static JSliderPane THIS; private UITextField showVal; private UISlider slider; @@ -32,11 +43,11 @@ public class JSliderPane extends JPanel { private int sliderValue; private UIButton downButton; private UIButton upButton; - private int showValue; //拖动条处理和button、直接输入不一样 private boolean isButtonOrIsTxt = true; + public JSliderPane() { this.setLayout(new BorderLayout()); slider = new UISlider(0,100,50); @@ -45,7 +56,7 @@ public class JSliderPane extends JPanel { showVal = new UITextField(); showVal.setText("100%"); - + showVal.setPreferredSize(new Dimension(40,18)); showVal.getDocument().addDocumentListener(showValDocumentListener); downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveDown.png")); @@ -55,15 +66,6 @@ public class JSliderPane extends JPanel { downButton.addActionListener(buttonActionListener); upButton.addActionListener(buttonActionListener); -// double f = TableLayout.FILL; -// double p = TableLayout.PREFERRED; -// Component[][] components = new Component[][]{ -// new Component[]{downButton, slider, upButton, showVal}, -// }; -// double[] rowSize = {p}; -// double[] columnSize = {p,p,p,p}; -// JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - JPanel panel = new JPanel(new FlowLayout(1,1,0)); panel.add(downButton); @@ -85,9 +87,10 @@ public class JSliderPane extends JPanel { } public static final JSliderPane getInstance() { - if (THIS == null) { - THIS = new JSliderPane(); - } +// if (THIS == null) { +// THIS = new JSliderPane(); +// } + THIS = new JSliderPane(); return THIS; } @@ -118,6 +121,7 @@ public class JSliderPane extends JPanel { public void insertUpdate(DocumentEvent e) { isButtonOrIsTxt = true; refreshSlider(); + refreshBody(); } @Override @@ -142,7 +146,28 @@ public class JSliderPane extends JPanel { } } - ActionListener buttonActionListener = new ActionListener() { + private void refreshBody(){ + this.resolutionTimes = divide(showValue,100,2); + int resolution = (int) (ScreenResolution.getScreenResolution()*resolutionTimes); + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution); + + } + + public double getResolutionTimes(){ + return this.resolutionTimes; + } + + public int getshowValue(){ + return this.showValue; + } + + public static double divide(double v1, double v2,int scale) { + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + return b1.divide(b2,scale).doubleValue(); + } + + ActionListener buttonActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showValue = Integer.parseInt(showVal.getText().substring(0, showVal.getText().indexOf("%"))); @@ -178,6 +203,10 @@ public class JSliderPane extends JPanel { } + public UITextField getShowVal(){ + return this.showVal; + } + public static void main(String[] args) { JFrame jf = new JFrame("test"); diff --git a/designer_base/src/com/fr/design/mainframe/JTemplate.java b/designer_base/src/com/fr/design/mainframe/JTemplate.java index a275d3d5d..e2aa2433b 100644 --- a/designer_base/src/com/fr/design/mainframe/JTemplate.java +++ b/designer_base/src/com/fr/design/mainframe/JTemplate.java @@ -210,6 +210,10 @@ public abstract class JTemplate> ex */ public abstract void removeParameterPaneSelection(); + public abstract void setScale(int resolution); + + public abstract int getScale(); + protected abstract DesignModelAdapter createDesignModel(); /** diff --git a/designer_form/src/com/fr/design/mainframe/FormArea.java b/designer_form/src/com/fr/design/mainframe/FormArea.java index 51867ba6f..dae7e7c38 100644 --- a/designer_form/src/com/fr/design/mainframe/FormArea.java +++ b/designer_form/src/com/fr/design/mainframe/FormArea.java @@ -20,6 +20,8 @@ import javax.swing.JPanel; import javax.swing.border.LineBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; @@ -45,8 +47,8 @@ import com.fr.general.Inter; public class FormArea extends JComponent implements ScrollRulerComponent { - private static final double SLIDER_FLOAT = 120.0; - private static final double SLIDER_MIN = 60.0; + private static final double SLIDER_FLOAT = 400.0; + private static final double SLIDER_MIN = 10.0; public static final double DEFAULT_SLIDER = 100.0; private static final int ROTATIONS = 50; private FormDesigner designer; @@ -59,11 +61,12 @@ public class FormArea extends JComponent implements ScrollRulerComponent { //显示和设置表单界面大小的控件 private UINumberField widthPane; private UINumberField heightPane; - private UINumberSlidePane slidePane; + private JSliderPane slidePane; private boolean isValid = true; // 初始时滑块值为100,托动后的值设为START_VALUE; private double START_VALUE = DEFAULT_SLIDER; private double screenValue; + private JSliderPane sliderPane; public FormScrollBar getHorScrollBar() { return horScrollBar; @@ -114,8 +117,13 @@ public class FormArea extends JComponent implements ScrollRulerComponent { widthPane.setPreferredSize(new Dimension(60, 0)); heightPane = new UINumberField(); heightPane.setPreferredSize(new Dimension(60, 0)); - slidePane = new UINumberSlidePane(SLIDER_MIN, SLIDER_FLOAT); - slidePane.setPreferredSize(new Dimension(200,0)); + +// slidePane = new UINumberSlidePane(SLIDER_MIN, SLIDER_FLOAT); +// slidePane.setPreferredSize(new Dimension(260,20)); + slidePane = JSliderPane.getInstance(); + slidePane.setPreferredSize(new Dimension(300,20)); + + JPanel resizePane =TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{ {tipsPane, new UILabel(), widthPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel("x"), heightPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel(), slidePane}}, @@ -124,8 +132,8 @@ public class FormArea extends JComponent implements ScrollRulerComponent { setWidgetsConfig(); // 先初始话滑块及对应事件,然后获取分辨率调整容器的显示大小 slidePane.setEnabled(false); - slidePane.setVisible(false); -// initTransparent(); + slidePane.setVisible(true); + initTransparent(); initCalculateSize(); } @@ -143,16 +151,36 @@ public class FormArea extends JComponent implements ScrollRulerComponent { private void initTransparent() { initCalculateSize(); - slidePane.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - double value = ((UINumberSlidePane) e.getSource()).getValue(); - reCalculateRoot(value, true); - JTemplate form = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if(form != null){ - form.fireTargetModified(); - } - } - }); + slidePane.getShowVal().getDocument().addDocumentListener(new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { +// slidePane.getShowVal().getDocument() + double value = slidePane.getshowValue(); + reCalculateRoot(value, true); + JTemplate form = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + if(form != null){ + form.fireTargetModified(); + } + } + + @Override + public void removeUpdate(DocumentEvent e) { + } + + @Override + public void changedUpdate(DocumentEvent e) { + } + }); +// slidePane.addChangeListener(new ChangeListener() { +// public void stateChanged(ChangeEvent e) { +// double value = ((UINumberSlidePane) e.getSource()).getValue(); +// reCalculateRoot(value, true); +// JTemplate form = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); +// if(form != null){ +// form.fireTargetModified(); +// } +// } +// }); } /** diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index ba491e351..c8971264a 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -240,6 +240,16 @@ public class JForm extends JTemplate implements BaseJForm { return; } + @Override + public void setScale(int resolution) { + + } + + @Override + public int getScale() { + return 0; + } + /** * 创建权限细粒度编辑面板 * From 3d04d3d75412c89d354c72ad38cdf669959c999c Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 18 Jul 2017 16:43:13 +0800 Subject: [PATCH 21/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E9=9D=A2=E6=9D=BFtab=E9=A1=B9=E5=8A=A8=E6=80=81=E5=8F=98?= =?UTF-8?q?=E5=8C=96=EF=BC=88=E9=83=A8=E5=88=86=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/ElementCasePane.java | 2 +- .../mainframe/ElementCasePaneDelegate.java | 12 +- .../mainframe/EastRegionContainerPane.java | 158 +++++++++++++++--- .../form/parameter/FormParaDesigner.java | 1 + .../src/com/fr/design/mainframe/JForm.java | 21 +-- 5 files changed, 154 insertions(+), 40 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/ElementCasePane.java b/designer/src/com/fr/design/mainframe/ElementCasePane.java index 52bbc6393..6865c49d0 100644 --- a/designer/src/com/fr/design/mainframe/ElementCasePane.java +++ b/designer/src/com/fr/design/mainframe/ElementCasePane.java @@ -504,7 +504,7 @@ public abstract class ElementCasePane extends Tar */ public void setSelection(Selection selection) { if (!ComparatorUtils.equals(this.selection, selection) || - !ComparatorUtils.equals(EastRegionContainerPane.getInstance().getDownPane(), CellElementPropertyPane.getInstance())) { + !ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())) { this.selection = selection; fireSelectionChanged(); } diff --git a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java index 7fb3132bc..4bb9c6832 100644 --- a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java +++ b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java @@ -4,6 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.design.fun.MenuHandler; import com.fr.design.menu.KeySetUtils; import com.fr.general.Inter; +import com.fr.grid.selection.FloatSelection; import com.fr.page.ReportSettingsProvider; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.DesignState; @@ -56,8 +57,15 @@ public class ElementCasePaneDelegate extends ElementCasePane { QuickEditorRegion.getInstance().populate(getCurrentEditor()); JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (editingTemplate != null && !editingTemplate.isUpMode()) { - EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance()); - EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance()); + if (((ElementCasePaneDelegate)e.getSource()).getSelection() instanceof FloatSelection) { + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT); +// EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance()); + EastRegionContainerPane.getInstance().replaceFloatElementPane(QuickEditorRegion.getInstance()); + } else { + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT); + EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance()); + EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance()); + } EastRegionContainerPane.getInstance().removeParameterPane(); } } diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index 131ed25d2..c661580e4 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -15,9 +15,7 @@ import javax.swing.*; import javax.swing.border.EmptyBorder; import java.awt.*; import java.awt.event.*; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.Map; +import java.util.*; public class EastRegionContainerPane extends UIEastResizableContainer { private static EastRegionContainerPane THIS; @@ -37,6 +35,25 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private static final String KEY_CONDITION_ATTR = "conditionAttr"; private static final String KEY_HYPERLINK = "hyperlink"; private static final String KEY_WIDGET_LIB = "widgetLib"; + private static final String DEFAULT_PANE = "defaultPane"; // "无可用配置项"面板 + + +// public static final String MODE_REPORT = "report"; // 报表模式 +// public static final String MODE_REPORT_PARA = "reportPara"; // 报表参数面板 +// public static final String MODE_FORM = "form"; // 表单模式 +// public static final String MODE_POLY = "poly"; // 聚合报表模式 + public enum PropertyMode { + REPORT, // 报表 + REPORT_PARA, // 报表参数面板 + REPORT_FLOAT, // 报表悬浮元素 + FORM, // 表单 + FORM_REPORT, // 表单报表块 + POLY, // 聚合报表 + POLY_REPORT, // 聚合报表-报表块 + POLY_CHART // 聚合报表-图表块 + } + private PropertyMode currentMode; // 当前模式(根据不同模式,显示不同的可用面板) + /** * 得到实例 @@ -56,28 +73,46 @@ public class EastRegionContainerPane extends UIEastResizableContainer { super(); // setVerticalDragEnabled(false); initPropertyItemList(); - initContentPane(); + switchMode(PropertyMode.REPORT); +// initContentPane(); // super(leftPane, rightPane); setContainerWidth(CONTAINER_WIDTH); } private void initPropertyItemList() { propertyItemMap = new LinkedHashMap<>(); // 有序map - // 单元格元素 - PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, Inter.getLocText("FR-Designer_Cell_Element"), "/com/fr/design/images/buttonicon/add.png"); + PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, Inter.getLocText("FR-Designer_Cell_Element"), + "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY}, + new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); // 单元格属性 - PropertyItem cellAttr = new PropertyItem(KEY_CELL_ATTR, Inter.getLocText("FR-Designer_Cell_Attributes"), "com/fr/design/images/toolbarbtn/close.png"); + PropertyItem cellAttr = new PropertyItem(KEY_CELL_ATTR, Inter.getLocText("FR-Designer_Cell_Attributes"), + "com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY}, + new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); // 悬浮元素 - PropertyItem floatElement = new PropertyItem(KEY_FLOAT_ELEMENT, Inter.getLocText("FR-Designer_Float_Element"), "com/fr/design/images/toolbarbtn/close.png"); + PropertyItem floatElement = new PropertyItem(KEY_FLOAT_ELEMENT, Inter.getLocText("FR-Designer_Float_Element"), + "com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY}, + new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.POLY_REPORT}); // 控件设置 - PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, Inter.getLocText("FR-Designer-Widget_Settings"), "com/fr/design/images/toolbarbtn/close.png"); + PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, Inter.getLocText("FR-Designer-Widget_Settings"), + "com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY}, + new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.FORM, PropertyMode.POLY_REPORT}); // 条件属性 - PropertyItem conditionAttr = new PropertyItem(KEY_CONDITION_ATTR, Inter.getLocText("FR-Designer_Condition_Attributes"), "com/fr/design/images/toolbarbtn/close.png"); + PropertyItem conditionAttr = new PropertyItem(KEY_CONDITION_ATTR, Inter.getLocText("FR-Designer_Condition_Attributes"), + "com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY}, + new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); // 超级链接 - PropertyItem hyperlink = new PropertyItem(KEY_HYPERLINK, Inter.getLocText("FR-Designer_Hyperlink"), "com/fr/design/images/toolbarbtn/close.png"); + PropertyItem hyperlink = new PropertyItem(KEY_HYPERLINK, Inter.getLocText("FR-Designer_Hyperlink"), + "com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY}, + new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); // 组件库 - PropertyItem widgetLib = new PropertyItem(KEY_WIDGET_LIB, Inter.getLocText("FR-Designer_Widget_Library"), "com/fr/design/images/toolbarbtn/close.png"); + PropertyItem widgetLib = new PropertyItem(KEY_WIDGET_LIB, Inter.getLocText("FR-Designer_Widget_Library"), + "com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.FORM}, + new PropertyMode[]{PropertyMode.FORM}); +// // 图表属性设置 +// PropertyItem chartSettings = new PropertyItem(KEY_WIDGET_LIB, Inter.getLocText("FR-Designer_Widget_Library"), +// "com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.FORM}, +// new PropertyMode[]{PropertyMode.FORM}); propertyItemMap.put(KEY_CELL_ELEMENT, cellElement); propertyItemMap.put(KEY_CELL_ATTR, cellAttr); propertyItemMap.put(KEY_FLOAT_ELEMENT, floatElement); @@ -108,14 +143,15 @@ public class EastRegionContainerPane extends UIEastResizableContainer { rightPane.setBackground(Color.green); rightPane.setLayout(propertyCard); for (PropertyItem item : propertyItemMap.values()) { - if (item.isPoppedOut()) { + if (item.isPoppedOut() || !item.isVisible()) { continue; } rightPane.add(item.getName(), item.getPropertyPanel()); } - rightPane.add(getDefaultPane()); + rightPane.add(DEFAULT_PANE, getDefaultPane()); replaceRightPane(rightPane); + refreshRightPane(); } // 左侧按钮面板 @@ -123,7 +159,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { leftPane = new JPanel(); leftPane.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0)); for (PropertyItem item : propertyItemMap.values()) { - if (item.isPoppedOut()) { + if (item.isPoppedOut() || !item.isVisible()) { continue; } leftPane.add(item.getButton()); @@ -134,10 +170,30 @@ public class EastRegionContainerPane extends UIEastResizableContainer { replaceLeftPane(leftPane); } + public void switchMode(PropertyMode mode) { + if (currentMode != null && currentMode.equals(mode)) { + return; + } + currentMode = mode; + updateAllPropertyPane(); + } + + public void updateAllPropertyPane() { + updatePropertyItemMap(); + initContentPane(); + } + + private void updatePropertyItemMap() { + for (PropertyItem item : propertyItemMap.values()) { + item.updateStatus(); + } + } + // 弹出面板时,更新框架内容 private void removeItem(PropertyItem propertyItem) { leftPane.remove(propertyItem.getButton()); rightPane.remove(propertyItem.getPropertyPanel()); + refreshRightPane(); refreshContainer(); } @@ -186,6 +242,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer { return propertyItemMap.get(KEY_CELL_ATTR).getContentPane(); } + public void replaceFloatElementPane(JComponent pane) { + propertyItemMap.get(KEY_FLOAT_ELEMENT).replaceContentPane(pane); + } + + public JComponent getFloatElementPane() { + return propertyItemMap.get(KEY_FLOAT_ELEMENT).getContentPane(); + } + public void replaceWidgetSettingsPane(JComponent pane) { propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceContentPane(pane); } @@ -203,7 +267,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } public void addParameterPane(JComponent paraPane) { - propertyItemMap.get(KEY_HYPERLINK).replaceContentPane(paraPane); +// propertyItemMap.get(KEY_HYPERLINK).replaceContentPane(paraPane); } public void setParameterHeight(int height) { @@ -249,6 +313,18 @@ public class EastRegionContainerPane extends UIEastResizableContainer { * 刷新右面板 */ public void refreshRightPane() { + boolean hasAvailableTab = false; + for (String name : propertyItemMap.keySet()) { + PropertyItem propertyItem = propertyItemMap.get(name); + if (propertyItem.isVisible() && !propertyItem.isPoppedOut() && propertyItem.isEnabled()) { + propertyCard.show(rightPane, name); // 显示第一个可用tab + hasAvailableTab = true; + break; + } + } + if (!hasAvailableTab) { + propertyCard.show(rightPane, DEFAULT_PANE); + } // if (this.getRightPane() instanceof DockingView) { // ((DockingView) this.getRightPane()).refreshDockingView(); @@ -275,7 +351,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { class PropertyItem { - // private UIButton button; private UIButton button; private String name; // 用于 card 切换 private String title; // 用于显示 @@ -284,21 +359,54 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private FixedPopupPane popupPane; // 左侧固定弹出框 private PopupToolPane popupToolPane; // 弹出工具条 private PopupDialog popupDialog; // 弹出框 - private int x, y; // 弹出框的坐标 - private int height; // 弹出框的高度 private boolean isPoppedOut = false; // 是否弹出 - private Dimension fixedSize; + private boolean isVisible = true; // 是否可见 + private boolean isEnabled = true; // 是否可用 + private Set visibleModes; + private Set enableModes; - public PropertyItem(String name, String title, String btnUrl) { + public PropertyItem(String name, String title, String btnUrl, PropertyMode[] visibleModes, PropertyMode[] enableModes) { this.name = name; this.title = title; initButton(btnUrl); initPropertyPanel(); +// this.visibleModes = new ArrayList(visibleModes); + initModes(visibleModes, enableModes); + } + + private void initModes(PropertyMode[] visibleModes, PropertyMode[] enableModes) { + this.enableModes = new HashSet<>(); + this.visibleModes = new HashSet<>(); + for (PropertyMode enableMode : enableModes) { + this.enableModes.add(enableMode); + } + for (PropertyMode visibleMode : visibleModes) { + this.visibleModes.add(visibleMode); + } + this.visibleModes.addAll(this.enableModes); // 可用必可见 + } + + public void updateStatus() { + setEnabled(enableModes.contains(currentMode)); + setVisible(visibleModes.contains(currentMode)); + } + + public boolean isVisible() { + return isVisible; + } + + public void setVisible(boolean isVisible) { + this.isVisible = isVisible; + } + + public boolean isEnabled() { + return isEnabled; } // 选项不可用 - public void setEnabled(boolean enabled) { - button.setEnabled(enabled); + public void setEnabled(boolean isEnabled) { + this.isEnabled = isEnabled; + button.setEnabled(isEnabled); } private void initPropertyPanel() { @@ -311,10 +419,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyPanel.add(contentPane, BorderLayout.CENTER); } - public void setIsPoppedOut(boolean isPoppedOut) { - this.isPoppedOut = isPoppedOut; - } - public boolean isPoppedOut() { return isPoppedOut; } diff --git a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java index 1327823bb..73ca39f2e 100644 --- a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java @@ -109,6 +109,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP */ public void initBeforeUpEdit() { WidgetToolBarPane.getInstance(this); + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA); EastRegionContainerPane.getInstance().replaceWidgetLibPane( FormWidgetDetailPane.getInstance(this)); if (!BaseUtils.isAuthorityEditing()) { diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index ba491e351..d5f1229a2 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -257,12 +257,12 @@ public class JForm extends JTemplate implements BaseJForm { return; } editingComponent = comp.createToolPane(this, formDesign); + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM); if (BaseUtils.isAuthorityEditing()) { - EastRegionContainerPane.getInstance().replaceUpPane( + EastRegionContainerPane.getInstance().replaceWidgetSettingsPane( ComparatorUtils.equals(editingComponent.getClass(), NoSupportAuthorityEdit.class) ? editingComponent : createAuthorityEditPane()); } else { - EastRegionContainerPane.getInstance().replaceUpPane(editingComponent); - + EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(editingComponent); } } @@ -617,17 +617,19 @@ public class JForm extends JTemplate implements BaseJForm { if (formDesign.isReportBlockEditing()) { if (elementCaseDesign != null) { + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM_REPORT); EastRegionContainerPane.getInstance().removeParameterPane(); - EastRegionContainerPane.getInstance().replaceDownPane(elementCaseDesign.getEastDownPane()); - EastRegionContainerPane.getInstance().replaceUpPane(elementCaseDesign.getEastUpPane()); + EastRegionContainerPane.getInstance().replaceCellAttrPane(elementCaseDesign.getEastDownPane()); + EastRegionContainerPane.getInstance().replaceCellElementPane(elementCaseDesign.getEastUpPane()); return; } } - EastRegionContainerPane.getInstance().replaceUpPane(WidgetPropertyPane.getInstance(formDesign)); + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM); + EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(WidgetPropertyPane.getInstance(formDesign)); EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(formDesign)); EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(formDesign).getPreferredSize().height); - if (EastRegionContainerPane.getInstance().getDownPane() == null) { + if (EastRegionContainerPane.getInstance().getWidgetLibPane() == null) { new Thread() { public void run() { try { @@ -638,15 +640,14 @@ public class JForm extends JTemplate implements BaseJForm { JPanel pane = new JPanel(); pane.setLayout(new BorderLayout()); pane.add(FormWidgetDetailPane.getInstance(formDesign), BorderLayout.CENTER); - EastRegionContainerPane.getInstance().replaceDownPane(pane); + EastRegionContainerPane.getInstance().replaceWidgetLibPane(pane); } }.start(); } else { JPanel pane = new JPanel(); pane.setLayout(new BorderLayout()); pane.add(FormWidgetDetailPane.getInstance(formDesign), BorderLayout.CENTER); - EastRegionContainerPane.getInstance().replaceDownPane(pane); - + EastRegionContainerPane.getInstance().replaceWidgetLibPane(pane); } } From 49e4850a0018be0257ffa53f84a2bc9b5e38448e Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 18 Jul 2017 17:30:20 +0800 Subject: [PATCH 22/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E9=9D=A2=E6=9D=BFtab=E9=A1=B9=E5=8A=A8=E6=80=81=E5=8F=98?= =?UTF-8?q?=E5=8C=96=EF=BC=88=E8=81=9A=E5=90=88=E6=8A=A5=E8=A1=A8=E9=83=A8?= =?UTF-8?q?=E5=88=86=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/JWorkBook.java | 3 ++- designer/src/com/fr/poly/PolyDesigner.java | 9 ++++--- .../com/fr/poly/creator/ECBlockEditor.java | 2 +- .../mainframe/EastRegionContainerPane.java | 26 +++++++------------ 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/JWorkBook.java b/designer/src/com/fr/design/mainframe/JWorkBook.java index fd4cd7b0d..2708eea5f 100644 --- a/designer/src/com/fr/design/mainframe/JWorkBook.java +++ b/designer/src/com/fr/design/mainframe/JWorkBook.java @@ -746,7 +746,8 @@ public class JWorkBook extends JTemplate { if (delegate4ToolbarMenuAdapter() instanceof PolyDesigner) { PolyDesigner polyDesigner = (PolyDesigner) delegate4ToolbarMenuAdapter(); if (polyDesigner.getSelectionType() == PolyDesigner.SelectionType.NONE || polyDesigner.getSelection() == null) { - EastRegionContainerPane.getInstance().replaceDownPane(new JPanel()); + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY); +// EastRegionContainerPane.getInstance().replaceDownPane(new JPanel()); QuickEditorRegion.getInstance().populate(QuickEditor.DEFAULT_EDITOR); } else { EastRegionContainerPane.getInstance().replaceDownPane(CellElementPropertyPane.getInstance()); diff --git a/designer/src/com/fr/poly/PolyDesigner.java b/designer/src/com/fr/poly/PolyDesigner.java index 66cdcecb7..faa15a946 100644 --- a/designer/src/com/fr/poly/PolyDesigner.java +++ b/designer/src/com/fr/poly/PolyDesigner.java @@ -842,11 +842,14 @@ public class PolyDesigner extends ReportComponent { } QuickEditorRegion.getInstance().populate(editComponent.getCurrentEditor()); CellElementPropertyPane.getInstance().populate(editComponent); - EastRegionContainerPane.getInstance().replaceDownPane(CellElementPropertyPane.getInstance()); + EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance()); } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index c661580e4..6e3de8e18 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -37,11 +37,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private static final String KEY_WIDGET_LIB = "widgetLib"; private static final String DEFAULT_PANE = "defaultPane"; // "无可用配置项"面板 - -// public static final String MODE_REPORT = "report"; // 报表模式 -// public static final String MODE_REPORT_PARA = "reportPara"; // 报表参数面板 -// public static final String MODE_FORM = "form"; // 表单模式 -// public static final String MODE_POLY = "poly"; // 聚合报表模式 public enum PropertyMode { REPORT, // 报表 REPORT_PARA, // 报表参数面板 @@ -83,36 +78,33 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyItemMap = new LinkedHashMap<>(); // 有序map // 单元格元素 PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, Inter.getLocText("FR-Designer_Cell_Element"), - "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY}, + "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); // 单元格属性 PropertyItem cellAttr = new PropertyItem(KEY_CELL_ATTR, Inter.getLocText("FR-Designer_Cell_Attributes"), - "com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY}, + "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); // 悬浮元素 PropertyItem floatElement = new PropertyItem(KEY_FLOAT_ELEMENT, Inter.getLocText("FR-Designer_Float_Element"), - "com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY}, + "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.POLY_REPORT}); // 控件设置 PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, Inter.getLocText("FR-Designer-Widget_Settings"), - "com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY}, - new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.FORM, PropertyMode.POLY_REPORT}); + "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY}, + new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART}); // 条件属性 PropertyItem conditionAttr = new PropertyItem(KEY_CONDITION_ATTR, Inter.getLocText("FR-Designer_Condition_Attributes"), - "com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY}, + "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); // 超级链接 PropertyItem hyperlink = new PropertyItem(KEY_HYPERLINK, Inter.getLocText("FR-Designer_Hyperlink"), - "com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY}, + "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); // 组件库 PropertyItem widgetLib = new PropertyItem(KEY_WIDGET_LIB, Inter.getLocText("FR-Designer_Widget_Library"), - "com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.FORM}, + "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.FORM}, new PropertyMode[]{PropertyMode.FORM}); -// // 图表属性设置 -// PropertyItem chartSettings = new PropertyItem(KEY_WIDGET_LIB, Inter.getLocText("FR-Designer_Widget_Library"), -// "com/fr/design/images/toolbarbtn/close.png", new PropertyMode[]{PropertyMode.FORM}, -// new PropertyMode[]{PropertyMode.FORM}); + propertyItemMap.put(KEY_CELL_ELEMENT, cellElement); propertyItemMap.put(KEY_CELL_ATTR, cellAttr); propertyItemMap.put(KEY_FLOAT_ELEMENT, floatElement); From 4525ae72c9dfdb75117b85e004abd36081c281ad Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 18 Jul 2017 21:14:49 +0800 Subject: [PATCH 23/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E9=9D=A2=E6=9D=BFtab=E9=A1=B9=E5=8A=A8=E6=80=81=E5=8F=98?= =?UTF-8?q?=E5=8C=96=EF=BC=88=E6=9D=83=E9=99=90=E7=BC=96=E8=BE=91=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/ElementCasePaneDelegate.java | 5 +-- .../fr/design/mainframe/JPolyWorkBook.java | 5 +++ .../com/fr/design/mainframe/JWorkBook.java | 7 +++++ .../actions/AllowAuthorityEditAction.java | 2 +- .../com/fr/design/locale/designer.properties | 1 + .../design/locale/designer_en_US.properties | 1 + .../design/locale/designer_ja_JP.properties | 3 +- .../design/locale/designer_ko_KR.properties | 3 +- .../design/locale/designer_zh_CN.properties | 1 + .../design/locale/designer_zh_TW.properties | 1 + .../fr/design/mainframe/DesignerFrame.java | 5 +-- .../mainframe/EastRegionContainerPane.java | 31 ++++++++++++++++++- .../com/fr/design/mainframe/JTemplate.java | 3 ++ .../com/fr/design/roleAuthority/RoleTree.java | 2 +- .../src/com/fr/design/mainframe/JForm.java | 4 +++ 15 files changed, 63 insertions(+), 11 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java index 4bb9c6832..433628209 100644 --- a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java +++ b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java @@ -48,8 +48,9 @@ public class ElementCasePaneDelegate extends ElementCasePane { if (BaseUtils.isAuthorityEditing()) { AuthorityPropertyPane authorityPropertyPane = new AuthorityPropertyPane(ElementCasePaneDelegate.this); authorityPropertyPane.populate(); - EastRegionContainerPane.getInstance().replaceUpPane(authorityPropertyPane); - EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance()); + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION); + EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(authorityPropertyPane); + EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); return; } diff --git a/designer/src/com/fr/design/mainframe/JPolyWorkBook.java b/designer/src/com/fr/design/mainframe/JPolyWorkBook.java index aa5a727e8..4f949f5df 100644 --- a/designer/src/com/fr/design/mainframe/JPolyWorkBook.java +++ b/designer/src/com/fr/design/mainframe/JPolyWorkBook.java @@ -38,4 +38,9 @@ public class JPolyWorkBook extends JWorkBook { public SheetNameTabPane createSheetNameTabPane(ReportComponentComposite reportCompositeX){ return new PolySheetNameTabPane(reportCompositeX); } + + @Override + public void refreshEastPropertiesPane() { + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY); + } } \ No newline at end of file diff --git a/designer/src/com/fr/design/mainframe/JWorkBook.java b/designer/src/com/fr/design/mainframe/JWorkBook.java index 2708eea5f..819d3f132 100644 --- a/designer/src/com/fr/design/mainframe/JWorkBook.java +++ b/designer/src/com/fr/design/mainframe/JWorkBook.java @@ -102,6 +102,13 @@ public class JWorkBook extends JTemplate { populateReportParameterAttr(); } + @Override + public void refreshEastPropertiesPane() { + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT); + EastRegionContainerPane.getInstance().replaceCellElementPane(getEastUpPane()); + EastRegionContainerPane.getInstance().replaceCellAttrPane(getEastDownPane()); + } + @Override protected UIModeControlContainer createCenterPane() { parameterPane = ModuleContext.isModuleStarted(Module.FORM_MODULE) ? new ParameterDefinitePane() : null; diff --git a/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java b/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java index 4a79a2d98..4d7369205 100644 --- a/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java +++ b/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java @@ -1 +1 @@ -package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.*; /** * Author : daisy * Date: 13-8-30 * Time: 上午10:12 */ public class AllowAuthorityEditAction extends TemplateComponentAction { public AllowAuthorityEditAction(TargetComponent t) { super(t); this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png")); } /** * 撤销 */ public void prepare4Undo() { HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState(); } /** * 执行动作 * * @return 是否执行成功 */ public boolean executeActionReturnUndoRecordNeeded() { TargetComponent tc = getEditingComponent(); if (tc == null) { return false; } cleanAuthorityCondition(); //进入时是格式刷则取消格式刷 if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { tc.cancelFormat(); } BaseUtils.setAuthorityEditing(true); ReportAndFSManagePane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().refreshDockingView(); WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance()); DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY); DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); DesignerContext.getDesignerFrame().needToAddAuhtorityPaint(); EastRegionContainerPane.getInstance().replaceUpPane(tc.getEastUpPane()); DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); //画虚线 return true; } /** * 进入权限编辑之前将权限编辑界面重置一下工具栏 */ private void cleanAuthorityCondition() { java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); for (int i = 0; i < opendedTemplate.size(); i++) { opendedTemplate.get(i).cleanAuthorityUndo(); } } } \ No newline at end of file +package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.*; /** * Author : daisy * Date: 13-8-30 * Time: 上午10:12 */ public class AllowAuthorityEditAction extends TemplateComponentAction { public AllowAuthorityEditAction(TargetComponent t) { super(t); this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png")); } /** * 撤销 */ public void prepare4Undo() { HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState(); } /** * 执行动作 * * @return 是否执行成功 */ public boolean executeActionReturnUndoRecordNeeded() { TargetComponent tc = getEditingComponent(); if (tc == null) { return false; } cleanAuthorityCondition(); //进入时是格式刷则取消格式刷 if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { tc.cancelFormat(); } BaseUtils.setAuthorityEditing(true); ReportAndFSManagePane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().refreshDockingView(); WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance()); DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY); DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); DesignerContext.getDesignerFrame().needToAddAuhtorityPaint(); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION); EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(tc.getEastUpPane()); DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); //画虚线 return true; } /** * 进入权限编辑之前将权限编辑界面重置一下工具栏 */ private void cleanAuthorityCondition() { java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); for (int i = 0; i < opendedTemplate.size(); i++) { opendedTemplate.get(i).cleanAuthorityUndo(); } } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index cf38d99b5..0e51b4c21 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -2010,3 +2010,4 @@ FR-Designer_Cell_Attributes=Cell Attributes FR-Designer_Float_Element=Float Element FR-Designer_Widget_Library=Widget Library FR-Designer_No_Settings_Available=No Settings Available! +FR-Designer_Configured_Roles=Configured role diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties index 83ac59ba1..296dcbe7a 100644 --- a/designer_base/src/com/fr/design/locale/designer_en_US.properties +++ b/designer_base/src/com/fr/design/locale/designer_en_US.properties @@ -2010,3 +2010,4 @@ FR-Designer_Cell_Attributes=Cell Attributes FR-Designer_Float_Element=Float Element FR-Designer_Widget_Library=Widget Library FR-Designer_No_Settings_Available=No Settings Available! +FR-Designer_Configured_Roles=Configured role diff --git a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties index 3d037b05e..03514583a 100644 --- a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties +++ b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties @@ -1986,4 +1986,5 @@ FR-Designer_Cell_Element=\u30BB\u30EB\u8981\u7D20 FR-Designer_Cell_Attributes=\u30BB\u30EB\u5C5E\u6027 FR-Designer_Float_Element=\u30D5\u30ED\u30FC\u30C8\u8981\u7D20 FR-Designer_Widget_Library= -FR-Designer_No_Settings_Available= \ No newline at end of file +FR-Designer_No_Settings_Available= +FR-Designer_Configured_Roles=\u69CB\u6210\u3055\u308C\u305F\u5F79\u5272 \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties index a561e99a6..cafc02022 100644 --- a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties +++ b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties @@ -1986,4 +1986,5 @@ FR-Designer_Cell_Element=\uC140\uC694\uC18C FR-Designer_Cell_Attributes=\uC140\uC18D\uC131 FR-Designer_Float_Element=\uD638\uBC84\uC694\uC18C FR-Designer_Widget_Library= -FR-Designer_No_Settings_Available= \ No newline at end of file +FR-Designer_No_Settings_Available= +FR-Designer_Configured_Roles=\uC5ED\uD560\uC774\uAD6C\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index c487655cb..1675df05e 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -2008,3 +2008,4 @@ FR-Designer_Cell_Attributes=\u5355\u5143\u683C\u5C5E\u6027 FR-Designer_Float_Element=\u60AC\u6D6E\u5143\u7D20 FR-Designer_Widget_Library=\u7EC4\u4EF6\u5E93 FR-Designer_No_Settings_Available=\u65E0\u53EF\u7528\u914D\u7F6E\u9879\uFF01 +FR-Designer_Configured_Roles=\u5DF2\u914D\u7F6E\u89D2\u8272 diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index 848b2f05e..269d4e2e4 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties @@ -2009,3 +2009,4 @@ FR-Designer_Cell_Attributes=\u5132\u5B58\u683C\u5C6C\u6027 FR-Designer_Float_Element=\u61F8\u6D6E\u5143\u7D20 FR-Designer_Widget_Library=\u7D44\u4EF6\u5EAB FR-Designer_No_Settings_Available=\u7121\u53EF\u7528\u914D\u5BD8\u9805\uFF01 +FR-Designer_Configured_Roles=\u5DF2\u914D\u7F6E\u89D2\u8272 diff --git a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java index 91f9c12fb..19e71ec8e 100644 --- a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java +++ b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java @@ -421,10 +421,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta BaseUtils.setAuthorityEditing(false); WestRegionContainerPane.getInstance().replaceDownPane( TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); - EastRegionContainerPane.getInstance().replaceUpPane( - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getEastUpPane()); - EastRegionContainerPane.getInstance().replaceDownPane( - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getEastDownPane()); + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); DesignerContext.getDesignerFrame().resetToolkitByPlus( HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus()); needToAddAuhtorityPaint(); diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index 6e3de8e18..9aaa4f6fb 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -35,6 +35,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private static final String KEY_CONDITION_ATTR = "conditionAttr"; private static final String KEY_HYPERLINK = "hyperlink"; private static final String KEY_WIDGET_LIB = "widgetLib"; + private static final String KEY_AUTHORITY_EDITION = "authorityEdition"; + private static final String KEY_CONFIGURED_ROLES = "editedRoles"; private static final String DEFAULT_PANE = "defaultPane"; // "无可用配置项"面板 public enum PropertyMode { @@ -45,7 +47,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { FORM_REPORT, // 表单报表块 POLY, // 聚合报表 POLY_REPORT, // 聚合报表-报表块 - POLY_CHART // 聚合报表-图表块 + POLY_CHART, // 聚合报表-图表块 + AUTHORITY_EDITION // 权限编辑 } private PropertyMode currentMode; // 当前模式(根据不同模式,显示不同的可用面板) @@ -104,6 +107,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer { PropertyItem widgetLib = new PropertyItem(KEY_WIDGET_LIB, Inter.getLocText("FR-Designer_Widget_Library"), "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.FORM}, new PropertyMode[]{PropertyMode.FORM}); + // 权限编辑 + PropertyItem authorityEdition = new PropertyItem(KEY_AUTHORITY_EDITION, Inter.getLocText("FR-Designer_Permissions_Edition"), + "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.AUTHORITY_EDITION}, + new PropertyMode[]{PropertyMode.AUTHORITY_EDITION}); + // 已配置角色 + PropertyItem configuredRoles = new PropertyItem(KEY_CONFIGURED_ROLES, Inter.getLocText("FR-Designer_Configured_Roles"), + "/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.AUTHORITY_EDITION}, + new PropertyMode[]{PropertyMode.AUTHORITY_EDITION}); propertyItemMap.put(KEY_CELL_ELEMENT, cellElement); propertyItemMap.put(KEY_CELL_ATTR, cellAttr); @@ -112,6 +123,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyItemMap.put(KEY_CONDITION_ATTR, conditionAttr); propertyItemMap.put(KEY_HYPERLINK, hyperlink); propertyItemMap.put(KEY_WIDGET_LIB, widgetLib); + propertyItemMap.put(KEY_AUTHORITY_EDITION, authorityEdition); + propertyItemMap.put(KEY_CONFIGURED_ROLES, configuredRoles); } // "无可用配置项"面板 @@ -258,6 +271,22 @@ public class EastRegionContainerPane extends UIEastResizableContainer { return propertyItemMap.get(KEY_WIDGET_LIB).getContentPane(); } + public void replaceAuthorityEditionPane(JComponent pane) { + propertyItemMap.get(KEY_AUTHORITY_EDITION).replaceContentPane(pane); + } + + public JComponent getAuthorityEditionPane() { + return propertyItemMap.get(KEY_AUTHORITY_EDITION).getContentPane(); + } + + public void replaceConfiguredRolesPane(JComponent pane) { + propertyItemMap.get(KEY_CONFIGURED_ROLES).replaceContentPane(pane); + } + + public JComponent getConfiguredRolesPane() { + return propertyItemMap.get(KEY_CONFIGURED_ROLES).getContentPane(); + } + public void addParameterPane(JComponent paraPane) { // propertyItemMap.get(KEY_HYPERLINK).replaceContentPane(paraPane); } diff --git a/designer_base/src/com/fr/design/mainframe/JTemplate.java b/designer_base/src/com/fr/design/mainframe/JTemplate.java index a275d3d5d..e8a835baa 100644 --- a/designer_base/src/com/fr/design/mainframe/JTemplate.java +++ b/designer_base/src/com/fr/design/mainframe/JTemplate.java @@ -109,6 +109,9 @@ public abstract class JTemplate> ex } } + // 刷新右侧属性面板 + public abstract void refreshEastPropertiesPane(); + // 为收集模版信息作准备 private void initForCollect() { template.initTemplateID(); // 为新模板设置 templateID 属性 diff --git a/designer_base/src/com/fr/design/roleAuthority/RoleTree.java b/designer_base/src/com/fr/design/roleAuthority/RoleTree.java index 1af8c1caa..ce6102fe3 100644 --- a/designer_base/src/com/fr/design/roleAuthority/RoleTree.java +++ b/designer_base/src/com/fr/design/roleAuthority/RoleTree.java @@ -1 +1 @@ -package com.fr.design.roleAuthority; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.itree.checkboxtree.CheckBoxTree; import com.fr.design.gui.itree.checkboxtree.CheckBoxTreeSelectionModel; import com.fr.general.NameObject; import com.fr.design.constants.UIConstants; import com.fr.design.beans.BasicBeanPane; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.UserObjectRefreshJTree; import com.fr.design.mainframe.AuthorityPropertyPane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import javax.swing.SwingUtilities; import javax.swing.JTree; import javax.swing.JComponent; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreePath; import java.awt.Component; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; /** * Author : daisy * Time: 下午3:32 * Date: 13-8-30 */ public class RoleTree extends UserObjectRefreshJTree { private static final long serialVersionUID = 2L; private String roleName = null; public RoleTree() { super(); this.setCellRenderer(roleTreeRenderer); this.setEnabled(true); this.setEditable(true); this.setRowHeight(20); this.setDigIn(true); Handler handler = createHandlerForRoleTree(); this.replaceMouseListener(this, handler, 0); this.replaceKeyListener(this, handler, 0); this.addTreeSelectionListener(handler); // this.removeMouseListener(treeMouseListener); // this.addTreeSelectionListener(new TreeSelectionListener() { // public void valueChanged(TreeSelectionEvent e) { // doWithValueChanged(e); // } // }); } public boolean isCheckBoxVisible(TreePath path) { return true; } /** * Creates the mouse listener and key listener used by RoleTree. * * @return the Handler. */ protected Handler createHandlerForRoleTree() { return new Handler(this); } protected static class Handler implements MouseListener, KeyListener, TreeSelectionListener { protected RoleTree _tree; int _hotspot = new UICheckBox().getPreferredSize().width; private int _toggleCount = -1; public Handler(RoleTree tree) { _tree = tree; } protected TreePath getTreePathForMouseEvent(MouseEvent e) { if (!SwingUtilities.isLeftMouseButton(e)) { return null; } if (!_tree.isCheckBoxEnabled()) { return null; } TreePath path = _tree.getPathForLocation(e.getX(), e.getY()); if (path == null) { return null; } // if (clicksInCheckBox(e, path)) { return path; // } else { // return null; // } } // protected boolean clicksInCheckBox(MouseEvent e, TreePath path) { // if (!_tree.isCheckBoxVisible(path)) { // return false; // } else { // Rectangle bounds = _tree.getPathBounds(path); // if (_tree.getComponentOrientation().isLeftToRight()) { // return e.getX() < bounds.x + _hotspot; // } else { // return e.getX() > bounds.x + bounds.width - _hotspot; // } // } // } private TreePath preventToggleEvent(MouseEvent e) { TreePath pathForMouseEvent = getTreePathForMouseEvent(e); if (pathForMouseEvent != null) { int toggleCount = _tree.getToggleClickCount(); if (toggleCount != -1) { _toggleCount = toggleCount; _tree.setToggleClickCount(-1); } } return pathForMouseEvent; } public void mouseClicked(MouseEvent e) { preventToggleEvent(e); } public void mousePressed(MouseEvent e) { TreePath path = preventToggleEvent(e); if (path != null) { toggleSelection(path); e.consume(); } } public void mouseReleased(MouseEvent e) { TreePath path = preventToggleEvent(e); if (path != null) { e.consume(); } if (_toggleCount != -1) { _tree.setToggleClickCount(_toggleCount); } } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void keyPressed(KeyEvent e) { if (e.isConsumed()) { return; } if (!_tree.isCheckBoxEnabled()) { return; } if (e.getModifiers() == 0 && e.getKeyChar() == KeyEvent.VK_SPACE) { toggleSelections(); } } public void keyTyped(KeyEvent e) { } public void keyReleased(KeyEvent e) { } public void valueChanged(TreeSelectionEvent e) { _tree.treeDidChange(); _tree.doWithValueChanged(e); } private void toggleSelection(TreePath path) { if (!_tree.isEnabled() || !_tree.isCheckBoxEnabled(path)) { return; } CheckBoxTreeSelectionModel selectionModel = _tree.getCheckBoxTreeSelectionModel(); boolean selected = selectionModel.isPathSelected(path, selectionModel.isDigIn()); selectionModel.removeTreeSelectionListener(this); try { if (!selectionModel.isSingleEventMode()) { selectionModel.setBatchMode(true); } if (selected) selectionModel.removeSelectionPath(path); else selectionModel.addSelectionPath(path); } finally { if (!selectionModel.isSingleEventMode()) { selectionModel.setBatchMode(false); } selectionModel.addTreeSelectionListener(this); _tree.treeDidChange(); _tree.doWithValueChanged(path); } } protected void toggleSelections() { TreePath[] treePaths = _tree.getSelectionPaths(); if (treePaths == null) { return; } for (int i = 0, length = treePaths.length; i < length; i++) { TreePath tmpTreePath = treePaths[i]; toggleSelection(tmpTreePath); } // for (TreePath treePath : treePaths) { // toggleSelection(treePath); // } } } /** * 更新UI */ public void updateUI() { super.updateUI(); setUI(new UIRoleTreeUI()); } /** * @param e 选中事件 */ protected void doWithValueChanged(TreeSelectionEvent e) { if (e.getNewLeadSelectionPath() != null) { if (!e.getNewLeadSelectionPath().getLastPathComponent().toString().equals(Inter.getLocText("FR-Designer_Role"))) { roleName = e.getNewLeadSelectionPath().getLastPathComponent().toString(); setTabRoleName(roleName); refreshRoleTree(roleName); refreshElementAndAuthorityPane(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().judgeSheetAuthority(roleName); } } } /** * @param treepath 所选的节点路径 */ protected void doWithValueChanged(TreePath treepath) { if (treepath != null && !treepath.getLastPathComponent().toString().equals(Inter.getLocText("FR-Designer_Role"))) { roleName = treepath.getLastPathComponent().toString(); setTabRoleName(roleName); refreshRoleTree(roleName); refreshElementAndAuthorityPane(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().judgeSheetAuthority(roleName); } } protected void setTabRoleName(String roleName) { } /** * 刷新角色树 * * @param selectedRole 角色 */ public void refreshRoleTree(String selectedRole) { if (EastRegionContainerPane.getInstance().getUpPane() instanceof AuthorityPropertyPane) { AuthorityPropertyPane authorityPropertyPane = (AuthorityPropertyPane) EastRegionContainerPane.getInstance().getUpPane(); authorityPropertyPane.populate(); EastRegionContainerPane.getInstance().replaceUpPane(authorityPropertyPane); } } public void setSelectedRole(String selectedRole, TreePath parent) { ExpandMutableTreeNode node = (ExpandMutableTreeNode) parent.getLastPathComponent(); if (node.children() != null && node.getChildCount() >= 0) { for (Enumeration e = node.children(); e.hasMoreElements(); ) { ExpandMutableTreeNode n = (ExpandMutableTreeNode) e.nextElement(); Object userObj = n.getUserObject(); String chilld = null; if (userObj instanceof String) { chilld = (String) userObj; } else if (userObj instanceof NameObject) { NameObject nameObject = (NameObject) userObj; chilld = nameObject.getName(); } if (ComparatorUtils.equals(chilld, selectedRole)) { this.setSelectionPath(parent.pathByAddingChild(n)); return; } else { setSelectedRole(selectedRole, parent.pathByAddingChild(n)); } } } } private void refreshElementAndAuthorityPane() { JComponent authorityToolBar = DesignerContext.getDesignerFrame().getToolbarComponent(); if (authorityToolBar instanceof BasicBeanPane) { //说明是工具栏的 ((BasicBeanPane) authorityToolBar).populateAuthority(); } HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().repaint(); } public String getSelectedRoleName() { return roleName; } public void setSelectedRoleName(String name) { roleName = name; } private DefaultTreeCellRenderer roleTreeRenderer = new DefaultTreeCellRenderer() { private static final long serialVersionUID = 2L; public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); ExpandMutableTreeNode treeNode = (ExpandMutableTreeNode) value; Object userObj = treeNode.getUserObject(); if (userObj instanceof String) { // p:这个是column field. this.setIcon(null); this.setText((String) userObj); } else if (userObj instanceof NameObject) { NameObject nameObject = (NameObject) userObj; this.setText(nameObject.getName()); this.setIcon(null); } // 这里新建一个Label作为render是因为JTree在动态刷新的时候,节点上render画布的的宽度不会变,会使得一部分比较长的数据显示为"..." this.setBackgroundNonSelectionColor(UIConstants.NORMAL_BACKGROUND); this.setForeground(UIConstants.FONT_COLOR); this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE); return this; } }; /** * 去除不需要的鼠标监听器 * * @param component 组件 * @param l 所需的鼠标监听器 * @param index 插入的索引 */ private void replaceMouseListener(Component component, MouseListener l, int index) { component.removeMouseListener(treeMouseListener); MouseListener[] listeners = component.getMouseListeners(); for (int i = 0, length = listeners.length; i < length; i++) { component.removeMouseListener(listeners[i]); } // for (MouseListener listener : listeners) { // component.removeMouseListener(listener); // } for (int i = 0; i < listeners.length; i++) { MouseListener listener = listeners[i]; if (index == i) { component.addMouseListener(l); } if (listener instanceof CheckBoxTree.Handler) { continue; } component.addMouseListener(listener); } // index is too large, add to the end. if (index > listeners.length - 1) { component.addMouseListener(l); } } /** * 去除一些不需要的键盘监听器 * * @param component 组件 * @param l 所需的键盘监听器 * @param index 插入的索引 */ private void replaceKeyListener(Component component, KeyListener l, int index) { KeyListener[] listeners = component.getKeyListeners(); for (int i = 0, length = listeners.length; i < length; i++) { component.removeKeyListener(listeners[i]); } // for (MouseListener listener : listeners) { // component.removeMouseListener(listener); // } for (int i = 0; i < listeners.length; i++) { KeyListener listener = listeners[i]; if (index == i) { component.addKeyListener(l); } if (listener instanceof CheckBoxTree.Handler) { continue; } component.addKeyListener(listener); } // index is too large, add to the end. if (index > listeners.length - 1) { component.addKeyListener(l); } } /* * p:获得选中的NameObject = name + role. */ public NameObject getSelectedNameObject() { TreePath selectedTreePath = this.getSelectionPath(); if (selectedTreePath == null) { return null; } ExpandMutableTreeNode selectedTreeNode = (ExpandMutableTreeNode) selectedTreePath.getLastPathComponent(); Object selectedUserObject = selectedTreeNode.getUserObject(); return new NameObject(selectedUserObject.toString(), ""); } /** * p:添加一个NameObject节点 * * @param no 需要添加的节点 */ public void addNameObject(NameObject no) { if (no == null) { return; } DefaultTreeModel treeModel = (DefaultTreeModel) this.getModel(); // 新建一个放着NameObject的newChildTreeNode,加到Root下面 ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot(); ExpandMutableTreeNode newChildTreeNode = new ExpandMutableTreeNode(no); root.add(newChildTreeNode); newChildTreeNode.add(new ExpandMutableTreeNode()); treeModel.reload(root); } /** * 刷新树节点 */ public void refreshTreeNode() { DefaultTreeModel treeModel = (DefaultTreeModel) this.getModel(); ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot(); if (interceptRefresh(root)) { return; } ExpandMutableTreeNode[] new_nodes = loadChildTreeNodes(root); List childTreeNodeList = new ArrayList(); for (int i = 0, len = root.getChildCount(); i < len; i++) { if (root.getChildAt(i) instanceof ExpandMutableTreeNode) { childTreeNodeList.add((ExpandMutableTreeNode) root.getChildAt(i)); } else { childTreeNodeList.add((DefaultMutableTreeNode) root.getChildAt(i)); } } root.removeAllChildren(); for (int ci = 0; ci < new_nodes.length; ci++) { Object cUserObject = new_nodes[ci].getUserObject(); for (int ni = 0, nlen = childTreeNodeList.size(); ni < nlen; ni++) { ExpandMutableTreeNode cTreeNode = (ExpandMutableTreeNode) childTreeNodeList.get(ni); if (ComparatorUtils.equals(cTreeNode.getUserObject(), cUserObject)) { new_nodes[ci].setExpanded(cTreeNode.isExpanded()); if (cTreeNode.getFirstChild() instanceof ExpandMutableTreeNode && cTreeNode.isExpanded()) { checkChildNodes(cTreeNode, new_nodes[ci]); } break; } } root.add(new_nodes[ci]); } } protected void checkChildNodes(ExpandMutableTreeNode oldNode, ExpandMutableTreeNode newNode) { for (int i = 0; i < oldNode.getChildCount(); i++) { ExpandMutableTreeNode oldChild = (ExpandMutableTreeNode) oldNode.getChildAt(i); for (int j = 0; j < newNode.getChildCount(); j++) { ExpandMutableTreeNode newChild = (ExpandMutableTreeNode) newNode.getChildAt(j); ExpandMutableTreeNode[] nodes = RoleTree.this.loadChildTreeNodes(newChild); for (int k = 0; k < nodes.length; k++) { newChild.add(nodes[k]); } if (newChild.getChildCount() > 1 && ((ExpandMutableTreeNode) newChild.getFirstChild()).getUserObject() == PENDING) { newChild.remove(0); } if (ComparatorUtils.equals(oldChild.getUserObject(), newChild.getUserObject())) { newChild.setExpanded(oldChild.isExpanded()); } } } } public NameObject getRealSelectedNameObject() { TreePath selectedTreePath = this.getSelectionPath(); if (selectedTreePath == null) { return null; } ExpandMutableTreeNode selectedTreeNode = (ExpandMutableTreeNode) selectedTreePath.getLastPathComponent(); Object selectedUserObject = selectedTreeNode.getUserObject(); if (selectedUserObject instanceof NameObject) { return (NameObject) selectedUserObject; } selectedTreeNode = (ExpandMutableTreeNode) selectedTreeNode.getParent(); selectedUserObject = selectedTreeNode.getUserObject(); if (selectedUserObject instanceof NameObject) { return (NameObject) selectedUserObject; } return null; } } \ No newline at end of file +package com.fr.design.roleAuthority; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.itree.checkboxtree.CheckBoxTree; import com.fr.design.gui.itree.checkboxtree.CheckBoxTreeSelectionModel; import com.fr.general.NameObject; import com.fr.design.constants.UIConstants; import com.fr.design.beans.BasicBeanPane; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.UserObjectRefreshJTree; import com.fr.design.mainframe.AuthorityPropertyPane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import javax.swing.SwingUtilities; import javax.swing.JTree; import javax.swing.JComponent; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreePath; import java.awt.Component; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; /** * Author : daisy * Time: 下午3:32 * Date: 13-8-30 */ public class RoleTree extends UserObjectRefreshJTree { private static final long serialVersionUID = 2L; private String roleName = null; public RoleTree() { super(); this.setCellRenderer(roleTreeRenderer); this.setEnabled(true); this.setEditable(true); this.setRowHeight(20); this.setDigIn(true); Handler handler = createHandlerForRoleTree(); this.replaceMouseListener(this, handler, 0); this.replaceKeyListener(this, handler, 0); this.addTreeSelectionListener(handler); // this.removeMouseListener(treeMouseListener); // this.addTreeSelectionListener(new TreeSelectionListener() { // public void valueChanged(TreeSelectionEvent e) { // doWithValueChanged(e); // } // }); } public boolean isCheckBoxVisible(TreePath path) { return true; } /** * Creates the mouse listener and key listener used by RoleTree. * * @return the Handler. */ protected Handler createHandlerForRoleTree() { return new Handler(this); } protected static class Handler implements MouseListener, KeyListener, TreeSelectionListener { protected RoleTree _tree; int _hotspot = new UICheckBox().getPreferredSize().width; private int _toggleCount = -1; public Handler(RoleTree tree) { _tree = tree; } protected TreePath getTreePathForMouseEvent(MouseEvent e) { if (!SwingUtilities.isLeftMouseButton(e)) { return null; } if (!_tree.isCheckBoxEnabled()) { return null; } TreePath path = _tree.getPathForLocation(e.getX(), e.getY()); if (path == null) { return null; } // if (clicksInCheckBox(e, path)) { return path; // } else { // return null; // } } // protected boolean clicksInCheckBox(MouseEvent e, TreePath path) { // if (!_tree.isCheckBoxVisible(path)) { // return false; // } else { // Rectangle bounds = _tree.getPathBounds(path); // if (_tree.getComponentOrientation().isLeftToRight()) { // return e.getX() < bounds.x + _hotspot; // } else { // return e.getX() > bounds.x + bounds.width - _hotspot; // } // } // } private TreePath preventToggleEvent(MouseEvent e) { TreePath pathForMouseEvent = getTreePathForMouseEvent(e); if (pathForMouseEvent != null) { int toggleCount = _tree.getToggleClickCount(); if (toggleCount != -1) { _toggleCount = toggleCount; _tree.setToggleClickCount(-1); } } return pathForMouseEvent; } public void mouseClicked(MouseEvent e) { preventToggleEvent(e); } public void mousePressed(MouseEvent e) { TreePath path = preventToggleEvent(e); if (path != null) { toggleSelection(path); e.consume(); } } public void mouseReleased(MouseEvent e) { TreePath path = preventToggleEvent(e); if (path != null) { e.consume(); } if (_toggleCount != -1) { _tree.setToggleClickCount(_toggleCount); } } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void keyPressed(KeyEvent e) { if (e.isConsumed()) { return; } if (!_tree.isCheckBoxEnabled()) { return; } if (e.getModifiers() == 0 && e.getKeyChar() == KeyEvent.VK_SPACE) { toggleSelections(); } } public void keyTyped(KeyEvent e) { } public void keyReleased(KeyEvent e) { } public void valueChanged(TreeSelectionEvent e) { _tree.treeDidChange(); _tree.doWithValueChanged(e); } private void toggleSelection(TreePath path) { if (!_tree.isEnabled() || !_tree.isCheckBoxEnabled(path)) { return; } CheckBoxTreeSelectionModel selectionModel = _tree.getCheckBoxTreeSelectionModel(); boolean selected = selectionModel.isPathSelected(path, selectionModel.isDigIn()); selectionModel.removeTreeSelectionListener(this); try { if (!selectionModel.isSingleEventMode()) { selectionModel.setBatchMode(true); } if (selected) selectionModel.removeSelectionPath(path); else selectionModel.addSelectionPath(path); } finally { if (!selectionModel.isSingleEventMode()) { selectionModel.setBatchMode(false); } selectionModel.addTreeSelectionListener(this); _tree.treeDidChange(); _tree.doWithValueChanged(path); } } protected void toggleSelections() { TreePath[] treePaths = _tree.getSelectionPaths(); if (treePaths == null) { return; } for (int i = 0, length = treePaths.length; i < length; i++) { TreePath tmpTreePath = treePaths[i]; toggleSelection(tmpTreePath); } // for (TreePath treePath : treePaths) { // toggleSelection(treePath); // } } } /** * 更新UI */ public void updateUI() { super.updateUI(); setUI(new UIRoleTreeUI()); } /** * @param e 选中事件 */ protected void doWithValueChanged(TreeSelectionEvent e) { if (e.getNewLeadSelectionPath() != null) { if (!e.getNewLeadSelectionPath().getLastPathComponent().toString().equals(Inter.getLocText("FR-Designer_Role"))) { roleName = e.getNewLeadSelectionPath().getLastPathComponent().toString(); setTabRoleName(roleName); refreshRoleTree(roleName); refreshElementAndAuthorityPane(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().judgeSheetAuthority(roleName); } } } /** * @param treepath 所选的节点路径 */ protected void doWithValueChanged(TreePath treepath) { if (treepath != null && !treepath.getLastPathComponent().toString().equals(Inter.getLocText("FR-Designer_Role"))) { roleName = treepath.getLastPathComponent().toString(); setTabRoleName(roleName); refreshRoleTree(roleName); refreshElementAndAuthorityPane(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().judgeSheetAuthority(roleName); } } protected void setTabRoleName(String roleName) { } /** * 刷新角色树 * * @param selectedRole 角色 */ public void refreshRoleTree(String selectedRole) { if (EastRegionContainerPane.getInstance().getAuthorityEditionPane() instanceof AuthorityPropertyPane) { AuthorityPropertyPane authorityPropertyPane = (AuthorityPropertyPane) EastRegionContainerPane.getInstance().getAuthorityEditionPane(); authorityPropertyPane.populate(); EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(authorityPropertyPane); } } public void setSelectedRole(String selectedRole, TreePath parent) { ExpandMutableTreeNode node = (ExpandMutableTreeNode) parent.getLastPathComponent(); if (node.children() != null && node.getChildCount() >= 0) { for (Enumeration e = node.children(); e.hasMoreElements(); ) { ExpandMutableTreeNode n = (ExpandMutableTreeNode) e.nextElement(); Object userObj = n.getUserObject(); String chilld = null; if (userObj instanceof String) { chilld = (String) userObj; } else if (userObj instanceof NameObject) { NameObject nameObject = (NameObject) userObj; chilld = nameObject.getName(); } if (ComparatorUtils.equals(chilld, selectedRole)) { this.setSelectionPath(parent.pathByAddingChild(n)); return; } else { setSelectedRole(selectedRole, parent.pathByAddingChild(n)); } } } } private void refreshElementAndAuthorityPane() { JComponent authorityToolBar = DesignerContext.getDesignerFrame().getToolbarComponent(); if (authorityToolBar instanceof BasicBeanPane) { //说明是工具栏的 ((BasicBeanPane) authorityToolBar).populateAuthority(); } HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().repaint(); } public String getSelectedRoleName() { return roleName; } public void setSelectedRoleName(String name) { roleName = name; } private DefaultTreeCellRenderer roleTreeRenderer = new DefaultTreeCellRenderer() { private static final long serialVersionUID = 2L; public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); ExpandMutableTreeNode treeNode = (ExpandMutableTreeNode) value; Object userObj = treeNode.getUserObject(); if (userObj instanceof String) { // p:这个是column field. this.setIcon(null); this.setText((String) userObj); } else if (userObj instanceof NameObject) { NameObject nameObject = (NameObject) userObj; this.setText(nameObject.getName()); this.setIcon(null); } // 这里新建一个Label作为render是因为JTree在动态刷新的时候,节点上render画布的的宽度不会变,会使得一部分比较长的数据显示为"..." this.setBackgroundNonSelectionColor(UIConstants.NORMAL_BACKGROUND); this.setForeground(UIConstants.FONT_COLOR); this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE); return this; } }; /** * 去除不需要的鼠标监听器 * * @param component 组件 * @param l 所需的鼠标监听器 * @param index 插入的索引 */ private void replaceMouseListener(Component component, MouseListener l, int index) { component.removeMouseListener(treeMouseListener); MouseListener[] listeners = component.getMouseListeners(); for (int i = 0, length = listeners.length; i < length; i++) { component.removeMouseListener(listeners[i]); } // for (MouseListener listener : listeners) { // component.removeMouseListener(listener); // } for (int i = 0; i < listeners.length; i++) { MouseListener listener = listeners[i]; if (index == i) { component.addMouseListener(l); } if (listener instanceof CheckBoxTree.Handler) { continue; } component.addMouseListener(listener); } // index is too large, add to the end. if (index > listeners.length - 1) { component.addMouseListener(l); } } /** * 去除一些不需要的键盘监听器 * * @param component 组件 * @param l 所需的键盘监听器 * @param index 插入的索引 */ private void replaceKeyListener(Component component, KeyListener l, int index) { KeyListener[] listeners = component.getKeyListeners(); for (int i = 0, length = listeners.length; i < length; i++) { component.removeKeyListener(listeners[i]); } // for (MouseListener listener : listeners) { // component.removeMouseListener(listener); // } for (int i = 0; i < listeners.length; i++) { KeyListener listener = listeners[i]; if (index == i) { component.addKeyListener(l); } if (listener instanceof CheckBoxTree.Handler) { continue; } component.addKeyListener(listener); } // index is too large, add to the end. if (index > listeners.length - 1) { component.addKeyListener(l); } } /* * p:获得选中的NameObject = name + role. */ public NameObject getSelectedNameObject() { TreePath selectedTreePath = this.getSelectionPath(); if (selectedTreePath == null) { return null; } ExpandMutableTreeNode selectedTreeNode = (ExpandMutableTreeNode) selectedTreePath.getLastPathComponent(); Object selectedUserObject = selectedTreeNode.getUserObject(); return new NameObject(selectedUserObject.toString(), ""); } /** * p:添加一个NameObject节点 * * @param no 需要添加的节点 */ public void addNameObject(NameObject no) { if (no == null) { return; } DefaultTreeModel treeModel = (DefaultTreeModel) this.getModel(); // 新建一个放着NameObject的newChildTreeNode,加到Root下面 ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot(); ExpandMutableTreeNode newChildTreeNode = new ExpandMutableTreeNode(no); root.add(newChildTreeNode); newChildTreeNode.add(new ExpandMutableTreeNode()); treeModel.reload(root); } /** * 刷新树节点 */ public void refreshTreeNode() { DefaultTreeModel treeModel = (DefaultTreeModel) this.getModel(); ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot(); if (interceptRefresh(root)) { return; } ExpandMutableTreeNode[] new_nodes = loadChildTreeNodes(root); List childTreeNodeList = new ArrayList(); for (int i = 0, len = root.getChildCount(); i < len; i++) { if (root.getChildAt(i) instanceof ExpandMutableTreeNode) { childTreeNodeList.add((ExpandMutableTreeNode) root.getChildAt(i)); } else { childTreeNodeList.add((DefaultMutableTreeNode) root.getChildAt(i)); } } root.removeAllChildren(); for (int ci = 0; ci < new_nodes.length; ci++) { Object cUserObject = new_nodes[ci].getUserObject(); for (int ni = 0, nlen = childTreeNodeList.size(); ni < nlen; ni++) { ExpandMutableTreeNode cTreeNode = (ExpandMutableTreeNode) childTreeNodeList.get(ni); if (ComparatorUtils.equals(cTreeNode.getUserObject(), cUserObject)) { new_nodes[ci].setExpanded(cTreeNode.isExpanded()); if (cTreeNode.getFirstChild() instanceof ExpandMutableTreeNode && cTreeNode.isExpanded()) { checkChildNodes(cTreeNode, new_nodes[ci]); } break; } } root.add(new_nodes[ci]); } } protected void checkChildNodes(ExpandMutableTreeNode oldNode, ExpandMutableTreeNode newNode) { for (int i = 0; i < oldNode.getChildCount(); i++) { ExpandMutableTreeNode oldChild = (ExpandMutableTreeNode) oldNode.getChildAt(i); for (int j = 0; j < newNode.getChildCount(); j++) { ExpandMutableTreeNode newChild = (ExpandMutableTreeNode) newNode.getChildAt(j); ExpandMutableTreeNode[] nodes = RoleTree.this.loadChildTreeNodes(newChild); for (int k = 0; k < nodes.length; k++) { newChild.add(nodes[k]); } if (newChild.getChildCount() > 1 && ((ExpandMutableTreeNode) newChild.getFirstChild()).getUserObject() == PENDING) { newChild.remove(0); } if (ComparatorUtils.equals(oldChild.getUserObject(), newChild.getUserObject())) { newChild.setExpanded(oldChild.isExpanded()); } } } } public NameObject getRealSelectedNameObject() { TreePath selectedTreePath = this.getSelectionPath(); if (selectedTreePath == null) { return null; } ExpandMutableTreeNode selectedTreeNode = (ExpandMutableTreeNode) selectedTreePath.getLastPathComponent(); Object selectedUserObject = selectedTreeNode.getUserObject(); if (selectedUserObject instanceof NameObject) { return (NameObject) selectedUserObject; } selectedTreeNode = (ExpandMutableTreeNode) selectedTreeNode.getParent(); selectedUserObject = selectedTreeNode.getUserObject(); if (selectedUserObject instanceof NameObject) { return (NameObject) selectedUserObject; } return null; } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index d5f1229a2..85730fd4f 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -88,6 +88,10 @@ public class JForm extends JTemplate implements BaseJForm { super(form, file); } + @Override + public void refreshEastPropertiesPane() { + } + public int getMenuState() { return DesignState.JFORM; From e08c971d3ffe587c9ee7f74c3d33271706cec511 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Tue, 18 Jul 2017 23:30:54 +0800 Subject: [PATCH 24/32] =?UTF-8?q?REPORT-2897=209.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E4=BF=AE=E6=94=B9=20=E7=BC=A9=E6=94=BE=E6=9D=A1?= =?UTF-8?q?=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/grid/GridColumnUI.java | 8 ++++---- .../src/com/fr/design/mainframe/JSliderPane.java | 12 +++++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/designer/src/com/fr/grid/GridColumnUI.java b/designer/src/com/fr/grid/GridColumnUI.java index eb625eabe..292c38a0a 100644 --- a/designer/src/com/fr/grid/GridColumnUI.java +++ b/designer/src/com/fr/grid/GridColumnUI.java @@ -163,11 +163,11 @@ public class GridColumnUI extends ComponentUI { } double stringWidth = gridColumn.getFont().getStringBounds(columnContent, fontRenderContext).getWidth(); - if (stringWidth > tmpIncreaseWidth) { - paintMoreContent(i, g2d, tmpWidth1, size, tmpIncreaseWidth, isSelectedBounds, gridColumn, elementCase, columnContent, stringWidth, fmAscent); - } else { +// if (stringWidth > tmpIncreaseWidth) { +// paintMoreContent(i, g2d, tmpWidth1, size, tmpIncreaseWidth, isSelectedBounds, gridColumn, elementCase, columnContent, stringWidth, fmAscent); +// } else { paintNormalContent(i, g2d, tmpWidth1, tmpIncreaseWidth, isSelectedBounds, gridColumn, elementCase, columnContent, stringWidth, fmAscent); - } +// } } diff --git a/designer_base/src/com/fr/design/mainframe/JSliderPane.java b/designer_base/src/com/fr/design/mainframe/JSliderPane.java index e45d6a0a8..b4c879289 100644 --- a/designer_base/src/com/fr/design/mainframe/JSliderPane.java +++ b/designer_base/src/com/fr/design/mainframe/JSliderPane.java @@ -107,6 +107,7 @@ public class JSliderPane extends JPanel { public void run() { sliderValue = slider.getValue(); getTimes(sliderValue); + showValue = times; showVal.setText(times + "%"); } }); @@ -120,6 +121,7 @@ public class JSliderPane extends JPanel { @Override public void insertUpdate(DocumentEvent e) { isButtonOrIsTxt = true; + resolutionTimes = divide(showValue,100,2); refreshSlider(); refreshBody(); } @@ -147,9 +149,9 @@ public class JSliderPane extends JPanel { } private void refreshBody(){ - this.resolutionTimes = divide(showValue,100,2); - int resolution = (int) (ScreenResolution.getScreenResolution()*resolutionTimes); - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution); + +// int resolution = (int) (ScreenResolution.getScreenResolution()*resolutionTimes); +// HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution); } @@ -175,16 +177,20 @@ public class JSliderPane extends JPanel { if(e.getActionCommand().equals("less")){ int newDownVal = showValue - 10; if (newDownVal >= 10 ){ + showValue = newDownVal; showVal.setText(newDownVal + "%"); }else { + showValue = newDownVal; showVal.setText(10 + "%"); } } if(e.getActionCommand().equals("more")){ int newUpVal = showValue + 10; if (newUpVal <= 400 ){ + showValue = newUpVal; showVal.setText(newUpVal + "%"); }else { + showValue = newUpVal; showVal.setText(400 + "%"); } } From cb344ec64ae32d72b372f84c93a00927864e49d4 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Tue, 18 Jul 2017 23:31:53 +0800 Subject: [PATCH 25/32] =?UTF-8?q?REPORT-2897=209.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E4=BF=AE=E6=94=B9=20=E7=BC=A9=E6=94=BE=E6=9D=A1?= =?UTF-8?q?=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_form/src/com/fr/design/mainframe/FormArea.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormArea.java b/designer_form/src/com/fr/design/mainframe/FormArea.java index dae7e7c38..51a18c696 100644 --- a/designer_form/src/com/fr/design/mainframe/FormArea.java +++ b/designer_form/src/com/fr/design/mainframe/FormArea.java @@ -155,7 +155,9 @@ public class FormArea extends JComponent implements ScrollRulerComponent { @Override public void insertUpdate(DocumentEvent e) { // slidePane.getShowVal().getDocument() - double value = slidePane.getshowValue(); + double value = Integer.parseInt(slidePane.getShowVal().getText().substring(0, slidePane.getShowVal().getText().indexOf("%"))); + value = value>400 ? 400 : value; + value = value<10 ? 10 : value; reCalculateRoot(value, true); JTemplate form = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if(form != null){ From bc2ab1dbe94ab32e1580f7427cc5c955ad4c88f8 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 18 Jul 2017 21:23:45 +0800 Subject: [PATCH 26/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E5=B7=A6=E4=BE=A7?= =?UTF-8?q?=E5=8F=AF=E4=BC=B8=E7=BC=A9=E9=9D=A2=E6=9D=BF=E6=94=B9=E5=9B=9E?= =?UTF-8?q?=E5=8E=9F=E6=9C=89=E8=AE=BE=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/icontainer/UIResizableContainer.java | 177 +++--------------- 1 file changed, 21 insertions(+), 156 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java index 0c8633fbd..96eccfc59 100644 --- a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -5,6 +5,7 @@ import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.DesignerContext; import com.fr.stable.Constants; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.stable.collections.utils.MathUtils; import javax.swing.*; import java.awt.*; @@ -18,9 +19,7 @@ public class UIResizableContainer extends JPanel { private int containerWidth = 240; private int preferredWidth = 240; private int toolPaneY = 300; - private int toolPaneHeightRight = 20; private int toolPaneHeight = 10; - private int clickToolPaneHeight = 40; private int bottomHeight = 30; private JComponent upPane; @@ -29,7 +28,7 @@ public class UIResizableContainer extends JPanel { private JComponent parameterPane = new JPanel(); private HorizotalToolPane horizontToolPane; - private VerticalToolPaneRight verticalToolPane; + private VerticalToolPane verticalToolPane; private int direction; private boolean hasParameterPane; @@ -46,7 +45,7 @@ public class UIResizableContainer extends JPanel { private boolean isDownPaneVisible = true ; private int paraHeight; - public UIResizableContainer(int direction) { + public UIResizableContainer(int direction) { this(new JPanel(), new JPanel(), direction); } @@ -80,12 +79,13 @@ public class UIResizableContainer extends JPanel { public UIResizableContainer(JComponent upPane, JComponent downPane, int direction) { setBackground(UIConstants.NORMAL_BACKGROUND); + this.upPane = upPane; this.direction = direction; this.downPane = downPane; this.horizontToolPane = new HorizotalToolPane(); - this.verticalToolPane = new VerticalToolPaneRight(); + this.verticalToolPane = new VerticalToolPane(); setLayout(containerLayout); add(upPane); @@ -94,23 +94,6 @@ public class UIResizableContainer extends JPanel { add(verticalToolPane); } - public static void main(String... args) { - JFrame jf = new JFrame("test"); - jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - JPanel content = (JPanel) jf.getContentPane(); - content.setLayout(new BorderLayout()); - - UIResizableContainer bb = new UIResizableContainer(1); - JPanel cc = new JPanel(); - cc.setBackground(Color.white); - - content.add(bb, BorderLayout.EAST); - content.add(cc, BorderLayout.CENTER); - GUICoreUtils.centerWindow(jf); - jf.setSize(500, 500); - jf.setVisible(true); - } - public UIResizableContainer(JComponent upPane, int direction) { setBackground(UIConstants.NORMAL_BACKGROUND); @@ -118,17 +101,17 @@ public class UIResizableContainer extends JPanel { this.direction = direction; this.horizontToolPane = new HorizotalToolPane(); - setLayout(containerLayout); add(upPane); add(horizontToolPane); + } public void setDownPane(JComponent downPane) { if (this.downPane != null){ return; } - this.verticalToolPane = new VerticalToolPaneRight(); + this.verticalToolPane = new VerticalToolPane(); this.downPane = downPane; add(downPane); add(verticalToolPane); @@ -249,11 +232,6 @@ public class UIResizableContainer extends JPanel { upPane.setBounds(toolPaneHeight, getParameterPaneHeight(), containerWidth - toolPaneHeight, getHeight() - getParameterPaneHeight()); verticalToolPane.setBounds(0, 0, toolPaneHeight, getHeight()); } - }else { - parameterPane.setBounds(20, 0, 230, getParameterPaneHeight());//10,0,230,462 - upPane.setBounds(0, toolPaneHeightRight, containerWidth, getHeight() - toolPaneHeightRight);//20,0,230,0 - verticalToolPane.setBounds(0, 0, containerWidth, toolPaneHeightRight);//0,0,10,462 - } } @@ -510,7 +488,6 @@ public class UIResizableContainer extends JPanel { public void paint(Graphics g) { Image button; if (direction == Constants.RIGHT) { -// g.drawImage(UIConstants.DRAG_BAR, 0, 0, toolPaneHeight, getHeight(), null); g.drawImage(UIConstants.DRAG_BAR, 0, 0, toolPaneHeight, getHeight(), null); if (containerWidth == toolPaneHeight) { if (model == UIConstants.MODEL_NORMAL) { @@ -549,134 +526,22 @@ public class UIResizableContainer extends JPanel { } } - private class VerticalToolPaneRight extends JPanel { - private int model = UIConstants.MODEL_NORMAL; - - public VerticalToolPaneRight() { - super(); - addMouseMotionListener(new MouseMotionListener() { - - @Override - public void mouseMoved(MouseEvent e) { - if (e.getY() <= ARROW_RANGE_VERTICAL) { - setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - model = UIConstants.MODEL_PRESS; - } else if (isLeftRightDragEnabled) { - setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR)); - } - repaint(); - } - - @Override - public void mouseDragged(MouseEvent e) { - if (!isLeftRightDragEnabled) { - return; - } - upPane.setVisible(true); - downPane.setVisible(true); - if (direction == Constants.RIGHT) { - containerWidth = e.getXOnScreen() - UIResizableContainer.this.getLocationOnScreen().x; - } else if (direction == Constants.LEFT) { - containerWidth = UIResizableContainer.this.getWidth() + (UIResizableContainer.this.getLocationOnScreen().x - e.getXOnScreen()); - } - - containerWidth = containerWidth > MAX_WIDTH ? MAX_WIDTH : containerWidth; - containerWidth = containerWidth < MIN_WIDTH ? MIN_WIDTH : containerWidth; - if (containerWidth < MIN_WIDTH) { - upPane.setVisible(false); - downPane.setVisible(false); - containerWidth = toolPaneHeight; - } - refreshContainer(); - if (BaseUtils.isAuthorityEditing()) { - DesignerContext.getDesignerFrame().doResize(); - } - - - } - }); - addMouseListener(new MouseAdapter() { - @Override - public void mouseEntered(MouseEvent e) { - if (!isLeftRightDragEnabled) { - return; - } - setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR)); - } - - @Override - public void mouseExited(MouseEvent e) { - setCursor(Cursor.getDefaultCursor()); - model = UIConstants.MODEL_NORMAL; - repaint(); - } - - @Override - public void mouseClicked(MouseEvent e) { - if (e.getY() <= ARROW_RANGE_VERTICAL) { - if (containerWidth == clickToolPaneHeight) { - containerWidth = preferredWidth; - } else { - setPreferredWidth(containerWidth); - containerWidth = clickToolPaneHeight; - } - refreshContainer(); - if (BaseUtils.isAuthorityEditing()) { - DesignerContext.getDesignerFrame().doResize(); - } - } - } - }); - } - - @Override - public void paint(Graphics g) { - Image button; - if (direction == Constants.RIGHT) { - g.drawImage(UIConstants.DRAG_BAR, 0, 0, toolPaneHeight, getHeight(), null); - if (containerWidth == toolPaneHeight) { - if (model == UIConstants.MODEL_NORMAL) { - button = UIConstants.DRAG_RIGHT_NORMAL; - } else { - button = UIConstants.DRAG_RIGHT_PRESS; - } - } else { - if (model == UIConstants.MODEL_NORMAL) { - button = UIConstants.DRAG_LEFT_NORMAL; - } else { - button = UIConstants.DRAG_LEFT_PRESS; - } - } - g.drawImage(button, 3, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null); - if (isLeftRightDragEnabled) { - g.drawImage(UIConstants.DRAG_DOT_VERTICAL, 2, getHeight() / 2, 5, toolPaneHeight, null); - } - } else { - g.drawImage(UIConstants.DRAG_BAR, 0, 0, containerWidth, toolPaneHeightRight, null); -// g.drawImage(UIConstants.DRAG_BAR, 0, 0, toolPaneHeight, getHeight(), null); - if (containerWidth == clickToolPaneHeight) { - if (model == UIConstants.MODEL_NORMAL) { - button = UIConstants.DRAG_LEFT_NORMAL; - } else { - button = UIConstants.DRAG_LEFT_PRESS; - } - } else { - if (model == UIConstants.MODEL_NORMAL) { - button = UIConstants.DRAG_RIGHT_NORMAL; - } else { - button = UIConstants.DRAG_RIGHT_PRESS; - } - } -// g.drawImage(button, 2, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null); - g.drawImage(button, 14, 7, 5, 5, null); - } - - } - } - /** * 主函数 * @param args 参数 */ - + public static void main(String... args) { + JFrame jf = new JFrame("test"); + jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + JPanel content = (JPanel) jf.getContentPane(); + content.setLayout(new BorderLayout()); + UIResizableContainer bb = new UIResizableContainer(Constants.RIGHT); + JPanel cc = new JPanel(); + cc.setBackground(Color.blue); + content.add(bb, BorderLayout.EAST); + content.add(cc, BorderLayout.CENTER); + GUICoreUtils.centerWindow(jf); + jf.setSize(500, 500); + jf.setVisible(true); + } } \ No newline at end of file From 9336b661737b03e3f7f358b7bd62fb286e6fa901 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Wed, 19 Jul 2017 11:17:05 +0800 Subject: [PATCH 27/32] =?UTF-8?q?REPORT-2897=209.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E4=BF=AE=E6=94=B9=20=E7=BC=A9=E6=94=BE=E6=9D=A1?= =?UTF-8?q?=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/JSliderPane.java | 100 +++++++++++++++--- 1 file changed, 83 insertions(+), 17 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/JSliderPane.java b/designer_base/src/com/fr/design/mainframe/JSliderPane.java index b4c879289..c2d163643 100644 --- a/designer_base/src/com/fr/design/mainframe/JSliderPane.java +++ b/designer_base/src/com/fr/design/mainframe/JSliderPane.java @@ -1,30 +1,21 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; -import com.fr.base.ScreenResolution; -import com.fr.design.ExtraDesignClassManager; -import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.file.MutilTempalteTabPane; -import com.fr.design.fun.GridUIProcessor; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.islider.UISlider; import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.grid.DefaultGridUIProcessor; -import com.fr.grid.Grid; +import com.fr.general.Inter; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicSliderUI; import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; +import java.awt.event.*; import java.math.BigDecimal; import java.util.Observable; @@ -45,7 +36,8 @@ public class JSliderPane extends JPanel { private UIButton upButton; //拖动条处理和button、直接输入不一样 private boolean isButtonOrIsTxt = true; - + private boolean isDialogOut = false; // 是否弹出 + private Dialog dialog; public JSliderPane() { @@ -58,6 +50,7 @@ public class JSliderPane extends JPanel { showVal.setText("100%"); showVal.setPreferredSize(new Dimension(40,18)); showVal.getDocument().addDocumentListener(showValDocumentListener); +// showVal.addMouseListener(showValMouseListener); downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveDown.png")); upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveUp.png")); @@ -72,7 +65,6 @@ public class JSliderPane extends JPanel { panel.add(slider); panel.add(upButton); panel.add(showVal); - // JPanel panel = new JPanel(null); // panel.add(downButton); // panel.add(slider); @@ -83,7 +75,7 @@ public class JSliderPane extends JPanel { // upButton.setBounds(176+KERNING*2,0,16,16); // showVal.setBounds(192+KERNING*3,0,40,16); this.add(panel,BorderLayout.NORTH); - this.setBounds(0,0,260,16); + this.setBounds(0,0,300,16); } public static final JSliderPane getInstance() { @@ -137,6 +129,33 @@ public class JSliderPane extends JPanel { } }; + MouseListener showValMouseListener = new MouseListener() { + @Override + public void mouseClicked(MouseEvent e) { + popupDialog(); + } + + @Override + public void mousePressed(MouseEvent e) { + + } + + @Override + public void mouseReleased(MouseEvent e) { + + } + + @Override + public void mouseEntered(MouseEvent e) { + + } + + @Override + public void mouseExited(MouseEvent e) { + + } + }; + private void refreshSlider(){ showValue = Integer.parseInt(showVal.getText().substring(0, showVal.getText().indexOf("%"))); if (showValue >100){ @@ -213,6 +232,21 @@ public class JSliderPane extends JPanel { return this.showVal; } + private void popupDialog(){ + if (isDialogOut) { + dialog.setVisible(false); + isDialogOut = false; + return; + } + if (dialog == null) { + dialog = new Dialog(showVal); + isDialogOut = true; + } else { + dialog.setVisible(true); + isDialogOut = true; + } + } + public static void main(String[] args) { JFrame jf = new JFrame("test"); @@ -221,7 +255,7 @@ public class JSliderPane extends JPanel { content.setLayout(new BorderLayout()); content.add(JSliderPane.getInstance(),BorderLayout.CENTER); GUICoreUtils.centerWindow(jf); - jf.setSize(320, 80); + jf.setSize(400, 80); jf.setVisible(true); } @@ -287,5 +321,37 @@ class JSliderPaneUI extends BasicSliderUI { super.paintTrack(g); } } - +} +class Dialog extends JDialog { + private Container container; + private static final int RESIZE_RANGE = 4; + private Cursor originCursor; + private Cursor southResizeCursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR); + private Point mouseDownCompCoords; + private int minHeight; // 对话框最小高度 + private JComponent contentPane; + private UILabel upLabel; + + public Dialog(UITextField j) { + super(DesignerContext.getDesignerFrame()); + container = getContentPane(); + setUndecorated(true); + contentPane = new JPanel(new BorderLayout()); + upLabel = new UILabel(Inter.getLocText("Enlarge_Or_Reduce")); + upLabel.setOpaque(true); + upLabel.setPreferredSize(new Dimension(300,25)); + upLabel.setBackground(Color.LIGHT_GRAY); + contentPane.add(upLabel,BorderLayout.NORTH); +// contentPane.add(new JPanel()) + container.add(contentPane, BorderLayout.CENTER); + minHeight = container.getPreferredSize().height; + setSize(150, 250); +// validate(); + Point btnCoords = j.getLocationOnScreen(); + + this.setLocation(btnCoords.x -150+j.getWidth(), btnCoords.y -250); + +// initListener(); + this.setVisible(true); + } } From 1d06cbfe19240948ab754a31503460eba1e68aa9 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 19 Jul 2017 12:04:15 +0800 Subject: [PATCH 28/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>pmd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 170 +++++++++--------- 1 file changed, 84 insertions(+), 86 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index 9aaa4f6fb..3c279f902 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -8,14 +8,18 @@ import com.fr.design.gui.icontainer.UIEastResizableContainer; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; import com.fr.general.Inter; +import com.fr.stable.StringUtils; +import com.fr.third.fr.pdf.kernel.utils.CompareTool; import javax.swing.*; import javax.swing.border.EmptyBorder; import java.awt.*; import java.awt.event.*; import java.util.*; +import java.util.List; public class EastRegionContainerPane extends UIEastResizableContainer { private static EastRegionContainerPane THIS; @@ -446,7 +450,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public JComponent generateContentPane() { JComponent contentPane = new JPanel(); - JButton testBtn = new JButton(name); + UIButton testBtn = new UIButton(name); testBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -616,11 +620,84 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private static final int MAX_X_SHIFT = 50; private static final int MAX_Y_SHIFT = 50; - private static final String NO_BUTTON = "NoButton"; private static final String UP_BUTTON = "UpButton"; private static final String DOWN_BUTTON = "DownButton"; + private MouseListener mouseListener = new MouseAdapter() { + @Override + public void mouseExited(MouseEvent e) { + setCursor(Cursor.getDefaultCursor()); + if (mouseDownCompCoords == null) { + setBackground(originColor); + } + model = UIConstants.MODEL_NORMAL; + repaint(); + } + @Override + public void mouseClicked(MouseEvent e) { + if (e.getX() >= ARROW_RANGE_START) { + onPop(); + } + } + @Override + public void mouseReleased(MouseEvent e) { + mouseDownCompCoords = null; + if (!getBounds().contains(e.getPoint())) { + setBackground(originColor); + } + } + @Override + public void mousePressed(MouseEvent e) { + if (e.getX() < ARROW_RANGE_START) { + mouseDownCompCoords = e.getPoint(); + } + } + }; + + private MouseMotionListener mouseMotionListener = new MouseMotionListener() { + @Override + public void mouseMoved(MouseEvent e) { + if (e.getX() >= ARROW_RANGE_START) { + setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + model = UIConstants.MODEL_PRESS; + } else if (isMovable) { + setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); + setBackground(Color.pink); + } else { + setCursor(Cursor.getDefaultCursor()); + model = UIConstants.MODEL_NORMAL; + } + repaint(); + } + @Override + public void mouseDragged(MouseEvent e) { + if (isMovable && mouseDownCompCoords != null) { + Point currCoords = e.getLocationOnScreen(); + int x = currCoords.x - mouseDownCompCoords.x; + int y = currCoords.y - mouseDownCompCoords.y; + //屏幕可用区域 + Rectangle screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); + + int minY = screen.y; + int maxX = Toolkit.getDefaultToolkit().getScreenSize().width - MAX_X_SHIFT; + int maxY = Toolkit.getDefaultToolkit().getScreenSize().height - MAX_Y_SHIFT; + if (x < MIN_X) { + x = MIN_X; + } else if (x > maxX) { + x = maxX; + } + if (y < minY) { + y = minY; + } else if (y > maxY) { + y = maxY; + } + // 移动到屏幕边缘时,需要校正位置 + parentDialog.setLocation(x, y); + } + } + }; + public PopupToolPane(PropertyItem propertyItem) { this(propertyItem, NO_BUTTON); } @@ -647,94 +724,15 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private void initToolButton(final String buttonType) { this.buttonType = buttonType; - if (buttonType.equals(NO_BUTTON)) { + if (StringUtils.isEmpty(buttonType) || buttonType.equals(NO_BUTTON)) { return; } - - if (buttonType.equals(DOWN_BUTTON)) { - - } else if (buttonType.equals(UP_BUTTON)) { - - } else { + // validate + if (!buttonType.equals(UP_BUTTON) || !buttonType.equals(DOWN_BUTTON)) { throw new IllegalArgumentException("unknown button type: " + buttonType); } - - addMouseMotionListener(new MouseMotionListener() { - @Override - public void mouseMoved(MouseEvent e) { - if (e.getX() >= ARROW_RANGE_START) { - setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - model = UIConstants.MODEL_PRESS; - } else if (isMovable) { - setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); - setBackground(Color.pink); - } else { - setCursor(Cursor.getDefaultCursor()); - model = UIConstants.MODEL_NORMAL; - } - repaint(); - } - - @Override - public void mouseDragged(MouseEvent e) { - if (isMovable && mouseDownCompCoords != null) { - Point currCoords = e.getLocationOnScreen(); - int x = currCoords.x - mouseDownCompCoords.x; - int y = currCoords.y - mouseDownCompCoords.y; - //屏幕可用区域 - Rectangle screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); - - int minY = screen.y; - int maxX = Toolkit.getDefaultToolkit().getScreenSize().width - MAX_X_SHIFT; - int maxY = Toolkit.getDefaultToolkit().getScreenSize().height - MAX_Y_SHIFT; - if (x < MIN_X) { - x = MIN_X; - } else if (x > maxX) { - x = maxX; - } - if (y < minY) { - y = minY; - } else if (y > maxY) { - y = maxY; - } - // 移动到屏幕边缘时,需要校正位置 - parentDialog.setLocation(x, y); - } - } - }); - addMouseListener(new MouseAdapter() { - @Override - public void mouseExited(MouseEvent e) { - setCursor(Cursor.getDefaultCursor()); - if (mouseDownCompCoords == null) { - setBackground(originColor); - } - model = UIConstants.MODEL_NORMAL; - repaint(); - } - - @Override - public void mouseClicked(MouseEvent e) { - if (e.getX() >= ARROW_RANGE_START) { - onPop(); - } - } - - @Override - public void mouseReleased(MouseEvent e) { - mouseDownCompCoords = null; - if (!getBounds().contains(e.getPoint())) { - setBackground(originColor); - } - } - @Override - public void mousePressed(MouseEvent e) { - if (e.getX() < ARROW_RANGE_START) { - mouseDownCompCoords = e.getPoint(); - } - } - - }); + addMouseMotionListener(mouseMotionListener); + addMouseListener(mouseListener); } // 触发弹入、弹出 From 5d4fc485b9efef841d8bb1856abdef65cfb0d88b Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 19 Jul 2017 14:32:57 +0800 Subject: [PATCH 29/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E4=B8=80=E5=A4=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/EastRegionContainerPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index 3c279f902..aac685076 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -728,7 +728,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { return; } // validate - if (!buttonType.equals(UP_BUTTON) || !buttonType.equals(DOWN_BUTTON)) { + if (!buttonType.equals(UP_BUTTON) && !buttonType.equals(DOWN_BUTTON)) { throw new IllegalArgumentException("unknown button type: " + buttonType); } addMouseMotionListener(mouseMotionListener); From 7d9ff599d603af8aa4a33ccf212219256a1e4650 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Wed, 19 Jul 2017 18:41:26 +0800 Subject: [PATCH 30/32] =?UTF-8?q?REPORT-2897=209.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E4=BF=AE=E6=94=B9=20PMD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/expand/ExpandFatherPane.java | 6 +- .../mainframe/ReportComponentComposite.java | 34 +- .../cell/settingpane/CellExpandAttrPane.java | 44 +- .../cell/settingpane/CellOtherSetPane.java | 2 +- .../cell/settingpane/CellPresentPane.java | 2 +- .../cell/settingpane/CellStylePane.java | 18 +- designer/src/com/fr/grid/GridRow.java | 3 +- .../com/fr/design/gui/style/BorderPane.java | 44 +- .../com/fr/design/gui/style/FRFontPane.java | 64 +- .../com/fr/design/gui/style/FormatPane.java | 15 - .../com/fr/design/locale/designer.properties | 22 + .../design/locale/designer_en_US.properties | 22 + .../design/locale/designer_ja_JP.properties | 24 +- .../design/locale/designer_ko_KR.properties | 23 +- .../design/locale/designer_zh_CN.properties | 22 + .../design/locale/designer_zh_TW.properties | 21 + .../com/fr/design/mainframe/JSliderPane.java | 280 ++-- .../src/com/fr/design/mainframe/FormArea.java | 1122 +++++++++-------- 18 files changed, 989 insertions(+), 779 deletions(-) diff --git a/designer/src/com/fr/design/expand/ExpandFatherPane.java b/designer/src/com/fr/design/expand/ExpandFatherPane.java index 88aeb44c3..ea863dd81 100644 --- a/designer/src/com/fr/design/expand/ExpandFatherPane.java +++ b/designer/src/com/fr/design/expand/ExpandFatherPane.java @@ -40,9 +40,9 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser public ExpandFatherPane() { this.setLayout(new BorderLayout(0, LayoutConstants.VGAP_SMALL)); comboBox = new UIComboBox(new String[]{ - Inter.getLocText("None"), - Inter.getLocText("Default"), - Inter.getLocText("Custom")}); + Inter.getLocText("FR-Designer_None"), + Inter.getLocText("FR-Designer_DEFAULT"), + Inter.getLocText("FR-Designer_Custom")}); final CardLayout cardLayout = new CardLayout(); customPane = new JPanel(cardLayout); customParentColumnRowPane = new ColumnRowPane() { diff --git a/designer/src/com/fr/design/mainframe/ReportComponentComposite.java b/designer/src/com/fr/design/mainframe/ReportComponentComposite.java index 0b47214a9..b3ab87a28 100644 --- a/designer/src/com/fr/design/mainframe/ReportComponentComposite.java +++ b/designer/src/com/fr/design/mainframe/ReportComponentComposite.java @@ -6,10 +6,14 @@ import java.util.ArrayList; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JSplitPane; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; import com.fr.base.FRContext; +import com.fr.base.ScreenResolution; import com.fr.design.designer.EditingState; import com.fr.design.event.TargetModifiedListener; +import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.icontainer.UIModeControlContainer; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.Inter; @@ -24,6 +28,9 @@ import com.fr.report.report.TemplateReport; * @since 2012-3-27下午12:12:05 */ public class ReportComponentComposite extends JComponent { + + private static final int MAX = 400; + private static final int MIN = 10; private JWorkBook parent; private UIModeControlContainer parentContainer = null; @@ -36,7 +43,7 @@ public class ReportComponentComposite extends JComponent { private JPanel hbarContainer; - private JPanel jSliderContainer; + private JSliderPane jSliderContainer; /** @@ -52,8 +59,28 @@ public class ReportComponentComposite extends JComponent { CellElementRegion = FRGUIPaneFactory.createBorderLayout_S_Pane(); this.add(CellElementRegion, BorderLayout.NORTH); this.add(createSouthControlPane(), BorderLayout.SOUTH); + jSliderContainer.getShowVal().getDocument().addDocumentListener(jSliderContainerListener); } + DocumentListener jSliderContainerListener = new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + double value = Integer.parseInt(jSliderContainer.getShowVal().getText().substring(0, jSliderContainer.getShowVal().getText().indexOf("%"))); + value = value>MAX ? MAX : value; + value = value= 0) { templateStateList.set(oldIndex, centerCardPane.editingComponet.createEditingState()); @@ -63,7 +90,7 @@ public class ReportComponentComposite extends JComponent { protected void doAfterChange(int newIndex) { WorkBook workbook = getEditingWorkBook(); if (workbook == null) { - FRContext.getLogger().error(Inter.getLocText("Read_failure") + "!"); + FRContext.getLogger().error(Inter.getLocText("FR-Designer_Read_failure") + "!"); //AUGUST:加个报错,不然测试总是SB的认为打不开一个坏的excel文件就是BUG,也不知道去检查下源文件。 return; } @@ -160,7 +187,8 @@ public class ReportComponentComposite extends JComponent { hbarContainer.add(centerCardPane.editingComponet.getHorizontalScrollBar()); // JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, hbarContainer); JPanel southPane = new JPanel(new BorderLayout()); - JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, JSliderPane.getInstance()); + jSliderContainer = JSliderPane.getInstance(); + JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, jSliderContainer); splitpane.setBorder(null); splitpane.setDividerSize(3); splitpane.setResizeWeight(1); diff --git a/designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java b/designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java index d6a5a9bef..128c01418 100644 --- a/designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java +++ b/designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java @@ -62,22 +62,22 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { public static void main(String[] args){ - JFrame jf = new JFrame("test"); - jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - JPanel content = (JPanel) jf.getContentPane(); - content.setLayout(new BorderLayout()); - content.add(new CellExpandAttrPane().layoutPane(), BorderLayout.CENTER); - GUICoreUtils.centerWindow(jf); - jf.setSize(290, 400); - jf.setVisible(true); +// JFrame jf = new JFrame("test"); +// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); +// JPanel content = (JPanel) jf.getContentPane(); +// content.setLayout(new BorderLayout()); +// content.add(new CellExpandAttrPane().layoutPane(), BorderLayout.CENTER); +// GUICoreUtils.centerWindow(jf); +// jf.setSize(290, 400); +// jf.setVisible(true); } private void initAllNames() { - expandDirectionButton.setGlobalName(Inter.getLocText("ExpandD-Expand_Direction")); - leftFatherPane.setGlobalName(Inter.getLocText("LeftParent")); - rightFatherPane.setGlobalName(Inter.getLocText("ExpandD-Up_Father_Cell")); - horizontalExpandableCheckBox.setGlobalName(Inter.getLocText("ExpandD-Expandable")); - verticalExpandableCheckBox.setGlobalName(Inter.getLocText("ExpandD-Expandable")); + expandDirectionButton.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expand_Direction")); + leftFatherPane.setGlobalName(Inter.getLocText("FR-Designer_LeftParent")); + rightFatherPane.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell")); + horizontalExpandableCheckBox.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expandable")); + verticalExpandableCheckBox.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expandable")); } private JPanel layoutPane() { @@ -111,9 +111,9 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ new Component[]{null,null}, - new Component[]{new UILabel(" "+Inter.getLocText("ExpandD-Expand_Direction")+" ", SwingConstants.LEFT), expandDirectionButton}, - new Component[]{new UILabel(" "+Inter.getLocText("LeftParent"), SwingConstants.LEFT), leftFatherPane}, - new Component[]{new UILabel(" "+Inter.getLocText("ExpandD-Up_Father_Cell"), SwingConstants.LEFT), rightFatherPane}, + new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpandD_Expand_Direction")+" ", SwingConstants.LEFT), expandDirectionButton}, + new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_LeftParent"), SwingConstants.LEFT), leftFatherPane}, + new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"), SwingConstants.LEFT), rightFatherPane}, }; double[] rowSize = {p, p, p, p, p, p}; double[] columnSize = {p, f}; @@ -128,7 +128,7 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { new Component[]{null,null}, new Component[]{horizontalExpandableCheckBox, null}, new Component[]{verticalExpandableCheckBox, null}, - new Component[]{new UILabel(" "+Inter.getLocText("ExpandD-Sort_After_Expand") + Inter.getLocText("FR-Action_Sort"), SwingConstants.RIGHT), sortAfterExpand}, + new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpendSort"), SwingConstants.RIGHT), sortAfterExpand}, }; double[] rowSize = {p, p, p, p, p, p, p, p}; double[] columnSize = {p, f}; @@ -176,7 +176,7 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { @Override public String getIconPath() { // return "com/fr/design/images/expand/cellAttr.gif"; - return Inter.getLocText("Expand"); + return Inter.getLocText("FR-Designer_Expand"); } @@ -187,19 +187,19 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { cellExpandAttr = new CellExpandAttr(); cellElement.setCellExpandAttr(cellExpandAttr); } - if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("ExpandD-Expand_Direction"))) { + if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"))) { cellExpandAttr.setDirection(expandDirectionButton.getSelectedItem()); } - if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("LeftParent"))) { + if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_LeftParent"))) { this.leftFatherPane.update(cellExpandAttr); } - if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("ExpandD-Up_Father_Cell"))) { + if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"))) { this.rightFatherPane.update(cellExpandAttr); } // extendable - if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("ExpandD-Expandable"))) { + if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD-Expandable"))) { if (horizontalExpandableCheckBox.isSelected()) { if (verticalExpandableCheckBox.isSelected()) { cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE); diff --git a/designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java b/designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java index c5d7af1b1..ee4ecfa4d 100644 --- a/designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java +++ b/designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java @@ -215,7 +215,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { @Override public String getIconPath() { // return "com/fr/design/images/m_format/cellstyle/otherset.png"; - return Inter.getLocText("Other"); + return Inter.getLocText("FR-Designer_Other"); } @Override diff --git a/designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java b/designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java index d0f13c5d2..8d29ff133 100644 --- a/designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java +++ b/designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java @@ -40,7 +40,7 @@ public class CellPresentPane extends AbstractCellAttrPane { @Override public String getIconPath() { // return "com/fr/design/images/data/source/dataDictionary.png"; - return Inter.getLocText("Present"); + return Inter.getLocText("FR-Designer_Present"); } @Override diff --git a/designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java b/designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java index 2d508c4f3..ce0351931 100644 --- a/designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java +++ b/designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java @@ -42,14 +42,14 @@ public class CellStylePane extends AbstractCellAttrPane { } public static void main(String[] args){ - JFrame jf = new JFrame("test"); - jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - JPanel content = (JPanel) jf.getContentPane(); - content.setLayout(new BorderLayout()); - content.add(new CellStylePane().createContentPane(), BorderLayout.CENTER); - GUICoreUtils.centerWindow(jf); - jf.setSize(290, 400); - jf.setVisible(true); +// JFrame jf = new JFrame("test"); +// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); +// JPanel content = (JPanel) jf.getContentPane(); +// content.setLayout(new BorderLayout()); +// content.add(new CellStylePane().createContentPane(), BorderLayout.CENTER); +// GUICoreUtils.centerWindow(jf); +// jf.setSize(290, 400); +// jf.setVisible(true); } @Override @@ -120,7 +120,7 @@ public class CellStylePane extends AbstractCellAttrPane { @Override public String title4PopupWindow() { - return Inter.getLocText("Style"); + return Inter.getLocText(Inter.getLocText("FR-Designer_Style")); } public void setSelectedByIds(int level, String... id) { diff --git a/designer/src/com/fr/grid/GridRow.java b/designer/src/com/fr/grid/GridRow.java index c111c7188..4c42ce630 100644 --- a/designer/src/com/fr/grid/GridRow.java +++ b/designer/src/com/fr/grid/GridRow.java @@ -21,6 +21,7 @@ import javax.swing.plaf.ComponentUI; */ public class GridRow extends GridHeader { + private static final int MAX = 5; private int resolution = ScreenResolution.getScreenResolution(); @Override @@ -65,7 +66,7 @@ public class GridRow extends GridHeader { * Calculates max char number. */ private int caculateMaxCharNumber(ElementCasePane reportPane) { - int maxCharNumber = 5; + int maxCharNumber = MAX; maxCharNumber = Math.max(maxCharNumber, ("" + (reportPane.getGrid().getVerticalValue() + reportPane.getGrid().getVerticalExtent())).length() + 1); return maxCharNumber; diff --git a/designer_base/src/com/fr/design/gui/style/BorderPane.java b/designer_base/src/com/fr/design/gui/style/BorderPane.java index d214198a8..585bfe98b 100644 --- a/designer_base/src/com/fr/design/gui/style/BorderPane.java +++ b/designer_base/src/com/fr/design/gui/style/BorderPane.java @@ -87,10 +87,10 @@ public class BorderPane extends AbstractBasicStylePane { new Component[]{null,null}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Color") + " ", SwingConstants.LEFT), currentLineColorPane}, new Component[]{null,null}, - new Component[]{new UILabel("外边框 ", SwingConstants.LEFT),outerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/out.png"))}, + new Component[]{new UILabel(Inter.getLocText("FR-Designer_outBorder") +" ", SwingConstants.LEFT),outerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/out.png"))}, new Component[]{null,externalPane}, new Component[]{null,null}, - new Component[]{new UILabel("内边框 ", SwingConstants.LEFT),innerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/in.png"))}, + new Component[]{new UILabel(Inter.getLocText("FR-Designer_inBorder") +" ", SwingConstants.LEFT),innerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/in.png"))}, new Component[]{null,insidePane}, new Component[]{null,null} }; @@ -105,26 +105,30 @@ public class BorderPane extends AbstractBasicStylePane { backgroundPanel = new UIExpandablePane(Inter.getLocText("FR-Designer_Background"),280,20,backgroundPane); this.add(backgroundPanel,BorderLayout.CENTER); - outerToggleButton.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - boolean value = outerToggleButton.isSelected(); - topToggleButton.setSelected(value); - bottomToggleButton.setSelected(value); - leftToggleButton.setSelected(value); - rightToggleButton.setSelected(value); - } - }); - innerToggleButton.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - boolean value = innerToggleButton.isSelected(); - horizontalToggleButton.setSelected(value); - verticalToggleButton.setSelected(value); - } - }); + outerToggleButton.addChangeListener(outerToggleButtonChangeListener); + innerToggleButton.addChangeListener(innerToggleButtonChangeListener); } + ChangeListener outerToggleButtonChangeListener = new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + boolean value = outerToggleButton.isSelected(); + topToggleButton.setSelected(value); + bottomToggleButton.setSelected(value); + leftToggleButton.setSelected(value); + rightToggleButton.setSelected(value); + } + }; + + ChangeListener innerToggleButtonChangeListener = new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + boolean value = innerToggleButton.isSelected(); + horizontalToggleButton.setSelected(value); + verticalToggleButton.setSelected(value); + } + }; + private void initButtonsWithIcon(){ topToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/top.png")); leftToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/left.png")); diff --git a/designer_base/src/com/fr/design/gui/style/FRFontPane.java b/designer_base/src/com/fr/design/gui/style/FRFontPane.java index bfe86801f..e7267d683 100644 --- a/designer_base/src/com/fr/design/gui/style/FRFontPane.java +++ b/designer_base/src/com/fr/design/gui/style/FRFontPane.java @@ -42,7 +42,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse public static Integer[] FONT_SIZES = {new Integer(6), new Integer(8), new Integer(9), new Integer(10), new Integer(11), new Integer(12), new Integer(14), new Integer(16), new Integer(18), new Integer(20), new Integer(22), new Integer(24), new Integer(26), new Integer(28), new Integer(36), new Integer(48), new Integer(72)}; private static final Dimension BUTTON_SIZE = new Dimension(20, 18); - private final String[] fontSizeStyles = {Inter.getLocText("FRFont-plain"), Inter.getLocText("FRFont-bold"), Inter.getLocText("FRFont-italic"), Inter.getLocText("FRFont-bolditalic")}; + private final String[] fontSizeStyles = {Inter.getLocText("FR-Designer_FRFont_plain"), Inter.getLocText("FR-Designer_FRFont_bold"), Inter.getLocText("FR-Designer_FRFont_italic"), Inter.getLocText("FR-Designer_FRFont_bolditalic")}; private JPanel buttonPane; private JPanel isSuperOrSubPane; private UIComboBox fontNameComboBox; @@ -82,7 +82,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse @Override protected String title4PopupWindow() { - return Inter.getLocText("Sytle-FRFont"); + return Inter.getLocText("FR-Designer_Sytle-FRFont"); } /** @@ -130,34 +130,34 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse */ public FRFont update(FRFont frFont) { - if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Family"))) { + if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_Name"))) { frFont = frFont.applyName((String) fontNameComboBox.getSelectedItem()); } - if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Style"))) { + if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Style"))) { frFont = frFont.applyStyle(fontSizeStyleComboBox.getSelectedIndex()); } - if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Size"))) { + if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer-FRFont_Size"))) { frFont = frFont.applySize(Float.parseFloat(fontSizeComboBox.getSelectedItem().toString())); } - if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Foreground"))) { + if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Foreground"))) { frFont = frFont.applyForeground(this.colorSelectPane.getColor()); } - if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Underline"))) { + if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Underline"))) { int line = underline.isSelected() ? this.underlineCombo.getSelectedLineStyle() : Constants.LINE_NONE; frFont = frFont.applyUnderline(line); } - if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("Line-Style"))) { + if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer-FRFont_Line_Style"))) { frFont = frFont.applyUnderline(this.underlineCombo.getSelectedLineStyle()); } - if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Strikethrough"))) { + if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Strikethrough"))) { frFont = frFont.applyStrikethrough(isStrikethroughCheckBox.isSelected()); } - if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Shadow"))) { + if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Shadow"))) { frFont = frFont.applyShadow(isShadowCheckBox.isSelected()); } @@ -175,7 +175,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse private FRFont updateSubSuperscript(FRFont frFont) { boolean isSuper = frFont.isSuperscript(); boolean isSub = frFont.isSubscript(); - if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Superscript"))) { + if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Superscript"))) { //如果上标没有选中,点击则选中上标,并且下标一定是不选中状态 //如果上标选中,点击则取消选中上标,字体回复正常 if (superPane.isSelected() && !isSuper) { @@ -185,7 +185,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse frFont = frFont.applySuperscript(false); } } - if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Subscript"))) { + if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Subscript"))) { if (subPane.isSelected() && !isSub) { frFont = frFont.applySubscript(true); frFont = frFont.applySuperscript(false); @@ -260,29 +260,29 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse } private void initAllNames() { - fontSizeStyleComboBox.setGlobalName(Inter.getLocText("FRFont-Style")); - fontNameComboBox.setGlobalName(Inter.getLocText("FRFont-Family")); - fontSizeComboBox.setGlobalName(Inter.getLocText("FRFont-Size")); - colorSelectPane.setGlobalName(Inter.getLocText("FRFont-Foreground")); - italic.setGlobalName(Inter.getLocText("FRFont-italic")); - bold.setGlobalName(Inter.getLocText("FRFont-bold")); - underline.setGlobalName(Inter.getLocText("FRFont-Underline")); - underlineCombo.setGlobalName(Inter.getLocText("Line-Style")); - isStrikethroughCheckBox.setGlobalName(Inter.getLocText("FRFont-Strikethrough")); - isShadowCheckBox.setGlobalName(Inter.getLocText("FRFont-Shadow")); - superPane.setGlobalName(Inter.getLocText("FRFont-Superscript")); - subPane.setGlobalName(Inter.getLocText("FRFont-Subscript")); + fontSizeStyleComboBox.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Style")); + fontNameComboBox.setGlobalName(Inter.getLocText("FR-Designer_Name")); + fontSizeComboBox.setGlobalName(Inter.getLocText("FR-Designer-FRFont_Size")); + colorSelectPane.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Foreground")); + italic.setGlobalName(Inter.getLocText("FR-Designer_FRFont_italic")); + bold.setGlobalName(Inter.getLocText("FR-Designer_FRFont_bold")); + underline.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Underline")); + underlineCombo.setGlobalName(Inter.getLocText("FR-Designer-FRFont_Line_Style")); + isStrikethroughCheckBox.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Strikethrough")); + isShadowCheckBox.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Shadow")); + superPane.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Superscript")); + subPane.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Subscript")); } private void setToolTips() { - colorSelectPane.setToolTipText(Inter.getLocText("FRFont-Foreground")); - italic.setToolTipText(Inter.getLocText("FRFont-italic")); - bold.setToolTipText(Inter.getLocText("FRFont-bold")); - underline.setToolTipText(Inter.getLocText("FRFont-Underline")); - isStrikethroughCheckBox.setToolTipText(Inter.getLocText("FRFont-Strikethrough")); - isShadowCheckBox.setToolTipText(Inter.getLocText("FRFont-Shadow")); - superPane.setToolTipText(Inter.getLocText("FRFont-Superscript")); - subPane.setToolTipText(Inter.getLocText("FRFont-Subscript")); + colorSelectPane.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Foreground")); + italic.setToolTipText(Inter.getLocText("FR-Designer_FRFont_italic")); + bold.setToolTipText(Inter.getLocText("FR-Designer_FRFont_bold")); + underline.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Underline")); + isStrikethroughCheckBox.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Strikethrough")); + isShadowCheckBox.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Shadow")); + superPane.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Superscript")); + subPane.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Subscript")); } diff --git a/designer_base/src/com/fr/design/gui/style/FormatPane.java b/designer_base/src/com/fr/design/gui/style/FormatPane.java index 7dc5f108f..4d81d0101 100644 --- a/designer_base/src/com/fr/design/gui/style/FormatPane.java +++ b/designer_base/src/com/fr/design/gui/style/FormatPane.java @@ -81,9 +81,7 @@ public class FormatPane extends AbstractBasicStylePane{ protected void initComponents(Integer[] types) { this.setLayout(new BorderLayout(0, 4)); - iniSampleLable(); - contentPane = new JPanel(new BorderLayout(0, 4)) { @Override public Dimension getPreferredSize() { @@ -91,33 +89,24 @@ public class FormatPane extends AbstractBasicStylePane{ } }; typeComboBox = new UIComboBox(types); - UIComboBoxRenderer render = createComBoxRender(); typeComboBox.setRenderer(render); typeComboBox.addItemListener(itemListener); contentPane.add(sampleLabel, BorderLayout.NORTH); -// this.add(typeComboBox, BorderLayout.NORTH); centerPane = new JPanel(new CardLayout()); centerPane.add(new JPanel(), "hide"); centerPane.setPreferredSize(new Dimension(0, 0) ); centerPane.add(contentPane, "show"); - formatFontPane = new JPanel(new BorderLayout()); formatFontPane.add(centerPane, BorderLayout.NORTH); formatFontPane.add(new FRFontPane(), BorderLayout.CENTER); - -// this.add(formatFontPane, BorderLayout.CENTER); - // content pane. txtCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); contentPane.add(txtCenterPane, BorderLayout.CENTER); - textField = new UIComboBox(FormatField.getInstance().getFormatArray(getFormatContents())); textField.addItemListener(textFieldItemListener); textField.setEditable(true); txtCenterPane.add(textField, BorderLayout.NORTH); - frFontPane = new FRFontPane(); - double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ @@ -132,7 +121,6 @@ public class FormatPane extends AbstractBasicStylePane{ int[][] rowCount = {{1, 1},{1, 1}, {1, 1}, {1, 3}, {1, 1}}; JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); this.add(panel,BorderLayout.CENTER); - } protected UIComboBoxRenderer createComBoxRender(){ @@ -323,12 +311,9 @@ public class FormatPane extends AbstractBasicStylePane{ cardLayout.show(centerPane, "hide"); } else { textField.removeAllItems(); - long begin = System.currentTimeMillis(); for (int i = 0; i < items.length; i++) { textField.addItem(items[i]); } - long end = System.currentTimeMillis(); - System.out.println(end-begin+"ms"); centerPane.setPreferredSize(new Dimension(270, 70) ); cardLayout.show(centerPane, "show"); } diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 0e51b4c21..8cbd876a2 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -2011,3 +2011,25 @@ FR-Designer_Float_Element=Float Element FR-Designer_Widget_Library=Widget Library FR-Designer_No_Settings_Available=No Settings Available! FR-Designer_Configured_Roles=Configured role +FR-Designer_Scale_EnlargeOrReduce=Scale +FR-Designer_Scale_selfAdaptButton=Fit the selected area exactly +FR-Designer_Scale_customButton=custom +FR-Designer_FRFont_Subscript=Subscript +FR-Designer_FRFont_Superscript=Superscript +FR-Designer_FRFont_Shadow=Shadow +FR-Designer_FRFont_Strikethrough=Strikethrough +FR-Designer_FRFont_Underline=Underline +FR-Designer_FRFont_bold=bold +FR-Designer_FRFont_italic=italic +FR-Designer_FRFont_Foreground=Foreground +FR-Designer_FRFont_Style=Style +FR-Designer_FRFont_plain=plain +FR-Designer_FRFont_bolditalic=bolditalic +FR-Designer_outBorder=outBorder +FR-Designer_inBorder=inBorder +FR-Designer_ExpandD_Up_Father_Cell=Up_Father_Cell +FR-Designer_ExpandD_Expand_Direction=Expand_Direction +FR-Designer_Expand=Expand +FR-Designer_ExpendSort=ExpendSort +FR-Designer_ExpandD_Expandable=Expandable +FR-Designer_Read_failure=Read_failure diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties index 296dcbe7a..9d5a8a9fe 100644 --- a/designer_base/src/com/fr/design/locale/designer_en_US.properties +++ b/designer_base/src/com/fr/design/locale/designer_en_US.properties @@ -2011,3 +2011,25 @@ FR-Designer_Float_Element=Float Element FR-Designer_Widget_Library=Widget Library FR-Designer_No_Settings_Available=No Settings Available! FR-Designer_Configured_Roles=Configured role +FR-Designer_Scale_EnlargeOrReduce=Scale +FR-Designer_Scale_selfAdaptButton=Fit the selected area exactly +FR-Designer_Scale_customButton=custom +FR-Designer_FRFont_Subscript=Subscript +FR-Designer_FRFont_Superscript=\ +FR-Designer_FRFont_Shadow=Shadow +FR-Designer_FRFont_Strikethrough=Strikethrough +FR-Designer_FRFont_Underline=Underline +FR-Designer_FRFont_bold=bold +FR-Designer_FRFont_italic=italic +FR-Designer_FRFont_Foreground=Foreground +FR-Designer_FRFont_Style=Style +FR-Designer_FRFont_plain=plain +FR-Designer_FRFont_bolditalic=bolditalic +FR-Designer_outBorder=outBorder +FR-Designer_inBorder=inBorder +FR-Designer_ExpandD_Up_Father_Cell=Up_Father_Cell +FR-Designer_ExpandD_Expand_Direction=Expand_Direction +FR-Designer_Expand=Expand +FR-Designer_ExpendSort=ExpendSort +FR-Designer_ExpandD_Expandable=Expandable +FR-Designer_Read_failure=Read_failure diff --git a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties index 03514583a..4caf82100 100644 --- a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties +++ b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties @@ -1987,4 +1987,26 @@ FR-Designer_Cell_Attributes=\u30BB\u30EB\u5C5E\u6027 FR-Designer_Float_Element=\u30D5\u30ED\u30FC\u30C8\u8981\u7D20 FR-Designer_Widget_Library= FR-Designer_No_Settings_Available= -FR-Designer_Configured_Roles=\u69CB\u6210\u3055\u308C\u305F\u5F79\u5272 \ No newline at end of file +FR-Designer_Configured_Roles=\u69CB\u6210\u3055\u308C\u305F\u5F79\u5272 +FR-Designer_Scale_EnlargeOrReduce= +FR-Designer_Scale_selfAdaptButton=\ +FR-Designer_Scale_customButton=\ +FR-Designer_FRFont_Subscript=\ +FR-Designer_FRFont_Superscript=\ +FR-Designer_FRFont_Shadow=\ +FR-Designer_FRFont_Strikethrough=\ +FR-Designer_FRFont_Underline=\ +FR-Designer_FRFont_bold=\ +FR-Designer_FRFont_italic=\ +FR-Designer_FRFont_Foreground=\ +FR-Designer_FRFont_Style=\ +FR-Designer_FRFont_plain=\ +FR-Designer_FRFont_bolditalic=\ +FR-Designer_outBorder=\ +FR-Designer_inBorder=\ +FR-Designer_ExpandD_Up_Father_Cell=\ +FR-Designer_ExpandD_Expand_Direction=\ +FR-Designer_Expand=\ +FR-Designer_ExpendSort=\ +FR-Designer_ExpandD_Expandable=\ +FR-Designer_Read_failure=\ \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties index cafc02022..6cd6849c7 100644 --- a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties +++ b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties @@ -1987,4 +1987,25 @@ FR-Designer_Cell_Attributes=\uC140\uC18D\uC131 FR-Designer_Float_Element=\uD638\uBC84\uC694\uC18C FR-Designer_Widget_Library= FR-Designer_No_Settings_Available= -FR-Designer_Configured_Roles=\uC5ED\uD560\uC774\uAD6C\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \ No newline at end of file +FR-Designer_Configured_Roles=\uC5ED\uD560\uC774\uAD6C\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4. +FR-Designer_Scale_EnlargeOrReduce= +FR-Designer_Scale_selfAdaptButton=\ +FR-Designer_FRFont_Subscript=\ +FR-Designer_FRFont_Superscript=\ +FR-Designer_FRFont_Shadow=\ +FR-Designer_FRFont_Strikethrough=\ +FR-Designer_FRFont_Underline=\ +FR-Designer_FRFont_bold=\ +FR-Designer_FRFont_italic=\ +FR-Designer_FRFont_Foreground=\ +FR-Designer_FRFont_Style=\ +FR-Designer_FRFont_plain=\ +FR-Designer_FRFont_bolditalic=\ +FR-Designer_outBorder=\ +FR-Designer_inBorder=\ +FR-Designer_ExpandD_Up_Father_Cell=\ +FR-Designer_ExpandD_Expand_Direction=\ +FR-Designer_Expand=\ +FR-Designer_ExpendSort=\ +FR-Designer_ExpandD_Expandable=\ +FR-Designer_Read_failure=\ \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index 1675df05e..61912d31c 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -2009,3 +2009,25 @@ FR-Designer_Float_Element=\u60AC\u6D6E\u5143\u7D20 FR-Designer_Widget_Library=\u7EC4\u4EF6\u5E93 FR-Designer_No_Settings_Available=\u65E0\u53EF\u7528\u914D\u7F6E\u9879\uFF01 FR-Designer_Configured_Roles=\u5DF2\u914D\u7F6E\u89D2\u8272 +FR-Designer_Scale_EnlargeOrReduce=\u7F29\u653E +FR-Designer_Scale_selfAdaptButton=\u6070\u597D\u5BB9\u7EB3\u9009\u5B9A\u533A\u57DF +FR-Designer_Scale_customButton=\u81EA\u5B9A\u4E49 +FR-Designer_FRFont_Subscript=\u4E0B\u6807 +FR-Designer_FRFont_Superscript=\u4E0A\u6807 +FR-Designer_FRFont_Shadow=\u9634\u5F71 +FR-Designer_FRFont_Strikethrough=\u5220\u9664\u7EBF +FR-Designer_FRFont_Underline=\u4E0B\u5212\u7EBF +FR-Designer_FRFont_bold=\u52A0\u7C97 +FR-Designer_FRFont_italic=\u659C\u4F53 +FR-Designer_FRFont_Foreground=\u989C\u8272 +FR-Designer_FRFont_Style=\u5B57\u5F62 +FR-Designer_FRFont_plain=\u5E38\u89C4 +FR-Designer_FRFont_bolditalic=\u52A0\u7C97\u503E\u659C +FR-Designer_outBorder=\u5916\u8FB9\u6846 +FR-Designer_inBorder=\u5185\u8FB9\u6846 +FR-Designer_ExpandD_Up_Father_Cell=\u4E0A\u7236\u683C +FR-Designer_ExpandD_Expand_Direction=\u6269\u5C55\u65B9\u5411 +FR-Designer_Expand=\u6269\u5C55 +FR-Designer_ExpendSort=\u6269\u5C55\u540E\u6392\u5E8F +FR-Designer_ExpandD_Expandable=\u53EF\u4F38\u5C55\u6027 +FR-Designer_Read_failure=\u8BFB\u53D6\u5931\u8D25\uFF0C\u53EF\u80FD\u6E90\u6587\u4EF6\u5DF2\u635F\u574F diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index 269d4e2e4..6ed80f9d0 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties @@ -2010,3 +2010,24 @@ FR-Designer_Float_Element=\u61F8\u6D6E\u5143\u7D20 FR-Designer_Widget_Library=\u7D44\u4EF6\u5EAB FR-Designer_No_Settings_Available=\u7121\u53EF\u7528\u914D\u5BD8\u9805\uFF01 FR-Designer_Configured_Roles=\u5DF2\u914D\u7F6E\u89D2\u8272 +FR-Designer_Scale_selfAdaptButton=\ +FR-Designer_Scale_customButton=\ +FR-Designer_FRFont_Subscript=\ +FR-Designer_FRFont_Superscript=\ +FR-Designer_FRFont_Shadow=\ +FR-Designer_FRFont_Strikethrough=\ +FR-Designer_FRFont_Underline=\ +FR-Designer_FRFont_bold=\ +FR-Designer_FRFont_italic=\ +FR-Designer_FRFont_Foreground=\ +FR-Designer_FRFont_Style=\ +FR-Designer_FRFont_plain=\ +FR-Designer_FRFont_bolditalic=\ +FR-Designer_outBorder=\ +FR-Designer_inBorder=\ +FR-Designer_ExpandD_Up_Father_Cell=\ +FR-Designer_ExpandD_Expand_Direction=\ +FR-Designer_Expand=\ +FR-Designer_ExpendSort=\ +FR-Designer_ExpandD_Expandable=\ +FR-Designer_Read_failure=\ diff --git a/designer_base/src/com/fr/design/mainframe/JSliderPane.java b/designer_base/src/com/fr/design/mainframe/JSliderPane.java index c2d163643..7125b53b1 100644 --- a/designer_base/src/com/fr/design/mainframe/JSliderPane.java +++ b/designer_base/src/com/fr/design/mainframe/JSliderPane.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.islider.UISlider; import com.fr.design.gui.itextfield.UITextField; @@ -9,6 +10,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.Inter; import javax.swing.*; +import javax.swing.border.MatteBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; @@ -17,14 +19,24 @@ import javax.swing.plaf.basic.BasicSliderUI; import java.awt.*; import java.awt.event.*; import java.math.BigDecimal; -import java.util.Observable; /** * Created by MoMeak on 2017/7/13. */ public class JSliderPane extends JPanel { - private final int KERNING = 2; + private static final double ONEPOINTEIGHT = 1.8; + private static final int SIX = 6; + private static final int TEN = 10; + private static final int ONEEIGHT = 18; + private static final int FOURTEN = 40; + private static final int HALFHUNDRED = 50; + private static final int HUNDRED = 100; + private static final int TWOHUNDRED = 200; + private static final int THREEHUNDRED = 300; + private static final int FOURHUNDRED = 400; + private static final int DIALOGWIDTH = 150; + private static final int DIALOGHEIGHT = 200; public int showValue = 100; public double resolutionTimes = 1.0; private static JSliderPane THIS; @@ -34,23 +46,30 @@ public class JSliderPane extends JPanel { private int sliderValue; private UIButton downButton; private UIButton upButton; + private UIButton showValButton; + private UIRadioButton twoHundredButton; + private UIRadioButton oneHundredButton; + private UIRadioButton SevenFiveButton; + private UIRadioButton fiveTenButton; + private UIRadioButton twoFiveButton; + private UIRadioButton selfAdaptButton; + private UIRadioButton customButton; //拖动条处理和button、直接输入不一样 private boolean isButtonOrIsTxt = true; - private boolean isDialogOut = false; // 是否弹出 - private Dialog dialog; + private PopupPane dialog; + private int upButtonX; public JSliderPane() { this.setLayout(new BorderLayout()); - slider = new UISlider(0,100,50); + slider = new UISlider(0,HUNDRED,HALFHUNDRED); slider.setUI(new JSliderPaneUI(slider)); slider.addChangeListener(listener); showVal = new UITextField(); showVal.setText("100%"); - showVal.setPreferredSize(new Dimension(40,18)); + showVal.setPreferredSize(new Dimension(FOURTEN,ONEEIGHT)); showVal.getDocument().addDocumentListener(showValDocumentListener); -// showVal.addMouseListener(showValMouseListener); downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveDown.png")); upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveUp.png")); @@ -61,21 +80,23 @@ public class JSliderPane extends JPanel { JPanel panel = new JPanel(new FlowLayout(1,1,0)); + showValButton = new UIButton(showVal.getText()); + showValButton.setBorderPainted(false); + showValButton.setPreferredSize(new Dimension(HALFHUNDRED,ONEEIGHT)); + + showValButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + popupDialog(); + } + }); panel.add(downButton); panel.add(slider); panel.add(upButton); - panel.add(showVal); -// JPanel panel = new JPanel(null); -// panel.add(downButton); -// panel.add(slider); -// panel.add(upButton); -// panel.add(showVal); -// downButton.setBounds(0,0,16,16); -// slider.setBounds(16+KERNING,0,160,16); -// upButton.setBounds(176+KERNING*2,0,16,16); -// showVal.setBounds(192+KERNING*3,0,40,16); + panel.add(showValButton); this.add(panel,BorderLayout.NORTH); - this.setBounds(0,0,300,16); + this.setBounds(0,0,THREEHUNDRED,ONEEIGHT); + } public static final JSliderPane getInstance() { @@ -86,6 +107,24 @@ public class JSliderPane extends JPanel { return THIS; } + private void initUIRadioButton(){ + twoHundredButton = new UIRadioButton("200%"); + oneHundredButton = new UIRadioButton("100%"); + SevenFiveButton = new UIRadioButton("75%"); + fiveTenButton = new UIRadioButton("50%"); + twoFiveButton = new UIRadioButton("25%"); + selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton")); + customButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_customButton")); + + ButtonGroup bg=new ButtonGroup();// 初始化按钮组 + bg.add(twoHundredButton);// 加入按钮组 + bg.add(oneHundredButton); + bg.add(SevenFiveButton); + bg.add(fiveTenButton); + bg.add(twoFiveButton); + bg.add(selfAdaptButton); + bg.add(customButton); + } //定义一个监听器,用于监听所有滑动条 @@ -115,7 +154,7 @@ public class JSliderPane extends JPanel { isButtonOrIsTxt = true; resolutionTimes = divide(showValue,100,2); refreshSlider(); - refreshBody(); + refreshBottun(); } @Override @@ -129,49 +168,20 @@ public class JSliderPane extends JPanel { } }; - MouseListener showValMouseListener = new MouseListener() { - @Override - public void mouseClicked(MouseEvent e) { - popupDialog(); - } - - @Override - public void mousePressed(MouseEvent e) { - - } - - @Override - public void mouseReleased(MouseEvent e) { - - } - - @Override - public void mouseEntered(MouseEvent e) { - - } - - @Override - public void mouseExited(MouseEvent e) { - - } - }; - private void refreshSlider(){ showValue = Integer.parseInt(showVal.getText().substring(0, showVal.getText().indexOf("%"))); - if (showValue >100){ - slider.setValue((int)(showValue+200)/6); - }else if (showValue <100){ - slider.setValue((int)((showValue-10)/1.8)); - }else if (showValue == 100){ - slider.setValue(50); + if (showValue >HUNDRED){ + slider.setValue((int)(showValue+TWOHUNDRED)/SIX); + }else if (showValue = 10 ){ + int newDownVal = showValue - TEN; + if (newDownVal >= TEN ){ showValue = newDownVal; showVal.setText(newDownVal + "%"); }else { showValue = newDownVal; - showVal.setText(10 + "%"); + showVal.setText(TEN + "%"); } } if(e.getActionCommand().equals("more")){ - int newUpVal = showValue + 10; - if (newUpVal <= 400 ){ + int newUpVal = showValue + TEN; + if (newUpVal <= FOURHUNDRED ){ showValue = newUpVal; showVal.setText(newUpVal + "%"); }else { showValue = newUpVal; - showVal.setText(400 + "%"); + showVal.setText(FOURHUNDRED + "%"); } } isButtonOrIsTxt = true; } }; + + private void getTimes(int value){ - if (value == 50){ - times=100; - }else if (value < 50){ - times = (int) Math.round(1.8*value + 10); + if (value == HALFHUNDRED){ + times=HUNDRED; + }else if (value < HALFHUNDRED){ + times = (int) Math.round(ONEPOINTEIGHT*value + TEN); }else { - times = (int) (6*value - 200); + times = (int) (SIX*value - TWOHUNDRED); } } @@ -233,17 +245,20 @@ public class JSliderPane extends JPanel { } private void popupDialog(){ - if (isDialogOut) { - dialog.setVisible(false); - isDialogOut = false; - return; - } - if (dialog == null) { - dialog = new Dialog(showVal); - isDialogOut = true; - } else { - dialog.setVisible(true); - isDialogOut = true; + Point btnCoords = upButton.getLocationOnScreen(); + if (dialog == null){ + dialog = new PopupPane(upButton,showVal); + if (upButtonX == 0) { + upButtonX = btnCoords.x; + GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +HALFHUNDRED, -DIALOGHEIGHT); + } + }else { + if (upButtonX == 0) { + upButtonX = btnCoords.x; + GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +HALFHUNDRED, -DIALOGHEIGHT); + } else { + GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +HALFHUNDRED, -DIALOGHEIGHT); + } } } @@ -263,6 +278,12 @@ public class JSliderPane extends JPanel { class JSliderPaneUI extends BasicSliderUI { + private static final int VERTICAL_WIDTH = 11; + private static final int VERTICAL_HEIGHT = 16; + private static final int FOUR = 4; + private static final int FIVE = 5; + private static final int SIX = 6; + public JSliderPaneUI(UISlider b) { super(b); } @@ -276,12 +297,12 @@ class JSliderPaneUI extends BasicSliderUI { Dimension size = new Dimension(); if ( slider.getOrientation() == JSlider.VERTICAL ) { - size.width = 11; - size.height = 16; + size.width = VERTICAL_WIDTH; + size.height = VERTICAL_HEIGHT; } else { - size.width = 11; - size.height = 16; + size.width = VERTICAL_WIDTH; + size.height = VERTICAL_HEIGHT; } return size; @@ -300,7 +321,7 @@ class JSliderPaneUI extends BasicSliderUI { g.setColor(slider.getBackground().darker()); } g.setColor(Color.darkGray); - g.fillRect(0, 1, w-6, h+1); + g.fillRect(0, 1, w-SIX, h+1); } /** */ @@ -315,43 +336,82 @@ class JSliderPaneUI extends BasicSliderUI { cy = (trackBounds.height / 2); cw = trackBounds.width; g.setColor(Color.lightGray); - g.drawLine(0, cy, cw+5, cy); - g.drawLine(5+cw/2, cy-4, 5+cw/2, cy+4); + g.drawLine(0, cy, cw+FIVE, cy); + g.drawLine(FIVE+cw/2, cy-FOUR, FIVE+cw/2, cy+FOUR); } else { super.paintTrack(g); } } + } class Dialog extends JDialog { - private Container container; - private static final int RESIZE_RANGE = 4; - private Cursor originCursor; - private Cursor southResizeCursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR); - private Point mouseDownCompCoords; - private int minHeight; // 对话框最小高度 +// private Container container; +// private static final int UPLABELHEIGHT = 25; +// private static final int HALFHUNDRED = 50; +// private static final int DIALOGWIDTH = 150; +// private static final int DIALOGHEIGHT = 200; +// private static final int UPLABELWIDTH = 300; +// private int minHeight; // 对话框最小高度 +// private JComponent contentPane; +// private JComponent centerPane; +// private UILabel upLabel; + +// public Dialog(UIButton b,UITextField j) { +// super(DesignerContext.getDesignerFrame()); +// container = getContentPane(); +// setUndecorated(true); +// contentPane = new JPanel(new BorderLayout()); +// centerPane = new JPanel(new BorderLayout()); +// upLabel = new UILabel(Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce")); +// upLabel.setOpaque(true); +// upLabel.setPreferredSize(new Dimension(UPLABELWIDTH,UPLABELHEIGHT)); +// upLabel.setBackground(Color.LIGHT_GRAY); +// upLabel.setBorder(BorderFactory.createLineBorder(Color.gray,1)); +// upLabel.setBorder(new MatteBorder(0,0,1,0,Color.gray)); +// centerPane.add(j,BorderLayout.NORTH); +// contentPane.add(upLabel,BorderLayout.NORTH); +// contentPane.add(centerPane,BorderLayout.CENTER); +//// contentPane.setBorder(BorderFactory.createLineBorder(Color.gray,1)); +// contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray)); +//// contentPane.add(new JPanel()) +// container.add(contentPane, BorderLayout.CENTER); +// minHeight = container.getPreferredSize().height; +// setSize(DIALOGWIDTH, DIALOGHEIGHT); +//// validate(); +// Point btnCoords = b.getLocationOnScreen(); +// +// this.setLocation(btnCoords.x - DIALOGWIDTH + b.getWidth() +HALFHUNDRED, btnCoords.y -DIALOGHEIGHT); +//// initListener(); +// +// this.setVisible(true); +// } +} +class PopupPane extends JPopupMenu { private JComponent contentPane; + private static final int UPLABELHEIGHT = 25; + private static final int HALFHUNDRED = 50; + private static final int DIALOGWIDTH = 150; + private static final int DIALOGHEIGHT = 200; + private static final int UPLABELWIDTH = 300; + private JComponent centerPane; private UILabel upLabel; - - public Dialog(UITextField j) { - super(DesignerContext.getDesignerFrame()); - container = getContentPane(); - setUndecorated(true); + PopupPane(UIButton b,UITextField j) { contentPane = new JPanel(new BorderLayout()); - upLabel = new UILabel(Inter.getLocText("Enlarge_Or_Reduce")); + centerPane = new JPanel(new BorderLayout()); + upLabel = new UILabel(Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce")); upLabel.setOpaque(true); - upLabel.setPreferredSize(new Dimension(300,25)); + upLabel.setPreferredSize(new Dimension(UPLABELWIDTH,UPLABELHEIGHT)); upLabel.setBackground(Color.LIGHT_GRAY); + upLabel.setBorder(new MatteBorder(0,0,1,0,Color.gray)); + centerPane.add(j,BorderLayout.NORTH); contentPane.add(upLabel,BorderLayout.NORTH); -// contentPane.add(new JPanel()) - container.add(contentPane, BorderLayout.CENTER); - minHeight = container.getPreferredSize().height; - setSize(150, 250); -// validate(); - Point btnCoords = j.getLocationOnScreen(); + contentPane.add(centerPane,BorderLayout.CENTER); +// contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray)); + this.add(contentPane, BorderLayout.CENTER); + this.setPreferredSize(new Dimension(DIALOGWIDTH, DIALOGHEIGHT)); + this.setOpaque(false); + } - this.setLocation(btnCoords.x -150+j.getWidth(), btnCoords.y -250); -// initListener(); - this.setVisible(true); - } -} + +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/FormArea.java b/designer_form/src/com/fr/design/mainframe/FormArea.java index 51a18c696..2a321cd32 100644 --- a/designer_form/src/com/fr/design/mainframe/FormArea.java +++ b/designer_form/src/com/fr/design/mainframe/FormArea.java @@ -50,25 +50,27 @@ public class FormArea extends JComponent implements ScrollRulerComponent { private static final double SLIDER_FLOAT = 400.0; private static final double SLIDER_MIN = 10.0; public static final double DEFAULT_SLIDER = 100.0; - private static final int ROTATIONS = 50; - private FormDesigner designer; - private int horizontalValue = 0; - private int verticalValue = 0; - private int verticalMax = 0; - private int horicalMax = 0; - private FormScrollBar verScrollBar; + private static final int ROTATIONS = 50; + private static final int showValMax = 400; + private static final int showValMin = 10; + private FormDesigner designer; + private int horizontalValue = 0; + private int verticalValue = 0; + private int verticalMax = 0; + private int horicalMax = 0; + private FormScrollBar verScrollBar; private FormScrollBar horScrollBar; - //显示和设置表单界面大小的控件 - private UINumberField widthPane; - private UINumberField heightPane; - private JSliderPane slidePane; - private boolean isValid = true; - // 初始时滑块值为100,托动后的值设为START_VALUE; - private double START_VALUE = DEFAULT_SLIDER; - private double screenValue; + //显示和设置表单界面大小的控件 + private UINumberField widthPane; + private UINumberField heightPane; + private JSliderPane slidePane; + private boolean isValid = true; + // 初始时滑块值为100,托动后的值设为START_VALUE; + private double START_VALUE = DEFAULT_SLIDER; + private double screenValue; private JSliderPane sliderPane; - - public FormScrollBar getHorScrollBar() { + + public FormScrollBar getHorScrollBar() { return horScrollBar; } @@ -76,47 +78,47 @@ public class FormArea extends JComponent implements ScrollRulerComponent { this.horScrollBar = horScrollBar; } - public FormArea(FormDesigner designer) { - this(designer, true); - } - - public FormArea(FormDesigner designer, boolean useScrollBar) { - this.designer = designer; - this.designer.setParent(this); - isValid = useScrollBar; - verScrollBar = new FormScrollBar(Adjustable.VERTICAL, this); - horScrollBar = new FormScrollBar(Adjustable.HORIZONTAL, this); - if (useScrollBar) { - this.setLayout(new FormRulerLayout()); - designer.setBorder(new LineBorder(new Color(198,198,198))); - this.add(FormRulerLayout.CENTER, designer); - addFormSize(); - this.add(FormRulerLayout.VERTICAL, verScrollBar); - this.add(FormRulerLayout.HIRIZONTAL, horScrollBar); - enableEvents(AWTEvent.MOUSE_WHEEL_EVENT_MASK); - } else { - // 报表参数界面只要标尺和中心pane - this.setLayout(new RulerLayout()); - this.add(RulerLayout.CENTER, designer); - addFormRuler(); - } - this.setFocusTraversalKeysEnabled(false); - } - - /** - * 增加表单的页面大小控制界面,包括手动修改和滑块拖动 - */ - private void addFormSize() { - double f = TableLayout.FILL; + public FormArea(FormDesigner designer) { + this(designer, true); + } + + public FormArea(FormDesigner designer, boolean useScrollBar) { + this.designer = designer; + this.designer.setParent(this); + isValid = useScrollBar; + verScrollBar = new FormScrollBar(Adjustable.VERTICAL, this); + horScrollBar = new FormScrollBar(Adjustable.HORIZONTAL, this); + if (useScrollBar) { + this.setLayout(new FormRulerLayout()); + designer.setBorder(new LineBorder(new Color(198,198,198))); + this.add(FormRulerLayout.CENTER, designer); + addFormSize(); + this.add(FormRulerLayout.VERTICAL, verScrollBar); + this.add(FormRulerLayout.HIRIZONTAL, horScrollBar); + enableEvents(AWTEvent.MOUSE_WHEEL_EVENT_MASK); + } else { + // 报表参数界面只要标尺和中心pane + this.setLayout(new RulerLayout()); + this.add(RulerLayout.CENTER, designer); + addFormRuler(); + } + this.setFocusTraversalKeysEnabled(false); + } + + /** + * 增加表单的页面大小控制界面,包括手动修改和滑块拖动 + */ + private void addFormSize() { + double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {f}; double[] columnSize = { p, f, p, p, p, p, p, f, p}; UILabel tipsPane = new UILabel("form"); tipsPane.setPreferredSize(new Dimension(200, 0)); - widthPane = new UINumberField(); - widthPane.setPreferredSize(new Dimension(60, 0)); - heightPane = new UINumberField(); - heightPane.setPreferredSize(new Dimension(60, 0)); + widthPane = new UINumberField(); + widthPane.setPreferredSize(new Dimension(60, 0)); + heightPane = new UINumberField(); + heightPane.setPreferredSize(new Dimension(60, 0)); // slidePane = new UINumberSlidePane(SLIDER_MIN, SLIDER_FLOAT); // slidePane.setPreferredSize(new Dimension(260,20)); @@ -124,40 +126,40 @@ public class FormArea extends JComponent implements ScrollRulerComponent { slidePane.setPreferredSize(new Dimension(300,20)); - JPanel resizePane =TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{ - {tipsPane, new UILabel(), widthPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel("x"), - heightPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel(), slidePane}}, - rowSize, columnSize, 8); - this.add(FormRulerLayout.BOTTOM, resizePane); - setWidgetsConfig(); - // 先初始话滑块及对应事件,然后获取分辨率调整容器的显示大小 - slidePane.setEnabled(false); - slidePane.setVisible(true); - initTransparent(); - initCalculateSize(); - } - - private void setWidgetsConfig() { - widthPane.setHorizontalAlignment(widthPane.CENTER); - heightPane.setHorizontalAlignment(heightPane.CENTER); - widthPane.setMaxDecimalLength(0); - heightPane.setMaxDecimalLength(0); - //控件初始值就是根节点组件初始的宽和高 - widthPane.setValue(designer.getRootComponent().getWidth()); - heightPane.setValue(designer.getRootComponent().getHeight()); - addWidthPaneListener(); - addHeightPaneListener(); - } - - private void initTransparent() { - initCalculateSize(); + JPanel resizePane =TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{ + {tipsPane, new UILabel(), widthPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel("x"), + heightPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel(), slidePane}}, + rowSize, columnSize, 8); + this.add(FormRulerLayout.BOTTOM, resizePane); + setWidgetsConfig(); + // 先初始话滑块及对应事件,然后获取分辨率调整容器的显示大小 + slidePane.setEnabled(false); + slidePane.setVisible(true); + initTransparent(); + initCalculateSize(); + } + + private void setWidgetsConfig() { + widthPane.setHorizontalAlignment(widthPane.CENTER); + heightPane.setHorizontalAlignment(heightPane.CENTER); + widthPane.setMaxDecimalLength(0); + heightPane.setMaxDecimalLength(0); + //控件初始值就是根节点组件初始的宽和高 + widthPane.setValue(designer.getRootComponent().getWidth()); + heightPane.setValue(designer.getRootComponent().getHeight()); + addWidthPaneListener(); + addHeightPaneListener(); + } + + private void initTransparent() { + initCalculateSize(); slidePane.getShowVal().getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { // slidePane.getShowVal().getDocument() double value = Integer.parseInt(slidePane.getShowVal().getText().substring(0, slidePane.getShowVal().getText().indexOf("%"))); - value = value>400 ? 400 : value; - value = value<10 ? 10 : value; + value = value>showValMax ? showValMax : value; + value = value= designer.getRootComponent().getWidth(); - } - - /** - * 设置界面内的组件可见以及水平垂直滚动条的值 - * (除了根容器,拖入组件进来时如果大小超过当前界面大小,必须设置滚动条值,否则滚动条默认不显示) - * - * @param creator 控件 - */ - public void scrollPathToVisible(XCreator creator) { - creator.seleteRelatedComponent(creator); - - if (!ComponentUtils.isComponentVisible(creator) && !designer.isRoot(creator) && (creator.toData()).isVisible()) { - designer.makeVisible(creator); - } - - if (shouldSetScrollValue(creator)) { - return; - } - //获取在容器的绝对位置 - Rectangle rec = ComponentUtils.getRelativeBounds(creator); - int dWidth = getDesignerWidth(); - if (rec.width <= dWidth&&rec.x < getHorizontalValue()) { - //在边界内部且x位置小于水平滚动条的值 - horScrollBar.setValue(rec.x); - } else if (rec.x + rec.width > dWidth + horizontalValue) { - //超出边界宽度 - horScrollBar.setValue(rec.x + rec.width - dWidth); - } - int dHeight = getDesignerHeight(); - if (rec.height < dHeight && rec.y < getVerticalValue()) { - //在边界内部且y位置小于竖直滚动条的值 - verScrollBar.setValue(rec.y); - } else if (rec.y + rec.height > dHeight + verticalValue) { - //超出边界高度 - verScrollBar.setValue(rec.y + rec.height - dHeight); - } - } - - - /** - * 容器布局 - */ - public void doLayout() { - layout(); - if (isValid) { - XLayoutContainer root = designer.getRootComponent(); - setScrollBarProperties(root.getWidth()-designer.getWidth(), horScrollBar); - //计算滚动条值的时候应该算上参数面板的高度 - setScrollBarProperties(designer.getParaHeight() + root.getHeight()-designer.getHeight(), verScrollBar); - } - } - - /** - * 设置滚动条的属性 - */ - private void setScrollBarProperties(int value, FormScrollBar bar) { - if (value == 0 && isScrollNotVisible(bar)) { - return; - } - if (value <= 0) { - // 界面有滚动条时,手动缩小容器宽度到界面内,重置滚动条值和max - setScrollBarMax(0, bar); - bar.setMaximum(0); - bar.setValue(0); - bar.setEnabled(false); - } else { - //参数面板拖拽过程中value一直为当前value - int oldValue = verticalValue; - setScrollBarMax(value, bar); - bar.setEnabled(true); - bar.setMaximum(value); - bar.setValue(value); - bar.setValue(oldValue); - } - } - - private boolean isScrollNotVisible(FormScrollBar bar) { - if (bar.getOrientation() == Adjustable.VERTICAL ) { - return verticalMax == 0; - } else { - return horicalMax == 0; - } - } - - private void setScrollBarMax( int max, FormScrollBar bar) { - if (bar.getOrientation() == Adjustable.VERTICAL ) { - verticalMax = max; - } else { - horicalMax = max; - } - } - - /** - *返回designer的最小高度 - * - * @return int - */ - public int getMinHeight() { - return designer.getDesignerMode().getMinDesignHeight(); - } - - /** - *返回designer的最小宽度 - * - * @return int - */ - public int getMinWidth() { - return designer.getDesignerMode().getMinDesignWidth(); - } - - /** - * getRulerLengthUnit - * - * @return short - */ - public short getRulerLengthUnit() { - return -1; - } - - /** - * 返回水平滚动条的value - * - * @return int - */ - public int getHorizontalValue() { - return horizontalValue; - } - - /** - * 设置水平滚动条的value - * - * @param newValue - */ - public void setHorizontalValue(int newValue) { - this.horizontalValue = newValue; - } - - /** - * 返回竖直滚动条的value - * - * @return - */ - public int getVerticalValue() { - return verticalValue; - } - - /** - * 竖直滚动条赋值 - * - * @param newValue - */ - public void setVerticalValue(int newValue) { - this.verticalValue = newValue; - } - - /** - * 返回当前designer的高度 - * - * @return height - */ - public int getDesignerHeight() { - return designer.getHeight(); - } - - /** - * 返回当前designer的宽度 - * - * @return - */ - public int getDesignerWidth() { - return designer.getWidth(); - } - - /** - * 返回宽度控件的value - * - * @return 宽度 - */ - public double getWidthPaneValue() { - return widthPane.getValue(); - } - - /** - * 设置宽度值 - * @param value 值 - */ - public void setWidthPaneValue(int value) { - widthPane.setValue(value); - } - - /** - * 设置高度值 - * @param value 值 - */ - public void setHeightPaneValue(int value) { - heightPane.setValue(value); - } - - /** - * 返回高度控件的value - * - * @return 高度 - */ - public double getHeightPaneValue() { - return heightPane.getValue(); - } - - /** - * 返回界面大小的百分比值 - * - * @return 百分比值 - */ - public double getSlideValue() { + + } + + /** + * 增加刻度条 + */ + public void addFormRuler() { + BaseRuler vRuler = new VerticalRuler(this); + BaseRuler hRuler = new HorizontalRuler(this); + this.add(RulerLayout.VRULER, vRuler); + this.add(RulerLayout.HRULER, hRuler); + } + + /** + * 鼠标滚轮事件 + * 由于表单设计界面要求: 容器大小大于界面时,滚动条才可以拖动,所以不支持滚动无限往下滚 + */ + @Override + protected void processMouseWheelEvent(java.awt.event.MouseWheelEvent evt) { + int id = evt.getID(); + switch (id) { + case MouseEvent.MOUSE_WHEEL: { + int rotations = evt.getWheelRotation(); + int value = this.verScrollBar.getValue() + rotations * ROTATIONS ; + value = Math.min(value, verticalMax); + value = Math.max(0, value); + doLayout(); //加dolayout是因为每次滚动都要重置 Max的大小 + this.verScrollBar.setValue(value); + break; + } + } + } + + /** + * 返回表单容器的中心designer + * getFormEditor. + */ + public FormDesigner getFormEditor() { + return designer; + } + + private boolean shouldSetScrollValue(XCreator creator) { + return !isValid || designer.isRoot(creator) || getDesignerWidth() >= designer.getRootComponent().getWidth(); + } + + /** + * 设置界面内的组件可见以及水平垂直滚动条的值 + * (除了根容器,拖入组件进来时如果大小超过当前界面大小,必须设置滚动条值,否则滚动条默认不显示) + * + * @param creator 控件 + */ + public void scrollPathToVisible(XCreator creator) { + creator.seleteRelatedComponent(creator); + + if (!ComponentUtils.isComponentVisible(creator) && !designer.isRoot(creator) && (creator.toData()).isVisible()) { + designer.makeVisible(creator); + } + + if (shouldSetScrollValue(creator)) { + return; + } + //获取在容器的绝对位置 + Rectangle rec = ComponentUtils.getRelativeBounds(creator); + int dWidth = getDesignerWidth(); + if (rec.width <= dWidth&&rec.x < getHorizontalValue()) { + //在边界内部且x位置小于水平滚动条的值 + horScrollBar.setValue(rec.x); + } else if (rec.x + rec.width > dWidth + horizontalValue) { + //超出边界宽度 + horScrollBar.setValue(rec.x + rec.width - dWidth); + } + int dHeight = getDesignerHeight(); + if (rec.height < dHeight && rec.y < getVerticalValue()) { + //在边界内部且y位置小于竖直滚动条的值 + verScrollBar.setValue(rec.y); + } else if (rec.y + rec.height > dHeight + verticalValue) { + //超出边界高度 + verScrollBar.setValue(rec.y + rec.height - dHeight); + } + } + + + /** + * 容器布局 + */ + public void doLayout() { + layout(); + if (isValid) { + XLayoutContainer root = designer.getRootComponent(); + setScrollBarProperties(root.getWidth()-designer.getWidth(), horScrollBar); + //计算滚动条值的时候应该算上参数面板的高度 + setScrollBarProperties(designer.getParaHeight() + root.getHeight()-designer.getHeight(), verScrollBar); + } + } + + /** + * 设置滚动条的属性 + */ + private void setScrollBarProperties(int value, FormScrollBar bar) { + if (value == 0 && isScrollNotVisible(bar)) { + return; + } + if (value <= 0) { + // 界面有滚动条时,手动缩小容器宽度到界面内,重置滚动条值和max + setScrollBarMax(0, bar); + bar.setMaximum(0); + bar.setValue(0); + bar.setEnabled(false); + } else { + //参数面板拖拽过程中value一直为当前value + int oldValue = verticalValue; + setScrollBarMax(value, bar); + bar.setEnabled(true); + bar.setMaximum(value); + bar.setValue(value); + bar.setValue(oldValue); + } + } + + private boolean isScrollNotVisible(FormScrollBar bar) { + if (bar.getOrientation() == Adjustable.VERTICAL ) { + return verticalMax == 0; + } else { + return horicalMax == 0; + } + } + + private void setScrollBarMax( int max, FormScrollBar bar) { + if (bar.getOrientation() == Adjustable.VERTICAL ) { + verticalMax = max; + } else { + horicalMax = max; + } + } + + /** + *返回designer的最小高度 + * + * @return int + */ + public int getMinHeight() { + return designer.getDesignerMode().getMinDesignHeight(); + } + + /** + *返回designer的最小宽度 + * + * @return int + */ + public int getMinWidth() { + return designer.getDesignerMode().getMinDesignWidth(); + } + + /** + * getRulerLengthUnit + * + * @return short + */ + public short getRulerLengthUnit() { + return -1; + } + + /** + * 返回水平滚动条的value + * + * @return int + */ + public int getHorizontalValue() { + return horizontalValue; + } + + /** + * 设置水平滚动条的value + * + * @param newValue + */ + public void setHorizontalValue(int newValue) { + this.horizontalValue = newValue; + } + + /** + * 返回竖直滚动条的value + * + * @return + */ + public int getVerticalValue() { + return verticalValue; + } + + /** + * 竖直滚动条赋值 + * + * @param newValue + */ + public void setVerticalValue(int newValue) { + this.verticalValue = newValue; + } + + /** + * 返回当前designer的高度 + * + * @return height + */ + public int getDesignerHeight() { + return designer.getHeight(); + } + + /** + * 返回当前designer的宽度 + * + * @return + */ + public int getDesignerWidth() { + return designer.getWidth(); + } + + /** + * 返回宽度控件的value + * + * @return 宽度 + */ + public double getWidthPaneValue() { + return widthPane.getValue(); + } + + /** + * 设置宽度值 + * @param value 值 + */ + public void setWidthPaneValue(int value) { + widthPane.setValue(value); + } + + /** + * 设置高度值 + * @param value 值 + */ + public void setHeightPaneValue(int value) { + heightPane.setValue(value); + } + + /** + * 返回高度控件的value + * + * @return 高度 + */ + public double getHeightPaneValue() { + return heightPane.getValue(); + } + + /** + * 返回界面大小的百分比值 + * + * @return 百分比值 + */ + public double getSlideValue() { // return slidePane.updateBean(); - //7.1.1不加缩放滑块 - return this.screenValue; - } - - /** - * 返回界面区域大小 - * - * @return Dimension - */ - public Dimension getAreaSize() { - return new Dimension(horScrollBar.getMaximum(), verScrollBar.getMaximum()); - } - - /** - * setAreaSize - * - * @param totalSize - * @param horizontalValue - * @param verticalValue - */ - public void setAreaSize(Dimension totalSize, int horizontalValue, int verticalValue, double width, double height, double slide) { - this.verticalMax = (int) totalSize.getHeight(); - this.horicalMax = (int) totalSize.getHeight(); - // 撤销时会refreshRoot,导致layout大小变为默认大小 - // 按照之前设置的宽高和百分比重置下容器size - if (width != widthPane.getValue()) { - widthPane.setValue(width); - reCalculateWidth((int) width); - } - if (height != heightPane.getValue()) { - heightPane.setValue(height); - reCalculateHeight((int) height); - } - if (designer.getRootComponent().acceptType(XWFitLayout.class) && slide == DEFAULT_SLIDER) { - XWFitLayout layout = (XWFitLayout) designer.getRootComponent(); - // 撤销时先refreshRoot了,此处去掉内边距再增加间隔 - layout.moveContainerMargin(); - layout.addCompInterval(layout.getAcualInterval()); - } else if (designer.getRootComponent().acceptType(XWFitLayout.class)){ - START_VALUE = DEFAULT_SLIDER; - reCalculateRoot(slide, true); + //7.1.1不加缩放滑块 + return this.screenValue; + } + + /** + * 返回界面区域大小 + * + * @return Dimension + */ + public Dimension getAreaSize() { + return new Dimension(horScrollBar.getMaximum(), verScrollBar.getMaximum()); + } + + /** + * setAreaSize + * + * @param totalSize + * @param horizontalValue + * @param verticalValue + */ + public void setAreaSize(Dimension totalSize, int horizontalValue, int verticalValue, double width, double height, double slide) { + this.verticalMax = (int) totalSize.getHeight(); + this.horicalMax = (int) totalSize.getHeight(); + // 撤销时会refreshRoot,导致layout大小变为默认大小 + // 按照之前设置的宽高和百分比重置下容器size + if (width != widthPane.getValue()) { + widthPane.setValue(width); + reCalculateWidth((int) width); + } + if (height != heightPane.getValue()) { + heightPane.setValue(height); + reCalculateHeight((int) height); + } + if (designer.getRootComponent().acceptType(XWFitLayout.class) && slide == DEFAULT_SLIDER) { + XWFitLayout layout = (XWFitLayout) designer.getRootComponent(); + // 撤销时先refreshRoot了,此处去掉内边距再增加间隔 + layout.moveContainerMargin(); + layout.addCompInterval(layout.getAcualInterval()); + } else if (designer.getRootComponent().acceptType(XWFitLayout.class)){ + START_VALUE = DEFAULT_SLIDER; + reCalculateRoot(slide, true); // slidePane.populateBean(slide); - } - } - - /** - * 计算滚动条的值和max - * @param oldmax 之前最大值 - * @param max 当前最大值 - * @param newValue 当前value - * @param oldValue 之前value - * @param visi designer的大小 - * @param orientation 滚动条方向 - * @return 计算后的值和max - */ - @Override - public Point calculateScroll(int oldmax, int max, int newValue, int oldValue, int visi, int orientation) { - int scrollMax = orientation==1 ? verticalMax : horicalMax; - //防止滚动条到达低端还可以继续点击移动(滚动条最大范围不变时,newValue要在范围之内) - if ( oldmax == scrollMax+visi && newValue>scrollMax ) { - return new Point(oldValue, oldmax); - } + } + } + + /** + * 计算滚动条的值和max + * @param oldmax 之前最大值 + * @param max 当前最大值 + * @param newValue 当前value + * @param oldValue 之前value + * @param visi designer的大小 + * @param orientation 滚动条方向 + * @return 计算后的值和max + */ + @Override + public Point calculateScroll(int oldmax, int max, int newValue, int oldValue, int visi, int orientation) { + int scrollMax = orientation==1 ? verticalMax : horicalMax; + //防止滚动条到达低端还可以继续点击移动(滚动条最大范围不变时,newValue要在范围之内) + if ( oldmax == scrollMax+visi && newValue>scrollMax ) { + return new Point(oldValue, oldmax); + } return new Point(newValue, max); } private class FormRulerLayout extends RulerLayout{ - private int DESIGNERWIDTH = 960; - private int DESIGNERHEIGHT =540; - private int TOPGAP = 8; - - public FormRulerLayout(){ - super(); - } - - /** - * 表单用的layout,当前不需要标尺 - */ - public void layoutContainer(Container target) { - synchronized (target.getTreeLock()) { - Insets insets = target.getInsets(); - int top = insets.top; - int left = insets.left; - int bottom = target.getHeight() - insets.bottom; - int right = target.getWidth() - insets.right; - Dimension resize = resizePane.getPreferredSize(); - Dimension hbarPreferredSize = null; - Dimension vbarPreferredSize = null; - - resizePane.setBounds(left, bottom - resize.height, right, resize.height); - if(horScrollBar != null) { - hbarPreferredSize = horScrollBar.getPreferredSize(); - vbarPreferredSize = verScrollBar.getPreferredSize(); - horScrollBar.setBounds(left , bottom - hbarPreferredSize.height-resize.height, right - BARSIZE, hbarPreferredSize.height); - verScrollBar.setBounds(right - vbarPreferredSize.width, top, vbarPreferredSize.width, bottom - BARSIZE-resize.height); - } - FormDesigner dg = ((FormDesigner) designer); - XLayoutContainer root = dg.getRootComponent(); - if (root.acceptType(XWFitLayout.class)) { - DESIGNERWIDTH = root.getWidth(); - DESIGNERHEIGHT = dg.hasWAbsoluteLayout() ? root.getHeight()+dg.getParaHeight() : root.getHeight(); - } - Rectangle rec = new Rectangle(left+(right - DESIGNERWIDTH)/2, TOPGAP, right, bottom); - //是否为表单 - if (isValid ){ - int maxHeight = bottom - hbarPreferredSize.height - resize.height -TOPGAP*2; - int maxWidth = right - vbarPreferredSize.width; - DESIGNERWIDTH = DESIGNERWIDTH> maxWidth ? maxWidth : DESIGNERWIDTH; - DESIGNERHEIGHT = DESIGNERHEIGHT > maxHeight ? maxHeight : DESIGNERHEIGHT; - int designerLeft = left+(verScrollBar.getX() - DESIGNERWIDTH)/2; - rec = new Rectangle(designerLeft, TOPGAP, DESIGNERWIDTH, DESIGNERHEIGHT); - } - // designer是整个表单设计界面中的面板部分,目前只放自适应布局和参数界面。 - designer.setBounds(rec); - } - } - - } + private int DESIGNERWIDTH = 960; + private int DESIGNERHEIGHT =540; + private int TOPGAP = 8; + + public FormRulerLayout(){ + super(); + } + + /** + * 表单用的layout,当前不需要标尺 + */ + public void layoutContainer(Container target) { + synchronized (target.getTreeLock()) { + Insets insets = target.getInsets(); + int top = insets.top; + int left = insets.left; + int bottom = target.getHeight() - insets.bottom; + int right = target.getWidth() - insets.right; + Dimension resize = resizePane.getPreferredSize(); + Dimension hbarPreferredSize = null; + Dimension vbarPreferredSize = null; + + resizePane.setBounds(left, bottom - resize.height, right, resize.height); + if(horScrollBar != null) { + hbarPreferredSize = horScrollBar.getPreferredSize(); + vbarPreferredSize = verScrollBar.getPreferredSize(); + horScrollBar.setBounds(left , bottom - hbarPreferredSize.height-resize.height, right - BARSIZE, hbarPreferredSize.height); + verScrollBar.setBounds(right - vbarPreferredSize.width, top, vbarPreferredSize.width, bottom - BARSIZE-resize.height); + } + FormDesigner dg = ((FormDesigner) designer); + XLayoutContainer root = dg.getRootComponent(); + if (root.acceptType(XWFitLayout.class)) { + DESIGNERWIDTH = root.getWidth(); + DESIGNERHEIGHT = dg.hasWAbsoluteLayout() ? root.getHeight()+dg.getParaHeight() : root.getHeight(); + } + Rectangle rec = new Rectangle(left+(right - DESIGNERWIDTH)/2, TOPGAP, right, bottom); + //是否为表单 + if (isValid ){ + int maxHeight = bottom - hbarPreferredSize.height - resize.height -TOPGAP*2; + int maxWidth = right - vbarPreferredSize.width; + DESIGNERWIDTH = DESIGNERWIDTH> maxWidth ? maxWidth : DESIGNERWIDTH; + DESIGNERHEIGHT = DESIGNERHEIGHT > maxHeight ? maxHeight : DESIGNERHEIGHT; + int designerLeft = left+(verScrollBar.getX() - DESIGNERWIDTH)/2; + rec = new Rectangle(designerLeft, TOPGAP, DESIGNERWIDTH, DESIGNERHEIGHT); + } + // designer是整个表单设计界面中的面板部分,目前只放自适应布局和参数界面。 + designer.setBounds(rec); + } + } + + } } \ No newline at end of file From 20c4524cab35dce2761a565d3006d96d2951d40c Mon Sep 17 00:00:00 2001 From: MoMeak Date: Wed, 19 Jul 2017 18:47:53 +0800 Subject: [PATCH 31/32] =?UTF-8?q?REPORT-2897=209.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E4=BF=AE=E6=94=B9=20PMD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/ReportComponentComposite.java | 3 ++- designer_form/src/com/fr/design/mainframe/FormArea.java | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/ReportComponentComposite.java b/designer/src/com/fr/design/mainframe/ReportComponentComposite.java index b3ab87a28..d51db1770 100644 --- a/designer/src/com/fr/design/mainframe/ReportComponentComposite.java +++ b/designer/src/com/fr/design/mainframe/ReportComponentComposite.java @@ -30,6 +30,7 @@ import com.fr.report.report.TemplateReport; public class ReportComponentComposite extends JComponent { private static final int MAX = 400; + private static final int HUND = 100; private static final int MIN = 10; private JWorkBook parent; private UIModeControlContainer parentContainer = null; @@ -68,7 +69,7 @@ public class ReportComponentComposite extends JComponent { double value = Integer.parseInt(jSliderContainer.getShowVal().getText().substring(0, jSliderContainer.getShowVal().getText().indexOf("%"))); value = value>MAX ? MAX : value; value = valueshowValMax ? showValMax : value; - value = valueSHOWVALMAX ? SHOWVALMAX : value; + value = value Date: Wed, 19 Jul 2017 19:16:32 +0800 Subject: [PATCH 32/32] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E5=B7=A6=E4=BE=A7?= =?UTF-8?q?=E5=8F=AF=E4=BC=B8=E7=BC=A9=E9=9D=A2=E6=9D=BF=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/icontainer/UIResizableContainer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java index 96eccfc59..afb23ec70 100644 --- a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -37,9 +37,9 @@ public class UIResizableContainer extends JPanel { private static final int MIN_WIDTH = 165; private static final int ARROW_MARGIN = 15; - private static final int ARROW_MARGIN_VERTICAL = 20; + private static final int ARROW_MARGIN_VERTICAL = 7; private static final int ARROW_RANGE = 35; - private static final int ARROW_RANGE_VERTICAL = 40; + private static final int ARROW_RANGE_VERTICAL = 25; private boolean isLeftRightDragEnabled = true; private boolean isDownPaneVisible = true ; @@ -502,7 +502,7 @@ public class UIResizableContainer extends JPanel { button = UIConstants.DRAG_LEFT_PRESS; } } - g.drawImage(button, 3, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null); + g.drawImage(button, 3, ARROW_MARGIN_VERTICAL, 5, 5, null); } else { g.drawImage(UIConstants.DRAG_BAR, 0, 0, toolPaneHeight, getHeight(), null); if (containerWidth == toolPaneHeight) {