Browse Source

REPORT-3163 合作开发9.0设计器=>列表面板=》完善UI细节

master
plough 8 years ago
parent
commit
18c5fc3941
  1. 11
      designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java
  2. 24
      designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java
  3. 37
      designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java
  4. 2
      designer_base/src/com/fr/design/gui/ilist/UINameEdList.java

11
designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java

@ -110,6 +110,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
// mainSplitPane.setOneTouchExpandable(true);
this.add(getLeftPane(), BorderLayout.CENTER);
this.setBorder(BorderFactory.createEmptyBorder(0, 10, 12, 10));
// mainSplitPane.setDividerLocation(getLeftPreferredSize());
this.checkButtonEnabled();
}
@ -134,14 +135,21 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
toolbarDef.addShortCut(sj.getShortCut());
}
toolBar = ToolBarDef.createJToolBar();
// toolBar.setLayout(new FlowLayout(FlowLayout.LEFT));
toolbarDef.updateToolBar(toolBar);
leftContentPane.add(toolBar, BorderLayout.NORTH);
// 封装一层,加边框
JPanel toolBarPane = new JPanel(new BorderLayout());
toolBarPane.add(toolBar, BorderLayout.CENTER);
toolBarPane.setBorder(BorderFactory.createMatteBorder(1, 1, 0, 1, new Color(201, 198, 184)));
leftContentPane.add(toolBarPane, BorderLayout.NORTH);
// leftContentPane.setBorder(BorderFactory.createLineBorder(new Color(201, 198, 184)));
// 顶部标签及add按钮
UIToolbar topToolBar = new UIToolbar();
topToolBar.setLayout(new BorderLayout());
ShortCut addItem = addItemShortCut().getShortCut();
addItem.intoJToolBar(topToolBar);
topToolBar.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0));
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = { p, f };
@ -150,6 +158,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
new Component[]{new UILabel("add hyperlink "), topToolBar},
};
JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize);
leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0));
leftPane.add(leftTopPane, BorderLayout.NORTH);
return leftPane;

24
designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java

@ -9,6 +9,7 @@ import com.fr.design.data.tabledata.tabledatapane.GlobalTreeTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.MultiTDTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.TreeTableDataPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilist.UINameEdList;
import com.fr.design.gui.ilist.ListModelElement;
@ -47,7 +48,7 @@ import java.util.Comparator;
public abstract class UIListControlPane extends UIControlPane {
public static final String LIST_NAME = "UIControl_List";
private static final int EDIT_RANGE = 20; // 编辑按钮的x坐标范围
private static final int EDIT_RANGE = 25; // 编辑按钮的x坐标范围
protected UINameEdList nameableList;
protected int editingIndex;
@ -358,8 +359,11 @@ public abstract class UIListControlPane extends UIControlPane {
}
private void popupEditPane() {
if (editingIndex < 0) {
return;
}
GUICoreUtils.showPopupMenu(popupEditPane, this,
- popupEditPane.getPreferredSize().width, nameableList.getSelectedIndex() * EDIT_RANGE);
- popupEditPane.getPreferredSize().width, editingIndex * EDIT_RANGE);
}
/**
@ -394,6 +398,21 @@ public abstract class UIListControlPane extends UIControlPane {
wrapActionListener(creators);
}
/**
* 生成UIButton
* @return 菜单按钮
*/
public UIButton createUIButton() {
createdButton = super.createUIButton();
// 此按钮单独抽出,不应使用工具栏外观
if (!createdButton.isOpaque()) {
createdButton.setOpaque(true);
createdButton.setNormalPainted(true);
createdButton.setBorderPaintedOnlyWhenPressed(false);
}
return createdButton;
}
private void wrapActionListener(NameableCreator[] creators) {
for (final NameableCreator creator : creators) {
if (!whetherAdd(creator.menuName())) {
@ -649,6 +668,7 @@ public abstract class UIListControlPane extends UIControlPane {
selectedName = nameableList.getNameAt(editingIndex);
nameableList.editItemAt(nameableList.getSelectedIndex());
} else if (SwingUtilities.isLeftMouseButton(evt) && evt.getX() <= EDIT_RANGE) {
editingIndex = nameableList.getSelectedIndex();
popupEditPane();
}

37
designer_base/src/com/fr/design/gui/controlpane/UINameableListCellRenderer.java

@ -25,8 +25,9 @@ public class UINameableListCellRenderer extends
JPanel implements ListCellRenderer {
private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
private static final Border DEFAULT_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
private static final Color BORDER_COLOR = new Color(201, 198, 184);
protected static Border noFocusBorder = DEFAULT_NO_FOCUS_BORDER;
private static final int BUTTON_WIDTH = 20;
private static final int BUTTON_WIDTH = 25;
private UILabel editButton; // "编辑按钮",实际上是一个 UILabel,由列表项(UIListControlPane)统一处理点击事件
private UILabel label;
private UIListControlPane listControlPane;
@ -48,6 +49,8 @@ public class UINameableListCellRenderer extends
};
// editButton.set4LargeToolbarButton();
editButton.setIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png"));
editButton.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, BORDER_COLOR));
editButton.setHorizontalAlignment(SwingConstants.CENTER);
// editButton.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
@ -55,30 +58,28 @@ public class UINameableListCellRenderer extends
// }
// });
label = new UILabel();
label.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
// label.setEditable(false);
this.setLayout(new BorderLayout());
this.add(editButton, BorderLayout.WEST);
this.add(label, BorderLayout.CENTER);
}
private void popupEditPane() {
GUICoreUtils.showPopupMenu(listControlPane.popupEditPane, editButton,
- listControlPane.popupEditPane.getPreferredSize().width, 0);
}
private Border getNoFocusBorder() {
Border border = DefaultLookup.getBorder(this, ui, "List.cellNoFocusBorder");
if (System.getSecurityManager() != null) {
if (border != null) return border;
return SAFE_NO_FOCUS_BORDER;
} else {
if (border != null &&
(noFocusBorder == null ||
noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) {
return border;
}
return noFocusBorder;
}
// return BorderFactory.createLineBorder(new Color(201, 198, 184));
return BorderFactory.createMatteBorder(0, 0, 1, 0, BORDER_COLOR);
// Border border = DefaultLookup.getBorder(this, ui, "List.cellNoFocusBorder");
// if (System.getSecurityManager() != null) {
// if (border != null) return border;
// return SAFE_NO_FOCUS_BORDER;
// } else {
// if (border != null &&
// (noFocusBorder == null ||
// noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) {
// return border;
// }
// return noFocusBorder;
// }
}
private void setText(String t) {

2
designer_base/src/com/fr/design/gui/ilist/UINameEdList.java

@ -24,7 +24,7 @@ import java.util.Vector;
*/
public class UINameEdList extends UIList implements CellEditorListener {
private static final int TEST_LIST_LENTH = 20;
private static final int BUTTON_WIDTH = 20;
private static final int BUTTON_WIDTH = 25;
private boolean editable = true;
// kunsnat: 是否强制ListName是数字 (int型)

Loading…
Cancel
Save