Browse Source

Merge branch 'temp1' into release/9.0

master
MoMeak 7 years ago
parent
commit
e77686820d
  1. 2
      designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java
  2. 7
      designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java
  3. 42
      designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  4. 60
      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. 2
      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. 33
      designer_base/src/com/fr/design/foldablepane/HeaderPane.java
  11. 58
      designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java
  12. 276
      designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java
  13. 15
      designer_base/src/com/fr/design/gui/ibutton/UITabGroup.java
  14. 12
      designer_base/src/com/fr/design/gui/itextfield/UITextField.java
  15. 2
      designer_base/src/com/fr/design/gui/style/AlignmentPane.java
  16. 1
      designer_base/src/com/fr/design/gui/style/FormatPane.java

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

@ -89,7 +89,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, -5, 0, 5));
downTitle.add(center, BorderLayout.CENTER); downTitle.add(center, BorderLayout.CENTER);
this.add(downTitle, BorderLayout.CENTER); this.add(downTitle, BorderLayout.CENTER);

7
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;
@ -85,8 +86,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 +123,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},

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

60
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;
@ -17,16 +18,18 @@ import java.awt.event.ItemListener;
* @since 2012-5-11下午5:24:35 * @since 2012-5-11下午5:24:35
*/ */
public class CellPresentPane extends AbstractCellAttrPane { public class CellPresentPane extends AbstractCellAttrPane {
private PresentPane presentPane; private PresentPane presentPane;
/** /**
* 初始化面板 * 初始化面板
* @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
@ -35,23 +38,23 @@ public class CellPresentPane extends AbstractCellAttrPane {
} }
}); });
return content; return content;
} }
@Override @Override
public String getIconPath() { public String getIconPath() {
// return "com/fr/design/images/data/source/dataDictionary.png"; // return "com/fr/design/images/data/source/dataDictionary.png";
return Inter.getLocText("FR-Designer_Present"); return Inter.getLocText("FR-Designer_Present");
} }
@Override @Override
public void updateBean(TemplateCellElement cellElement) { public void updateBean(TemplateCellElement cellElement) {
cellElement.setPresent(presentPane.updateBean()); cellElement.setPresent(presentPane.updateBean());
} }
/** /**
* 保存 * 保存
*/ */
public void updateBeans() { public void updateBeans() {
Present present = presentPane.updateBean(); Present present = presentPane.updateBean();
TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
int cellRectangleCount = cs.getCellRectangleCount(); int cellRectangleCount = cs.getCellRectangleCount();
@ -71,17 +74,17 @@ public class CellPresentPane extends AbstractCellAttrPane {
} }
} }
} }
} }
@Override @Override
protected void populateBean() { protected void populateBean() {
//选中的所有单元格都有形态,属性表才会有内容,否则是初始值 //选中的所有单元格都有形态,属性表才会有内容,否则是初始值
//主要是解决37664 //主要是解决37664
Present present = getSelectCellPresent(); Present present = getSelectCellPresent();
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,8 +96,8 @@ 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,15 +107,16 @@ public class CellPresentPane extends AbstractCellAttrPane {
/** /**
* 对话框标题 * 对话框标题
* @return 标题 *
* @return 标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("FR-Chart-Style_Present"); return Inter.getLocText("FR-Chart-Style_Present");
} }
public void setSelectedByIds(int level, String... id) { public void setSelectedByIds(int level, String... id) {
presentPane.setSelectedByName(id[level]); presentPane.setSelectedByName(id[level]);
} }
} }

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

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

@ -65,7 +65,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 ,10, 0, 10));
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;

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

@ -11,16 +11,16 @@ 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 int headWidth;
private int headHeight = 25; 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 = 12;
public void setShow(boolean isShow) { public void setShow(boolean isShow) {
this.isShow = isShow; this.isShow = isShow;
@ -56,18 +56,20 @@ 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.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, 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);
} }
@ -90,21 +92,20 @@ 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;
} }
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,15 @@
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 long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private HeaderPane headerPanel; private HeaderPane headerPanel;
private JPanel contentPanel; private JPanel contentPanel;
@ -22,8 +19,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 +28,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 ,5, 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 +63,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);
} }

276
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,155 +11,152 @@ 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
*/ */
public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> { public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
protected abstract List<FurtherBasicBeanPane<? extends T>> initPaneList(); protected abstract List<FurtherBasicBeanPane<? extends T>> initPaneList();
protected UIComboBox jcb; protected UIComboBox jcb;
protected JPanel cardPane; protected JPanel cardPane;
protected List<FurtherBasicBeanPane<? extends T>> cards; protected List<FurtherBasicBeanPane<? extends T>> cards;
protected String[] cardNames; protected String[] cardNames;
public UIComboBoxPane() { public UIComboBoxPane() {
cards = initPaneList(); cards = initPaneList();
initComponents(); initComponents();
} }
protected void initComponents() { protected void initComponents() {
cardNames = new String[cards.size()]; cardNames = new String[cards.size()];
jcb = createComboBox(); jcb = createComboBox();
cardPane = new JPanel(new CardLayout()) { cardPane = new JPanel(new CardLayout()) {
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return cards.get(jcb.getSelectedIndex()).getPreferredSize(); return cards.get(jcb.getSelectedIndex()).getPreferredSize();
} }
}; };
for (int i = 0; i < this.cards.size(); i++) { for (int i = 0; i < this.cards.size(); i++) {
String name = this.cards.get(i).title4PopupWindow();// Name从各自的pane里面获取 String name = this.cards.get(i).title4PopupWindow();// Name从各自的pane里面获取
cardNames[i] = name; cardNames[i] = name;
cardPane.add(this.cards.get(i), cardNames[i]); cardPane.add(this.cards.get(i), cardNames[i]);
addComboBoxItem(cards, i); addComboBoxItem(cards, i);
} }
addItemChangeEvent(); addItemChangeEvent();
initLayout(); initLayout();
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());
} }
protected void addItemChangeEvent() { protected void addItemChangeEvent() {
jcb.addItemListener(new ItemListener() { jcb.addItemListener(new ItemListener() {
@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()]);
} }
}); });
} }
protected UIComboBox createComboBox() { protected UIComboBox createComboBox() {
return new UIComboBox(); return new UIComboBox();
} }
protected void addComboBoxItem(List<FurtherBasicBeanPane<? extends T>> cards, int index) { protected void addComboBoxItem(List<FurtherBasicBeanPane<? extends T>> cards, int index) {
jcb.addItem(cards.get(index).title4PopupWindow()); jcb.addItem(cards.get(index).title4PopupWindow());
} }
/** /**
* 设置只支持其中的某个选项, * 设置只支持其中的某个选项,
*/ */
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);
} }
/** /**
* 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);
}
}
protected void comboBoxItemStateChanged() {
protected void comboBoxItemStateChanged() {
}
}
public void reset() {
public void reset() { jcb.setSelectedIndex(0);
jcb.setSelectedIndex(0); for (FurtherBasicBeanPane<?> pane : cards) {
for (FurtherBasicBeanPane<?> pane : cards) { pane.reset();
pane.reset(); }
} }
}
@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++) { FurtherBasicBeanPane pane = cards.get(i);
FurtherBasicBeanPane pane = cards.get(i); if (pane.accept(ob)) {
if (pane.accept(ob)) { pane.populateBean(ob);
pane.populateBean(ob); jcb.setSelectedIndex(i);
jcb.setSelectedIndex(i); return;
return; }
} }
} }
}
@Override
public T updateBean() {
@Override return cards.get(jcb.getSelectedIndex()).updateBean();
public T updateBean() { }
return cards.get(jcb.getSelectedIndex()).updateBean();
} @Override
public void checkValid() throws Exception {
@Override cards.get(jcb.getSelectedIndex()).checkValid();
public void checkValid() throws Exception {
cards.get(jcb.getSelectedIndex()).checkValid(); }
} public int getSelectedIndex() {
return jcb.getSelectedIndex();
public int getSelectedIndex() { }
return jcb.getSelectedIndex();
} public void setSelectedIndex(int index) {
jcb.setSelectedIndex(index);
public void setSelectedIndex(int index) { }
jcb.setSelectedIndex(index);
} public void addTabChangeListener(ItemListener l) {
jcb.addItemListener(l);
public void addTabChangeListener(ItemListener l){ }
jcb.addItemListener(l);
} public UIComboBox getUIComboBox() {
return this.jcb;
public UIComboBox getUIComboBox(){ }
return this.jcb;
} public List<FurtherBasicBeanPane<? extends T>> getCards() {
return this.cards;
public List<FurtherBasicBeanPane<? extends T>> getCards(){ }
return this.cards;
} public void clear() {
reset();
public void clear() { }
reset();
}
} }

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

12
designer_base/src/com/fr/design/gui/itextfield/UITextField.java

@ -61,13 +61,19 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs
protected void initListener() { protected void initListener() {
if (shouldResponseChangeListener()) { if (shouldResponseChangeListener()) {
addFocusListener(new FocusListener() { getDocument().addDocumentListener(new DocumentListener() {
@Override @Override
public void focusGained(FocusEvent e) { public void insertUpdate(DocumentEvent e) {
attributeChange();
}
@Override
public void removeUpdate(DocumentEvent e) {
attributeChange();
} }
@Override @Override
public void focusLost(FocusEvent e) { public void changedUpdate(DocumentEvent e) {
attributeChange(); attributeChange();
} }
}); });

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