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
*/
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 TemplateCellElement cellelement;
private ElementCasePane ePane;
private UIHeadGroup tabsHeaderIconPane;
private boolean isEditing;
private int PaneListIndex;
private CardLayout card;
private JPanel center;
private JPanel downTitle;
private JPanel title;
private UILabel titlename;
private TitleChangeListener titleChangeListener = 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() {
setLayout(new BorderLayout());
initPaneList();
@ -89,7 +76,7 @@ public class CellElementEditPane extends BasicPane {
downTitle = new JPanel();
downTitle.setLayout(new BorderLayout());
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);
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.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.expand.ExpandLeftFatherPane;
import com.fr.design.expand.ExpandUpFatherPane;
import com.fr.design.expand.SortExpandAttrPane;
@ -61,18 +62,6 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
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() {
expandDirectionButton.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"));
leftFatherPane.setGlobalName(Inter.getLocText("FR-Designer_LeftParent"));
@ -85,8 +74,8 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
layoutPane = new JPanel(new BorderLayout());
basicPane = new JPanel();
seniorPane = new JPanel();
basicPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), 290, 24, basicPane());
seniorPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 290, 24, seniorPane());
basicPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), 223, 24, basicPane());
seniorPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 223, 24, seniorPane());
layoutPane.add(basicPane, BorderLayout.NORTH);
layoutPane.add(seniorPane, BorderLayout.CENTER);
return layoutPane;
@ -122,6 +111,8 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
UILabel expendSort = new UILabel(Inter.getLocText("FR-Designer_ExpendSort"), SwingConstants.LEFT);
JPanel expendSortPane = new JPanel(new BorderLayout());
expendSortPane.add(expendSort, BorderLayout.NORTH);
horizontalExpandableCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
verticalExpandableCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{horizontalExpandableCheckBox, null},
@ -163,6 +154,7 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
default: {
horizontalExpandableCheckBox.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;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.file.HistoryTemplateListPane;
@ -88,18 +89,18 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private JPanel basicPane() {
autoHeightCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Auto_Adjust_Height"));
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[] rowSize = {p, p, p, p, p};
double[] rowSize = {p, p, 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[][]{
new Component[]{null},
new Component[]{autoHeightCheckBox},
new Component[]{null},
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() {
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 p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p, p, p, p};
double[] rowSize = {p, p, p, p};
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[][]{
new Component[]{null, null},
new Component[]{previewCellContent, null},
new Component[]{printAndExportContent, 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[]{null, fileNamePane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_CellWrite_ToolTip"), SwingConstants.RIGHT), tooltipTextField},
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() {
@ -175,6 +192,13 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
canBreakOnPaginateCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellPage_Can_Break_On_Paginate"));
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[] rowSize = {p, p, p, p, p, p, p, p, p, p, p};
double[] columnSize = {p};
@ -190,7 +214,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
new Component[]{canBreakOnPaginateCheckBox},
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;
import com.fr.base.present.Present;
import com.fr.design.constants.UIConstants;
import com.fr.design.present.PresentPane;
import com.fr.general.Inter;
import com.fr.report.cell.DefaultTemplateCellElement;
@ -21,12 +22,14 @@ public class CellPresentPane extends AbstractCellAttrPane {
/**
* 初始化面板
*
* @return 面板
*/
public JPanel createContentPane() {
presentPane = new PresentPane();
JPanel content = new JPanel(new BorderLayout());
content.add(presentPane, BorderLayout.CENTER);
presentPane.setBorder(UIConstants.CELL_ATTR_PRESENTBORDER);
presentPane.addTabChangeListener(new ItemListener() {
@Override
@ -81,7 +84,7 @@ public class CellPresentPane extends AbstractCellAttrPane {
presentPane.populateBean(present);
}
private Present getSelectCellPresent(){
private Present getSelectCellPresent() {
TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
//按住ctrl选中多个cell块
int cellRectangleCount = cs.getCellRectangleCount();
@ -93,7 +96,7 @@ public class CellPresentPane extends AbstractCellAttrPane {
int column = i + cellRectangle.x;
int row = j + cellRectangle.y;
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row);
if(cellElement == null || cellElement.getPresent() == null){
if (cellElement == null || cellElement.getPresent() == null) {
return null;
}
}
@ -104,6 +107,7 @@ public class CellPresentPane extends AbstractCellAttrPane {
/**
* 对话框标题
*
* @return 标题
*/
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;
import com.fr.base.Style;
import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.cell.settingpane.style.StylePane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
@ -25,6 +26,7 @@ public class CellStylePane extends AbstractCellAttrPane {
JPanel content = new JPanel(new BorderLayout());
stylePane = new StylePane();
content.add(stylePane, BorderLayout.CENTER);
stylePane.setBorder(UIConstants.CELL_ATTR_PRESENTBORDER);
stylePane.addPredefinedChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
attributeChanged();
@ -37,7 +39,6 @@ public class CellStylePane extends AbstractCellAttrPane {
adjustValues();// 里面的Tab切换后要及时调整滚动条,因为一些界面可能不需要滚动条
}
});
// content.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
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() {
super();
tabPane.setOneLineTab(true);
tabPane.setDrawLine(false);
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 {
private static final int LEFT_BORDER = 10;
private static final int RIGHT_BORDER = 10;
private DefaultListModel defaultListModel;
private JList styleList;
private ChangeListener changeListener;
@ -65,7 +67,7 @@ public class PredefinedStylePane extends FurtherBasicBeanPane<NameStyle> impleme
styleList.setCellRenderer(render);
this.setLayout(FRGUIPaneFactory.createBorderLayout());
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() {
@Override

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

@ -70,25 +70,21 @@ public class PresentPane extends UIComboBoxPane<Present> {
displays.add(none.title4PopupWindow());
dictPresentPane = new DictPresentPane();
dictPresentPane.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
paneList.add(dictPresentPane);
keys.add(DictPresent.class.getName());
displays.add(dictPresentPane.title4PopupWindow());
FurtherBasicBeanPane<BarcodePresent> bar = new BarCodePane();
bar.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
paneList.add(bar);
keys.add(BarcodePresent.class.getName());
displays.add(bar.title4PopupWindow());
FurtherBasicBeanPane<FormulaPresent> formula = new FormulaPresentPane();
formula.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
paneList.add(formula);
keys.add(FormulaPresent.class.getName());
displays.add(formula.title4PopupWindow());
FurtherBasicBeanPane<CurrencyLinePresent> currency = new CurrencyLinePane();
currency.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
paneList.add(currency);
keys.add(CurrencyLinePresent.class.getName());
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 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_NORMALBORDER = BorderFactory.createEmptyBorder(0 ,10, 0, 15);
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_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;
@ -155,7 +156,7 @@ public interface UIConstants {
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 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 BUTTON_GROUP_ARC = 0;
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 {
private static final long serialVersionUID = 1L;
private static final int TITLE_X = 9;
private static final int LEFT_X = 221;
private static final int TITLE_X = 5;
private static final int LEFT_X = 16;
private static final int LEFT_Y = 6;
private int headWidth = 280;
private int headHeight = 25;
private static final int NORMAL_FONTSIZE = 12;
private int headWidth;
private int headHeight;
private Color bgColor;
private boolean isShow;
private String title;
private Image image;
private int fontSize = 13;
private int fontSize;
public void setShow(boolean isShow) {
this.isShow = isShow;
@ -56,21 +57,19 @@ public class HeaderPane extends JPanel {
BufferedImage panelImage = new BufferedImage(getWidth(), headHeight, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = panelImage.createGraphics();
g2d.setColor(UIConstants.COMPONENT_BACKGROUND_COLOR);
headWidth = this.getWidth();
g2d.fillRect(0, 0, headWidth, headHeight);
// g2d.drawImage(UIConstants.DRAG_BAR, 0, 0, headWidth, headHeight, null);
g2d.setFont(new Font("SimSun", 0, fontSize));
g2d.setPaint(bgColor);
// g2d.drawString(this.title, fontSize/2, headHeight-fontSize/3);
g2d.drawString(this.title, TITLE_X, headHeight - fontSize / 2 - 1);
int leftWdith = headWidth - LEFT_X;
if (this.isShow) {
image = UIConstants.DRAG_DOWN_SELECTED_SMALL;
g2d.drawImage(image, LEFT_X, LEFT_Y, null);
g2d.drawImage(image, leftWdith, LEFT_Y, null);
} else {
image = UIConstants.DRAG_LEFT_NORMAL_SMALL;
g2d.drawImage(image, LEFT_X, LEFT_Y , null);
g2d.drawImage(image, leftWdith, LEFT_Y, null);
}
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.title = title;
this.headHeight = headHeight;
this.headWidth = headWidth;
this.fontSize = NORMAL_FONTSIZE;
}
public static void main(String[] args) {
JFrame mainFrame = new JFrame("UI Demo - Gloomyfish");
mainFrame.getContentPane().setLayout(new BorderLayout());
mainFrame.getContentPane().add(new HeaderPane(Color.black, "基本", 280, 24), BorderLayout.CENTER);
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.pack();
mainFrame.setSize(250, 400);
mainFrame.setVisible(true);
// JFrame mainFrame = new JFrame("UI Demo - Gloomyfish");
// mainFrame.getContentPane().setLayout(new BorderLayout());
// mainFrame.getContentPane().add(new HeaderPane(Color.black, "基本", 24), BorderLayout.CENTER);
// mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// mainFrame.pack();
// mainFrame.setSize(300, 400);
// mainFrame.setVisible(true);
}
}

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

@ -1,18 +1,17 @@
package com.fr.design.foldablepane;
import com.fr.design.constants.UIConstants;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.*;
/**
* Created by MoMeak on 2017/7/5.
*/
public class UIExpandablePane extends JPanel {
private static final int LEFT_BORDER = 5;
private static final long serialVersionUID = 1L;
private HeaderPane headerPanel;
private JPanel contentPanel;
@ -22,8 +21,7 @@ public class UIExpandablePane extends JPanel {
private int headHeight;
public UIExpandablePane(String title,int headWidth,int headHeight,JPanel contentPanel)
{
public UIExpandablePane(String title, int headWidth, int headHeight, JPanel contentPanel) {
super();
this.title = title;
this.headWidth = headWidth;
@ -32,29 +30,32 @@ public class UIExpandablePane extends JPanel {
initComponents();
}
public UIExpandablePane(String title, int headHeight, JPanel contentPanel) {
super();
this.title = title;
this.headHeight = headHeight;
this.contentPanel = contentPanel;
initComponents();
}
private void initComponents() {
this.setLayout(new BorderLayout());
headerPanel = new HeaderPane(color, title,headWidth,headHeight);
headerPanel = new HeaderPane(color, title, headHeight);
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(contentPanel, BorderLayout.CENTER);
setOpaque(false);
}
class PanelAction extends MouseAdapter
{
public void mousePressed(MouseEvent e)
{
HeaderPane hp = (HeaderPane)e.getSource();
if(contentPanel.isShowing())
{
class PanelAction extends MouseAdapter {
public void mousePressed(MouseEvent e) {
HeaderPane hp = (HeaderPane) e.getSource();
if (contentPanel.isShowing()) {
contentPanel.setVisible(false);
hp.setShow(false);
}
else
{
} else {
contentPanel.setVisible(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");
// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// JPanel content = (JPanel) jf.getContentPane();
// content.setLayout(new BorderLayout());
//
// JPanel myPanel = new JPanel();
// myPanel.setLayout(new BorderLayout());
// JPanel Panel = new JPanel();
// Panel.setBackground(Color.blue);
// myPanel.add(new UIExpandablePane("基本",280,25,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);
//// }
// myPanel.add(new UIExpandablePane("基本", 223, 24, Panel), BorderLayout.CENTER);
// content.add(myPanel, BorderLayout.CENTER);
// GUICoreUtils.centerWindow(jf);
// jf.setSize(280, 400);
// jf.setSize(439, 400);
// 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.FurtherBasicBeanPane;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.icombobox.UIComboBox;
import javax.swing.*;
@ -12,7 +11,6 @@ import java.awt.event.ItemListener;
import java.util.List;
/**
*
* @author zhou
* @since 2012-5-31下午12:25:21
*/
@ -56,7 +54,7 @@ public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> {
jcb.setSelectedIndex(0);
}
public FurtherBasicBeanPane<? extends T> getSelectedPane(){
public FurtherBasicBeanPane<? extends T> getSelectedPane() {
return cards.get(jcb.getSelectedIndex());
}
@ -66,7 +64,7 @@ public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> {
@Override
public void itemStateChanged(ItemEvent e) {
comboBoxItemStateChanged();
CardLayout cl = (CardLayout)cardPane.getLayout();
CardLayout cl = (CardLayout) cardPane.getLayout();
cl.show(cardPane, cardNames[jcb.getSelectedIndex()]);
}
});
@ -84,7 +82,7 @@ public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> {
* 设置只支持其中的某个选项,
*/
public void justSupportOneSelect(boolean surpport) {
if(!surpport) {
if (!surpport) {
jcb.setSelectedIndex(0);
}
jcb.setEnabled(surpport);
@ -94,11 +92,10 @@ public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> {
* august 如果需要的布局有变化覆盖之
*/
protected void initLayout() {
this.setLayout(new BorderLayout(0,6));
this.setLayout(new BorderLayout(0, 6));
JPanel northPane = new JPanel(new BorderLayout());
northPane.add(jcb, BorderLayout.CENTER);
this.add(northPane, BorderLayout.NORTH);
northPane.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
this.add(cardPane, BorderLayout.CENTER);
}
@ -114,7 +111,7 @@ public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> {
}
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public void populateBean(T ob) {
for (int i = 0; i < this.cards.size(); i++) {
@ -128,7 +125,6 @@ public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> {
}
@Override
public T updateBean() {
return cards.get(jcb.getSelectedIndex()).updateBean();
@ -148,15 +144,15 @@ public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> {
jcb.setSelectedIndex(index);
}
public void addTabChangeListener(ItemListener l){
public void addTabChangeListener(ItemListener l) {
jcb.addItemListener(l);
}
public UIComboBox getUIComboBox(){
public UIComboBox getUIComboBox() {
return this.jcb;
}
public List<FurtherBasicBeanPane<? extends T>> getCards(){
public List<FurtherBasicBeanPane<? extends T>> getCards() {
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> {
private boolean isOneLineTab = false;
private boolean isDrawLine = true;
private static final int BUTTON_NUMBER = 5;
private static final int SEVEN_NUMBER = 7;
private static final int ORIGINAL_WIDTH = 10;
@ -50,7 +51,7 @@ public class UITabGroup extends UIButtonGroup<Integer> {
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(UIConstants.LINE_COLOR);
if (!isTwoLine()) {
int width = isDrawLine() ? ORIGINAL_WIDTH : 0;
int width = isDrawLine ? ORIGINAL_WIDTH : 0;
for (int i = 0; i < labelButtonList.size() - 1; i++) {
width += labelButtonList.get(i).getWidth() + 1;
int height = labelButtonList.get(i).getHeight();
@ -58,7 +59,7 @@ public class UITabGroup extends UIButtonGroup<Integer> {
}
width += labelButtonList.get(labelButtonList.size() - 1).getWidth() + 1;
if (isDrawLine()) {
if (isDrawLine) {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.drawRoundRect(ORIGINAL_WIDTH, 0, width - ORIGINAL_WIDTH, getHeight() - 1, UIConstants.ARC, UIConstants.ARC);
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);
}
if (isDrawLine()) {
if (isDrawLine) {
g2d.drawLine(0, getHeight() / 2, getWidth(), getHeight() / 2);
}
}
@ -127,12 +128,16 @@ public class UITabGroup extends UIButtonGroup<Integer> {
}
protected boolean isDrawLine() {
return true;
return isDrawLine;
}
public void setDrawLine(boolean isDrawLine) {
this.isDrawLine = isDrawLine;
}
@Override
protected Border getGroupBorder() {
if (!isDrawLine()) {
if (!isDrawLine) {
return BorderFactory.createEmptyBorder(1, 1, 1, 1);
}
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 {
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"),
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() {
this.initComponents(TYPES);
this.setBorder(UIConstants.CELL_ATTR_NORMALBORDER);
}
protected void initComponents(Integer[] types) {

Loading…
Cancel
Save