Browse Source

REPORT-3163 合作开发9.0设计器=>外框架=》视觉修改

master
plough 7 years ago
parent
commit
adee1bff13
  1. 3
      designer_base/src/com/fr/design/constants/UIConstants.java
  2. 3
      designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java
  3. BIN
      designer_base/src/com/fr/design/images/buttonicon/popdownarrow.png
  4. BIN
      designer_base/src/com/fr/design/images/buttonicon/popuparrow.png
  5. 72
      designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java

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

@ -88,6 +88,7 @@ public interface UIConstants {
public static final Color DEFAULT_BG_RULER = new Color(0xf7f7f7); public static final Color DEFAULT_BG_RULER = new Color(0xf7f7f7);
public static final Color RULER_LINE_COLOR = new Color(0xababab); public static final Color RULER_LINE_COLOR = new Color(0xababab);
public static final Color RULER_SCALE_COLOR = new Color(0x4e504f); public static final Color RULER_SCALE_COLOR = new Color(0x4e504f);
public static final Color PROPERTY_PANE_BACKGROUND = new Color(0xdadadd);
@ -104,6 +105,8 @@ public interface UIConstants {
public static final BufferedImage DRAG_LEFT_PRESS = BaseUtils.readImage("com/fr/design/images/control/leftpre.png"); public static final BufferedImage DRAG_LEFT_PRESS = BaseUtils.readImage("com/fr/design/images/control/leftpre.png");
public static final BufferedImage DRAG_DOT = BaseUtils.readImage("com/fr/design/images/control/dot.png"); public static final BufferedImage DRAG_DOT = BaseUtils.readImage("com/fr/design/images/control/dot.png");
public static final BufferedImage DRAG_DOT_VERTICAL = BaseUtils.readImage("com/fr/design/images/control/dotv.png"); public static final BufferedImage DRAG_DOT_VERTICAL = BaseUtils.readImage("com/fr/design/images/control/dotv.png");
public static final BufferedImage POP_BUTTON_DOWN = BaseUtils.readImage("com/fr/design/images/buttonicon/popdownarrow.png");
public static final BufferedImage POP_BUTTON_UP = BaseUtils.readImage("com/fr/design/images/buttonicon/popuparrow.png");
public static final int MODEL_NORMAL = 0; public static final int MODEL_NORMAL = 0;
public static final int MODEL_PRESS = 1; public static final int MODEL_PRESS = 1;
public static final Icon ARROW_DOWN_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/arrowdown.png"); public static final Icon ARROW_DOWN_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/arrowdown.png");

3
designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java

@ -63,11 +63,12 @@ public class UIEastResizableContainer extends JPanel {
} }
public UIEastResizableContainer(JComponent leftPane, JComponent rightPane) { public UIEastResizableContainer(JComponent leftPane, JComponent rightPane) {
setBackground(UIConstants.NORMAL_BACKGROUND); setBackground(UIConstants.PROPERTY_PANE_BACKGROUND);
this.leftPane = leftPane; this.leftPane = leftPane;
this.rightPane = rightPane; this.rightPane = rightPane;
this.topToolPane = new TopToolPane(); this.topToolPane = new TopToolPane();
topToolPane.setBackground(UIConstants.PROPERTY_PANE_BACKGROUND);
setLayout(containerLayout); setLayout(containerLayout);
add(topToolPane); add(topToolPane);

BIN
designer_base/src/com/fr/design/images/buttonicon/popdownarrow.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

BIN
designer_base/src/com/fr/design/images/buttonicon/popuparrow.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

72
designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java

@ -28,12 +28,17 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private JPanel leftPane; private JPanel leftPane;
private JPanel rightPane; private JPanel rightPane;
private FixedPopupPane currentPopupPane; private FixedPopupPane currentPopupPane;
private static final int CONTAINER_WIDTH = 290; private static final int CONTAINER_WIDTH = 288;
private static final int TAB_WIDTH = 40; private static final int TAB_WIDTH = 38;
private static final int TAB_BUTTON_WIDTH = 32; private static final int TAB_BUTTON_WIDTH = 32;
private static final int TAB_BUTTON_HEIGHT = 28;
private static final int CONTENT_WIDTH = CONTAINER_WIDTH - TAB_WIDTH; private static final int CONTENT_WIDTH = CONTAINER_WIDTH - TAB_WIDTH;
private static final int POPUP_TOOLPANE_HEIGHT = 25; private static final int POPUP_TOOLPANE_HEIGHT = 25;
private static final int ARROW_RANGE_START = CONTENT_WIDTH - 30; private static final int ARROW_RANGE_START = CONTENT_WIDTH - 30;
// 弹出对话框高度
private static final int POPUP_MIN_HEIGHT = 145;
private static final int POPUP_MAX_HEIGHT = 480;
private static final int POPUP_DEFAULT_HEIGHT = 360;
private static final String KEY_CELL_ELEMENT = "cellElement"; private static final String KEY_CELL_ELEMENT = "cellElement";
private static final String KEY_CELL_ATTR = "cellAttr"; private static final String KEY_CELL_ATTR = "cellAttr";
private static final String KEY_FLOAT_ELEMENT = "floatElement"; private static final String KEY_FLOAT_ELEMENT = "floatElement";
@ -138,6 +143,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private JPanel getDefaultPane() { private JPanel getDefaultPane() {
JPanel defaultPane = new JPanel(); JPanel defaultPane = new JPanel();
UILabel label = new UILabel(Inter.getLocText("FR-Designer_No_Settings_Available")); UILabel label = new UILabel(Inter.getLocText("FR-Designer_No_Settings_Available"));
label.setHorizontalAlignment(SwingConstants.CENTER);
defaultPane.setLayout(new BorderLayout()); defaultPane.setLayout(new BorderLayout());
defaultPane.add(label, BorderLayout.CENTER); defaultPane.add(label, BorderLayout.CENTER);
return defaultPane; return defaultPane;
@ -177,8 +183,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
leftPane.add(item.getButton()); leftPane.add(item.getButton());
} }
// leftPane.setLayout(new BoxLayout(leftPane, BoxLayout.Y_AXIS)); leftPane.setBackground(UIConstants.PROPERTY_PANE_BACKGROUND);
leftPane.setBackground(new Color(226, 226, 226));
replaceLeftPane(leftPane); replaceLeftPane(leftPane);
} }
@ -431,7 +436,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private static final String ICON_SUFFIX_SELECTED = "_selected.png"; private static final String ICON_SUFFIX_SELECTED = "_selected.png";
private String btnIconName; private String btnIconName;
private String iconSuffix = ICON_SUFFIX_NORMAL; // normal, diabled, selected, 三者之一 private String iconSuffix = ICON_SUFFIX_NORMAL; // normal, diabled, selected, 三者之一
private final Color selectedBtnBackground = new Color(240, 240, 240); private final Color selectedBtnBackground = new Color(0xF5F5F7);
private Color originBtnBackground; private Color originBtnBackground;
public PropertyItem(String name, String title, String btnIconName, PropertyMode[] visibleModes, PropertyMode[] enableModes) { public PropertyItem(String name, String title, String btnIconName, PropertyMode[] visibleModes, PropertyMode[] enableModes) {
@ -577,7 +582,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private void initButton() { private void initButton() {
button = new UIButton(BaseUtils.readIcon(getBtnIconUrl())) { button = new UIButton(BaseUtils.readIcon(getBtnIconUrl())) {
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(TAB_BUTTON_WIDTH, TAB_BUTTON_WIDTH); return new Dimension(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT);
} }
@Override @Override
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
@ -666,36 +671,25 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private class FixedPopupPane extends JPopupMenu { private class FixedPopupPane extends JPopupMenu {
private JComponent contentPane; private JComponent contentPane;
// private PopupToolPane popupToolPane;
private int fixedHeight;
FixedPopupPane(PropertyItem propertyItem) { FixedPopupPane(PropertyItem propertyItem) {
contentPane = propertyItem.getContentPane(); contentPane = propertyItem.getContentPane();
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
// popupToolPane = ;
this.add(new PopupToolPane(propertyItem), BorderLayout.NORTH); this.add(new PopupToolPane(propertyItem), BorderLayout.NORTH);
this.add(contentPane, BorderLayout.CENTER); this.add(contentPane, BorderLayout.CENTER);
this.setOpaque(false); this.setOpaque(false);
fixedHeight = getPreferredSize().height - contentPane.getPreferredSize().height; setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, POPUP_DEFAULT_HEIGHT));
updateSize();
} }
public void menuSelectionChanged(boolean isIncluded) { public void menuSelectionChanged(boolean isIncluded) {
} }
private void updateSize() {
int newHeight = fixedHeight + contentPane.getPreferredSize().height;
this.setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, newHeight));
}
public JComponent getContentPane() { public JComponent getContentPane() {
return contentPane; return contentPane;
} }
public void replaceContentPane(JComponent pane) { public void replaceContentPane(JComponent pane) {
// remove(pane);
this.remove(this.contentPane); this.remove(this.contentPane);
this.add(this.contentPane = pane); this.add(this.contentPane = pane);
updateSize();
refreshContainer(); refreshContainer();
} }
@ -708,9 +702,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
// 弹出属性面板的工具条 // 弹出属性面板的工具条
private class PopupToolPane extends JPanel { private class PopupToolPane extends JPanel {
private int model = UIConstants.MODEL_NORMAL;
private String title; private String title;
private JComponent contentPane;
private PropertyItem propertyItem; private PropertyItem propertyItem;
private String buttonType; private String buttonType;
private JDialog parentDialog; // 如果不在对话框中,值为null private JDialog parentDialog; // 如果不在对话框中,值为null
@ -733,7 +725,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
if (mouseDownCompCoords == null) { if (mouseDownCompCoords == null) {
setBackground(originColor); setBackground(originColor);
} }
model = UIConstants.MODEL_NORMAL;
repaint(); repaint();
} }
@Override @Override
@ -762,13 +753,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {
if (e.getX() >= ARROW_RANGE_START) { if (e.getX() >= ARROW_RANGE_START) {
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
model = UIConstants.MODEL_PRESS;
} else if (isMovable) { } else if (isMovable) {
setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
setBackground(Color.pink); setBackground(Color.pink);
} else { } else {
setCursor(Cursor.getDefaultCursor()); setCursor(Cursor.getDefaultCursor());
model = UIConstants.MODEL_NORMAL;
} }
repaint(); repaint();
} }
@ -808,13 +797,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
super(); super();
this.propertyItem = propertyItem; this.propertyItem = propertyItem;
this.title = propertyItem.getTitle(); this.title = propertyItem.getTitle();
this.contentPane = propertyItem.getContentPane(); originColor = Color.white;
originColor = getBackground(); setBackground(originColor);
setLayout(new BorderLayout()); setLayout(new BorderLayout());
UILabel label = new UILabel(title); UILabel label = new UILabel(title);
label.setForeground(new Color(69, 135, 255));
add(label, BorderLayout.WEST); add(label, BorderLayout.WEST);
setBorder(new EmptyBorder(5, 10, 0, 0)); setBorder(new EmptyBorder(5, 10, 5, 0));
initToolButton(buttonType); initToolButton(buttonType);
} }
@ -857,27 +845,15 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
Image button; Image button;
g.setColor(new Color(69, 135, 255)); g.setColor(new Color(69, 135, 255));
g.setFont(FRFont.getInstance().applySize(14)); g.setFont(FRFont.getInstance().applySize(14));
// g.drawString(title, 5, 20);
// g.drawImage(UIConstants.DRAG_BAR, 0, 0, CONTENT_WIDTH, POPUP_TOOLPANE_HEIGHT, null);
if (buttonType.equals(NO_BUTTON)) { if (buttonType.equals(NO_BUTTON)) {
return; return;
} }
if (buttonType.equals(DOWN_BUTTON)) { if (buttonType.equals(DOWN_BUTTON)) {
if (model == UIConstants.MODEL_NORMAL) { button = UIConstants.POP_BUTTON_DOWN;
button = UIConstants.DRAG_LEFT_NORMAL;
} else {
button = UIConstants.DRAG_LEFT_PRESS;
}
} else { } else {
if (model == UIConstants.MODEL_NORMAL) { button = UIConstants.POP_BUTTON_UP;
button = UIConstants.DRAG_RIGHT_NORMAL;
} else {
button = UIConstants.DRAG_RIGHT_PRESS;
}
} }
// g.drawImage(button, 2, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null); g.drawImage(button, ARROW_RANGE_START + 8, 4, 16, 16, null);
g.drawImage(button, ARROW_RANGE_START + 12, 7, 5, 5, null);
} }
} }
@ -887,7 +863,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private Cursor originCursor; private Cursor originCursor;
private Cursor southResizeCursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR); private Cursor southResizeCursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR);
private Point mouseDownCompCoords; private Point mouseDownCompCoords;
private int minHeight; // 对话框最小高度
private JComponent contentPane; private JComponent contentPane;
private PropertyItem propertyItem; private PropertyItem propertyItem;
public PopupDialog(PropertyItem propertyItem) { public PopupDialog(PropertyItem propertyItem) {
@ -900,8 +876,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
contentPane = propertyItem.getContentPane(); contentPane = propertyItem.getContentPane();
container.add(popupToolPane, BorderLayout.NORTH); container.add(popupToolPane, BorderLayout.NORTH);
container.add(contentPane, BorderLayout.CENTER); container.add(contentPane, BorderLayout.CENTER);
minHeight = container.getPreferredSize().height; setSize(CONTENT_WIDTH, POPUP_DEFAULT_HEIGHT);
setSize(CONTENT_WIDTH, minHeight);
// validate(); // validate();
adjustLocation(); adjustLocation();
@ -941,8 +916,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
Point currCoords = e.getLocationOnScreen(); Point currCoords = e.getLocationOnScreen();
bounds.height = currCoords.y - mouseDownCompCoords.y + bounds.height; bounds.height = currCoords.y - mouseDownCompCoords.y + bounds.height;
// 校正位置 // 校正位置
if (bounds.height < minHeight) { if (bounds.height < POPUP_MIN_HEIGHT) {
bounds.height = minHeight; bounds.height = POPUP_MIN_HEIGHT;
}
if (bounds.height > POPUP_MAX_HEIGHT) {
bounds.height = POPUP_MAX_HEIGHT;
} }
mouseDownCompCoords.y = currCoords.y; mouseDownCompCoords.y = currCoords.y;
setBounds(bounds); setBounds(bounds);

Loading…
Cancel
Save