Browse Source

REPORT-3348 数据列高级设置内部组件调整

master
yaoh.wu 7 years ago
parent
commit
1a3b6fca8f
  1. 213
      designer/src/com/fr/design/dscolumn/DSColumnAdvancedEditorPane.java
  2. 1
      designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java
  3. 50
      designer/src/com/fr/design/dscolumn/ResultSetGroupDockingPane.java
  4. 23
      designer/src/com/fr/quickeditor/CellQuickEditor.java
  5. 2
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  6. 902
      designer_base/src/com/fr/design/layout/FRGUIPaneFactory.java
  7. 3
      designer_base/src/com/fr/design/utils/DesignUtils.java

213
designer/src/com/fr/design/dscolumn/DSColumnAdvancedEditorPane.java

@ -19,7 +19,6 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.cell.CellEditorPane; import com.fr.design.mainframe.cell.CellEditorPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
@ -52,9 +51,9 @@ public class DSColumnAdvancedEditorPane extends CellEditorPane {
//排列顺序 //排列顺序
private ResultSetSortConfigPane sortPane; private ResultSetSortConfigPane sortPane;
//结果集筛选 //结果集筛选
private SelectCountPane selectCountPane; private ResultSetFilterConfigPane filterPane;
//自定义值显示 //自定义值显示
private ValuePane valuePane; private CustomValuePane valuePane;
//横向可扩展性 //横向可扩展性
private UICheckBox horizontalExtendableCheckBox; private UICheckBox horizontalExtendableCheckBox;
//纵向可扩展性 //纵向可扩展性
@ -68,6 +67,7 @@ public class DSColumnAdvancedEditorPane extends CellEditorPane {
public DSColumnAdvancedEditorPane() { public DSColumnAdvancedEditorPane() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(this.createContentPane(), BorderLayout.CENTER); this.add(this.createContentPane(), BorderLayout.CENTER);
this.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
} }
@ -99,22 +99,22 @@ public class DSColumnAdvancedEditorPane extends CellEditorPane {
private JPanel createContentPane() { private JPanel createContentPane() {
this.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); this.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
//结果集排序
this.sortPane = new ResultSetSortConfigPane(); this.sortPane = new ResultSetSortConfigPane();
//结果筛选
selectCountPane = new DSColumnAdvancedEditorPane.SelectCountPane(); filterPane = new ResultSetFilterConfigPane();
//自定义值显示
valuePane = new DSColumnAdvancedEditorPane.ValuePane(); valuePane = new CustomValuePane();
//可扩展性
JPanel extendableDirectionPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel extendableDirectionPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
extendableDirectionPane.add(horizontalExtendableCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Horizontal_Extendable"))); extendableDirectionPane.add(horizontalExtendableCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Horizontal_Extendable")));
extendableDirectionPane.add(verticalExtendableCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Vertical_Extendable"))); extendableDirectionPane.add(verticalExtendableCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Vertical_Extendable")));
JPanel extendablePane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("ExpandD-Expandable"));
extendablePane.setLayout(new BorderLayout());
extendablePane.add(extendableDirectionPane, BorderLayout.CENTER);
JPanel multiNumPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Fill_blank_Data")); //补充空白数据
JPanel multiNumPane = new JPanel();
useMultiplyNumCheckBox = new UICheckBox(Inter.getLocText("Column_Multiple")); useMultiplyNumCheckBox = new UICheckBox(Inter.getLocText("Column_Multiple"));
multiNumPane.add(useMultiplyNumCheckBox); multiNumPane.add(useMultiplyNumCheckBox);
@ -124,22 +124,20 @@ public class DSColumnAdvancedEditorPane extends CellEditorPane {
multiNumPane.add(multiNumSpinner); multiNumPane.add(multiNumSpinner);
useMultiplyNumCheckBox.addActionListener(new ActionListener() { useMultiplyNumCheckBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
checkButtonEnabled(); checkButtonEnabled();
} }
}); });
double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED, double p = TableLayout.PREFERRED, f = TableLayout.FILL;
TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}; double[] rowSize = {p, p, p, p, p, p};
double[] columnSize = {TableLayout.FILL}; double[] columnSize = {f};
Component[][] components = null; Component[][] components = new Component[][]{
components = new Component[][]{
{sortPane}, {sortPane},
{selectCountPane}, {filterPane},
{valuePane}, {valuePane},
{extendablePane}, {extendableDirectionPane},
{multiNumPane} {multiNumPane}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
@ -167,7 +165,7 @@ public class DSColumnAdvancedEditorPane extends CellEditorPane {
public ResultSetSortConfigPane() { public ResultSetSortConfigPane() {
this.setLayout(new BorderLayout(0, 4)); this.setLayout(new BorderLayout(0, 0));
Icon[] iconArray = { Icon[] iconArray = {
IOUtils.readIcon("/com/fr/design/images/expand/none16x16.png"), IOUtils.readIcon("/com/fr/design/images/expand/none16x16.png"),
IOUtils.readIcon("/com/fr/design/images/expand/asc.png"), IOUtils.readIcon("/com/fr/design/images/expand/asc.png"),
@ -177,24 +175,34 @@ public class DSColumnAdvancedEditorPane extends CellEditorPane {
sort_type_pane = new UIButtonGroup(iconArray); sort_type_pane = new UIButtonGroup(iconArray);
sort_type_pane.setAllToolTips(nameArray); sort_type_pane.setAllToolTips(nameArray);
sort_type_pane.setGlobalName(Inter.getLocText("ExpandD-Sort_After_Expand")); sort_type_pane.setGlobalName(Inter.getLocText("ExpandD-Sort_After_Expand"));
this.add(sort_type_pane, BorderLayout.NORTH);
cardLayout = new CardLayout(); cardLayout = new CardLayout();
centerPane = new JPanel(cardLayout); centerPane = new JPanel(cardLayout);
tinyFormulaPane = new TinyFormulaPane(); tinyFormulaPane = new TinyFormulaPane();
centerPane.add(new JPanel(), "none"); centerPane.add(new JPanel(), "none");
centerPane.add(tinyFormulaPane, "content"); centerPane.add(tinyFormulaPane, "content");
//todo 国际化
this.add(centerPane, BorderLayout.CENTER); UILabel sortLabel = new UILabel("排列顺序");
sort_type_pane.addChangeListener(new ChangeListener() { sort_type_pane.addChangeListener(new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
cardLayout.show(centerPane, sort_type_pane.getSelectedIndex() == 0 ? "none" : "content"); boolean noContent = sort_type_pane.getSelectedIndex() == 0;
cardLayout.show(centerPane, noContent ? "none" : "content");
if (noContent) {
centerPane.setPreferredSize(new Dimension(0, 0));
} else {
centerPane.setPreferredSize(new Dimension(165, 20));
}
} }
}); });
Component[][] components = new Component[][]{
new Component[]{sortLabel, sort_type_pane},
new Component[]{null, centerPane}
};
double p = TableLayout.PREFERRED, f = TableLayout.FILL;
double[] rowSize = {p, p}, columnSize = {p, f};
this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.CENTER);
} }
@ -224,80 +232,106 @@ public class DSColumnAdvancedEditorPane extends CellEditorPane {
* *
* @see DSColumnAdvancedPane.SelectCountPane * @see DSColumnAdvancedPane.SelectCountPane
*/ */
protected static class SelectCountPane extends JPanel { protected static class ResultSetFilterConfigPane extends JPanel {
private enum FilterType {
//前N个 后N个 奇数 偶数 自定义 未定义
TOP, BOTTOM, ODD, EVEN, SPECIFY, UNDEFINE;
}
CellElement cellElement; CellElement cellElement;
// private Comparator sortComparator; private UIComboBox rsComboBox;
private UIComboBox selectCountComboBox; private JPanel setCardPane;
private JPanel selectCountCardPane; private JPanel tipCardPane;
private UITextField serialTextField; private UITextField serialTextField;
DSColumnAdvancedEditorPane.JFormulaField topFormulaPane; DSColumnAdvancedEditorPane.JFormulaField topFormulaPane;
DSColumnAdvancedEditorPane.JFormulaField bottomFormulaPane; DSColumnAdvancedEditorPane.JFormulaField bottomFormulaPane;
public SelectCountPane() { public ResultSetFilterConfigPane() {
double p = TableLayout.PREFERRED, f = TableLayout.FILL;
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel filterLabel = new UILabel("结果集筛选");
selectCountComboBox = new UIComboBox(new String[]{ //结果集筛选下拉框
rsComboBox = new UIComboBox(new String[]{
Inter.getLocText("Undefined"), Inter.getLocText("Undefined"),
Inter.getLocText("BindColumn-Top_N"), Inter.getLocText("BindColumn-Top_N"),
Inter.getLocText("BindColumn-Bottom_N"), Inter.getLocText("BindColumn-Bottom_N"),
Inter.getLocText("Odd"), Inter.getLocText("Odd"),
Inter.getLocText("Even"), Inter.getLocText("Even"),
Inter.getLocText("Specify"),}); Inter.getLocText("Specify")
selectCountComboBox.addActionListener(new ActionListener() { });
rsComboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
int selectIndex = selectCountComboBox.getSelectedIndex(); int selectIndex = rsComboBox.getSelectedIndex();
CardLayout c1 = (CardLayout) selectCountCardPane.getLayout(); CardLayout setCardPaneLayout = (CardLayout) setCardPane.getLayout();
CardLayout tipCardPaneLayout = (CardLayout) tipCardPane.getLayout();
if (selectIndex == 1) { if (selectIndex == 1) {
c1.show(selectCountCardPane, "TOP"); setCardPaneLayout.show(setCardPane, FilterType.TOP.name());
tipCardPaneLayout.show(tipCardPane, FilterType.TOP.name());
} else if (selectIndex == 2) { } else if (selectIndex == 2) {
c1.show(selectCountCardPane, "BOTTOM"); setCardPaneLayout.show(setCardPane, FilterType.BOTTOM.name());
tipCardPaneLayout.show(tipCardPane, FilterType.BOTTOM.name());
} else if (selectIndex == 3) { } else if (selectIndex == 3) {
c1.show(selectCountCardPane, "ODD"); setCardPaneLayout.show(setCardPane, FilterType.ODD.name());
tipCardPaneLayout.show(tipCardPane, FilterType.ODD.name());
} else if (selectIndex == 4) { } else if (selectIndex == 4) {
c1.show(selectCountCardPane, "EVEN"); setCardPaneLayout.show(setCardPane, FilterType.EVEN.name());
tipCardPaneLayout.show(tipCardPane, FilterType.EVEN.name());
} else if (selectIndex == 5) { } else if (selectIndex == 5) {
c1.show(selectCountCardPane, "SPECIFY"); setCardPaneLayout.show(setCardPane, FilterType.SPECIFY.name());
tipCardPaneLayout.show(tipCardPane, FilterType.SPECIFY.name());
} else { } else {
c1.show(selectCountCardPane, "UNDEFINE"); setCardPaneLayout.show(setCardPane, FilterType.UNDEFINE.name());
tipCardPaneLayout.show(tipCardPane, FilterType.UNDEFINE.name());
} }
} }
}); });
//配置展示CardLayout
selectCountCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); setCardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
this.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(INSET_TEXT), selectCountComboBox, //提示信息展示CardLayout
new UILabel(INSET_TEXT), selectCountCardPane}, FlowLayout.LEFT), BorderLayout.WEST); tipCardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
// selectCountCardPane.setLayout(new CardLayout());
//前N个
//not define pane topFormulaPane = new DSColumnAdvancedEditorPane.JFormulaField("=");
setCardPane.add(topFormulaPane, FilterType.TOP.name());
JPanel undefinedPane = GUICoreUtils.createFlowPane(new UILabel(Inter.getLocText("Undefined")), FlowLayout.LEFT); tipCardPane.add(new JPanel(), FilterType.TOP.name());
topFormulaPane = new DSColumnAdvancedEditorPane.JFormulaField("-1");
bottomFormulaPane = new DSColumnAdvancedEditorPane.JFormulaField("-1"); //后N个
serialTextField = new UITextField(18); bottomFormulaPane = new DSColumnAdvancedEditorPane.JFormulaField("=");
JPanel oddPane = GUICoreUtils.createFlowPane(new UILabel(Inter.getLocText("BindColumn-Result_Serial_Number_Start_From_1") setCardPane.add(bottomFormulaPane, FilterType.BOTTOM.name());
+ " " + Inter.getLocText("BindColumn-Odd_Selected_(1,3,5...)")), FlowLayout.LEFT); tipCardPane.add(new JPanel(), FilterType.BOTTOM.name());
JPanel evenPane = GUICoreUtils.createFlowPane(new UILabel(Inter.getLocText("BindColumn-Result_Serial_Number_Start_From_1")
+ " " + Inter.getLocText("BindColumn-Even_Selected_(2,4,6...)")), FlowLayout.LEFT); //自定义值下方没有提示信息,也没有输入框
JPanel specifyPane = GUICoreUtils.createFlowPane(new JComponent[]{ JPanel undefinedPane = new JPanel();
serialTextField, new UILabel( setCardPane.add(new JPanel(), FilterType.UNDEFINE.name());
tipCardPane.add(new JPanel(), FilterType.UNDEFINE.name());
//奇数 UILabel 占一行作为提示信息
setCardPane.add(new JPanel(), FilterType.ODD.name());
tipCardPane.add(new UILabel(Inter.getLocText("BindColumn-Result_Serial_Number_Start_From_1")
+ "," + Inter.getLocText("BindColumn-Odd_Selected_(1,3,5...)")), FilterType.ODD.name());
//偶数 UILabel 占一行作为提示信息
setCardPane.add(new JPanel(), FilterType.EVEN.name());
tipCardPane.add(new UILabel(Inter.getLocText("BindColumn-Result_Serial_Number_Start_From_1")
+ "," + Inter.getLocText("BindColumn-Even_Selected_(2,4,6...)")), FilterType.ODD.name());
//输入框占用右半边,提示信息占一行
serialTextField = new UITextField(16);
setCardPane.add(serialTextField, FilterType.SPECIFY.name());
tipCardPane.add(new UILabel(
Inter.getLocText(new String[]{ Inter.getLocText(new String[]{
"Format", "BindColumn-Result_Serial_Number_Start_From_1", "Inner_Parameter", "Group_Count"}, "Format", "BindColumn-Result_Serial_Number_Start_From_1", "Inner_Parameter", "Group_Count"},
new String[]{": 1,2-3,5,8 ", ",", "$__count__"}) new String[]{": 1,2-3,5,8 ", ",", "$__count__"})), FilterType.SPECIFY.name());
)
}, FlowLayout.LEFT); this.add(TableLayoutHelper.createTableLayoutPane(new Component[][]{
serialTextField.setToolTipText(Inter.getLocText("StyleFormat-Sample") + ":=JOINARRAY(GREPARRAY(RANGE($__count__), item!=4), \",\")"); {filterLabel, rsComboBox},
selectCountCardPane.add(undefinedPane, "UNDEFINE"); {null, setCardPane},
selectCountCardPane.add(topFormulaPane, "TOP"); {tipCardPane, null}
selectCountCardPane.add(bottomFormulaPane, "BOTTOM"); }, new double[]{p, p, p}, new double[]{p, f}), BorderLayout.CENTER);
//odd
selectCountCardPane.add(oddPane, "ODD");
//even
selectCountCardPane.add(evenPane, "EVEN");
//specify
selectCountCardPane.add(specifyPane, "SPECIFY");
} }
public void populate(CellElement cellElement) { public void populate(CellElement cellElement) {
@ -316,7 +350,7 @@ public class DSColumnAdvancedEditorPane extends CellEditorPane {
this.bottomFormulaPane.populateElement(cellElement); this.bottomFormulaPane.populateElement(cellElement);
if (selectCount != null) { if (selectCount != null) {
int selectCountType = selectCount.getType(); int selectCountType = selectCount.getType();
this.selectCountComboBox.setSelectedIndex(selectCountType); this.rsComboBox.setSelectedIndex(selectCountType);
if (selectCountType == SelectCount.TOP) { if (selectCountType == SelectCount.TOP) {
this.topFormulaPane.populate(selectCount.getFormulaCount()); this.topFormulaPane.populate(selectCount.getFormulaCount());
} else if (selectCountType == SelectCount.BOTTOM) { } else if (selectCountType == SelectCount.BOTTOM) {
@ -338,7 +372,7 @@ public class DSColumnAdvancedEditorPane extends CellEditorPane {
DSColumn dSColumn = (DSColumn) (cellElement.getValue()); DSColumn dSColumn = (DSColumn) (cellElement.getValue());
//alex:SelectCount //alex:SelectCount
int selectCountSelectIndex = this.selectCountComboBox.getSelectedIndex(); int selectCountSelectIndex = this.rsComboBox.getSelectedIndex();
if (selectCountSelectIndex == 0) { if (selectCountSelectIndex == 0) {
dSColumn.setSelectCount(null); dSColumn.setSelectCount(null);
} else { } else {
@ -381,19 +415,16 @@ public class DSColumnAdvancedEditorPane extends CellEditorPane {
public JFormulaField(String defaultValue) { public JFormulaField(String defaultValue) {
this.defaultValue = defaultValue; this.defaultValue = defaultValue;
this.setLayout(FRGUIPaneFactory.createBoxFlowLayout()); this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
UILabel bottomLabel = new UILabel("="); formulaTextField = new UITextField(11);
bottomLabel.setFont(new Font("Dialog", Font.BOLD, 12));
this.add(bottomLabel);
formulaTextField = new UITextField(24);
this.add(formulaTextField); this.add(formulaTextField);
formulaTextField.setText(defaultValue); formulaTextField.setText(defaultValue);
UIButton bottomFrmulaButton = new UIButton("..."); UIButton formulaButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/m_insert/formula.png"));
this.add(bottomFrmulaButton); this.add(formulaButton);
bottomFrmulaButton.setToolTipText(Inter.getLocText("Formula") + "..."); formulaButton.setToolTipText(Inter.getLocText("Formula") + "...");
bottomFrmulaButton.setPreferredSize(new Dimension(25, formulaTextField.getPreferredSize().height)); formulaButton.setPreferredSize(new Dimension(20, formulaTextField.getPreferredSize().height));
bottomFrmulaButton.addActionListener(formulaButtonActionListener); formulaButton.addActionListener(formulaButtonActionListener);
} }
public void populate(String formulaContent) { public void populate(String formulaContent) {
@ -453,13 +484,12 @@ public class DSColumnAdvancedEditorPane extends CellEditorPane {
* *
* @see DSColumnAdvancedPane.ValuePane * @see DSColumnAdvancedPane.ValuePane
*/ */
private static class ValuePane extends JPanel { private static class CustomValuePane extends JPanel {
private DSColumnAdvancedEditorPane.JFormulaField formulaField; private DSColumnAdvancedEditorPane.JFormulaField formulaField;
public ValuePane() { public CustomValuePane() {
this.setLayout(FRGUIPaneFactory.createBoxFlowLayout()); this.setLayout(FRGUIPaneFactory.createBoxFlowLayout());
UILabel customValueLabel = new UILabel("显示值");
this.add(new UILabel(INSET_TEXT + Inter.getLocText("Value") + ":"));
this.add(Box.createHorizontalStrut(2)); this.add(Box.createHorizontalStrut(2));
this.add((formulaField = new DSColumnAdvancedEditorPane.JFormulaField("$$$"))); this.add((formulaField = new DSColumnAdvancedEditorPane.JFormulaField("$$$")));
} }
@ -493,7 +523,6 @@ public class DSColumnAdvancedEditorPane extends CellEditorPane {
return; return;
} }
DSColumn dSColumn = (DSColumn) (cellElement.getValue()); DSColumn dSColumn = (DSColumn) (cellElement.getValue());
//formula //formula
dSColumn.setResult(this.formulaField.getFormulaText()); dSColumn.setResult(this.formulaField.getFormulaText());
} }

1
designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java

@ -33,6 +33,7 @@ public class DSColumnBasicEditorPane extends CellEditorPane {
this.groupPane = groupPane; this.groupPane = groupPane;
this.conditionPane = conditionPane; this.conditionPane = conditionPane;
this.add(this.createContentPane(), BorderLayout.CENTER); this.add(this.createContentPane(), BorderLayout.CENTER);
this.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
} }

50
designer/src/com/fr/design/dscolumn/ResultSetGroupDockingPane.java

@ -1,35 +1,31 @@
package com.fr.design.dscolumn; package com.fr.design.dscolumn;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.FunctionComboBox; import com.fr.design.gui.icombobox.FunctionComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellExpandAttr; import com.fr.report.cell.cellattr.CellExpandAttr;
import com.fr.report.cell.cellattr.core.group.CustomGrouper; import com.fr.report.cell.cellattr.core.group.*;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.cellattr.core.group.FunctionGrouper;
import com.fr.report.cell.cellattr.core.group.RecordGrouper;
import com.fr.report.cell.cellattr.core.group.SummaryGrouper;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/** /**
* 这个pane是选中数据列后在上方QuickRegion处显示的pane * 这个pane是选中数据列后在上方QuickRegion处显示的pane
* *
* @author zhou * @author zhou, yaoh.wu
* @version 2017年8月2日14点55分
* @since 8.0
*/ */
public class ResultSetGroupDockingPane extends ResultSetGroupPane { public class ResultSetGroupDockingPane extends ResultSetGroupPane {
private static final int BIND_GROUP = 0; private static final int BIND_GROUP = 0;
@ -42,7 +38,7 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
private CardLayout cardLayout; private CardLayout cardLayout;
private UIComboBox goBox; private UIComboBox goBox;
ItemListener l; private ItemListener listener;
public ResultSetGroupDockingPane(ElementCasePane ePane) { public ResultSetGroupDockingPane(ElementCasePane ePane) {
super(); super();
@ -58,15 +54,13 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
} }
private JPanel layoutPane() { private JPanel layoutPane() {
double vs = 4;
double vg = 6;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
Component[][] components = new Component[][] Component[][] components = new Component[][]
{ {
new Component[]{new UILabel(Inter.getLocText("Data_Setting")), goBox}, new Component[]{new UILabel(Inter.getLocText("Data_Setting")), goBox},
new Component[]{cardPane, null} new Component[]{null, cardPane}
}; };
goBox.addItemListener(new ItemListener() { goBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent ee) { public void itemStateChanged(ItemEvent ee) {
@ -86,7 +80,7 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] rowSize = {p, p}; double[] rowSize = {p, p};
return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
private void initCardPane() { private void initCardPane() {
@ -190,15 +184,15 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
} }
} }
public void addListener(ItemListener l) { public void addListener(ItemListener listener) {
goBox.addItemListener(l); goBox.addItemListener(listener);
groupComboBox.addItemListener(l); groupComboBox.addItemListener(listener);
functionComboBox.addItemListener(l); functionComboBox.addItemListener(listener);
this.l = l; this.listener = listener;
} }
void fireTargetChanged() { void fireTargetChanged() {
l.itemStateChanged(null); listener.itemStateChanged(null);
} }
@Override @Override

23
designer/src/com/fr/quickeditor/CellQuickEditor.java

@ -37,18 +37,33 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] rowSize = {p, p, p}; double[] rowSize = {p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(" " + Inter.getLocText("Cell")), columnRowTextField = initColumnRowTextField()}, new Component[]{initTopContent(), null},
new Component[]{new UILabel(Inter.getLocText("HF-Insert_Content") + " "), cellElementEditButton = initCellElementEditButton()},
new Component[]{createCenterBody(), null} new Component[]{createCenterBody(), null}
}; };
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
} }
private JPanel initTopContent() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
new Component[]{new UILabel(" " + Inter.getLocText("Cell")), columnRowTextField = initColumnRowTextField()},
new Component[]{new UILabel(Inter.getLocText("HF-Insert_Content") + " "), cellElementEditButton = initCellElementEditButton()},
};
JPanel topContent = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
topContent.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
return topContent;
}
/** /**
* 初始化添加按钮 * 初始化添加按钮
* TODO 9.0 换成下拉菜单后原来的快捷键不好处理先跳过 * TODO 9.0 换成下拉菜单后原来的快捷键不好处理先跳过

2
designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -175,7 +175,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
*/ */
private void createPanes() { private void createPanes() {
paneList = new ArrayList<>(); paneList = new ArrayList<>();
/*基本设置面板*/ /*基本设置面板*/
this.dataPane = new SelectedDataColumnPane(); this.dataPane = new SelectedDataColumnPane();
this.groupPane = new ResultSetGroupDockingPane(tc); this.groupPane = new ResultSetGroupDockingPane(tc);
@ -194,7 +193,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
dataPane.addListener(dataListener); dataPane.addListener(dataListener);
groupPane.addListener(groupListener); groupPane.addListener(groupListener);
paneList.add(new DSColumnBasicEditorPane(cellElement, dataPane, groupPane, conditionPane)); paneList.add(new DSColumnBasicEditorPane(cellElement, dataPane, groupPane, conditionPane));
/*高级设置面板*/ /*高级设置面板*/
paneList.add(new DSColumnAdvancedEditorPane()); paneList.add(new DSColumnAdvancedEditorPane());
} }

902
designer_base/src/com/fr/design/layout/FRGUIPaneFactory.java

@ -1,456 +1,486 @@
package com.fr.design.layout; package com.fr.design.layout;
import java.awt.BorderLayout; import com.fr.design.border.UITitledBorder;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.LayoutManager;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.Icon;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import com.fr.design.border.UITitledBorder; import javax.swing.*;
import java.awt.*;
public class FRGUIPaneFactory { public class FRGUIPaneFactory {
private FRGUIPaneFactory() { public static final float WIDTH_PARA_F = 80.0f;
} public static final int WIDTH_OFFSET_N = 60;
public static final int WIDTH_OFFSET_M = 20;
public static final int WIDTH_PARA_INT = 80;
public static final float WIDTHABS_PARA_F = 2.0f;
public static final int HEIGHT_PARA = 25;
public static final int HEIGHT_OFFSET = 50;
public static final float WIDTH_PARA_F = 80.0f; private FRGUIPaneFactory() {
public static final int WIDTH_OFFSET_N = 60; }
public static final int WIDTH_OFFSET_M = 20;
public static final int WIDTH_PARA_INT = 80;
public static final float WIDTHABS_PARA_F = 2.0f;
public static final int HEIGHT_PARA = 25;
public static final int HEIGHT_OFFSET = 50;
/** /**
* 创建一个靠右靠左的水平间隙为2的流式布局 * 创建一个靠右靠左的水平间隙为2的流式布局
*
* @return FlowLayout对象 * @return FlowLayout对象
*/ */
public static LayoutManager createBoxFlowLayout() { // createBoxFlowLayout 图表用到的比较多 public static LayoutManager createBoxFlowLayout() { // createBoxFlowLayout 图表用到的比较多
return new FlowLayout(FlowLayout.LEFT, 2, 0); return new FlowLayout(FlowLayout.LEFT, 2, 0);
} }
/** /**
* 创建一个靠左的布局 * 创建一个靠左的布局
* @return FlowLayout对象 *
*/ * @return FlowLayout对象
public static LayoutManager createLeftZeroLayout() { */
return new FlowLayout(FlowLayout.LEFT, 0, 0); public static LayoutManager createLeftZeroLayout() {
} return new FlowLayout(FlowLayout.LEFT, 0, 0);
}
/** /**
* 创建一个靠左的水平和垂直间隙均为5的流式布局 * 创建一个靠左的水平和垂直间隙均为5的流式布局
*
* @return FlowLayout对象
*/
public static LayoutManager createLabelFlowLayout() { // createLabelFlowLayout
return new FlowLayout(FlowLayout.LEFT); // 默认 5, 5
}
/**
* 创建一个靠左流式布局间距10,10
*
* @return FlowLayout对象
*/
public static LayoutManager createL_FlowLayout() {
return new FlowLayout(FlowLayout.LEFT, 10, 10);
}
/**
* 创建一个居中流式布局
*
* @return FlowLayout对象 * @return FlowLayout对象
*/ */
public static LayoutManager createLabelFlowLayout() { // createLabelFlowLayout public static LayoutManager createCenterFlowLayout() {
return new FlowLayout(FlowLayout.LEFT); // 默认 5, 5 return new FlowLayout(FlowLayout.CENTER);
} }
/** /**
* 创建一个靠左流式布局间距10,10 * 创建一个靠右流式布局
* @return FlowLayout对象 *
*/ * @return FlowLayout对象
public static LayoutManager createL_FlowLayout() { */
return new FlowLayout(FlowLayout.LEFT, 10, 10); public static LayoutManager createRightFlowLayout() {
} return new FlowLayout(FlowLayout.RIGHT);
}
/**
* 创建一个居中流式布局 /**
* @return FlowLayout对象 * 创建一个边框布局
*/ *
public static LayoutManager createCenterFlowLayout() { * @return BorderLayout对象
return new FlowLayout(FlowLayout.CENTER); */
} public static LayoutManager createBorderLayout() {
return new BorderLayout();
/** }
* 创建一个靠右流式布局
* @return FlowLayout对象 /**
*/ * 创建一个边框布局间距4,4
public static LayoutManager createRightFlowLayout() { *
return new FlowLayout(FlowLayout.RIGHT); * @return BorderLayout对象
} */
public static LayoutManager createM_BorderLayout() {
/** return new BorderLayout(4, 4);
* 创建一个边框布局 }
* @return BorderLayout对象
*/
public static LayoutManager createBorderLayout() { /**
return new BorderLayout(); * 创建一个1列的网格布局
} *
* @return FRGridLayout对象
/** */
* 创建一个边框布局间距4,4 public static LayoutManager create1ColumnGridLayout() {
* @return BorderLayout对象 return new FRGridLayout(1);
*/ }
public static LayoutManager createM_BorderLayout() {
return new BorderLayout(4,4); /**
} * 创建一个2列的网格布局
*
// TODO 删掉 * @return FRGridLayout对象
*/
/** public static LayoutManager create2ColumnGridLayout() {
* 创建一个1列的网格布局 return new FRGridLayout(2);
* @return FRGridLayout对象 }
*/
public static LayoutManager create1ColumnGridLayout() { /**
return new FRGridLayout(1); * 创建一个n列的网格布局
} *
* @param nColumn 列数
/** * @return FRGridLayout对象
* 创建一个2列的网格布局 */
* @return FRGridLayout对象 public static LayoutManager createNColumnGridLayout(int nColumn) {
*/ return new FRGridLayout(nColumn);
public static LayoutManager create2ColumnGridLayout() { }
return new FRGridLayout(2);
} /**
* 创建一个带标题边框面板
/** *
* 创建一个n列的网格布局 * @param string 边框标题
* @param nColumn 列数 * @return JPanel对象
* @return FRGridLayout对象 */
*/ public static JPanel createTitledBorderPane(String string) {
public static LayoutManager createNColumnGridLayout(int nColumn) { JPanel jp = new JPanel();
return new FRGridLayout(nColumn); UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(string);
} jp.setBorder(explainBorder);
jp.setLayout(new FlowLayout(FlowLayout.LEFT));
/** return jp;
* 创建一个带标题边框面板 }
* @param string 边框标题
* @return JPanel对象 /**
*/ * 创建一个带标题边框面板并且居中显示
public static JPanel createTitledBorderPane(String string) { *
JPanel jp = new JPanel(); * @param borderTitle 边框标题
UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(string); * @return JPanel对象
jp.setBorder(explainBorder); */
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); public static JPanel createTitledBorderPaneCenter(String borderTitle) {
return jp; JPanel jp = new JPanel();
} UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(borderTitle);
jp.setBorder(explainBorder);
/** jp.setLayout(new FlowLayout(FlowLayout.CENTER));
* 创建一个带标题边框面板并且居中显示 return jp;
* @param borderTitle 边框标题 }
* @return JPanel对象
*/ /**
public static JPanel createTitledBorderPaneCenter(String borderTitle) { * 创建一个靠左空边框布局间隔大
JPanel jp = new JPanel(); *
UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(borderTitle); * @return JPanel对象
jp.setBorder(explainBorder); */
jp.setLayout(new FlowLayout(FlowLayout.CENTER)); public static JPanel createBigHGapFlowInnerContainer_M_Pane() {
return jp; JPanel jp = new JPanel();
} jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
jp.setLayout(new FRLeftFlowLayout(5, 60, 5));
/** return jp;
* 创建一个靠左空边框布局间隔大 }
* @return JPanel对象
*/ /**
public static JPanel createBigHGapFlowInnerContainer_M_Pane() { * 创建一个靠左空边框面板间隔中等
JPanel jp = new JPanel(); *
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); * @return JPanel对象
jp.setLayout(new FRLeftFlowLayout(5, 60, 5)); */
return jp; public static JPanel createMediumHGapFlowInnerContainer_M_Pane() {
} JPanel jp = new JPanel();
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
/** jp.setLayout(new FRLeftFlowLayout(5, 20, 5));
* 创建一个靠左空边框面板间隔中等 return jp;
* @return JPanel对象 }
*/
public static JPanel createMediumHGapFlowInnerContainer_M_Pane() { /**
JPanel jp = new JPanel(); * 创建一个靠左空边框面板间隔中等
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); *
jp.setLayout(new FRLeftFlowLayout(5, 20, 5)); * @return JPanel对象
return jp; */
} public static JPanel createMediumHGapHighTopFlowInnerContainer_M_Pane() {
JPanel jp = new JPanel();
/** jp.setBorder(BorderFactory.createEmptyBorder(50, 5, 0, 0));
* 创建一个靠左空边框面板间隔中等 jp.setLayout(new FRLeftFlowLayout(5, 20, 5));
* @return JPanel对象 return jp;
*/ }
public static JPanel createMediumHGapHighTopFlowInnerContainer_M_Pane() {
JPanel jp = new JPanel(); /**
jp.setBorder(BorderFactory.createEmptyBorder(50, 5, 0, 0)); * 创建一个正常靠左空边框面板
jp.setLayout(new FRLeftFlowLayout(5, 20, 5)); *
return jp; * @return JPanel对象
} */
public static JPanel createNormalFlowInnerContainer_M_Pane() {
/** JPanel jp = new JPanel();
* 创建一个正常靠左空边框面板 jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
* @return JPanel对象 jp.setLayout(new FlowLayout(FlowLayout.LEFT));
*/ return jp;
public static JPanel createNormalFlowInnerContainer_M_Pane() { }
JPanel jp = new JPanel();
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); /**
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); * 创建一个靠左0间距边框面板
return jp; *
} * @return JPanel对象
*/
/** public static JPanel createLeftFlowZeroGapBorderPane() {
* 创建一个靠左0间距边框面板 JPanel jp = new JPanel();
* @return JPanel对象 jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
*/ jp.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
public static JPanel createLeftFlowZeroGapBorderPane() { return jp;
JPanel jp = new JPanel(); }
jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
jp.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); /**
return jp; * 创建一个靠左流式布局正常流式内嵌
} *
* @return JPanel对象
/** */
* 创建一个靠左流式布局正常流式内嵌 public static JPanel createNormalFlowInnerContainer_S_Pane() {
* @return JPanel对象 JPanel jp = new JPanel();
*/ jp.setLayout(new FlowLayout(FlowLayout.LEFT));
public static JPanel createNormalFlowInnerContainer_S_Pane() { return jp;
JPanel jp = new JPanel(); }
jp.setLayout(new FlowLayout(FlowLayout.LEFT));
return jp; /**
} * 创建一个靠左流式布局流式内嵌
*
/** * @return JPanel对象
* 创建一个靠左流式布局流式内嵌 */
* @return JPanel对象 public static JPanel createBoxFlowInnerContainer_S_Pane() {
*/ JPanel jp = new JPanel();
public static JPanel createBoxFlowInnerContainer_S_Pane() { jp.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 2));
JPanel jp = new JPanel(); return jp;
jp.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 2)); }
return jp;
} /**
* 创建一个靠右面板
/** *
* 创建一个靠右面板 * @return JPanel对象
* @return JPanel对象 */
*/ public static JPanel createRightFlowInnerContainer_S_Pane() {
public static JPanel createRightFlowInnerContainer_S_Pane() { JPanel jp = new JPanel();
JPanel jp = new JPanel(); jp.setLayout(new FlowLayout(FlowLayout.RIGHT));
jp.setLayout(new FlowLayout(FlowLayout.RIGHT)); return jp;
return jp; }
}
/**
/** * 创建一个居中面板
* 创建一个居中面板 *
* @return JPanel对象 * @return JPanel对象
*/ */
public static JPanel createCenterFlowInnerContainer_S_Pane() { public static JPanel createCenterFlowInnerContainer_S_Pane() {
JPanel jp = new JPanel(); JPanel jp = new JPanel();
jp.setLayout(new FlowLayout(FlowLayout.CENTER)); jp.setLayout(new FlowLayout(FlowLayout.CENTER));
return jp; return jp;
} }
/** /**
* 创建一个居中0间距面板 * 创建一个居中0间距面板
* @return JPanel对象 *
*/ * @return JPanel对象
public static JPanel createCenterFlowZeroGapBorderPane() { */
JPanel jp = new JPanel(); public static JPanel createCenterFlowZeroGapBorderPane() {
jp.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); JPanel jp = new JPanel();
jp.setBorder(BorderFactory.createEmptyBorder()); jp.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
return jp; jp.setBorder(BorderFactory.createEmptyBorder());
} return jp;
}
/**
* 创建纵向排列面板 /**
* @return JPanel对象 * 创建纵向排列面板
*/ *
public static JPanel createY_AXISBoxInnerContainer_L_Pane() { * @return JPanel对象
JPanel jp = new JPanel(); */
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); public static JPanel createY_AXISBoxInnerContainer_L_Pane() {
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); JPanel jp = new JPanel();
return jp; jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
} jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
return jp;
/** }
* 创建纵向边框面板
* @return JPanel对象 /**
*/ * 创建纵向边框面板
public static JPanel createYBoxEmptyBorderPane() { *
JPanel jp = new JPanel(); * @return JPanel对象
jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); */
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); public static JPanel createYBoxEmptyBorderPane() {
return jp; JPanel jp = new JPanel();
} jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
/** return jp;
* 创建横向面板 }
* @return JPanel对象
*/ /**
public static JPanel createX_AXISBoxInnerContainer_L_Pane() { * 创建横向面板
JPanel jp = new JPanel(); *
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); * @return JPanel对象
jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); */
return jp; public static JPanel createX_AXISBoxInnerContainer_L_Pane() {
} JPanel jp = new JPanel();
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
/** jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS));
* 创建纵向面板M return jp;
* @return JPanel对象 }
*/
public static JPanel createY_AXISBoxInnerContainer_M_Pane() { /**
JPanel jp = new JPanel(); * 创建纵向面板M
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); *
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); * @return JPanel对象
return jp; */
} public static JPanel createY_AXISBoxInnerContainer_M_Pane() {
JPanel jp = new JPanel();
/** jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
* 创建横向内置boxlayout的面板 jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
* @return JPanel对象 return jp;
*/ }
public static JPanel createX_AXISBoxInnerContainer_M_Pane() {
JPanel jp = new JPanel(); /**
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); * 创建横向内置boxlayout的面板
jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); *
return jp; * @return JPanel对象
} */
public static JPanel createX_AXISBoxInnerContainer_M_Pane() {
/** JPanel jp = new JPanel();
* 创建纵向内置boxlayout的面板 jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
* @return JPanel对象 jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS));
*/ return jp;
public static JPanel createY_AXISBoxInnerContainer_S_Pane() { }
JPanel jp = new JPanel();
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); /**
return jp; * 创建纵向内置boxlayout的面板
} *
* @return JPanel对象
/** */
* 创建横向内置boxlayout的面板 public static JPanel createY_AXISBoxInnerContainer_S_Pane() {
* @return JPanel对象 JPanel jp = new JPanel();
*/ jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
public static JPanel createX_AXISBoxInnerContainer_S_Pane() { return jp;
JPanel jp = new JPanel(); }
jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS));
return jp; /**
} * 创建横向内置boxlayout的面板
*
/** * @return JPanel对象
* 创建n列网格面板 */
* @param nColumn 列数 public static JPanel createX_AXISBoxInnerContainer_S_Pane() {
* @return JPanel对象 JPanel jp = new JPanel();
*/ jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS));
public static JPanel createNColumnGridInnerContainer_S_Pane(int nColumn) { return jp;
JPanel jp = new JPanel(); }
jp.setLayout(new FRGridLayout(nColumn));
return jp; /**
} * 创建n列网格面板
*
/** * @param nColumn 列数
* 创建n列网格面板 * @return JPanel对象
* @param nColumn 列数 */
* @param h 水平间距 public static JPanel createNColumnGridInnerContainer_S_Pane(int nColumn) {
* @param v 垂直间距 JPanel jp = new JPanel();
* @return JPanel对象 jp.setLayout(new FRGridLayout(nColumn));
*/ return jp;
public static JPanel createNColumnGridInnerContainer_Pane(int nColumn, int h, int v) { }
JPanel jp = new JPanel();
jp.setLayout(new FRGridLayout(nColumn, h, v)); /**
return jp; * 创建n列网格面板
} *
* @param nColumn 列数
/** * @param h 水平间距
* 创建顶格n列网格面板 * @param v 垂直间距
* @param nColumn 列数 * @return JPanel对象
* @return JPanel对象 */
*/ public static JPanel createNColumnGridInnerContainer_Pane(int nColumn, int h, int v) {
public static JPanel createFillColumnPane(int nColumn) { JPanel jp = new JPanel();
JPanel jp = new JPanel(); jp.setLayout(new FRGridLayout(nColumn, h, v));
jp.setLayout(new FRGridLayout(nColumn, 0, 0)); return jp;
return jp; }
}
/**
/** * 创建顶格n列网格面板
* 创建边框面板L *
* @return JPanel对象 * @param nColumn 列数
*/ * @return JPanel对象
public static JPanel createBorderLayout_L_Pane() { */
JPanel jp = new JPanel(); public static JPanel createFillColumnPane(int nColumn) {
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); JPanel jp = new JPanel();
jp.setLayout(FRGUIPaneFactory.createBorderLayout()); jp.setLayout(new FRGridLayout(nColumn, 0, 0));
return jp; return jp;
} }
/** /**
* 创建边框面板M * 创建边框面板L
* @return JPanel对象 *
*/ * @return JPanel对象
public static JPanel createBorderLayout_M_Pane() { */
JPanel jp = new JPanel(); public static JPanel createBorderLayout_L_Pane() {
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); JPanel jp = new JPanel();
jp.setLayout(FRGUIPaneFactory.createM_BorderLayout()); jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
return jp; jp.setLayout(FRGUIPaneFactory.createBorderLayout());
} return jp;
}
/**
* 创建边框面板S /**
* @return JPanel对象 * 创建边框面板M
*/ *
public static JPanel createBorderLayout_S_Pane() { * @return JPanel对象
JPanel jp = new JPanel(); */
jp.setLayout(FRGUIPaneFactory.createBorderLayout()); public static JPanel createBorderLayout_M_Pane() {
return jp; JPanel jp = new JPanel();
} jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
jp.setLayout(FRGUIPaneFactory.createM_BorderLayout());
/** return jp;
* 创建卡片式布局 }
* @return JPanel对象
*/ /**
public static JPanel createCardLayout_S_Pane() { * 创建边框面板S
JPanel jp = new JPanel(); *
jp.setLayout(new CardLayout()); * @return JPanel对象
return jp; */
} public static JPanel createBorderLayout_S_Pane() {
JPanel jp = new JPanel();
/** jp.setLayout(FRGUIPaneFactory.createBorderLayout());
* 创建图标IconRadio面板 return jp;
* @param icon 图标 }
* @param jradiobtn 按钮
* @return JPanel对象 /**
*/ * 创建卡片式布局
public static JPanel createIconRadio_S_Pane(Icon icon, *
JRadioButton jradiobtn) { * @return JPanel对象
jradiobtn.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); */
jradiobtn.setBackground(new Color(255, 255, 255)); public static JPanel createCardLayout_S_Pane() {
JPanel iconRadioPane = new JPanel(); JPanel jp = new JPanel();
iconRadioPane.setLayout(new BoxLayout(iconRadioPane, BoxLayout.X_AXIS)); jp.setLayout(new CardLayout());
return jp;
iconRadioPane.add(new UILabel(icon)); }
iconRadioPane.add(jradiobtn);
/**
return iconRadioPane; * 创建图标IconRadio面板
} *
* @param icon 图标
/** * @param jradiobtn 按钮
* 计算宽度 * @return JPanel对象
* @param width 宽度输入值 */
* @return w 宽度输出值 public static JPanel createIconRadio_S_Pane(Icon icon,
*/ JRadioButton jradiobtn) {
public static int caculateWidth(int width) { jradiobtn.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
int w = 0; jradiobtn.setBackground(new Color(255, 255, 255));
float m = (width + WIDTH_OFFSET_M) / WIDTH_PARA_F; JPanel iconRadioPane = new JPanel();
float n = (width + WIDTH_OFFSET_N) / WIDTH_PARA_F; iconRadioPane.setLayout(new BoxLayout(iconRadioPane, BoxLayout.X_AXIS));
float i = Math.abs((((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m);
float j = Math.abs((((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n); iconRadioPane.add(new UILabel(icon));
float x = i > j ? i : j; iconRadioPane.add(jradiobtn);
if (x == i) {
w = Math.round(m) * WIDTH_PARA_INT - WIDTH_OFFSET_M; return iconRadioPane;
} else if (x == j) { }
w = Math.round(n) * WIDTH_PARA_INT - WIDTH_OFFSET_N;
} /**
return w; * 计算宽度
} *
* @param width 宽度输入值
/** * @return w 宽度输出值
* 计算高度 */
* @param height 高度输入值 public static int caculateWidth(int width) {
* @return 高度输出值 int w = 0;
*/ float m = (width + WIDTH_OFFSET_M) / WIDTH_PARA_F;
public static int caculateHeight(int height) { float n = (width + WIDTH_OFFSET_N) / WIDTH_PARA_F;
int h = 0; float i = Math.abs((((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m);
float x = (height + HEIGHT_OFFSET) / HEIGHT_PARA; float j = Math.abs((((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n);
h = ((int) x + 1) * HEIGHT_PARA; float x = i > j ? i : j;
return h; if (x == i) {
} w = Math.round(m) * WIDTH_PARA_INT - WIDTH_OFFSET_M;
} else if (x == j) {
w = Math.round(n) * WIDTH_PARA_INT - WIDTH_OFFSET_N;
}
return w;
}
/**
* 计算高度
*
* @param height 高度输入值
* @return 高度输出值
*/
public static int caculateHeight(int height) {
int h = 0;
float x = (height + HEIGHT_OFFSET) / HEIGHT_PARA;
h = ((int) x + 1) * HEIGHT_PARA;
return h;
}
} }

3
designer_base/src/com/fr/design/utils/DesignUtils.java

@ -52,7 +52,8 @@ public class DesignUtils {
public static boolean isStarted() { public static boolean isStarted() {
try { try {
new Socket("localhost", port); new Socket("localhost", port);
return true; // return true;
return false;
} catch (Exception exp) { } catch (Exception exp) {
} }

Loading…
Cancel
Save