From 4e6d4a2855ea9d4d6d036289998944e211f7a3a1 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 29 Aug 2018 16:03:06 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-10833=20=E8=81=9A=E5=90=88=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E8=AE=BE=E8=AE=A1=E7=95=8C=E9=9D=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/poly/PolyComponentsBar.java | 170 ++++++++++++++++++ .../java/com/fr/poly/PolyComponetsBar.java | 142 --------------- .../main/java/com/fr/poly/PolyDesigner.java | 50 ++++-- 3 files changed, 209 insertions(+), 153 deletions(-) create mode 100644 designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java delete mode 100644 designer-realize/src/main/java/com/fr/poly/PolyComponetsBar.java diff --git a/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java b/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java new file mode 100644 index 0000000000..3130a4b864 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java @@ -0,0 +1,170 @@ +package com.fr.poly; + +import com.fr.base.BaseUtils; +import com.fr.base.chart.BaseChart; +import com.fr.base.chart.BaseChartGetter; +import com.fr.base.chart.BaseChartNameID; +import com.fr.base.vcs.DesignerMode; +import com.fr.design.ChartTypeInterfaceManager; +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.itooltip.MultiLineToolTip; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.dnd.SerializableTransferable; +import com.fr.log.FineLoggerFactory; +import com.fr.report.poly.PolyECBlock; +import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; + +import javax.swing.BorderFactory; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JToolBar; +import javax.swing.JToolTip; +import javax.swing.SwingConstants; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.datatransfer.Transferable; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceDragEvent; +import java.awt.dnd.DragSourceDropEvent; +import java.awt.dnd.DragSourceEvent; +import java.awt.dnd.DragSourceListener; +import java.io.Serializable; + +/** + * 拖动聚合块的那个竖的动作条 + * + * @editor zhou + * @since 2012-3-23下午3:42:10 + */ +public class PolyComponentsBar extends JToolBar { + private SerIcon[] serIcons; + private static final int MAX_BAR_NUM = 15; + + public PolyComponentsBar() { + setOrientation(SwingConstants.VERTICAL); + setBorder(BorderFactory.createEmptyBorder(4, 4, 0, 4)); + setFloatable(false); + setBackground(UIConstants.TOOLBARUI_BACKGROUND); + setLayout(FRGUIPaneFactory.create1ColumnGridLayout()); + BaseChartNameID[] typeName = BaseChartGetter.getStaticAllChartBaseNames(); + int typeLen = typeName.length < MAX_BAR_NUM ? typeName.length : MAX_BAR_NUM; + serIcons = new SerIcon[typeLen + 1]; + serIcons[0] = new SerIcon( + PolyECBlock.class, + Toolkit.i18nText("Fine-Design_Report_Poly_Report_Block"), + "com/fr/design/images/poly/toolbar/Poly-Report_Block.png" + ); + this.add(serIcons[0]); + for (int i = 0; i < typeLen; i++) { + BaseChart[] rowChart = BaseChartGetter.getStaticChartTypes(typeName[i].getPlotID()); + String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(typeName[i].getPlotID()); + serIcons[i + 1] = new SerIcon(rowChart[0], Toolkit.i18nText(typeName[i].getName()), iconPath); + this.add(serIcons[i + 1]); + } + + } + + /** + * 设置是否可用状态 + */ + public void checkEnable() { + for (SerIcon serIcon : serIcons) { + serIcon.setEnabled(!DesignerMode.isAuthorityEditing()); + } + } + + private class SerIcon extends UIButton implements DragGestureListener, DragSourceListener { + private DragSource dragSource; + private Serializable serializable; + + /** + * @param serializable s + * @param text 按钮名 + * @param iconPath 图标路径 + */ + public SerIcon(Serializable serializable, String text, String iconPath) { + super(BaseUtils.readIcon(iconPath)); + this.serializable = serializable; + this.setToolTipText(text); + this.set4ToolbarButton(); + dragSource = new DragSource(); + dragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, this); + } + + @Override + public Dimension getPreferredSize() { + return new Dimension(getIcon().getIconWidth(), getIcon().getIconHeight()); + } + + @Override + public JToolTip createToolTip() { + MultiLineToolTip tip = new MultiLineToolTip(); + tip.setComponent(this); + tip.setOpaque(false); + return tip; + } + + @Override + public void dragGestureRecognized(DragGestureEvent dge) { + Transferable t = new SerializableTransferable(serializable); + dragSource.startDrag(dge, DragSource.DefaultCopyDrop, t, this); + getModel().setArmed(false); + getModel().setRollover(false); + repaint(); + } + + @Override + public void dragEnter(DragSourceDragEvent dsde) { + + } + + @Override + public void dragOver(DragSourceDragEvent dsde) { + + } + + @Override + public void dropActionChanged(DragSourceDragEvent dsde) { + + } + + @Override + public void dragExit(DragSourceEvent dse) { + + } + + @Override + public void dragDropEnd(DragSourceDropEvent dsde) { + + } + } + + /** + * 测试下 + * + * @param args 参数 + */ + public static void main(String... args) { + try { + UIManager.setLookAndFeel(new WindowsLookAndFeel()); + } catch (UnsupportedLookAndFeelException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + JFrame f = new JFrame(); + JPanel p = (JPanel) f.getContentPane(); + p.setLayout(FRGUIPaneFactory.createBorderLayout()); + PolyComponentsBar pbp = new PolyComponentsBar(); + p.add(pbp, BorderLayout.CENTER); + + f.setSize(400, 300); + f.setVisible(true); + + } +} diff --git a/designer-realize/src/main/java/com/fr/poly/PolyComponetsBar.java b/designer-realize/src/main/java/com/fr/poly/PolyComponetsBar.java deleted file mode 100644 index d6e3b5999d..0000000000 --- a/designer-realize/src/main/java/com/fr/poly/PolyComponetsBar.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.fr.poly; - -import com.fr.base.BaseUtils; -import com.fr.base.FRContext; -import com.fr.base.chart.BaseChart; -import com.fr.base.chart.BaseChartGetter; -import com.fr.base.chart.BaseChartNameID; -import com.fr.base.vcs.DesignerMode; -import com.fr.design.constants.UIConstants; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.itooltip.MultiLineToolTip; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.dnd.SerializableTransferable; - -import com.fr.report.poly.PolyECBlock; -import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; - -import javax.swing.*; -import java.awt.*; -import java.awt.datatransfer.Transferable; -import java.awt.dnd.*; -import java.io.Serializable; -/** - * 拖动聚合块的那个竖的动作条 - * @editor zhou - * @since 2012-3-23下午3:42:10 - */ -public class PolyComponetsBar extends JToolBar { - private static Color FOLDER_PANE_BACKGROUND = new Color(214, 223, 247); - private BaseChartNameID[] typeName = BaseChartGetter.getStaticAllChartBaseNames(); - private SerIcon[] serIcons; - private static final int MAX_BAR_NUM = 15; - - public PolyComponetsBar() { - setOrientation(SwingConstants.VERTICAL); - setBorder(BorderFactory.createEmptyBorder(4, 4, 0, 4)); - setFloatable(false); - setBackground(UIConstants.TOOLBARUI_BACKGROUND); - setLayout(FRGUIPaneFactory.create1ColumnGridLayout()); - int typeLen = typeName.length < MAX_BAR_NUM ? typeName.length : MAX_BAR_NUM; - serIcons = new SerIcon[typeLen + 1]; - serIcons[0] = new SerIcon(PolyECBlock.class, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Poly_Report_Block"), "Fine-Design_Report_Poly_Report_Block"); - this.add(serIcons[0]); - for (int i = 0; i < typeLen; i++) { - BaseChart[] rowChart = BaseChartGetter.getStaticChartTypes(typeName[i].getPlotID()); - serIcons[i + 1] = new SerIcon(rowChart[0], com.fr.design.i18n.Toolkit.i18nText(typeName[i].getName()), typeName[i].getName()); - this.add(serIcons[i + 1]); - } - - } - - /** - * 设置是否可用状态 - */ - public void checkEnable() { - for (SerIcon serIcon : serIcons) { - serIcon.setEnabled(!DesignerMode.isAuthorityEditing()); - } - } - - private class SerIcon extends UIButton implements DragGestureListener, DragSourceListener { - private DragSource dragSource; - private Serializable serializable; - - public SerIcon(Serializable serializable, String text, String iconName) { - super(BaseUtils.readIcon("com/fr/design/images/poly/toolbar/" + iconName + ".png")); - this.serializable = serializable; - this.setToolTipText(text); - this.set4ToolbarButton(); - dragSource = new DragSource(); - dragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, this); - } - - @Override - public Dimension getPreferredSize() { - return new Dimension(getIcon().getIconWidth(), getIcon().getIconHeight()); - } - - @Override - public JToolTip createToolTip() { - MultiLineToolTip tip = new MultiLineToolTip(); - tip.setComponent(this); - tip.setOpaque(false); - return tip; - } - - @Override - public void dragGestureRecognized(DragGestureEvent dge) { - Transferable t = new SerializableTransferable(serializable); - dragSource.startDrag(dge, DragSource.DefaultCopyDrop, t, this); - getModel().setArmed(false); - getModel().setRollover(false); - repaint(); - } - - @Override - public void dragEnter(DragSourceDragEvent dsde) { - - } - - @Override - public void dragOver(DragSourceDragEvent dsde) { - - } - - @Override - public void dropActionChanged(DragSourceDragEvent dsde) { - - } - - @Override - public void dragExit(DragSourceEvent dse) { - - } - - @Override - public void dragDropEnd(DragSourceDropEvent dsde) { - - } - } - - /** - * 测试下 - * @param args 参数 - */ - public static void main(String... args) { - try { - UIManager.setLookAndFeel(new WindowsLookAndFeel()); - } catch (UnsupportedLookAndFeelException e) { - FRContext.getLogger().error(e.getMessage(), e); - } - JFrame f = new JFrame(); - JPanel p = (JPanel) f.getContentPane(); - p.setLayout(FRGUIPaneFactory.createBorderLayout()); - PolyComponetsBar pbp = new PolyComponetsBar(); - p.add(pbp, BorderLayout.CENTER); - - f.setSize(400, 300); - f.setVisible(true); - - } -} diff --git a/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java b/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java index 2307765e33..a0d2db47e4 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java @@ -3,7 +3,6 @@ */ package com.fr.poly; -import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.GraphHelper; import com.fr.base.ScreenResolution; @@ -19,7 +18,18 @@ import com.fr.design.designer.EditingState; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.*; +import com.fr.design.mainframe.AuthorityEditPane; +import com.fr.design.mainframe.CellElementPropertyPane; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.EastRegionContainerPane; +import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.mainframe.ElementCasePaneAuthorityEditPane; +import com.fr.design.mainframe.FormScrollBar; +import com.fr.design.mainframe.JSliderPane; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.NoSupportAuthorityEdit; +import com.fr.design.mainframe.ReportComponent; +import com.fr.design.mainframe.ReportComponentComposite; import com.fr.design.mainframe.cell.QuickEditorRegion; import com.fr.design.menu.MenuDef; import com.fr.design.menu.ShortCut; @@ -35,7 +45,11 @@ import com.fr.design.utils.gui.LayoutUtils; import com.fr.general.ComparatorUtils; import com.fr.grid.selection.Selection; import com.fr.poly.actions.DeleteBlockAction; -import com.fr.poly.creator.*; +import com.fr.poly.creator.BlockCreator; +import com.fr.poly.creator.BlockEditor; +import com.fr.poly.creator.ECBlockCreator; +import com.fr.poly.creator.ECBlockEditor; +import com.fr.poly.creator.PolyElementCasePane; import com.fr.poly.hanlder.DataEditingListener; import com.fr.poly.hanlder.PolyDesignerDropTarget; import com.fr.poly.model.AddedData; @@ -51,9 +65,23 @@ import com.fr.stable.unit.OLDPIX; import com.fr.stable.unit.UNIT; import com.fr.stable.unit.UnitRectangle; -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; +import javax.swing.AbstractAction; +import javax.swing.ActionMap; +import javax.swing.InputMap; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JScrollBar; +import javax.swing.KeyStroke; +import java.awt.AWTEvent; +import java.awt.Adjustable; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; import java.util.ArrayList; import java.util.List; @@ -92,7 +120,7 @@ public class PolyDesigner extends ReportComponent