Browse Source

Merge pull request #499 in BA/design from ~XIAOXIA/design:release to release

* commit 'e36d08e8b2b334aa24acbe5204cd5e941ad20b1d':
  rt
  rt
  rt
  rt
master
superman 8 years ago
parent
commit
c0f8901593
  1. 42
      designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java

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

@ -29,16 +29,18 @@ 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 BUTTON_HEIGHT = 20;
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;
@ -47,12 +49,12 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
return new Dimension(super.getPreferredSize().width, 18);
}
};
label.setText(Inter.getLocText("Following_parameters_are_not_generated")+":");
label.setText(Inter.getLocText("FR-Following_parameters_are_not_generated")+":");
label.setHorizontalAlignment(SwingConstants.LEFT);
label.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
this.add(label);
addAll = new UIButton(Inter.getLocText("Add-all"));
addAll = new UIButton(Inter.getLocText("FR-Designer_Add_all"));
this.add(addAll);
}
@ -61,7 +63,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 +76,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 +86,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,10 +130,10 @@ 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);
int h= ((parameterSelectedLabellist.size() == 0) ? L_H : breakid * (BUTTON_HEIGHT + GAP_V) + GAP_BV + L_H + GAP_H + addAll.getPreferredSize().height);
return new Dimension(w, h);
}
@ -140,12 +142,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,12 +156,12 @@ 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);
addAll.setBounds(0, y + GAP_V + BUTTON_HEIGHT, width, addAll.getPreferredSize().height);
}
}

Loading…
Cancel
Save