Exemplo n.º 1
0
  public static JPanel makeDonatePanel(boolean border) {
    FormLayout layout =
        new FormLayout(
            "250px", // cols //$NON-NLS-1$
            "p, 6dlu,  p"); // rows //$NON-NLS-1$
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    if (border) builder.setDefaultDialogBorder();

    JLabel msg = new JLabel(Messages.getString("Text.donateMessage"));

    builder.append(msg);
    builder.nextLine(2);
    ImageIcon icon = IconManager.getIcon("paypal.donate");
    JButton donate = new JButton(icon);
    donate.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    builder.append(donate);
    donate.setEnabled(true);
    donate.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            BrowserControl.displayURL(donateUrl);
          }
        });

    return builder.getPanel();
  }
Exemplo n.º 2
0
  /**
   * Builds the panel. Initializes and configures components first, then creates a FormLayout,
   * configures the layout, creates a builder, sets a border, and finally adds the components.
   *
   * @return the built panel
   */
  public JComponent createContentPanel() {
    // Separating the component initialization and configuration
    // from the layout code makes both parts easier to read.
    // TODO set minimum size
    FormLayout layout =
        new FormLayout(
            "180px", // cols //$NON-NLS-1$
            "p, 6dlu,  p,6dlu,p,6dlu,p"); // rows //$NON-NLS-1$

    // Create a builder that assists in adding components to the container.
    // Wrap the panel with a standardized border.
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();
    JLabel logo = new JLabel(IconManager.getIcon("icon.projity"));
    logo.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent arg0) {
            BrowserControl.displayURL("http://www.projity.com"); // $NON-NLS-1$
          }
        });
    builder.append(logo);
    builder.nextLine(2);
    builder.append(link);
    //		builder.nextLine(2);
    //		builder.append(videos);
    if (Environment.isOpenProj()) {
      builder.nextLine(2);
      builder.append(tipOfTheDay);
    }
    builder.nextLine(2);
    builder.append(license);

    if (false || Environment.isOpenProj()) { // removed donation link
      JPanel p = new JPanel();
      p.add(builder.getPanel());
      //		p.add(makeDonatePanel(false));
      return p;
    } else return builder.getPanel();
  }
  /** @param col column that was clicked on */
  public SpreadSheetColumnMenu(CommonSpreadSheet spreadSheet, final int col) {
    super();
    // setLabel("");
    setBorder(new BevelBorder(BevelBorder.RAISED));
    final CommonSpreadSheet sp = spreadSheet;
    final SpreadSheetFieldArray fields = (SpreadSheetFieldArray) sp.getFieldArray();
    insert.setIcon(IconManager.getIcon("menu.insertColumn")); // $NON-NLS-1$
    insert.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            Field field = ColumnDialog.getFieldFromDialog(sp, sp.getAvailableFields(), fields);
            if (field != null) {
              int c = col;
              if (c == 0) // takes care of when adding off to right. openproj bug 1815404
              c = fields.size();
              sp.setFieldArray(fields.insertField(c, field));
            }
          }
        });
    hide.setIcon(IconManager.getIcon("menu.hideColumn")); // $NON-NLS-1$

    hide.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (fields.size()
                > 2) { // there is always the hidden Id field, so only allow delete if more than one
                       // other field
              sp.setFieldArray(fields.removeField(col));
            } else {
              Alert.warn(Messages.getString("Message.cantEmptySpreadsheet"), sp); // $NON-NLS-1$
            }
          }
        });

    final Field f = (Field) fields.get(col);

    rename.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {

            if (fields.size()
                > 2) { // there is always the hidden Id field, so only allow delete if more than one
                       // other field
              FieldAliasDialog.doRename(f);
              sp.setFieldArray(fields);
            } else {
              Alert.warn(Messages.getString("Message.cantEmptySpreadsheet"), sp); // $NON-NLS-1$
            }
          }
        });

    find.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent arg0) {
            GraphicManager.getInstance().doFind(sp, f);
          }
        });

    add(insert);
    add(hide);
    if (!Environment.isNoPodServer() && f.isCustom()) add(rename);
    add(find);
  }