Browse Source

Merge pull request #1496 in BA/design from ~MOMEAK/design9.0:feature/9.0 to feature/9.0

* commit '770511dd588a61806899cf3c31f437417662ca2c':
  REPORT-5714 添加预定义控件问题
master
superman 7 years ago
parent
commit
e744a373e4
  1. 63
      designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java

63
designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java

@ -40,6 +40,7 @@ import java.util.List;
public class FormParaWidgetPane extends JPanel { public class FormParaWidgetPane extends JPanel {
private static FormParaWidgetPane THIS; private static FormParaWidgetPane THIS;
private final static int BORDER = 5; private final static int BORDER = 5;
private final static int WIDGET_WIDTHGAP = 4;
private List<WidgetOption> predifinedwidgeList = new ArrayList<WidgetOption>(); private List<WidgetOption> predifinedwidgeList = new ArrayList<WidgetOption>();
@ -123,39 +124,37 @@ public class FormParaWidgetPane extends JPanel {
} }
private void initWidgetTypePopUp() { private void initWidgetTypePopUp() {
if (widgetTypePopupMenu == null) { JPanel widgetPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
JPanel widgetPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); loadPredefinedWidget();
loadPredefinedWidget(); int rowNum = calculateWidgetWindowRowNum();
int rowNum = calculateWidgetWindowRowNum(); JPanel westPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
JPanel westPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); for (WidgetOption o : loadWidgetOptions()) {
for (WidgetOption o : loadWidgetOptions()) { westPanel.add(new ToolBarButton(o));
westPanel.add(new ToolBarButton(o)); }
} int x = commonWidgetNum * (widgetButtonWidth + smallGAP) - smallGAP;
int x = commonWidgetNum * (widgetButtonWidth + smallGAP) - smallGAP; westPanel.setPreferredSize(new Dimension(x, (int) (rowNum * westPanel.getPreferredSize().getHeight())));
westPanel.setPreferredSize(new Dimension(x, (int) (rowNum * westPanel.getPreferredSize().getHeight()))); JPanel eastPane = new JPanel(new FlowLayout(FlowLayout.LEFT));
JPanel eastPane = new JPanel(new FlowLayout(FlowLayout.LEFT)); for (WidgetOption no : predifinedwidgeList) {
for (WidgetOption no : predifinedwidgeList) { eastPane.add(new ToolBarButton(no));
eastPane.add(new ToolBarButton(no));
}
int maxWidth = preWidgetShowMaxNum * (widgetButtonWidth + smallGAP) - smallGAP;
int width = predifinedwidgeList.size() >= preWidgetShowMaxNum ? maxWidth : (int) eastPane.getPreferredSize().getWidth();
eastPane.setPreferredSize(new Dimension(width, (int) (rowNum * eastPane.getPreferredSize().getHeight())));
UIScrollPane eastScrollPane = new UIScrollPane(eastPane);
eastScrollPane.setBorder(null);
int maxHeight = preWidgetShowMaxRow * (widgetButtonHeight + smallGAP) - smallGAP;
int height = predifinedwidgeList.size() >= preWidgetShowMaxNum * preWidgetShowMaxRow ? maxHeight : (int) eastPane.getPreferredSize().getHeight();
width = predifinedwidgeList.size() >= preWidgetShowMaxNum * preWidgetShowMaxRow ? (int) eastPane.getPreferredSize().getWidth() + smallGAP + jsparatorWidth : (int) eastPane.getPreferredSize().getWidth();
eastScrollPane.setPreferredSize(new Dimension(width, height));
widgetPane.add(westPanel);
widgetPane.add(createJSeparator(height));
widgetPane.add(eastScrollPane);
widgetTypePopupMenu = new UIPopupMenu();
widgetTypePopupMenu.setBackground(UIConstants.SELECT_TAB);
widgetTypePopupMenu.add(widgetPane);
} }
int maxWidth = preWidgetShowMaxNum * (widgetButtonWidth + smallGAP) - smallGAP + WIDGET_WIDTHGAP;
int width = predifinedwidgeList.size() >= preWidgetShowMaxNum ? maxWidth : (int) eastPane.getPreferredSize().getWidth();
eastPane.setPreferredSize(new Dimension(width, (int) (rowNum * eastPane.getPreferredSize().getHeight())));
UIScrollPane eastScrollPane = new UIScrollPane(eastPane);
eastScrollPane.setBorder(null);
int maxHeight = preWidgetShowMaxRow * (widgetButtonHeight + smallGAP) - smallGAP;
int height = predifinedwidgeList.size() >= preWidgetShowMaxNum * preWidgetShowMaxRow ? maxHeight : (int) eastPane.getPreferredSize().getHeight();
width = predifinedwidgeList.size() >= preWidgetShowMaxNum * preWidgetShowMaxRow ? (int) eastPane.getPreferredSize().getWidth() + smallGAP + jsparatorWidth : (int) eastPane.getPreferredSize().getWidth();
eastScrollPane.setPreferredSize(new Dimension(width, height));
widgetPane.add(westPanel);
widgetPane.add(createJSeparator(height));
widgetPane.add(eastScrollPane);
widgetTypePopupMenu = new UIPopupMenu();
widgetTypePopupMenu.setBackground(UIConstants.SELECT_TAB);
widgetTypePopupMenu.add(widgetPane);
} }
private void initChartTypePopUp() { private void initChartTypePopUp() {

Loading…
Cancel
Save