Package util.ui

Examples of util.ui.EnhancedPanelBuilder


    /**
     * creates a JPanel for getting the parameters
     */
    private void createPanel() {try {
      CellConstraints cc = new CellConstraints();
      EnhancedPanelBuilder pb = new EnhancedPanelBuilder("5dlu,pref,5dlu,pref:grow,pref,5dlu", this);
      pb.setDefaultDialogBorder();

      pb.addParagraph(mLocalizer.msg("parametersRecord", "Parameters for recording"));

      pb.addGrowingRow();
      mAddFormatTextField = new ParamInputField(new CaptureParamLibrary(mData), mData.getParameterFormatAdd(), false);
      mAddFormatTextField.addFocusListener(new FocusAdapter() {
        public void focusLost(FocusEvent e) {
          addFormatChanged();
        }
      });
     
      pb.add(mAddFormatTextField, cc.xyw(2, pb.getRow(), pb.getColumnCount() - 1));
     
      pb.addParagraph(mLocalizer.msg("parametersDelete", "Parameters for deletion"));

      pb.addGrowingRow();
      mRemFormatTextField = new ParamInputField(new CaptureParamLibrary(mData), mData.getParameterFormatRem(), false);
      mRemFormatTextField.addFocusListener(new FocusAdapter() {
        public void focusLost(FocusEvent e) {
          remFormatChanged();
        }
      });
     
      pb.add(mRemFormatTextField, cc.xyw(2, pb.getRow(), pb.getColumnCount() - 1));
     
      pb.addParagraph(mLocalizer.msg("parametersAdditional", "Additional commands"));
      pb.addRow();
      JButton additional = new JButton(mLocalizer.msg("Additional", "Define additional commands"));
     
      additional.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          AdditionalParams params = new AdditionalParams(mKonfigurator, mData);
          UiUtilities.centerAndShow(params);
        }
      });
       
      pb.add(additional, cc.xy(pb.getColumnCount() - 1, pb.getRow()));
     
      }catch(Exception e){e.printStackTrace();}
    }
View Full Code Here


    mPlugin = plugin;
    mSettings = settings;
  }

  public JPanel createSettingsPanel() {
    final EnhancedPanelBuilder pb = new EnhancedPanelBuilder(FormFactory.RELATED_GAP_COLSPEC.encode() + ","
        + FormFactory.PREF_COLSPEC.encode() + "," + FormFactory.RELATED_GAP_COLSPEC.encode() + ",default:grow,"
        + FormFactory.RELATED_GAP_COLSPEC.encode() + "," + FormFactory.PREF_COLSPEC.encode());
    CellConstraints cc = new CellConstraints();

    mCategorie = new JTextField(mSettings.getCategory());

    String[] reservedValues = { mLocalizer.msg("Busy", "Busy"), mLocalizer.msg("Free", "Free") };

    mShowTime = new JComboBox(reservedValues);
    if (mSettings.isShowBusy()) {
      mShowTime.setSelectedIndex(0);
    }
    else if (mSettings.isShowFree()) {
      mShowTime.setSelectedIndex(1);
    }

    String[] classificationValues = { mLocalizer.msg("Public", "Public"), mLocalizer.msg("Private", "Private"),
        mLocalizer.msg("Confidential", "Confidential") };

    mClassification = new JComboBox(classificationValues);

    if (mSettings.isClassificationPublic()) {
      mClassification.setSelectedIndex(0);
    }
    else if (mSettings.isClassificationPrivate()) {
      mClassification.setSelectedIndex(1);
    }
    else if (mSettings.isClassificationConfidential()) {
      mClassification.setSelectedIndex(2);
    }

    mNulltime = new JCheckBox(mLocalizer.msg("nullTime", "Set length to 0 Minutes"));

    if (mSettings.getNullTime()) {
      mNulltime.setSelected(true);
    }

    pb.addRow();
    pb.addLabel(mLocalizer.msg("Categorie", "Categorie") + ':', cc.xy(2,pb.getRow()));
    pb.add(mCategorie, cc.xyw(4,pb.getRow(), pb.getColumnCount() - 3));

    pb.addRow();
    pb.addLabel(mLocalizer.msg("ShowTime", "Show Time as") + ':', cc.xy(2,pb.getRow()));
    pb.add(mShowTime, cc.xyw(4,pb.getRow(), pb.getColumnCount() - 3));

    pb.addRow();
    pb.addLabel(mLocalizer.msg("Classification", "Classification") + ':', cc.xy(2,pb.getRow()));
    pb.add(mClassification, cc.xyw(4,pb.getRow(), pb.getColumnCount() - 3));

    mUseAlarm = new JCheckBox(mLocalizer.msg("reminder", "Use reminder"));
    pb.addRow();
    pb.add(mUseAlarm, cc.xy(2,pb.getRow()));

    SpinnerModel model = new SpinnerNumberModel(0, 0, 1440, 1);
    mAlarmMinutes = new JSpinner(model);
    JPanel panel = new JPanel(new BorderLayout());

    panel.add(mAlarmMinutes, BorderLayout.WEST);

    final JLabel label = new JLabel(mLocalizer.msg("minutesBefore", "Minutes before start."));
    label.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
    panel.add(label, BorderLayout.CENTER);

    mUseAlarm.addChangeListener(new ChangeListener() {
      public void stateChanged(ChangeEvent e) {
        mAlarmMinutes.setEnabled(mUseAlarm.isSelected());
        label.setEnabled(mUseAlarm.isSelected());
      }
    });

    if (mSettings.getUseAlarm()) {
      mUseAlarm.setSelected(true);
    }

    try {
      mAlarmMinutes.setValue(mSettings.getAlarmMinutes());
    } catch (Exception e) {
        // empty
    }

    mAlarmMinutes.setEnabled(mUseAlarm.isSelected());
    label.setEnabled(mUseAlarm.isSelected());


    pb.add(panel, cc.xyw(4, pb.getRow(), 2));

    pb.addRow();
    pb.add(mNulltime, cc.xyw(2,pb.getRow(),4));

    mMarkItems = new JCheckBox(mLocalizer.msg("markItems", "Mark items when exported"));
    if (mSettings.getMarkItems()) {
      mMarkItems.setSelected(true);
    }

    pb.addRow();
    pb.add(mMarkItems, cc.xyw(2,pb.getRow(),4));

    pb.addParagraph(mLocalizer.msg("interface", "Interface"));

    mExporterList = new SelectableItemList(mPlugin.getExporterFactory().getActiveExporters(), mPlugin.getExporterFactory().getAllExporters());
    pb.addRow("120");
    pb.add(mExporterList, cc.xyw(2,pb.getRow(),3));

    final JButton settings = new JButton(Localizer.getLocalization(Localizer.I18N_SETTINGS));
    settings.setEnabled(false);

    mExporterList.addListSelectionListener(new ListSelectionListener() {
      public void valueChanged(ListSelectionEvent e) {
        Object[] ob = mExporterList.getListSelection();
        if ((ob.length == 1) && (((ExporterIf)ob[0]).hasSettingsDialog())) {
          settings.setEnabled(true);
        } else {
          settings.setEnabled(false);
        }
      }
    });

    settings.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        Object[] ob = mExporterList.getListSelection();
        if (ob.length == 1) {
          ((ExporterIf)ob[0]).showSettingsDialog(mSettings);
        }
      }
    });

    pb.add(settings, cc.xy(6,pb.getRow(), CellConstraints.RIGHT, CellConstraints.TOP));

    pb.addParagraph(mLocalizer.msg("formattings", "Formattings"));

    JButton extended = new JButton(mLocalizer.msg("formattings", "Formattings"));

    extended.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        showExtendedDialog(pb.getPanel());
      }
    });

    pb.addRow();
    pb.add(extended, cc.xy(2,pb.getRow()));

    return pb.getPanel();
  }
View Full Code Here

    this.webPlugin = plugin;
  }

  public JPanel createSettingsPanel() {

    EnhancedPanelBuilder pb = new EnhancedPanelBuilder(FormFactory.RELATED_GAP_COLSPEC.encode() + ",fill:default:grow");
    CellConstraints cc = new CellConstraints();

    mRbShowDetails = new JRadioButton(mLocalizer.msg("showDetails","Show search menu for title, actors, and other fields"), webPlugin.getShowDetailMenus());
    mRbShowTitle = new JRadioButton(mLocalizer.msg("showTitle","Show title search only"), !webPlugin.getShowDetailMenus());

    ButtonGroup bg = new ButtonGroup();
    bg.add(mRbShowDetails);
    bg.add(mRbShowTitle);

    pb.addRow();
    pb.add(mRbShowDetails, cc.xy(2, pb.getRow()));

    pb.addRow();
    pb.add(mRbShowTitle, cc.xy(2, pb.getRow()));

    mAddressList = new JList(mListModel);
    // Register DnD on the List.
    ListDragAndDropHandler dnDHandler = new ListDragAndDropHandler(mAddressList,mAddressList,this);
    new DragAndDropMouseListener(mAddressList,mAddressList,this,dnDHandler);

    mAddressList.setSelectedIndex(0);
    mAddressList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    mAddressList.addListSelectionListener(new ListSelectionListener() {
      public void valueChanged(ListSelectionEvent e) {
        listSelectionChanged();
      }
    });
    mAddressList.addMouseListener(new MouseAdapter() {

      @Override
      public void mouseClicked(MouseEvent e) {
        if ((e.getButton() == MouseEvent.BUTTON1) && (e.getClickCount() == 2)) {
          editPressed();
        }
        super.mouseClicked(e);
      }
    });

    mAddressList.setCellRenderer(new WebAddressRenderer());

    GridBagConstraints c = new GridBagConstraints();

    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1.0;
    c.weighty = 1.0;
    c.insets = new Insets(0, 0, 5, 5);

    JPanel panel = new JPanel(new GridBagLayout());
    panel.add(new JScrollPane(mAddressList), c);

    c = new GridBagConstraints();
    c.insets = new Insets(5, 0, 5, 5);
    c.weightx = 0;
    c.weighty = 0;
    c.fill = GridBagConstraints.NONE;

    createButtons();

    panel.add(mStartStop, c);
    c.insets = new Insets(5, 0, 5, 5);
    panel.add(mNew, c);
    panel.add(mEdit, c);
    panel.add(mDelete, c);
    panel.add(mResetIcons, c);

    GridBagConstraints filler = new GridBagConstraints();

    filler.weightx = 1.0;
    filler.fill = GridBagConstraints.HORIZONTAL;

    panel.add(new JPanel(), filler);

    panel.add(mUp, c);

    c.gridwidth = GridBagConstraints.REMAINDER;
    c.insets = new Insets(5, 0, 5, 5);

    panel.add(mDown, c);

    listSelectionChanged();

    pb.addParagraph(mLocalizer.msg("WebPages", "Web Pages"));
    pb.addGrowingRow();
    pb.add(panel, cc.xy(2, pb.getRow()));

    WebPlugin.getInstance().getInfo();
    LinkButton link = new LinkButton(mLocalizer.msg("examples", "More search engine examples"), PluginInfo.getHelpUrl(WebPlugin.getInstance().getId()));
    pb.addRow();
    pb.add(link, cc.xy(2, pb.getRow()));

    return pb.getPanel();
  }
View Full Code Here

    }
    mSettings = settings;
  }

  public JPanel createSettingsPanel() {
    final EnhancedPanelBuilder panelBuilder = new EnhancedPanelBuilder(FormFactory.RELATED_GAP_COLSPEC.encode() + ","
        + FormFactory.PREF_COLSPEC.encode() + "," + FormFactory.RELATED_GAP_COLSPEC.encode() + ","
        + FormFactory.PREF_COLSPEC.encode() + ", fill:default:grow");
    final CellConstraints cc = new CellConstraints();

    final JLabel label = new JLabel(mLocalizer
        .msg("daysToShow", "Days to show"));

    panelBuilder.addRow();
    panelBuilder.add(label, cc.xy(2, panelBuilder.getRow()));
   
    final SpinnerNumberModel model = new SpinnerNumberModel(7, 1, 28, 1);
    mSpinner = new JSpinner(model);
    mSpinner.setValue(mSettings.getDays());
    panelBuilder.add(mSpinner, cc.xy(4, panelBuilder.getRow()));

    mUnifyBraces = new JCheckBox(mLocalizer.msg("unifyBracedGenres", "Unify genres with sub genres in braces"), mSettings.getUnifyBraceGenres());
    panelBuilder.addRow();
    panelBuilder.add(mUnifyBraces, cc.xy(2, panelBuilder.getRow()));

    panelBuilder.addParagraph(mLocalizer.msg("filteredGenres", "Filtered genres"));

    mFilteredGenres = new JList(mListModel);
    mFilteredGenres.setSelectedIndex(0);
    mFilteredGenres.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    mFilteredGenres.addListSelectionListener(new ListSelectionListener() {
      public void valueChanged(final ListSelectionEvent e) {
        listSelectionChanged();
      }
    });

    panelBuilder.addGrowingRow();
    panelBuilder.add(new JScrollPane(mFilteredGenres), cc.xyw(2, panelBuilder.getRow(), panelBuilder.getColumnCount() - 1));
   
    mAddFilter = new JButton(mLocalizer.msg("addFilterBtn", "Add filter"));
    mAddFilter.addActionListener(new ActionListener() {

      public void actionPerformed(final ActionEvent e) {
        String genre = JOptionPane.showInputDialog(mLocalizer.msg("addFilterMessage", "Add genre to be filtered"), "");
        if (genre != null) {
          genre = genre.trim();
          if (genre.length() > 0) {
            mListModel.addElement(genre);
          }
        }
      }});
   
    mRemoveFilter = new JButton(mLocalizer.msg("removeFilterBtn", "Remove filter"));
    mRemoveFilter.addActionListener(new ActionListener() {

      public void actionPerformed(final ActionEvent e) {
        final int index = mFilteredGenres.getSelectedIndex();
        if (index >= 0) {
          mListModel.remove(index);
        }
      }});
   
    panelBuilder.addRow();
    ButtonBarBuilder2 buttonBar = new ButtonBarBuilder2();
    buttonBar.addButton(new JButton[]{mAddFilter, mRemoveFilter});
    panelBuilder.add(buttonBar.getPanel(), cc.xyw(2, panelBuilder.getRow(), panelBuilder.getColumnCount() - 1));

    mFilteredGenres.addListSelectionListener(new ListSelectionListener() {
      public void valueChanged(final ListSelectionEvent e) {
        mRemoveFilter.setEnabled(mFilteredGenres.getSelectedIndex() >= 0);
      }});
   
    // force update of enabled states
    listSelectionChanged();
   
    return panelBuilder.getPanel();
  }
View Full Code Here

    private void createGui() {
        setTitle(mLocalizer.msg("title", "Configure Dreambox"));

        UiUtilities.registerForClosing(this);

        EnhancedPanelBuilder basicPanel = new EnhancedPanelBuilder("2dlu, pref, 3dlu, fill:min:grow, 3dlu, pref, 3dlu, pref");
        basicPanel.setBorder(Borders.DLU4_BORDER);

        CellConstraints cc = new CellConstraints();

        basicPanel.addParagraph(mLocalizer.msg("misc", "Miscellaneous"));

        basicPanel.addRow();
        basicPanel.add(new JLabel(mLocalizer.msg("name","Name:")), cc.xy(2, basicPanel.getRow()));
        mDeviceName = new JTextField(mDevice.getName());
        basicPanel.add(mDeviceName, cc.xy(4, basicPanel.getRow()));

        basicPanel.addRow();
        basicPanel.add(new JLabel(mLocalizer.msg("webIf","Webif:")), cc.xy(2,basicPanel.getRow()));

        String[] values = {"ipkg",
                           "opkg"};

        mSoftwareSelection = new JComboBox(values);
        mSoftwareSelection.setSelectedIndex(mConfig.isOpkg() ? 1 : 0);

        basicPanel.add(mSoftwareSelection, cc.xy(4, basicPanel.getRow()));

        basicPanel.addRow();
        basicPanel.add(new JLabel(mLocalizer.msg("ipaddress", "IP address")), cc.xy(2, basicPanel.getRow()));
        mDreamboxAddress = new JTextField(mConfig.getDreamboxAddress());
        basicPanel.add(mDreamboxAddress, cc.xy(4, basicPanel.getRow()));

        JButton help = new JButton(CapturePlugin.getInstance().createImageIcon("apps", "help-browser", 16));
        help.setToolTipText(Localizer.getLocalization(Localizer.I18N_HELP));
        help.setOpaque(false);
        help.setBorder(Borders.EMPTY_BORDER);
        basicPanel.add(help, cc.xy(8, basicPanel.getRow()));

        ButtonBarBuilder2 refresh = new ButtonBarBuilder2();

        refresh.addGlue();

        mRefreshButton = new JButton(mLocalizer.msg("refresh", "Refresh channel list"));
        mRefreshButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                refreshChannelList();
            }
        });
        mRefreshButton.setIcon(TVBrowserIcons.refresh(TVBrowserIcons.SIZE_SMALL));
        mRefreshButton.setEnabled(mConfig.hasValidAddress());

        mDreamboxAddress.getDocument().addDocumentListener(new DocumentListener() {

          @Override
          public void removeUpdate(DocumentEvent e) {
            check(e);
          }

          @Override
          public void insertUpdate(DocumentEvent e) {
            check(e);
          }

          @Override
          public void changedUpdate(DocumentEvent e) {
            check(e);
          }

          private void check(DocumentEvent e) {
            mRefreshButton.setEnabled(!mDreamboxAddress.getText().trim().isEmpty());
          }
        });

        refresh.addButton(new JButton[]{mRefreshButton});

        basicPanel.addRow();
        basicPanel.add(refresh.getPanel(), cc.xy(4, basicPanel.getRow()));

        basicPanel.addRow();
        basicPanel.add(new JLabel(mLocalizer.msg("preTime", "Time before in minutes:")), cc.xy(2,basicPanel.getRow()));

        mBeforeModel = new SpinnerNumberModel(mConfig.getPreTime(), 0, 60, 1);
        JSpinner beforeSpinner = new JSpinner(mBeforeModel);
        basicPanel.add(beforeSpinner, cc.xy(4, basicPanel.getRow()));

        basicPanel.addRow();
        basicPanel.add(new JLabel(mLocalizer.msg("afterTime", "Time after in minutes:")), cc.xy(2, basicPanel.getRow()));

        mAfterModel = new SpinnerNumberModel(mConfig.getAfterTime(), 0, 60, 1);
        JSpinner afterSpinner = new JSpinner(mAfterModel);
        basicPanel.add(afterSpinner, cc.xy(4, basicPanel.getRow()));

        basicPanel.addParagraph(mLocalizer.msg("channel", "Channel assignment"));

        mTable = new JTable(new ConfigTableModel(mConfig, mLocalizer.msg("dreambox", "Dreambox channel")));
        mTable.getTableHeader().setReorderingAllowed(false);
        mTable.getColumnModel().getColumn(0).setCellRenderer(new util.ui.ChannelTableCellRenderer());
        mTable.getColumnModel().getColumn(1).setCellRenderer(new ExternalChannelTableCellRenderer());
        mTable.getColumnModel().getColumn(1).setCellEditor(new ExternalChannelTableCellEditor(mConfig));

        basicPanel.addGrowingRow();
        basicPanel.add(new JScrollPane(mTable), cc.xyw(2, basicPanel.getRow(), basicPanel.getColumnCount() - 1));

        ButtonBarBuilder2 builder = new ButtonBarBuilder2();

        builder.addGlue();

        JButton attach = new JButton(mLocalizer.msg("attach", "Attach"));
        attach.setToolTipText(mLocalizer.msg("attachHelp", "Attach channels"));
        attach.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                attachChannels();
            }
        });

        builder.addButton(attach);

        basicPanel.addRow();
        basicPanel.add(builder.getPanel(), cc.xyw(2,basicPanel.getRow(), basicPanel.getColumnCount() - 1));

        final EnhancedPanelBuilder extendedPanel = new EnhancedPanelBuilder("2dlu, pref, 3dlu, fill:pref:grow, 3dlu, pref, 5dlu");
        extendedPanel.setBorder(Borders.DLU4_BORDER);

        extendedPanel.addParagraph(mLocalizer.msg("misc", "Miscellaneous"));

        extendedPanel.addRow();
        extendedPanel.add(new JLabel(mLocalizer.msg("Timeout", "Timeout for connections in ms:")), cc.xy(2, extendedPanel.getRow()));

        mTimeoutModel = new SpinnerNumberModel(mConfig.getTimeout(), 0, 100000, 10);
        JSpinner timeoutSpinner = new JSpinner(mTimeoutModel);
        extendedPanel.add(timeoutSpinner, cc.xyw(4, extendedPanel.getRow(), 3));

        extendedPanel.addParagraph(mLocalizer.msg("timeZoneSeparator","Time zone"));

        extendedPanel.addRow();
        extendedPanel.add(new JLabel(mLocalizer.msg("timeZone", "Time zone:")), cc.xy(2, extendedPanel.getRow()));

        String[] zoneIds = new String[0];
        try {
          zoneIds = TimeZone.getAvailableIDs();
        } catch (Exception e) {
          e.printStackTrace();
        }
        Arrays.sort(zoneIds);
        mTimezone = new JComboBox(zoneIds);

        String zone = mConfig.getTimeZoneAsString();
        for (int i = 0; i < zoneIds.length; i++) {
          if (zoneIds[i].equals(zone)) {
            mTimezone.setSelectedIndex(i);
            break;
          }
        }

        extendedPanel.add(mTimezone, cc.xyw(4, extendedPanel.getRow(), 3));

        extendedPanel.addParagraph(mLocalizer.msg("security", "Security"));

        extendedPanel.addRow();
        extendedPanel.add(new JLabel(mLocalizer.msg("userName", "User name :")), cc.xy(2, extendedPanel.getRow()));
        mUserName = new JTextField(mConfig.getUserName());
        extendedPanel.add(mUserName, cc.xyw(4, extendedPanel.getRow(),3));

        extendedPanel.addRow();
        extendedPanel.add(new JLabel(mLocalizer.msg("password", "Password :")), cc.xy(2, extendedPanel.getRow()));
        mPasswordField = new JPasswordField(mConfig.getPassword());
        extendedPanel.add(mPasswordField, cc.xyw(4, extendedPanel.getRow(), 3));

        extendedPanel.addParagraph(mLocalizer.msg("streaming", "Streaming"));

        extendedPanel.addRow();
        extendedPanel.add(new JLabel(mLocalizer.msg("mediaplayer", "Mediaplayer :")), cc.xy(2, extendedPanel.getRow()));
        mMediaplayer = new JTextField(mConfig.getMediaplayer());
        extendedPanel.add(mMediaplayer, cc.xy(4, extendedPanel.getRow()));

        JButton select = new JButton(Localizer.getLocalization(Localizer.I18N_SELECT));
        select.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                JFileChooser mediaplayerChooser = new JFileChooser();
                int returnVal = mediaplayerChooser.showOpenDialog(extendedPanel.getPanel());
                if(returnVal == JFileChooser.APPROVE_OPTION) {
                    mMediaplayer.setText(mediaplayerChooser.getSelectedFile().getAbsolutePath());
               }
            }
        });
        extendedPanel.add(select, cc.xy(6, extendedPanel.getRow()));

        mProgramReceiveTargetSelection = new ProgramReceiveTargetSelectionPanel(UiUtilities.getLastModalChildOf(CapturePlugin.getInstance().getSuperFrame()),
            mConfig.getProgramReceiveTargets(),null,CapturePlugin.getInstance(),true,mLocalizer.msg("sendToTitle","Send scheduled programs to:"));

        extendedPanel.addRow();
        extendedPanel.addRow();
        extendedPanel.add(mProgramReceiveTargetSelection, cc.xyw(1,extendedPanel.getRow(),7));

        builder = new ButtonBarBuilder2();

        JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK));
        ok.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                okPressed();
            }
        });

        JButton cancel = new JButton(Localizer.getLocalization(Localizer.I18N_CANCEL));
        cancel.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                close();
            }
        });

        builder.addGlue();
        builder.addButton(new JButton[]{ok, cancel});

        getRootPane().setDefaultButton(ok);

        JTabbedPane tabs = new JTabbedPane();
        tabs.add(mLocalizer.msg("basicTitle", "Basic settings"), basicPanel.getPanel());
        tabs.add(mLocalizer.msg("extendedTitle", "Extended settings"), extendedPanel.getPanel());

        JPanel content = (JPanel) getContentPane();
        content.setBorder(Borders.DLU4_BORDER);
        content.setLayout(new FormLayout("fill:pref:grow", "fill:pref:grow, 3dlu, pref"));
        content.add(tabs, cc.xy(1,1));
View Full Code Here

   * Creates the SettingsPanel
   *
   * @return Settings-Panel
   */
  public JPanel createSettingsPanel() {
    EnhancedPanelBuilder pb = new EnhancedPanelBuilder(FormFactory.RELATED_GAP_COLSPEC.encode() + ",fill:default:grow");
    CellConstraints cc = new CellConstraints();
   
    mConfigPanel = new PluginProgramConfigurationPanel(mPlugin.getSelectedPluginProgramFormatings(), mPlugin.getAvailableLocalPluginProgramFormatings(), ClipboardPlugin.getDefaultFormating(),false,false);
   
    pb.addRow();
    pb.add(mConfigPanel, cc.xyw(1,pb.getRow(),pb.getColumnCount()));

    return pb.getPanel();
  }
View Full Code Here

     
      JPanel content = (JPanel)getContentPane();
      content.setBorder(Borders.DIALOG_BORDER);
      content.setLayout(new BorderLayout());

      EnhancedPanelBuilder panel = new EnhancedPanelBuilder("2dlu,default,5dlu,default:grow");
     
      CellConstraints cc = new CellConstraints();

      if (titleEditable) {
        panel.addParagraph(mLocalizer.msg("Title", "Title"));
        mTitle = new JTextField(mPrgTime.getTitle());

        panel.addRow();
        panel.add(mTitle, cc.xyw(2, panel.getRow(), panel.getColumnCount() - 1));
      }

      panel.addParagraph(mLocalizer.msg("Times","Times"));
      panel.addRow();
      panel.add(new JLabel(mLocalizer.msg("StartTime","Start time")), cc.xy(2, panel.getRow()));
      mStart = new TimeDateSpinner(mPrgTime.getStart());
      panel.add(mStart, cc.xy(4, panel.getRow()));
     
      panel.addRow();
      panel.add(new JLabel(mLocalizer.msg("EndTime","End time")), cc.xy(2, panel.getRow()));
      mEnd =  new TimeDateSpinner(mPrgTime.getEnd());
      panel.add(mEnd, cc.xy(4, panel.getRow()));
     
      if (mPrgTime.getProgram().getLength() <= 0) {
        mEnd.setSpinnerBackground(new Color(255, 153, 153));
      }
     
      if (additionalText != null) {
          panel.addParagraph(additionalText);
          panel.addRow();
          panel.add(additionalComponent, cc.xyw(2, panel.getRow(), panel.getColumnCount() - 1));
      }
     
      final ProgramRangeSelectionPanel programSelection = ProgramRangeSelectionPanel.createPanel(mPrgTime.getProgram(),(short)6);
     
      panel.addParagraph(mLocalizer.msg("programSelection","Program selection"));
      panel.addRow();
      panel.add(programSelection, cc.xyw(2, panel.getRow(), panel.getColumnCount() - 1));

      programSelection.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
          if(!e.getValueIsAdjusting()) {
            /* prevent concurrent changing of end date */
            if(!mEndDateChanging) {
              mProgramSelectionChanging = true;
             
              Program[] progs = ((ProgramList)e.getSource()).getSelectedPrograms();
             
              if(progs != null) {
                Program prog = progs[progs.length-1];
               
                Calendar c = Calendar.getInstance();
               
                c.setTimeInMillis(prog.getDate().getCalendar().getTimeInMillis());
                c.set(Calendar.HOUR_OF_DAY, prog.getHours());
                c.set(Calendar.MINUTE, prog.getMinutes());
 
                if (prog.getLength() <= 0) {
                  c.add(Calendar.MINUTE, 1);
                } else {
                  c.add(Calendar.MINUTE, prog.getLength());
                }
                c.set(Calendar.SECOND, 0);
               
                c.add(Calendar.MINUTE, postTime);
               
                mEnd.setValue(c.getTime());
                mProgramSelectionChanging = false;
              }
            }
          }
        }
      });
     
      mEnd.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
          try {
            /* prevent concurrent changing of end date */
            if(!mProgramSelectionChanging) {
              mEndDateChanging = true;
              programSelection.setEndDate(mEnd.getDate());
              mEndDateChanging = false;
            }
          }catch(Throwable t) {t.printStackTrace();}
        }
      });
     
      content.add(panel.getPanel(), BorderLayout.CENTER);
     
      ButtonBarBuilder2 btPanel = new ButtonBarBuilder2();
      btPanel.setBorder(Borders.DLU4_BORDER);
     
      JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK));
View Full Code Here

  private JSpinner mConnectionTimeout, mNetworkCheckTimeout;
 
  private JCheckBox mConnectionTest;
 
  public JPanel createSettingsPanel() {
    EnhancedPanelBuilder pb = new EnhancedPanelBuilder("5dlu, pref, 3dlu, 0dlu:grow");
    pb.setDefaultDialogBorder();
   
    CellConstraints cc = new CellConstraints();
   
    pb.addParagraph(mLocalizer.msg("connectionTestTitle","Internet connection test"));
   
    pb.addRow();
    pb.add(mConnectionTest = new JCheckBox(mLocalizer.msg("connectionTestText","Internet connection test activated"), Settings.propInternetConnectionCheck.getBoolean()), cc.xyw(2, pb.getRowCount(), 3));

    pb.addRow();
    pb.add(mNetworkCheckTimeout = new JSpinner(new SpinnerNumberModel(Settings.propNetworkCheckTimeout.getInt()/1000,10,90,5)), cc.xy(2, pb.getRowCount()));
    final JLabel label = pb.addLabel(mLocalizer.msg("waitTime","Seconds maximum waiting time for connection test"), cc.xy(4, pb.getRowCount()));
   
    pb.addRow();
    pb.add(new JLabel(mLocalizer.msg("sites", "Websites used for checking")), cc.xyw(2, pb.getRowCount(), 3));
   
    pb.addRow();
    final JList urlList = new JList(NetworkUtilities.getConnectionCheckUrls());
    urlList.setEnabled(false);
    pb.add(new JScrollPane(urlList), cc.xyw(2, pb.getRowCount(), 3));
   
    mConnectionTest.addItemListener(new ItemListener() {
      public void itemStateChanged(ItemEvent e) {
        boolean enabled = e.getStateChange() == ItemEvent.SELECTED;
        mNetworkCheckTimeout.setEnabled(enabled);
        label.setEnabled(enabled);
      }
    });
   
    mNetworkCheckTimeout.setEnabled(mConnectionTest.isSelected());
    label.setEnabled(mConnectionTest.isSelected());
   
    pb.addParagraph(mLocalizer.msg("cancelTime","Timeout for not responding connections"));
   
    pb.addRow();
    pb.add(mConnectionTimeout = new JSpinner(new SpinnerNumberModel(Settings.propDefaultNetworkConnectionTimeout.getInt()/1000,5,60,5)), cc.xy(2, pb.getRowCount()));
    pb.addLabel(mLocalizer.msg("seconds","Seconds"), cc.xy(4, pb.getRowCount()));
   
    return pb.getPanel();
  }
View Full Code Here

TOP

Related Classes of util.ui.EnhancedPanelBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.