Browse Source

REPORT-4604 设计器视觉修改

1.增加了一个UIToggleButton(Icon[] icons) 接口;供需要反白的按钮调用
2.修改单元格属性面板的反白按钮(10)
master
MoMeak 7 years ago
parent
commit
5769e260e6
  1. 12
      designer/src/com/fr/design/expand/SortExpandAttrPane.java
  2. 8
      designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java
  3. 36
      designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java
  4. 24
      designer_base/src/com/fr/design/gui/ibutton/UIToggleButton.java
  5. BIN
      designer_base/src/com/fr/design/images/expand/asc_selected.png
  6. BIN
      designer_base/src/com/fr/design/images/expand/des_selected.png
  7. BIN
      designer_base/src/com/fr/design/images/expand/landspace_selected@1x.png
  8. BIN
      designer_base/src/com/fr/design/images/expand/none16x16_selected@1x.png
  9. BIN
      designer_base/src/com/fr/design/images/expand/vertical_selected@1x.png

12
designer/src/com/fr/design/expand/SortExpandAttrPane.java

@ -24,13 +24,13 @@ public class SortExpandAttrPane extends JPanel {
public SortExpandAttrPane() { public SortExpandAttrPane() {
this.setLayout(new BorderLayout(0, 4)); this.setLayout(new BorderLayout(0, 4));
Icon[] iconArray = { Icon[][] iconArray = {
BaseUtils.readIcon("/com/fr/design/images/expand/none16x16.png"), {BaseUtils.readIcon("/com/fr/design/images/expand/none16x16.png"), BaseUtils.readIcon("/com/fr/design/images/expand/none16x16_selected@1x.png")},
BaseUtils.readIcon("/com/fr/design/images/expand/asc.png"), {BaseUtils.readIcon("/com/fr/design/images/expand/asc.png"), BaseUtils.readIcon("/com/fr/design/images/expand/asc_selected.png")},
BaseUtils.readIcon("/com/fr/design/images/expand/des.png") {BaseUtils.readIcon("/com/fr/design/images/expand/des.png"), BaseUtils.readIcon("/com/fr/design/images/expand/des_selected.png")}
}; };
String[] nameArray = { Inter.getLocText("Sort-Original"), Inter.getLocText("Sort-Ascending"), Inter.getLocText("Sort-Descending") }; String[] nameArray = { Inter.getLocText("Sort-Original"), Inter.getLocText("Sort-Ascending"), Inter.getLocText("Sort-Descending") };
sort_type_pane = new UIButtonGroup(iconArray); sort_type_pane = new UIButtonGroup(iconArray, null);
sort_type_pane.setAllToolTips(nameArray); sort_type_pane.setAllToolTips(nameArray);
sort_type_pane.setGlobalName(Inter.getLocText("ExpandD-Sort_After_Expand")); sort_type_pane.setGlobalName(Inter.getLocText("ExpandD-Sort_After_Expand"));
this.add(sort_type_pane, BorderLayout.NORTH); this.add(sort_type_pane, BorderLayout.NORTH);

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

@ -45,10 +45,10 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
*/ */
public JPanel createContentPane() { public JPanel createContentPane() {
String[] nameArray = {Inter.getLocText("ExpandD-Not_Expand"), Inter.getLocText("Utils-Top_to_Bottom"), Inter.getLocText("Utils-Left_to_Right")}; String[] nameArray = {Inter.getLocText("ExpandD-Not_Expand"), Inter.getLocText("Utils-Top_to_Bottom"), Inter.getLocText("Utils-Left_to_Right")};
Icon[] iconArray = { Icon[][] iconArray = {
BaseUtils.readIcon("/com/fr/design/images/expand/none16x16.png"), {BaseUtils.readIcon("/com/fr/design/images/expand/none16x16.png"), BaseUtils.readIcon("/com/fr/design/images/expand/none16x16_selected@1x.png")},
BaseUtils.readIcon("/com/fr/design/images/expand/vertical.png"), {BaseUtils.readIcon("/com/fr/design/images/expand/vertical.png"), BaseUtils.readIcon("/com/fr/design/images/expand/vertical_selected@1x.png")},
BaseUtils.readIcon("/com/fr/design/images/expand/landspace.png") {BaseUtils.readIcon("/com/fr/design/images/expand/landspace.png"), BaseUtils.readIcon("/com/fr/design/images/expand/landspace_selected@1x.png")}
}; };
Byte[] valueArray = {Constants.NONE, Constants.TOP_TO_BOTTOM, Constants.LEFT_TO_RIGHT}; Byte[] valueArray = {Constants.NONE, Constants.TOP_TO_BOTTOM, Constants.LEFT_TO_RIGHT};
expandDirectionButton = new UIButtonGroup<Byte>(iconArray, valueArray); expandDirectionButton = new UIButtonGroup<Byte>(iconArray, valueArray);

36
designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -80,6 +80,42 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
} }
} }
public UIButtonGroup(Icon[][] iconArray, T[] objects) {
if (!ArrayUtils.isEmpty(objects) && iconArray.length == objects.length) {
this.objectList = Arrays.asList(objects);
}
labelButtonList = new ArrayList<UIToggleButton>(iconArray.length);
this.setLayout(getGridLayout(iconArray.length));
this.setBorder(getGroupBorder());
for (int i = 0; i < iconArray.length; i++) {
final int index = i;
Icon[] icon = iconArray[i];
final UIToggleButton labelButton = new UIToggleButton(icon) {
@Override
protected MouseListener getMouseListener() {
return new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
isClick = true;
if (!isEnabled()) {
return;
}
if (globalNameListener != null) {
globalNameListener.setGlobalName(buttonGroupName);
}
setSelectedWithFireChanged(index);
}
};
}
public boolean shouldResponseNameListener() {
return false;
}
};
initButton(labelButton);
}
}
public boolean hasClick() { public boolean hasClick() {
return isClick; return isClick;
} }

24
designer_base/src/com/fr/design/gui/ibutton/UIToggleButton.java

@ -3,12 +3,13 @@ package com.fr.design.gui.ibutton;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Shape; import java.awt.Shape;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
import javax.swing.Icon; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
@ -46,6 +47,26 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
addMouseListener(getMouseListener()); addMouseListener(getMouseListener());
} }
/**
* 需要反白的按钮接口
* support icons[normalIcon, selectedIcon]
* @param icons
*/
public UIToggleButton(Icon[] icons) {
super(icons[0], null, icons[1]);
setSelectedIcon(icons[1]);
setExtraPainted(true);
addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
if (!UIToggleButton.super.isSelected()) {
UIToggleButton.super.setSelected(!UIToggleButton.super.isSelected());
}
}
});
addMouseListener(getMouseListener());
}
public void setGlobalName(String name){ public void setGlobalName(String name){
toggleButtonName = name ; toggleButtonName = name ;
} }
@ -66,6 +87,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
@Override @Override
public void setSelected(boolean isSelected) { public void setSelected(boolean isSelected) {
super.setSelected(isSelected);
if (this.isSelected != isSelected) { if (this.isSelected != isSelected) {
this.isSelected = isSelected; this.isSelected = isSelected;
repaint(); repaint();

BIN
designer_base/src/com/fr/design/images/expand/asc_selected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

BIN
designer_base/src/com/fr/design/images/expand/des_selected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

BIN
designer_base/src/com/fr/design/images/expand/landspace_selected@1x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

BIN
designer_base/src/com/fr/design/images/expand/none16x16_selected@1x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

BIN
designer_base/src/com/fr/design/images/expand/vertical_selected@1x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Loading…
Cancel
Save