xiaoxia 8 years ago
parent
commit
52580743f1
  1. 33
      designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java

33
designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java

@ -29,16 +29,17 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
private UIButton addAll;
private UILabel label;
private int breakid;
private static final int GAP_H = 4;
private static final int GAP_V = 6;
private static final int GAP_BV = 4;
private static final int WIDTH = 225;
private static final int L_H = 18;
public ParameterToolBarPane() {
this.setLayout(new FlowParameterPaneLayout());
label = new UILabel() {
private static final long serialVersionUID = 1L;
@ -51,7 +52,7 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
label.setHorizontalAlignment(SwingConstants.LEFT);
label.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
this.add(label);
addAll = new UIButton(Inter.getLocText("Add-all"));
this.add(addAll);
@ -61,7 +62,7 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
protected String title4PopupWindow() {
return null;
}
public Parameter getTargetParameter(UIButton button) {
int index = parameterSelectedLabellist.indexOf(button);
if(index < 0 || index > parameterList.length - 1) {
@ -74,9 +75,9 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
public void populateBean(Parameter[] parameterArray) {
parameterSelectedLabellist.clear();
this.removeAll();
this.add(label);
if (parameterArray.length == 0) {
this.setVisible(false);
this.repaint();
@ -84,14 +85,14 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
} else {
this.setVisible(true);
}
parameterList = parameterArray;
for (int i = 0; i < parameterList.length; i++) {
UIButton parameterSelectedLabel = new UIButton(parameterList[i].getName());
parameterSelectedLabellist.add(parameterSelectedLabel);
this.add(parameterSelectedLabel);
}
for(UIButton parameterSelectedLabel : parameterSelectedLabellist) {
parameterSelectedLabel.addMouseListener(paraMouseListner);
}
@ -128,9 +129,9 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
public Dimension preferredLayoutSize(Container parent) {
int w = parent.getWidth();
layoutContainer(parent);
int h= ((parameterSelectedLabellist.size() == 0) ? L_H : breakid * (20 + GAP_V) + GAP_BV + L_H + GAP_H + addAll.getPreferredSize().height);
return new Dimension(w, h);
}
@ -140,12 +141,12 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
}
public void layoutContainer(Container parent) {
int width = parent.getWidth();
int width = parent.getWidth() == 0 ? WIDTH : parent.getWidth();
int x = 0;
int y = L_H + GAP_H;
label.setBounds(0, 0, width, L_H);
breakid = 1;
for (UIButton tab : parameterSelectedLabellist) {
Dimension dim = tab.getPreferredSize();
@ -154,9 +155,9 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
x = 0;
y += (dim.height + GAP_V);
}
tab.setBounds(x, y, dim.width, dim.height);
x += (dim.width + GAP_H);
}
addAll.setBounds(0, y + GAP_V+ 20, width, addAll.getPreferredSize().height);

Loading…
Cancel
Save