Browse Source

Merge pull request #1087 in BA/design from ~MOMEAK/design9.0:release/9.0 to release/9.0

* commit 'c5a782d6390e16553ccccd3c23e855b4f7ea72eb':
  PMD
  rollback
  REPORT-2897 9.0设计器修改 1.修改UIExpandablePane自适应宽度,已经根据视觉修改样式 2.单元格属性面板根据视觉新出的图调整
master
superman 7 years ago
parent
commit
3419e063ee
  1. 19
      designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java
  2. 20
      designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java
  3. 42
      designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  4. 8
      designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java
  5. 3
      designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
  6. 1
      designer/src/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java
  7. 4
      designer/src/com/fr/design/mainframe/cell/settingpane/style/PredefinedStylePane.java
  8. 4
      designer/src/com/fr/design/present/PresentPane.java
  9. 9
      designer_base/src/com/fr/design/constants/UIConstants.java
  10. 39
      designer_base/src/com/fr/design/foldablepane/HeaderPane.java
  11. 58
      designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java
  12. 20
      designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java
  13. 15
      designer_base/src/com/fr/design/gui/ibutton/UITabGroup.java
  14. 2
      designer_base/src/com/fr/design/gui/style/AlignmentPane.java
  15. 1
      designer_base/src/com/fr/design/gui/style/FormatPane.java

19
designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java

@ -32,35 +32,22 @@ import java.util.List;
* @since 2012-5-8下午12:18:53 * @since 2012-5-8下午12:18:53
*/ */
public class CellElementEditPane extends BasicPane { public class CellElementEditPane extends BasicPane {
private static int TIME_GAP = 80; private static final int LEFT_BORDER = -5;
private static final int RIGHT_BORDER = 5;
private List<AbstractCellAttrPane> paneList; private List<AbstractCellAttrPane> paneList;
private TemplateCellElement cellelement; private TemplateCellElement cellelement;
private ElementCasePane ePane; private ElementCasePane ePane;
private UIHeadGroup tabsHeaderIconPane; private UIHeadGroup tabsHeaderIconPane;
private boolean isEditing; private boolean isEditing;
private int PaneListIndex;
private CardLayout card; private CardLayout card;
private JPanel center; private JPanel center;
private JPanel downTitle; private JPanel downTitle;
private JPanel title;
private UILabel titlename;
private TitleChangeListener titleChangeListener = null; private TitleChangeListener titleChangeListener = null;
private CellAttributeProvider cellAttributeProvider = 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(290, 400);
jf.setVisible(true);
}
public CellElementEditPane() { public CellElementEditPane() {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
initPaneList(); initPaneList();
@ -89,7 +76,7 @@ public class CellElementEditPane extends BasicPane {
downTitle = new JPanel(); downTitle = new JPanel();
downTitle.setLayout(new BorderLayout()); downTitle.setLayout(new BorderLayout());
downTitle.add(tabsHeaderIconPane, BorderLayout.NORTH); downTitle.add(tabsHeaderIconPane, BorderLayout.NORTH);
center.setBorder(BorderFactory.createEmptyBorder(0, -10, 0, -10)); center.setBorder(BorderFactory.createEmptyBorder(0, LEFT_BORDER, 0, RIGHT_BORDER));
downTitle.add(center, BorderLayout.CENTER); downTitle.add(center, BorderLayout.CENTER);
this.add(downTitle, BorderLayout.CENTER); this.add(downTitle, BorderLayout.CENTER);

20
designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe.cell.settingpane;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.expand.ExpandLeftFatherPane; import com.fr.design.expand.ExpandLeftFatherPane;
import com.fr.design.expand.ExpandUpFatherPane; import com.fr.design.expand.ExpandUpFatherPane;
import com.fr.design.expand.SortExpandAttrPane; import com.fr.design.expand.SortExpandAttrPane;
@ -61,18 +62,6 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
return layoutPane(); return layoutPane();
} }
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() { private void initAllNames() {
expandDirectionButton.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expand_Direction")); expandDirectionButton.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"));
leftFatherPane.setGlobalName(Inter.getLocText("FR-Designer_LeftParent")); leftFatherPane.setGlobalName(Inter.getLocText("FR-Designer_LeftParent"));
@ -85,8 +74,8 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
layoutPane = new JPanel(new BorderLayout()); layoutPane = new JPanel(new BorderLayout());
basicPane = new JPanel(); basicPane = new JPanel();
seniorPane = new JPanel(); seniorPane = new JPanel();
basicPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), 290, 24, basicPane()); basicPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), 223, 24, basicPane());
seniorPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 290, 24, seniorPane()); seniorPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 223, 24, seniorPane());
layoutPane.add(basicPane, BorderLayout.NORTH); layoutPane.add(basicPane, BorderLayout.NORTH);
layoutPane.add(seniorPane, BorderLayout.CENTER); layoutPane.add(seniorPane, BorderLayout.CENTER);
return layoutPane; return layoutPane;
@ -122,6 +111,8 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
UILabel expendSort = new UILabel(Inter.getLocText("FR-Designer_ExpendSort"), SwingConstants.LEFT); UILabel expendSort = new UILabel(Inter.getLocText("FR-Designer_ExpendSort"), SwingConstants.LEFT);
JPanel expendSortPane = new JPanel(new BorderLayout()); JPanel expendSortPane = new JPanel(new BorderLayout());
expendSortPane.add(expendSort, BorderLayout.NORTH); expendSortPane.add(expendSort, BorderLayout.NORTH);
horizontalExpandableCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
verticalExpandableCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{horizontalExpandableCheckBox, null}, new Component[]{horizontalExpandableCheckBox, null},
@ -163,6 +154,7 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
default: { default: {
horizontalExpandableCheckBox.setSelected(false); horizontalExpandableCheckBox.setSelected(false);
verticalExpandableCheckBox.setSelected(false); verticalExpandableCheckBox.setSelected(false);
break;
} }
} }

42
designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.cell.settingpane; package com.fr.design.mainframe.cell.settingpane;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory; import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
@ -88,18 +89,18 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private JPanel basicPane() { private JPanel basicPane() {
autoHeightCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Auto_Adjust_Height")); autoHeightCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Auto_Adjust_Height"));
autoWidthCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Auto_Adjust_Wdith")); autoWidthCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Auto_Adjust_Wdith"));
autoHeightCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
autoWidthCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p}; double[] rowSize = {p, p, p};
double[] columnSize = {p}; double[] columnSize = {p};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null}, new Component[]{null},
new Component[]{autoHeightCheckBox}, new Component[]{autoHeightCheckBox},
new Component[]{null},
new Component[]{autoWidthCheckBox}, new Component[]{autoWidthCheckBox},
new Component[]{null},
}; };
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_LARGE);
} }
@ -146,22 +147,38 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private JPanel seniorUpPane() { private JPanel seniorUpPane() {
JPanel fileNamePane = createNormal(); JPanel fileNamePane = createNormal();
previewCellContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
printAndExportContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
printAndExportBackground.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p};
double[] columnSize = {p, f}; double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{previewCellContent, null}, new Component[]{previewCellContent, null},
new Component[]{printAndExportContent, null}, new Component[]{printAndExportContent, null},
new Component[]{printAndExportBackground, null}, new Component[]{printAndExportBackground, null},
};
JPanel upPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_LARGE);
double[] downRowSize = {p, p, p, p, p, p};
double[] downColumnSize = {p, f};
int[][] downRowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] downComponent = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Show_Content"), SwingConstants.LEFT), showContent}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Show_Content"), SwingConstants.LEFT), showContent},
new Component[]{null, fileNamePane}, new Component[]{null, fileNamePane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_CellWrite_ToolTip"), SwingConstants.RIGHT), tooltipTextField}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_CellWrite_ToolTip"), SwingConstants.RIGHT), tooltipTextField},
new Component[]{null, null}, new Component[]{null, null},
new Component[]{null, null},
}; };
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); JPanel downPane = TableLayoutHelper.createGapTableLayoutPane(downComponent, downRowSize, downColumnSize, downRowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
JPanel pane = new JPanel(new BorderLayout());
pane.add(upPane, BorderLayout.NORTH);
pane.add(downPane, BorderLayout.CENTER);
return pane;
} }
private JPanel pagePane() { private JPanel pagePane() {
@ -175,6 +192,13 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
canBreakOnPaginateCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellPage_Can_Break_On_Paginate")); canBreakOnPaginateCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellPage_Can_Break_On_Paginate"));
repeatCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellPage_Repeat_Content_When_Paging")); repeatCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellPage_Repeat_Content_When_Paging"));
pageBeforeRowCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
pageAfterRowCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
pageBeforeColumnCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
pageAfterColumnCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
canBreakOnPaginateCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
repeatCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p};
double[] columnSize = {p}; double[] columnSize = {p};
@ -190,7 +214,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
new Component[]{canBreakOnPaginateCheckBox}, new Component[]{canBreakOnPaginateCheckBox},
new Component[]{repeatCheckBox}, new Component[]{repeatCheckBox},
}; };
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_LARGE);
} }

8
designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.cell.settingpane; package com.fr.design.mainframe.cell.settingpane;
import com.fr.base.present.Present; import com.fr.base.present.Present;
import com.fr.design.constants.UIConstants;
import com.fr.design.present.PresentPane; import com.fr.design.present.PresentPane;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
@ -21,12 +22,14 @@ public class CellPresentPane extends AbstractCellAttrPane {
/** /**
* 初始化面板 * 初始化面板
*
* @return 面板 * @return 面板
*/ */
public JPanel createContentPane() { public JPanel createContentPane() {
presentPane = new PresentPane(); presentPane = new PresentPane();
JPanel content = new JPanel(new BorderLayout()); JPanel content = new JPanel(new BorderLayout());
content.add(presentPane, BorderLayout.CENTER); content.add(presentPane, BorderLayout.CENTER);
presentPane.setBorder(UIConstants.CELL_ATTR_PRESENTBORDER);
presentPane.addTabChangeListener(new ItemListener() { presentPane.addTabChangeListener(new ItemListener() {
@Override @Override
@ -81,7 +84,7 @@ public class CellPresentPane extends AbstractCellAttrPane {
presentPane.populateBean(present); presentPane.populateBean(present);
} }
private Present getSelectCellPresent(){ private Present getSelectCellPresent() {
TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
//按住ctrl选中多个cell块 //按住ctrl选中多个cell块
int cellRectangleCount = cs.getCellRectangleCount(); int cellRectangleCount = cs.getCellRectangleCount();
@ -93,7 +96,7 @@ public class CellPresentPane extends AbstractCellAttrPane {
int column = i + cellRectangle.x; int column = i + cellRectangle.x;
int row = j + cellRectangle.y; int row = j + cellRectangle.y;
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row);
if(cellElement == null || cellElement.getPresent() == null){ if (cellElement == null || cellElement.getPresent() == null) {
return null; return null;
} }
} }
@ -104,6 +107,7 @@ public class CellPresentPane extends AbstractCellAttrPane {
/** /**
* 对话框标题 * 对话框标题
*
* @return 标题 * @return 标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {

3
designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.cell.settingpane; package com.fr.design.mainframe.cell.settingpane;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.cell.settingpane.style.StylePane; import com.fr.design.mainframe.cell.settingpane.style.StylePane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -25,6 +26,7 @@ public class CellStylePane extends AbstractCellAttrPane {
JPanel content = new JPanel(new BorderLayout()); JPanel content = new JPanel(new BorderLayout());
stylePane = new StylePane(); stylePane = new StylePane();
content.add(stylePane, BorderLayout.CENTER); content.add(stylePane, BorderLayout.CENTER);
stylePane.setBorder(UIConstants.CELL_ATTR_PRESENTBORDER);
stylePane.addPredefinedChangeListener(new ChangeListener() { stylePane.addPredefinedChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
attributeChanged(); attributeChanged();
@ -37,7 +39,6 @@ public class CellStylePane extends AbstractCellAttrPane {
adjustValues();// 里面的Tab切换后要及时调整滚动条,因为一些界面可能不需要滚动条 adjustValues();// 里面的Tab切换后要及时调整滚动条,因为一些界面可能不需要滚动条
} }
}); });
// content.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
return content; return content;
} }

1
designer/src/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java

@ -40,6 +40,7 @@ public class CustomStylePane extends MultiTabPane<Style> {
public CustomStylePane() { public CustomStylePane() {
super(); super();
tabPane.setOneLineTab(true); tabPane.setOneLineTab(true);
tabPane.setDrawLine(false);
tabPane.setLayout(new FiveButtonLayout(1)); tabPane.setLayout(new FiveButtonLayout(1));
} }

4
designer/src/com/fr/design/mainframe/cell/settingpane/style/PredefinedStylePane.java

@ -23,6 +23,8 @@ import java.util.Iterator;
public class PredefinedStylePane extends FurtherBasicBeanPane<NameStyle> implements DesignerBean { public class PredefinedStylePane extends FurtherBasicBeanPane<NameStyle> implements DesignerBean {
private static final int LEFT_BORDER = 10;
private static final int RIGHT_BORDER = 10;
private DefaultListModel defaultListModel; private DefaultListModel defaultListModel;
private JList styleList; private JList styleList;
private ChangeListener changeListener; private ChangeListener changeListener;
@ -65,7 +67,7 @@ public class PredefinedStylePane extends FurtherBasicBeanPane<NameStyle> impleme
styleList.setCellRenderer(render); styleList.setCellRenderer(render);
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(styleList, BorderLayout.CENTER); this.add(styleList, BorderLayout.CENTER);
this.setBorder(UIConstants.CELL_ATTR_NORMALBORDER); this.setBorder(BorderFactory.createEmptyBorder(0 ,LEFT_BORDER, 0, RIGHT_BORDER));
styleList.addMouseListener(new MouseAdapter() { styleList.addMouseListener(new MouseAdapter() {
@Override @Override

4
designer/src/com/fr/design/present/PresentPane.java

@ -70,25 +70,21 @@ public class PresentPane extends UIComboBoxPane<Present> {
displays.add(none.title4PopupWindow()); displays.add(none.title4PopupWindow());
dictPresentPane = new DictPresentPane(); dictPresentPane = new DictPresentPane();
dictPresentPane.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
paneList.add(dictPresentPane); paneList.add(dictPresentPane);
keys.add(DictPresent.class.getName()); keys.add(DictPresent.class.getName());
displays.add(dictPresentPane.title4PopupWindow()); displays.add(dictPresentPane.title4PopupWindow());
FurtherBasicBeanPane<BarcodePresent> bar = new BarCodePane(); FurtherBasicBeanPane<BarcodePresent> bar = new BarCodePane();
bar.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
paneList.add(bar); paneList.add(bar);
keys.add(BarcodePresent.class.getName()); keys.add(BarcodePresent.class.getName());
displays.add(bar.title4PopupWindow()); displays.add(bar.title4PopupWindow());
FurtherBasicBeanPane<FormulaPresent> formula = new FormulaPresentPane(); FurtherBasicBeanPane<FormulaPresent> formula = new FormulaPresentPane();
formula.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
paneList.add(formula); paneList.add(formula);
keys.add(FormulaPresent.class.getName()); keys.add(FormulaPresent.class.getName());
displays.add(formula.title4PopupWindow()); displays.add(formula.title4PopupWindow());
FurtherBasicBeanPane<CurrencyLinePresent> currency = new CurrencyLinePane(); FurtherBasicBeanPane<CurrencyLinePresent> currency = new CurrencyLinePane();
currency.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
paneList.add(currency); paneList.add(currency);
keys.add(CurrencyLinePresent.class.getName()); keys.add(CurrencyLinePresent.class.getName());
displays.add(currency.title4PopupWindow()); displays.add(currency.title4PopupWindow());

9
designer_base/src/com/fr/design/constants/UIConstants.java

@ -19,9 +19,10 @@ public interface UIConstants {
public static final Icon BLACK_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/blank.gif"); public static final Icon BLACK_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/blank.gif");
public static final Border CELL_ATTR_ZEROBORDER = BorderFactory.createEmptyBorder(0 ,0, 0, 0); public static final Border CELL_ATTR_ZEROBORDER = BorderFactory.createEmptyBorder(0, 0, 0, 0);
public static final Border CELL_ATTR_EMPTYBORDER = BorderFactory.createEmptyBorder(0 ,10, 0, 0); public static final Border CELL_ATTR_EMPTYBORDER = BorderFactory.createEmptyBorder(0, 10, 0, 0);
public static final Border CELL_ATTR_NORMALBORDER = BorderFactory.createEmptyBorder(0 ,10, 0, 15); public static final Border CELL_ATTR_PRESENTBORDER = BorderFactory.createEmptyBorder(0, 5, 0, 0);
public static final Border CELL_ATTR_NORMALBORDER = BorderFactory.createEmptyBorder(0, 10, 0, 15);
public static final int SIZE = 17; public static final int SIZE = 17;
@ -155,7 +156,7 @@ public interface UIConstants {
public static final Color PRESSED_DARK_GRAY = new Color(127, 127, 127); public static final Color PRESSED_DARK_GRAY = new Color(127, 127, 127);
public static final Color GRDIENT_DARK_GRAY = new Color(45, 45, 45); public static final Color GRDIENT_DARK_GRAY = new Color(45, 45, 45);
public static final Color BARNOMAL = new Color(232, 232, 233); public static final Color BARNOMAL = new Color(232, 232, 233);
public static final Color COMPONENT_BACKGROUND_COLOR = new Color(237,237,238); public static final Color COMPONENT_BACKGROUND_COLOR = new Color(237, 237, 238);
public static final int ARC = 0; public static final int ARC = 0;
public static final int BUTTON_GROUP_ARC = 0; public static final int BUTTON_GROUP_ARC = 0;
public static final int LARGEARC = 6; public static final int LARGEARC = 6;

39
designer_base/src/com/fr/design/foldablepane/HeaderPane.java

@ -11,16 +11,17 @@ import java.awt.image.BufferedImage;
*/ */
public class HeaderPane extends JPanel { public class HeaderPane extends JPanel {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final int TITLE_X = 9; private static final int TITLE_X = 5;
private static final int LEFT_X = 221; private static final int LEFT_X = 16;
private static final int LEFT_Y = 6; private static final int LEFT_Y = 6;
private int headWidth = 280; private static final int NORMAL_FONTSIZE = 12;
private int headHeight = 25; private int headWidth;
private int headHeight;
private Color bgColor; private Color bgColor;
private boolean isShow; private boolean isShow;
private String title; private String title;
private Image image; private Image image;
private int fontSize = 13; private int fontSize;
public void setShow(boolean isShow) { public void setShow(boolean isShow) {
this.isShow = isShow; this.isShow = isShow;
@ -56,21 +57,19 @@ public class HeaderPane extends JPanel {
BufferedImage panelImage = new BufferedImage(getWidth(), headHeight, BufferedImage.TYPE_INT_ARGB); BufferedImage panelImage = new BufferedImage(getWidth(), headHeight, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = panelImage.createGraphics(); Graphics2D g2d = panelImage.createGraphics();
g2d.setColor(UIConstants.COMPONENT_BACKGROUND_COLOR); g2d.setColor(UIConstants.COMPONENT_BACKGROUND_COLOR);
headWidth = this.getWidth();
g2d.fillRect(0, 0, headWidth, headHeight); g2d.fillRect(0, 0, headWidth, headHeight);
// g2d.drawImage(UIConstants.DRAG_BAR, 0, 0, headWidth, headHeight, null);
g2d.setFont(new Font("SimSun", 0, fontSize)); g2d.setFont(new Font("SimSun", 0, fontSize));
g2d.setPaint(bgColor); g2d.setPaint(bgColor);
// g2d.drawString(this.title, fontSize/2, headHeight-fontSize/3);
g2d.drawString(this.title, TITLE_X, headHeight - fontSize / 2 - 1); g2d.drawString(this.title, TITLE_X, headHeight - fontSize / 2 - 1);
int leftWdith = headWidth - LEFT_X;
if (this.isShow) { if (this.isShow) {
image = UIConstants.DRAG_DOWN_SELECTED_SMALL; image = UIConstants.DRAG_DOWN_SELECTED_SMALL;
g2d.drawImage(image, LEFT_X, LEFT_Y, null); g2d.drawImage(image, leftWdith, LEFT_Y, null);
} else { } else {
image = UIConstants.DRAG_LEFT_NORMAL_SMALL; image = UIConstants.DRAG_LEFT_NORMAL_SMALL;
g2d.drawImage(image, LEFT_X, LEFT_Y , null); g2d.drawImage(image, leftWdith, LEFT_Y, null);
} }
return panelImage; return panelImage;
} }
@ -90,21 +89,21 @@ public class HeaderPane extends JPanel {
} }
public HeaderPane(Color bgColor, String title, int headWidth, int headHeight) { public HeaderPane(Color bgColor, String title, int headHeight) {
this(bgColor); this(bgColor);
this.title = title; this.title = title;
this.headHeight = headHeight; this.headHeight = headHeight;
this.headWidth = headWidth; this.fontSize = NORMAL_FONTSIZE;
} }
public static void main(String[] args) { public static void main(String[] args) {
JFrame mainFrame = new JFrame("UI Demo - Gloomyfish"); // JFrame mainFrame = new JFrame("UI Demo - Gloomyfish");
mainFrame.getContentPane().setLayout(new BorderLayout()); // mainFrame.getContentPane().setLayout(new BorderLayout());
mainFrame.getContentPane().add(new HeaderPane(Color.black, "基本", 280, 24), BorderLayout.CENTER); // mainFrame.getContentPane().add(new HeaderPane(Color.black, "基本", 24), BorderLayout.CENTER);
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.pack(); // mainFrame.pack();
mainFrame.setSize(250, 400); // mainFrame.setSize(300, 400);
mainFrame.setVisible(true); // mainFrame.setVisible(true);
} }
} }

58
designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java

@ -1,18 +1,17 @@
package com.fr.design.foldablepane; package com.fr.design.foldablepane;
import com.fr.design.constants.UIConstants; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import javax.swing.*;
/** /**
* Created by MoMeak on 2017/7/5. * Created by MoMeak on 2017/7/5.
*/ */
public class UIExpandablePane extends JPanel { public class UIExpandablePane extends JPanel {
private static final int LEFT_BORDER = 5;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private HeaderPane headerPanel; private HeaderPane headerPanel;
private JPanel contentPanel; private JPanel contentPanel;
@ -22,8 +21,7 @@ public class UIExpandablePane extends JPanel {
private int headHeight; private int headHeight;
public UIExpandablePane(String title,int headWidth,int headHeight,JPanel contentPanel) public UIExpandablePane(String title, int headWidth, int headHeight, JPanel contentPanel) {
{
super(); super();
this.title = title; this.title = title;
this.headWidth = headWidth; this.headWidth = headWidth;
@ -32,29 +30,32 @@ public class UIExpandablePane extends JPanel {
initComponents(); initComponents();
} }
public UIExpandablePane(String title, int headHeight, JPanel contentPanel) {
super();
this.title = title;
this.headHeight = headHeight;
this.contentPanel = contentPanel;
initComponents();
}
private void initComponents() { private void initComponents() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
headerPanel = new HeaderPane(color, title,headWidth,headHeight); headerPanel = new HeaderPane(color, title, headHeight);
headerPanel.addMouseListener(new PanelAction()); headerPanel.addMouseListener(new PanelAction());
contentPanel.setBorder(UIConstants.CELL_ATTR_NORMALBORDER); contentPanel.setBorder(BorderFactory.createEmptyBorder(0 ,LEFT_BORDER, 0, 0));
this.add(headerPanel, BorderLayout.NORTH); this.add(headerPanel, BorderLayout.NORTH);
this.add(contentPanel, BorderLayout.CENTER); this.add(contentPanel, BorderLayout.CENTER);
setOpaque(false); setOpaque(false);
} }
class PanelAction extends MouseAdapter class PanelAction extends MouseAdapter {
{ public void mousePressed(MouseEvent e) {
public void mousePressed(MouseEvent e) HeaderPane hp = (HeaderPane) e.getSource();
{ if (contentPanel.isShowing()) {
HeaderPane hp = (HeaderPane)e.getSource();
if(contentPanel.isShowing())
{
contentPanel.setVisible(false); contentPanel.setVisible(false);
hp.setShow(false); hp.setShow(false);
} } else {
else
{
contentPanel.setVisible(true); contentPanel.setVisible(true);
hp.setShow(true); hp.setShow(true);
} }
@ -64,34 +65,19 @@ public class UIExpandablePane extends JPanel {
} }
public static void main(String[] args) public static void main(String[] args) {
{
// JFrame jf = new JFrame("test"); // JFrame jf = new JFrame("test");
// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// JPanel content = (JPanel) jf.getContentPane(); // JPanel content = (JPanel) jf.getContentPane();
// content.setLayout(new BorderLayout()); // content.setLayout(new BorderLayout());
//
// JPanel myPanel = new JPanel(); // JPanel myPanel = new JPanel();
// myPanel.setLayout(new BorderLayout()); // myPanel.setLayout(new BorderLayout());
// JPanel Panel = new JPanel(); // JPanel Panel = new JPanel();
// Panel.setBackground(Color.blue); // Panel.setBackground(Color.blue);
// myPanel.add(new UIExpandablePane("基本",280,25,Panel),BorderLayout.CENTER); // myPanel.add(new UIExpandablePane("基本", 223, 24, 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); // content.add(myPanel, BorderLayout.CENTER);
// GUICoreUtils.centerWindow(jf); // GUICoreUtils.centerWindow(jf);
// jf.setSize(280, 400); // jf.setSize(439, 400);
// jf.setVisible(true); // jf.setVisible(true);
} }

20
designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java

@ -2,7 +2,6 @@ package com.fr.design.gui.frpane;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import javax.swing.*; import javax.swing.*;
@ -12,7 +11,6 @@ import java.awt.event.ItemListener;
import java.util.List; import java.util.List;
/** /**
*
* @author zhou * @author zhou
* @since 2012-5-31下午12:25:21 * @since 2012-5-31下午12:25:21
*/ */
@ -56,7 +54,7 @@ public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> {
jcb.setSelectedIndex(0); jcb.setSelectedIndex(0);
} }
public FurtherBasicBeanPane<? extends T> getSelectedPane(){ public FurtherBasicBeanPane<? extends T> getSelectedPane() {
return cards.get(jcb.getSelectedIndex()); return cards.get(jcb.getSelectedIndex());
} }
@ -66,7 +64,7 @@ public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
comboBoxItemStateChanged(); comboBoxItemStateChanged();
CardLayout cl = (CardLayout)cardPane.getLayout(); CardLayout cl = (CardLayout) cardPane.getLayout();
cl.show(cardPane, cardNames[jcb.getSelectedIndex()]); cl.show(cardPane, cardNames[jcb.getSelectedIndex()]);
} }
}); });
@ -84,7 +82,7 @@ public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> {
* 设置只支持其中的某个选项, * 设置只支持其中的某个选项,
*/ */
public void justSupportOneSelect(boolean surpport) { public void justSupportOneSelect(boolean surpport) {
if(!surpport) { if (!surpport) {
jcb.setSelectedIndex(0); jcb.setSelectedIndex(0);
} }
jcb.setEnabled(surpport); jcb.setEnabled(surpport);
@ -94,11 +92,10 @@ public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> {
* august 如果需要的布局有变化覆盖之 * august 如果需要的布局有变化覆盖之
*/ */
protected void initLayout() { protected void initLayout() {
this.setLayout(new BorderLayout(0,6)); this.setLayout(new BorderLayout(0, 6));
JPanel northPane = new JPanel(new BorderLayout()); JPanel northPane = new JPanel(new BorderLayout());
northPane.add(jcb, BorderLayout.CENTER); northPane.add(jcb, BorderLayout.CENTER);
this.add(northPane, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);
northPane.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
this.add(cardPane, BorderLayout.CENTER); this.add(cardPane, BorderLayout.CENTER);
} }
@ -114,7 +111,7 @@ public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> {
} }
} }
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({"rawtypes", "unchecked"})
@Override @Override
public void populateBean(T ob) { public void populateBean(T ob) {
for (int i = 0; i < this.cards.size(); i++) { for (int i = 0; i < this.cards.size(); i++) {
@ -128,7 +125,6 @@ public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> {
} }
@Override @Override
public T updateBean() { public T updateBean() {
return cards.get(jcb.getSelectedIndex()).updateBean(); return cards.get(jcb.getSelectedIndex()).updateBean();
@ -148,15 +144,15 @@ public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> {
jcb.setSelectedIndex(index); jcb.setSelectedIndex(index);
} }
public void addTabChangeListener(ItemListener l){ public void addTabChangeListener(ItemListener l) {
jcb.addItemListener(l); jcb.addItemListener(l);
} }
public UIComboBox getUIComboBox(){ public UIComboBox getUIComboBox() {
return this.jcb; return this.jcb;
} }
public List<FurtherBasicBeanPane<? extends T>> getCards(){ public List<FurtherBasicBeanPane<? extends T>> getCards() {
return this.cards; return this.cards;
} }

15
designer_base/src/com/fr/design/gui/ibutton/UITabGroup.java

@ -10,6 +10,7 @@ import com.fr.design.constants.UIConstants;
public class UITabGroup extends UIButtonGroup<Integer> { public class UITabGroup extends UIButtonGroup<Integer> {
private boolean isOneLineTab = false; private boolean isOneLineTab = false;
private boolean isDrawLine = true;
private static final int BUTTON_NUMBER = 5; private static final int BUTTON_NUMBER = 5;
private static final int SEVEN_NUMBER = 7; private static final int SEVEN_NUMBER = 7;
private static final int ORIGINAL_WIDTH = 10; private static final int ORIGINAL_WIDTH = 10;
@ -50,7 +51,7 @@ public class UITabGroup extends UIButtonGroup<Integer> {
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
g2d.setColor(UIConstants.LINE_COLOR); g2d.setColor(UIConstants.LINE_COLOR);
if (!isTwoLine()) { if (!isTwoLine()) {
int width = isDrawLine() ? ORIGINAL_WIDTH : 0; int width = isDrawLine ? ORIGINAL_WIDTH : 0;
for (int i = 0; i < labelButtonList.size() - 1; i++) { for (int i = 0; i < labelButtonList.size() - 1; i++) {
width += labelButtonList.get(i).getWidth() + 1; width += labelButtonList.get(i).getWidth() + 1;
int height = labelButtonList.get(i).getHeight(); int height = labelButtonList.get(i).getHeight();
@ -58,7 +59,7 @@ public class UITabGroup extends UIButtonGroup<Integer> {
} }
width += labelButtonList.get(labelButtonList.size() - 1).getWidth() + 1; width += labelButtonList.get(labelButtonList.size() - 1).getWidth() + 1;
if (isDrawLine()) { if (isDrawLine) {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.drawRoundRect(ORIGINAL_WIDTH, 0, width - ORIGINAL_WIDTH, getHeight() - 1, UIConstants.ARC, UIConstants.ARC); g2d.drawRoundRect(ORIGINAL_WIDTH, 0, width - ORIGINAL_WIDTH, getHeight() - 1, UIConstants.ARC, UIConstants.ARC);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
@ -82,7 +83,7 @@ public class UITabGroup extends UIButtonGroup<Integer> {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
} }
if (isDrawLine()) { if (isDrawLine) {
g2d.drawLine(0, getHeight() / 2, getWidth(), getHeight() / 2); g2d.drawLine(0, getHeight() / 2, getWidth(), getHeight() / 2);
} }
} }
@ -127,12 +128,16 @@ public class UITabGroup extends UIButtonGroup<Integer> {
} }
protected boolean isDrawLine() { protected boolean isDrawLine() {
return true; return isDrawLine;
}
public void setDrawLine(boolean isDrawLine) {
this.isDrawLine = isDrawLine;
} }
@Override @Override
protected Border getGroupBorder() { protected Border getGroupBorder() {
if (!isDrawLine()) { if (!isDrawLine) {
return BorderFactory.createEmptyBorder(1, 1, 1, 1); return BorderFactory.createEmptyBorder(1, 1, 1, 1);
} }
return BorderFactory.createEmptyBorder(1, GAP, 1, GAP); return BorderFactory.createEmptyBorder(1, GAP, 1, GAP);

2
designer_base/src/com/fr/design/gui/style/AlignmentPane.java

@ -39,7 +39,7 @@ import java.util.Arrays;
*/ */
public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameObserver { public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameObserver {
private static final int ANGEL = 90; private static final int ANGEL = 90;
private static final Dimension SPINNER_DIMENSION = new Dimension(60, 20); private static final Dimension SPINNER_DIMENSION = new Dimension(70, 20);
private static final String[] TEXT = {Inter.getLocText("FR-Designer_StyleAlignment_Wrap_Text"), Inter.getLocText("FR-Designer_StyleAlignment_Single_Line"), private static final String[] TEXT = {Inter.getLocText("FR-Designer_StyleAlignment_Wrap_Text"), Inter.getLocText("FR-Designer_StyleAlignment_Single_Line"),
Inter.getLocText("FR-Designer_StyleAlignment_Single_Line(Adjust_Font)"), Inter.getLocText("FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)")}; Inter.getLocText("FR-Designer_StyleAlignment_Single_Line(Adjust_Font)"), Inter.getLocText("FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)")};

1
designer_base/src/com/fr/design/gui/style/FormatPane.java

@ -68,7 +68,6 @@ public class FormatPane extends AbstractBasicStylePane {
*/ */
public FormatPane() { public FormatPane() {
this.initComponents(TYPES); this.initComponents(TYPES);
this.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
} }
protected void initComponents(Integer[] types) { protected void initComponents(Integer[] types) {

Loading…
Cancel
Save