Browse Source

REPORT-10833 聚合报表设计界面问题

final/10.0
yaoh.wu 6 years ago
parent
commit
4e6d4a2855
  1. 170
      designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java
  2. 142
      designer-realize/src/main/java/com/fr/poly/PolyComponetsBar.java
  3. 50
      designer-realize/src/main/java/com/fr/poly/PolyDesigner.java

170
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);
}
}

142
designer-realize/src/main/java/com/fr/poly/PolyComponetsBar.java

@ -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);
}
}

50
designer-realize/src/main/java/com/fr/poly/PolyDesigner.java

@ -3,7 +3,6 @@
*/ */
package com.fr.poly; package com.fr.poly;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution; 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.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.layout.FRGUIPaneFactory; 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.mainframe.cell.QuickEditorRegion;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut; 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.general.ComparatorUtils;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.poly.actions.DeleteBlockAction; 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.DataEditingListener;
import com.fr.poly.hanlder.PolyDesignerDropTarget; import com.fr.poly.hanlder.PolyDesignerDropTarget;
import com.fr.poly.model.AddedData; 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.UNIT;
import com.fr.stable.unit.UnitRectangle; import com.fr.stable.unit.UnitRectangle;
import javax.swing.*; import javax.swing.AbstractAction;
import java.awt.*; import javax.swing.ActionMap;
import java.awt.event.*; 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.ArrayList;
import java.util.List; import java.util.List;
@ -92,7 +120,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
private JScrollBar verScrollBar; private JScrollBar verScrollBar;
private JScrollBar horScrollBar; private JScrollBar horScrollBar;
private PolyComponetsBar polyComponetsBar = new PolyComponetsBar(); private PolyComponentsBar polyComponentsBar = new PolyComponentsBar();
private JComponent[] toolBarComponent = null; private JComponent[] toolBarComponent = null;
private JPanel ployareaPane; private JPanel ployareaPane;
private JSliderPane jSliderContainer; private JSliderPane jSliderContainer;
@ -142,7 +170,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
@Override @Override
public void mouseWheelMoved(MouseWheelEvent evt) { public void mouseWheelMoved(MouseWheelEvent evt) {
int id = evt.getID(); int id = evt.getID();
if (id == MouseEvent.MOUSE_WHEEL){ if (id == MouseEvent.MOUSE_WHEEL) {
if (!InputEventBaseOnOS.isControlDown(evt)) { if (!InputEventBaseOnOS.isControlDown(evt)) {
int rotations = evt.getWheelRotation(); int rotations = evt.getWheelRotation();
verScrollBar.setValue(verScrollBar.getValue() + rotations * ROTATIONS); verScrollBar.setValue(verScrollBar.getValue() + rotations * ROTATIONS);
@ -167,7 +195,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
ployareaPane.add(PolyDesignerLayout.HRuler, new HorizontalRuler(this)); ployareaPane.add(PolyDesignerLayout.HRuler, new HorizontalRuler(this));
ployareaPane.setBackground(Color.WHITE); ployareaPane.setBackground(Color.WHITE);
this.add(ployareaPane, BorderLayout.CENTER); this.add(ployareaPane, BorderLayout.CENTER);
this.add(polyComponetsBar, BorderLayout.WEST); this.add(polyComponentsBar, BorderLayout.WEST);
} }
private void initPolyBlocks() { private void initPolyBlocks() {
@ -750,7 +778,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
* @return 工具按钮 * @return 工具按钮
*/ */
public JComponent[] toolBarButton4Form() { public JComponent[] toolBarButton4Form() {
polyComponetsBar.checkEnable(); polyComponentsBar.checkEnable();
if (selection != null) { if (selection != null) {
selection.checkButtonEnable(); selection.checkButtonEnable();
} }
@ -849,7 +877,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
public void updateJSliderValue() { public void updateJSliderValue() {
ReportComponentComposite reportComposite = (ReportComponentComposite) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentReportComponentPane(); ReportComponentComposite reportComposite = (ReportComponentComposite) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentReportComponentPane();
JSliderPane jSliderContainer = reportComposite.getjSliderContainer(); JSliderPane jSliderContainer = reportComposite.getjSliderContainer();
jSliderContainer.getShowVal().setValue((int)Math.ceil((double)this.resolution * HUND / ScreenResolution.getScreenResolution())); jSliderContainer.getShowVal().setValue((int) Math.ceil((double) this.resolution * HUND / ScreenResolution.getScreenResolution()));
} }

Loading…
Cancel
Save