Example #1
0
  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();
  }
 public void actionPerformed(ActionEvent e) {
   String cmd = e.getActionCommand();
   if ("export_excel_file".equals(cmd)) // $NON-NLS-1$
   {
     try {
       ExcelExport export = new ExcelExport(application);
       export.showFrame();
     } catch (Exception ex) {
       application.reportError(
           Messages.getString("servoy.plugin.export.exception"), ex); // $NON-NLS-1$
     }
   } else if ("import_excel_file".equals(cmd)) // $NON-NLS-1$
   {
     try {
       ExcelImport importer = new ExcelImport(application);
       importer.showFrame();
     } catch (Exception ex) {
       application.reportError(
           Messages.getString("servoy.plugin.import.exception"), ex); // $NON-NLS-1$
     }
   }
 }
  /*
   * @see IPlugin#initialize(IApplication)
   */
  public void initialize(IClientPluginAccess app) throws PluginException {
    application = ((ClientPluginAccessProvider) app).getApplication();

    if (app instanceof ISmartClientPluginAccess) {
      JMenu export_Menu = ((ISmartClientPluginAccess) app).getExportMenu();
      JMenuItem exp = null;
      if (export_Menu != null) {
        exp = new JMenuItem(Messages.getString("servoy.plugin.excel.toExcel")); // $NON-NLS-1$
        exp.addActionListener(this);
        exp.setActionCommand("export_excel_file"); // $NON-NLS-1$
        export_Menu.add(exp);
      }

      JMenu import_Menu = ((ISmartClientPluginAccess) app).getImportMenu();
      JMenuItem imp = null;
      if (import_Menu != null) {
        imp = new JMenuItem(Messages.getString("servoy.plugin.excel.fromExcel")); // $NON-NLS-1$
        imp.setActionCommand("import_excel_file"); // $NON-NLS-1$
        imp.addActionListener(this);
        import_Menu.add(imp);
      }
      en = new Enabler(imp, exp);
    }
  }
 public Properties getProperties() {
   Properties props = new Properties();
   props.put(DISPLAY_NAME, Messages.getString("servoy.plugin.excel.displayname")); // $NON-NLS-1$
   return props;
 }
  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);
  }