private void right() { DefaultListModel rdlm = (DefaultListModel) rlist.getModel(); Object o = dpe.getValue(); if (o != null) { if (o instanceof IDataProvider) { rdlm.addElement(getColumnDisplayText((IDataProvider) o)); rlist.setSelectedValue(o, true); } else { IDataProvider[] array = (IDataProvider[]) o; for (IDataProvider element : array) { if ((element) instanceof IDataProvider) { rdlm.addElement(getColumnDisplayText(element)); } } } // DefaultListModel ldlm = (DefaultListModel)llist.getModel(); // ldlm.removeElement(o); } }
public ExportSpecifyDestinationPanel(IWizard parent, IWizardState state, IApplication app) { application = app; this.parent = parent; this.state = state; setName("start"); // $NON-NLS-1$ setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); setLayout(new BorderLayout()); JPanel movePane = new JPanel(); movePane.setLayout(new BoxLayout(movePane, BoxLayout.Y_AXIS)); movePane.setMaximumSize(new Dimension(100, 200)); JButton downButton = new JButton(Messages.getString("servoy.button.moveDown")); // $NON-NLS-1$ Dimension minimumSize = downButton.getPreferredSize(); // new Dimension(100,20); final JButton rightButton = new JButton(" >> "); // $NON-NLS-1$ rightButton.addActionListener(this); rightButton.setActionCommand("right"); // $NON-NLS-1$ rightButton.setPreferredSize(minimumSize); rightButton.setMinimumSize(minimumSize); rightButton.setMaximumSize(minimumSize); // rightButton.setAlignmentX(0); // rightButton.setAlignmentY(0); movePane.add(rightButton); movePane.add(Box.createRigidArea(new Dimension(0, 5))); final JButton leftButton = new JButton(" << "); // $NON-NLS-1$ leftButton.addActionListener(this); leftButton.setActionCommand("left"); // $NON-NLS-1$ leftButton.setPreferredSize(minimumSize); leftButton.setMinimumSize(minimumSize); leftButton.setMaximumSize(minimumSize); // leftButton.setAlignmentX(0); // leftButton.setAlignmentY(0); movePane.add(leftButton); movePane.add(Box.createRigidArea(new Dimension(0, 5))); JButton upButton = new JButton(Messages.getString("servoy.button.moveUp")); // $NON-NLS-1$ upButton.addActionListener(this); upButton.setActionCommand("up"); // $NON-NLS-1$ upButton.setPreferredSize(minimumSize); upButton.setMinimumSize(minimumSize); upButton.setMaximumSize(minimumSize); // upButton.setAlignmentX(0); // upButton.setAlignmentY(0); movePane.add(upButton); movePane.add(Box.createRigidArea(new Dimension(0, 5))); // JButton downButton = new JButton("move down"); downButton.addActionListener(this); downButton.setActionCommand("down"); // $NON-NLS-1$ downButton.setPreferredSize(minimumSize); downButton.setMinimumSize(minimumSize); downButton.setMaximumSize(minimumSize); // downButton.setAlignmentX(0); // downButton.setAlignmentY(0); movePane.add(downButton); movePane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); dpe = new DataProviderEditor(); dpe.init(application); // llist.addMouseListener(new MouseAdapter() { // public void mouseClicked(MouseEvent e) { // if (e.getClickCount() == 2) { // rightButton.doClick(); // } // } // }); // JScrollPane listScroll = new JScrollPane(llist); // listScroll.setPreferredSize(new Dimension(200,200)); rlist = new JList(); rlist.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { leftButton.doClick(); } } }); JScrollPane tableScroll = new JScrollPane(rlist); tableScroll.setPreferredSize(new Dimension(200, 200)); JPanel rightPanel = new JPanel(); rightPanel.setLayout(new BorderLayout()); rightPanel.add(tableScroll, BorderLayout.CENTER); rightPanel.add( new JLabel(Messages.getString("servoy.plugin.export.toFile")), BorderLayout.NORTH); // $NON-NLS-1$ JPanel toppanel = new JPanel(); // toppanel.setLayout(new BorderLayout()); toppanel.setLayout(new BoxLayout(toppanel, BoxLayout.X_AXIS)); // JPanel comboPanel = new JPanel(); // comboPanel.setLayout(new BorderLayout(5,5)); // comboPanel.add(new JComboBox(),BorderLayout.NORTH); // comboPanel.add(listScroll,BorderLayout.CENTER); toppanel.add(dpe); // , BorderLayout.WEST); toppanel.add(movePane); // ,BorderLayout.CENTER); toppanel.add(rightPanel); // , BorderLayout.EAST); // toppanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); add(toppanel, BorderLayout.CENTER); }