|
|
@ -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() { |
|
|
|