Browse Source

REPORT-3163 合作开发9.0设计器=>聚合报表=》坐标尺寸

master
plough 7 years ago
parent
commit
69a6fea2fe
  1. 94
      designer/src/com/fr/poly/PolyBlockProperTable.java
  2. 52
      designer_base/src/com/fr/design/widget/WidgetBoundsPaneFactory.java
  3. 27
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java
  4. 24
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

94
designer/src/com/fr/poly/PolyBlockProperTable.java

@ -1,17 +1,80 @@
package com.fr.poly;
import java.awt.*;
import java.util.ArrayList;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.table.TableModel;
import com.fr.design.dialog.BasicPane;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.gui.itable.PropertyGroup;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.WidgetBoundsPaneFactory;
import com.fr.general.Inter;
import com.fr.poly.group.PolyBoundsGroup;
import com.fr.poly.group.PolyNameGroup;
import com.fr.report.poly.TemplateBlock;
public class PolyBlockProperTable extends AbstractPropertyTable {
public class PolyBlockProperTable extends JPanel {
private PolyDesigner designer;
private UISpinner x;
private UISpinner y;
private UISpinner width;
private UISpinner height;
public PolyBlockProperTable() {
initPropertyPane();
initListener(this);
}
private void initPropertyPane() {
x = new UISpinner(0, 1200, 1);
y = new UISpinner(0, 1200, 1);
width = new UISpinner(0, 1200, 1);
height = new UISpinner(0, 1200, 1);
UIExpandablePane uiExpandablePane = WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height);
this.setLayout(new BorderLayout());
this.add(uiExpandablePane, BorderLayout.CENTER);
}
private void initListener(Container parentComponent) {
for (int i = 0; i < parentComponent.getComponentCount(); i++) {
Component tmpComp = parentComponent.getComponent(i);
if (tmpComp instanceof Container) {
initListener((Container) tmpComp);
}
// if (tmpComp instanceof GlobalNameObserver) {
// ((GlobalNameObserver) tmpComp).registerNameListener(new GlobalNameListener() {
// public void setGlobalName(String name) {
// globalName = name;
// }
//
// public String getGlobalName() {
// return globalName;
// }
// });
// }
if (tmpComp instanceof UIObserver) {
((UIObserver) tmpComp).registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
update();
}
});
}
}
}
/**
* 初始化属性表
@ -20,16 +83,21 @@ public class PolyBlockProperTable extends AbstractPropertyTable {
*
*/
public void initPropertyGroups(Object source) {
groups = new ArrayList<PropertyGroup>();
// groups = new ArrayList<PropertyGroup>();
if (source instanceof TemplateBlock) {
TemplateBlock block = (TemplateBlock) source;
PolyNameGroup namegroup = new PolyNameGroup(block);
groups.add(new PropertyGroup(namegroup));
PolyBoundsGroup boundsgroup = new PolyBoundsGroup(block, designer.getTarget());
groups.add(new PropertyGroup(boundsgroup));
// groups.add(new PropertyGroup(namegroup));
final PolyBoundsGroup boundsgroup = new PolyBoundsGroup(block, designer.getTarget());
x.setValue((int)boundsgroup.getValue(0, 1));
y.setValue((int)boundsgroup.getValue(1, 1));
width.setValue((int)boundsgroup.getValue(2, 1));
height.setValue((int)boundsgroup.getValue(3, 1));
// groups.add(new PropertyGroup(boundsgroup));
}
TableModel model = new BeanTableModel();
setModel(model);
// TableModel model = new BeanTableModel();
// setModel(model);
this.repaint();
}
@ -46,4 +114,16 @@ public class PolyBlockProperTable extends AbstractPropertyTable {
initPropertyGroups(this.designer.getEditingTarget());
}
public void update() {
TemplateBlock block = this.designer.getEditingTarget();
if (block == null) {
return;
}
PolyBoundsGroup boundsgroup = new PolyBoundsGroup(block, designer.getTarget());
boundsgroup.setValue(x.getValue(), 0, 1);
boundsgroup.setValue(y.getValue(), 1, 1);
boundsgroup.setValue(width.getValue(), 2, 1);
boundsgroup.setValue(height.getValue(), 3, 1);
firePropertyEdit();
}
}

52
designer_base/src/com/fr/design/widget/WidgetBoundsPaneFactory.java

@ -0,0 +1,52 @@
package com.fr.design.widget;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by plough on 2017/8/7.
*/
public class WidgetBoundsPaneFactory {
public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Size")), width, height},
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer-Tree_Width"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer-Tree_Height"), SwingConstants.CENTER)},
};
double[] rowSize = {p, p};
double[] columnSize = {p, f, f};
int[][] rowCount = {{1, 1, 1}, {1, 1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5);
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
return new UIExpandablePane("尺寸", 280, 20, panel);
}
public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height) {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Position")), x, y},
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer_X_Coordinate"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer_Y_Coordinate"), SwingConstants.CENTER)},
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Size")), width, height},
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer-Tree_Width"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer-Tree_Height"), SwingConstants.CENTER)},
};
double[] rowSize = {p, p, p, p};
double[] columnSize = {p, f, f};
int[][] rowCount = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5);
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
return new UIExpandablePane(Inter.getLocText("Form-Component_Bounds"), 280, 20, panel);
}
}

27
designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java

@ -3,15 +3,10 @@ package com.fr.design.widget.ui.designer.component;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.WidgetBoundsPaneFactory;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
@ -26,32 +21,14 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
super(source);
XLayoutContainer xLayoutContainer = getParent(source);
this.parent = (XWAbsoluteLayout) xLayoutContainer;
}
public void initBoundPane() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
x = new UISpinner(0, 1200, 1);
y = new UISpinner(0, 1200, 1);
width = new UISpinner(0, 1200, 1);
height = new UISpinner(0, 1200, 1);
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Position")), x, y},
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer_X_Coordinate"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer_Y_Coordinate"), SwingConstants.CENTER)},
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Size")), width, height},
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer-Tree_Width"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer-Tree_Height"), SwingConstants.CENTER)},
};
double[] rowSize = {p, p, p, p};
double[] columnSize = {p, f, f};
int[][] rowCount = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5);
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("Form-Component_Bounds"), 280, 20, panel);
this.add(uiExpandablePane);
this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height));
}

24
designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -2,15 +2,10 @@ package com.fr.design.widget.ui.designer.component;
import com.fr.design.designer.creator.*;
import com.fr.design.dialog.BasicPane;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import com.fr.design.widget.WidgetBoundsPaneFactory;
import javax.swing.*;
import java.awt.*;
/**
@ -36,25 +31,10 @@ public class WidgetBoundPane extends BasicPane {
return container;
}
public void initBoundPane() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
width = new UISpinner(0, 1200, 1);
height = new UISpinner(0, 1200, 1);
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Size")), width, height},
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer-Tree_Width"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer-Tree_Height"), SwingConstants.CENTER)},
};
double[] rowSize = {p, p};
double[] columnSize = {p, f, f};
int[][] rowCount = {{1, 1, 1}, {1, 1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5);
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
UIExpandablePane uiExpandablePane = new UIExpandablePane("尺寸", 280, 20, panel);
this.add(uiExpandablePane);
this.add(WidgetBoundsPaneFactory.createBoundsPane(width, height));
}

Loading…
Cancel
Save