public List<SortColumn> showDialog(ITable t, List<SortColumn> sortColumns) { sortEditor.init(application, t, sortColumns); setVisible(true); if (OK) { return sortEditor.getData(); } else { return null; } }
private void init(IApplication b) { application = b; setTitle(Messages.getString("servoy.sortDialog.sortTitle")); // $NON-NLS-1$ // buttons final JButton setButton = new JButton(Messages.getString("servoy.sortDialog.sortTitle")); // $NON-NLS-1$ setButton.addActionListener(this); setButton.setActionCommand("ok"); // $NON-NLS-1$ final JButton cancelButton = new JButton(Messages.getString("servoy.button.cancel")); // $NON-NLS-1$ cancelButton.addActionListener(this); cancelButton.setActionCommand("cancel"); // $NON-NLS-1$ JButton copyButton = new JButton(Messages.getString("servoy.button.copy")); // $NON-NLS-1$ copyButton.addActionListener(this); copyButton.setActionCommand("copy"); // $NON-NLS-1$ getRootPane().setDefaultButton(setButton); // Lay out the buttons from left to right. JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS)); buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10)); buttonPane.add(copyButton); buttonPane.add(Box.createHorizontalGlue()); buttonPane.add(setButton); buttonPane.add(Box.createRigidArea(new Dimension(J2DBClient.BUTTON_SPACING, 0))); buttonPane.add(cancelButton); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); sortEditor = new SortEditor(); JPanel sortPane = new JPanel(new BorderLayout()); sortPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); sortPane.add(sortEditor.getCustomEditor(), BorderLayout.CENTER); contentPane.add(sortPane, BorderLayout.CENTER); contentPane.add(buttonPane, BorderLayout.SOUTH); loadBounds("SortDialog"); // $NON-NLS-1$ setMinimumSize(new Dimension(900, 250)); setButton.requestFocus(); }
private void copy() { List<SortColumn> list = sortEditor.getData(); WebStart.setClipboardContent(FoundSetManager.getSortColumnsAsString(list)); }