Package com.jgoodies.forms.builder

Examples of com.jgoodies.forms.builder.PanelBuilder


    setTitle(mLocalizer.msg("title","TV-Browser is able to do much more"));
   
    UiUtilities.registerForClosing(this);
   
    CellConstraints cc = new CellConstraints();
    PanelBuilder pb = new PanelBuilder(
        new FormLayout("default:grow,default,default:grow",
            "default,fill:default:grow,default"),
        (JPanel)getContentPane());
   
    JLabel l = pb.addLabel(mLocalizer.msg("header","Important informations about TV-Browser functionality!"), cc.xy(2,1));
    l.setForeground(new Color(200,0,0));
    l.setFont(l.getFont().deriveFont(Font.BOLD,20));
    l.setBorder(Borders.createEmptyBorder("10dlu,0dlu,5dlu,0dlu"));
   
    JEditorPane pane = UiUtilities.createHtmlHelpTextArea(mLocalizer.msg("text","<div style=\"font-size:medium;text-align:justify\"><p>TV-Browser can be extended with additional functions (Plugins), for instance to control hardware, other data sources, to load ratings from ImdB and much more.</p><p>You also can find more Plugins <a href=\"http://www.tvbrowser.org/downloads-mainmenu-5/plugins-mainmenu-24.html\">on our website</a>, that are currently not available to download from TV-Browser, but are mostly already usable.</p><p>Do you want to see the list with the Plugins available through download from TV-Browser?<br>(You also can always open that list over the Plugins menu.)</p></div>"),
        new HyperlinkListener() {
          public void hyperlinkUpdate(HyperlinkEvent e) {
            if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
              Launch.openURL(e.getURL().toString());
            }
          }
        },Color.white);
   
    pane.setPreferredSize(new Dimension(400,300));
   
    pane.setBackground(Color.white);
    pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0,0,1,0,Color.darkGray),Borders.createEmptyBorder("0dlu,10dlu,0dlu,10dlu")));
   
    pb.add(pane, cc.xyw(1,2,3));
   
    JButton[] buttons = {new JButton(mLocalizer.msg("showList","Show the list with the Plugins now")),
        new JButton(mLocalizer.msg("closeDialog","Close this dialog"))};
   
    buttons[0].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        MainFrame.getInstance().showUpdatePluginsDlg(true);
        close();
      }
    });
   
    buttons[1].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        close();
      }
    });
   
    buttons[0].setFont(buttons[0].getFont().deriveFont(Font.BOLD,13));
    buttons[1].setFont(buttons[1].getFont().deriveFont(Font.BOLD,13));
   
    getRootPane().setDefaultButton(buttons[0]);
   
    ButtonBarBuilder2 bb = new ButtonBarBuilder2();
    bb.addGlue();
    bb.addButton(buttons);
    bb.addGlue();
    bb.setBorder(Borders.createEmptyBorder("6dlu,6dlu,6dlu,6dlu"));
   
    pb.add(bb.getPanel(), cc.xyw(1,3,3));
    pb.getPanel().setBackground(Color.white);
  }
View Full Code Here


  public JPanel createContent(final WizardHandler handler) {

    LinkButton expertBtn = new LinkButton(mLocalizer.msg("advancedView", "Switch to expert view"), null);

    CellConstraints cc = new CellConstraints();
    PanelBuilder panelBuilder = new PanelBuilder(new FormLayout("5dlu, pref, default:grow",
        "pref, 5dlu, pref, 5dlu, pref, 5dlu, pref, 5dlu, pref"));

    panelBuilder.add(new JLabel(mMainQuestion), cc.xyw(1, 1, 3));
    panelBuilder
        .add(mTitleRb = new JRadioButton(mLocalizer.msg("option.title", "I like this program:")), cc.xy(2, 3));
    panelBuilder.add(mProgramNameTf = new JTextField(), cc.xy(3, 3));
    panelBuilder.add(mTopicRb = new JRadioButton(mLocalizer.msg("option.topic", "I like this subject:")), cc.xy(2, 5));
    panelBuilder.add(mTopicTf = new JTextField(), cc.xy(3, 5));

    panelBuilder.add(mActorsRb = new JRadioButton(mLocalizer.msg("option.actors","I like these actors:")), cc.xy(2,7));
    mActorsCb = new JComboBox();
    mActorsCb.setEditable(true);
    panelBuilder.add(mActorsCb, cc.xy(3,7));
    panelBuilder.setBorder(Borders.DLU4_BORDER);
    panelBuilder.add(expertBtn, cc.xyw(1, 9, 3));
    ButtonGroup group = new ButtonGroup();
    group.add(mTitleRb);
    group.add(mTopicRb);
    group.add(mActorsRb);

    mTitleRb.setSelected(true);

    updateTextfields();

    mTitleRb.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        updateTextfields();
      }
    });

    mTopicRb.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        updateTextfields();
      }
    });

    mActorsRb.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        updateTextfields();
      }
    });

    expertBtn.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        handler.closeCurrentStep();
        String title;
        if (mProgram != null) {
          title = mProgram.getTitle();
        } else {
          title = "";
        }
        AdvancedFavorite favorite = new AdvancedFavorite(title);
        Window parent = UiUtilities
            .getLastModalChildOf(MainFrame.getInstance());
        EditFavoriteDialog dlg = new EditFavoriteDialog(parent, favorite);
        UiUtilities.centerAndShow(dlg);
        if (dlg.getOkWasPressed()) {
          FavoriteTreeModel.getInstance().addFavorite(favorite, mParentNode);
          FavoritesPlugin.getInstance().updateRootNode(true);

          if(ManageFavoritesDialog.getInstance() != null) {
            ManageFavoritesDialog.getInstance().addFavorite(favorite, false);
          }
        }
      }
    });

    if (mProgram != null) {
      mProgramNameTf.setText(mProgram.getTitle());
      String[] actors = ProgramUtilities.getActorNames(mProgram);
      if (actors != null) {
        for (String actor : actors) {
          mActorsCb.addItem(actor);
        }
      }
    }

    mContent = panelBuilder.getPanel();

    mContent.addComponentListener(new ComponentAdapter() {
      public void componentResized(ComponentEvent e) {
        handleFocusEvent();
      }
View Full Code Here

    setTitle(mLocalizer.msg("title","TV-Browser was updated from {0} to {1}",oldTvBrowserVersion,TVBrowser.VERSION));
   
    UiUtilities.registerForClosing(this);
   
    CellConstraints cc = new CellConstraints();
    PanelBuilder pb = new PanelBuilder(
        new FormLayout("default:grow,default,default:grow",
            "default,fill:default:grow,default"),
        (JPanel)getContentPane());
   
    JLabel l = pb.addLabel(mLocalizer.msg("header","TV-Browser was updated from {0} to {1}!",oldTvBrowserVersion,TVBrowser.VERSION), cc.xy(2,1));
    l.setForeground(new Color(200,0,0));
    l.setFont(l.getFont().deriveFont(Font.BOLD,22));
    l.setBorder(Borders.createEmptyBorder("10dlu,0dlu,5dlu,0dlu"));
   
    JEditorPane pane = UiUtilities.createHtmlHelpTextArea(mLocalizer.msg("text","<div style=\"font-size:large;text-align:justify\"><p>TV-Browser is developed on a regular basis. Every version contains changes to improve TV-Browser, but sometimes it is necessary to change some functions that could lead to discontinued support for old Plugin versions.</p><br><div style=\"font-weight:bold;color:red\">We recommend to update all installed plugins now.</div><p>You will need an Internet connection.</b> If you currently don't have an internet connection we recommend to close TV-Browser now and using the previous version until a Plugin update is possible.</p><p>Do you want to update your Plugins now (this may take some time)?</p></div>"),
        new HyperlinkListener() {
          public void hyperlinkUpdate(HyperlinkEvent e) {
            if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
              Launch.openURL(e.getURL().toString());
            }
          }
        },Color.white);
   
    pane.setPreferredSize(new Dimension(400,300));
   
    pane.setBackground(Color.white);
    pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0,0,1,0,Color.darkGray),Borders.createEmptyBorder("0dlu,10dlu,0dlu,10dlu")));
   
    pb.add(pane, cc.xyw(1,2,3));
   
    JButton[] buttons = {new JButton(mLocalizer.msg("updatePlugins","Update Plugins now")),
        new JButton(mLocalizer.msg("closeTvBrowser","Close TV-Browser now")),
        new JButton(mLocalizer.msg("closeDialog","Close this dialog and don't update"))};
   
    buttons[0].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        try {
          SoftwareUpdateItem[] updateItems = PluginAutoUpdater.getUpdateItemsForVersionChange();
         
          if(updateItems.length > 0) {
            Settings.propPluginBetaWarning.setBoolean(false);
            SoftwareUpdateDlg updateDlg = new SoftwareUpdateDlg(null,true,updateItems,true);
            updateDlg.setLocationRelativeTo(null);
            updateDlg.setVisible(true);
          }
         
          mCloseTvBrowser = false;
        } catch (IOException e1) {
        }
       
        close();
      }
    });
   
    buttons[1].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        close();
      }
    });
   
    buttons[2].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        mCloseTvBrowser = false;
        close();
      }
    });
   
    buttons[0].setFont(buttons[0].getFont().deriveFont(Font.BOLD,13));
    buttons[1].setFont(buttons[1].getFont().deriveFont(Font.BOLD,13));
    buttons[2].setFont(buttons[2].getFont().deriveFont(Font.BOLD,13));
   
    getRootPane().setDefaultButton(buttons[0]);
   
    ButtonBarBuilder2 bb = new ButtonBarBuilder2();
    bb.addGlue();
    bb.addButton(buttons);
    bb.addGlue();
    bb.setBorder(Borders.createEmptyBorder("6dlu,6dlu,6dlu,6dlu"));
   
    pb.add(bb.getPanel(), cc.xyw(1,3,3));
    pb.getPanel().setBackground(Color.white);
  }
View Full Code Here

    final JPanel jcontentPane = new JPanel(new BorderLayout(0, 10));
    jcontentPane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
    mDialog.setContentPane(jcontentPane);

    mLayout = new FormLayout("pref:grow,3dlu,pref","pref,3dlu");
    final PanelBuilder programsPanel = new PanelBuilder(mLayout);
    CellConstraints cc = new CellConstraints();

    final Date today = Date.getCurrentDate();
    programsPanel.add(mHeader = new JLabel(""), cc.xyw(1, 1, 3));
    programsPanel.setRow(3);
    int remainingMinutesMax = 0;

    ArrayList<ProgramPanel> panels = new ArrayList<ProgramPanel>(reminders.size());

    for (ReminderListItem reminder : reminders) {
      Program program = reminder.getProgram();
      mGlobalReminderList.blockProgram(program);
      // text label
      String msg;
      final int progMinutesAfterMidnight = program.getStartTime();
      int remainingMinutes = 0;
      if (today.compareTo(program.getDate()) >= 0
          && IOUtilities.getMinutesAfterMidnight() > progMinutesAfterMidnight) {
        msg = updateRunningTime();
      } else {
        msg = mLocalizer.msg("soonStarts", "Soon starts");
        remainingMinutes = ReminderPlugin.getTimeToProgramStart(program);
      }
      mHeader.setText(msg);
      remainingMinutesMax = Math.max(remainingMinutesMax, remainingMinutes);

      List<JComponent> componentList = new ArrayList<JComponent>();
      mComponents.put(reminder, componentList);

      final ProgramPanel panel = new ProgramPanel(program,
          new ProgramPanelSettings(new PluginPictureSettings(
              PluginPictureSettings.ALL_PLUGINS_SETTINGS_TYPE), false,
              ProgramPanelSettings.X_AXIS));
      componentList.add(panel);
      panels.add(panel);
      panel.setMinimumSize(new Dimension(300,50));
      panel.setWidth(300);
      // register panel with tooltip manager
      panel.setToolTipText("");
      panel.addPluginContextMenuMouseListener(ReminderPluginProxy
          .getInstance());

      final JPanel channelPanel = new JPanel(new BorderLayout());
      componentList.add(channelPanel);
      if (program.getLength() > 0) {
        final JLabel endTime = new JLabel(mLocalizer.msg("endTime",
            "until {0}", program.getEndTimeString()));
        channelPanel.add(endTime, BorderLayout.PAGE_START);
      }
      String channelName = program.getChannel().getName();
      JLabel channelLabel = new JLabel();
      channelLabel.setToolTipText(channelName);
      channelLabel.setIcon(UiUtilities.createChannelIcon(program.getChannel()
          .getIcon()));
      channelLabel.setHorizontalTextPosition(SwingConstants.RIGHT);
      channelPanel.add(channelLabel, BorderLayout.CENTER);
      channelLabel = new JLabel(channelName);
      channelPanel.add(channelLabel, BorderLayout.PAGE_END);

      int layoutStartRow = programsPanel.getRowCount();
      mLayout.appendRow(RowSpec.decode("pref"));
      programsPanel.add(panel, cc.xy(1, programsPanel.getRow(), CellConstraints.FILL, CellConstraints.FILL));
      programsPanel.add(channelPanel, cc.xy(3, programsPanel.getRow(), CellConstraints.LEFT, CellConstraints.TOP));
      programsPanel.nextRow();

      String comment = reminder.getComment();
      if (comment != null && comment.length() > 0) {
        mLayout.appendRow(RowSpec.decode("2dlu"));
        mLayout.appendRow(RowSpec.decode("pref"));
        mLayout.appendRow(RowSpec.decode("2dlu"));
        JLabel commentLabel = new JLabel(comment);
        componentList.add(commentLabel);
        programsPanel.add(commentLabel, cc.xyw(1, programsPanel.getRow() + 1, 3));
        programsPanel.nextRow(3);
      }
      int layoutEndRow = programsPanel.getRowCount();
      mPanelRange.put(reminder, new Integer[] {layoutStartRow, layoutEndRow});
    }

    // initialize close button with full text, so it can show the countdown later without size problems
    mRemainingSecs = autoCloseSecs;
    mAutoCloseAtMillis = System.currentTimeMillis() + 1000 * autoCloseSecs;
    final JPanel btnPanel = new JPanel(new BorderLayout(10, 0));
    mCloseBtText = Localizer.getLocalization(Localizer.I18N_CLOSE);
    int seconds = mRemainingSecs;
    if (ReminderPlugin.getInstance().getSettings().getProperty("showTimeCounter","false").compareTo("true") == 0) {
      seconds = 10;
    }
    mCloseBt = new JButton(getCloseButtonText(seconds));
    mDialog.getRootPane().setDefaultButton(mCloseBt);

    for (ReminderListItem reminder : reminders) {
      if (reminder.getMinutes() < remainingMinutesMax) {
        remainingMinutesMax = reminder.getMinutes();
      }
    }

    mReminderCB = new JComboBox();
    int i=0;
    while (i < REMIND_VALUE_ARR.length
        && REMIND_VALUE_ARR[i] < remainingMinutesMax) {
      mReminderCB.addItem(REMIND_MSG_ARR[i]);
      i++;
    }
    // don't show reminder selection if it contains only the
    // entry "don't remind me"
    mReminderCB.setVisible(mReminderCB.getItemCount() > 1);

    btnPanel.add(mReminderCB, BorderLayout.WEST);
    btnPanel.add(mCloseBt, BorderLayout.EAST);

    final JScrollPane scrollPane = new JScrollPane(programsPanel.getPanel());
    scrollPane.setBorder(BorderFactory.createEmptyBorder());
    jcontentPane.add(scrollPane, BorderLayout.CENTER);
    jcontentPane.add(btnPanel,BorderLayout.SOUTH);

    mCloseBt.addActionListener(new ActionListener() {
View Full Code Here

    picturePanel.setDefaultDialogBorder();

    picturePanel.addRow("default");
    picturePanel.add(mPictureSettings = new PluginsPictureSettingsPanel(ProgramInfo.getInstance().getPictureSettings(),false), cc.xy(1, picturePanel.getRowCount()));

    PanelBuilder pb = new PanelBuilder(new FormLayout("default,2dlu,default,5dlu,default","default"));

    pb.add(mZoomEnabled = new JCheckBox(ProgramInfo.mLocalizer.msg(
        "scaleImage", "Scale picture:"), ProgramInfo.getInstance()
        .getSettings().getZoomEnabled()), cc.xy(1, 1));
    pb.add(mZoomValue = new JSpinner(new SpinnerNumberModel(ProgramInfo
        .getInstance().getSettings().getZoomValue(), 50, 300, 1)), cc.xy(3, 1));
    final JLabel label = pb.addLabel("%",cc.xy(5,1));

    mZoomEnabled.addItemListener(new ItemListener() {
      public void itemStateChanged(ItemEvent e) {
        mZoomValue.setEnabled(mZoomEnabled.isSelected());
        label.setEnabled(mZoomEnabled.isSelected());
      }
    });

    mZoomValue.setEnabled(mZoomEnabled.isSelected());
    label.setEnabled(mZoomEnabled.isSelected());

    picturePanel.addRow("5dlu");
    picturePanel.addRow("default");
    picturePanel.add(pb.getPanel(), cc.xy(1, picturePanel.getRowCount()));



    PluginAccess webPlugin = PluginManagerImpl.getInstance().getActivatedPluginForId("java.webplugin.WebPlugin");

    mAvailableTargetGroup = new ButtonGroup();

    final ArrayList<InternalRadioButton<?>> availableDefaultTargets = new ArrayList<InternalRadioButton<?>>();

    availableDefaultTargets.add(new InternalRadioButton<String>(ProgramInfoDialog.mLocalizer.msg("searchTvBrowser","Search in TV-Browser")));
    mAvailableTargetGroup.add(availableDefaultTargets.get(0));
    availableDefaultTargets.add(new InternalRadioButton<String>(ProgramInfoDialog.mLocalizer.msg("searchWikipedia","Search in Wikipedia")));
    mAvailableTargetGroup.add(availableDefaultTargets.get(1));

    final String currentValue = settings.getActorSearch();

    int selectedIndex = -1;

    if(webPlugin != null && webPlugin.canReceiveProgramsWithTarget()) {
      ProgramReceiveTarget[] targets = webPlugin.getProgramReceiveTargets();

      if(targets != null) {
        for(ProgramReceiveTarget target : targets) {
          availableDefaultTargets.add(new InternalRadioButton<ProgramReceiveTarget>(target));
          mAvailableTargetGroup.add(availableDefaultTargets.get(availableDefaultTargets.size()-1));

          if(currentValue.equals(target.getReceiveIfId() + "#_#_#" + target.getTargetId())) {
            selectedIndex = availableDefaultTargets.size()-1;
          }
        }
      }
    }

    if(selectedIndex == -1) {
      if(currentValue.equals("internalSearch")) {
        selectedIndex = 0;
      }
      else {
        selectedIndex = 1;
      }
    }

    availableDefaultTargets.get(selectedIndex).setSelected(true);

    ScrollableJPanel buttonPanel = new ScrollableJPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel,BoxLayout.Y_AXIS));
    buttonPanel.setOpaque(false);

    for(InternalRadioButton<?> button : availableDefaultTargets) {
      buttonPanel.add(button);
    }

    final JScrollPane scrollPane = new JScrollPane(buttonPanel);
    scrollPane.setBackground(UIManager.getDefaults().getColor("List.background"));
    scrollPane.getViewport().setBackground(UIManager.getDefaults().getColor("List.background"));
    PanelBuilder actorPanel = new PanelBuilder(
        new FormLayout(
        "default:grow", "pref,3dlu,default,1dlu,fill:default:grow"));
    actorPanel.setDefaultDialogBorder();

    mPersonSearchCB = new JCheckBox(ProgramInfo.mLocalizer.msg("enableSearch",
        "Show person names as links to person search"));
    actorPanel.add(mPersonSearchCB, cc.xy(1, 1));
    final JLabel searchLabel = new JLabel(ProgramInfo.mLocalizer.msg(
        "defaultActorSearchMethod", "Default search method:"));
    actorPanel.add(searchLabel, cc.xy(1, 3));
    actorPanel.add(scrollPane, cc.xy(1, 5));

    mPersonSearchCB.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent e) {
        scrollPane.setEnabled(mPersonSearchCB.isSelected());
        searchLabel.setEnabled(mPersonSearchCB.isSelected());
        for (InternalRadioButton<?> button : availableDefaultTargets) {
          button.setEnabled(mPersonSearchCB.isSelected());
        }
      }
    });
    mPersonSearchCB.setSelected(settings.getEnableSearch());
    mPersonSearchCB.getActionListeners()[0].actionPerformed(null);

    final JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.add(ProgramInfo.mLocalizer.msg("look","Look"), formatPanel.getPanel());
    tabbedPane.add(ProgramInfo.mLocalizer.msg("fields","Fields"), orderPanel.getPanel());
    tabbedPane.add(Localizer.getLocalization(Localizer.I18N_PICTURES), picturePanel.getPanel());
    tabbedPane.add(ProgramInfo.mLocalizer.msg("actorSearch","Actor search"), actorPanel.getPanel());
    tabbedPane.setSelectedIndex(0);

    FormLayout layout = new FormLayout("default,default:grow,default","pref");
    layout.setColumnGroups(new int[][] {{1,3}});
    JPanel buttonPn = new JPanel(layout);
View Full Code Here

    return mLocalizer.msg("title","Notification");
  }

  public JPanel createContent(WizardHandler handler) {
    CellConstraints cc = new CellConstraints();
    PanelBuilder panelBuilder = new PanelBuilder(new FormLayout("pref",
                    "pref, 5dlu, pref, 5dlu, pref, 5dlu, pref"));

    panelBuilder.setBorder(Borders.DLU4_BORDER);
    panelBuilder.add(new JLabel(mLocalizer.msg("mainQuestion","Wollen Sie automatisch auf diese Sendung hingewiesen werden?")), cc.xy(1,1));
    panelBuilder.add(mReminderCb = new JCheckBox(mLocalizer.msg("option.remind","Automatisch an diese Sendung erinnern.")), cc.xy(1,3));
    panelBuilder.add(mCheckOnUpdateCb = new JCheckBox(mLocalizer.msg("option.checkAfterUpdate","Sofort alarmieren, wenn die Sendung nach einer Aktualisierung gefunden wird.")), cc.xy(1,5));

    mReminderCb.setSelected(FavoritesPlugin.getInstance().isAutoSelectingReminder());
    JPanel result = panelBuilder.getPanel();
    result.addFocusListener(new FocusAdapter() {

      public void focusGained(FocusEvent e) {
        mReminderCb.requestFocusInWindow();
      }
View Full Code Here

      upBnd = 24 * 60 - 1;
    }
    mTimePeriodChooser = new TimePeriodChooser(lowBnd, upBnd, TimePeriodChooser.ALIGN_RIGHT);

    CellConstraints cc = new CellConstraints();
    PanelBuilder panelBuilder = new PanelBuilder(new FormLayout("pref, default:grow, pref", "pref, 5dlu, pref, 5dlu, pref, 5dlu, pref, 5dlu, pref"));

    panelBuilder.setBorder(Borders.DLU4_BORDER);
    panelBuilder.add(new JLabel(mLocalizer.msg("mainQuestion", "Are there any limitations?")), cc.xy(1, 1));
    panelBuilder.add(mChannelCb = new JCheckBox(mLocalizer.msg("limitByChannel",
        "Certain channels only:")), cc.xy(1, 3));
    panelBuilder.add(mDayOfWeekCb = new JCheckBox(mLocalizer.msg("limitByDayOfWeek","Certain day of week only:")), cc.xy(1,5));
    panelBuilder.add(mTimeCb = new JCheckBox(mLocalizer.msg("limitByTime",
        "Certain start times only:")), cc.xy(1, 7));

    panelBuilder.add(mChooseChannelsBtn = new JButton(mLocalizer.msg("selectChannels","Select channels")), cc.xy(3,3));
    panelBuilder.add(mDayOfWeekCombo, cc.xy(3,5));
    panelBuilder.add(mTimePeriodChooser, cc.xy(3,7));

    updateControls();

    mChannelCb.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e) {
        updateControls();
      }
    });

    mDayOfWeekCb.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e) {
        updateControls();
      }
    });

    mTimeCb.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e) {
        updateControls();
      }
    });

    mChooseChannelsBtn.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e) {
        Window parent = UiUtilities.getBestDialogParent(mContent);
        ChannelChooserDlg dlg = new ChannelChooserDlg(parent, mChannelArr,
            null,
            ChannelChooserDlg.SELECTABLE_ITEM_LIST);
        UiUtilities.centerAndShow(dlg);
        Channel[] chArr = dlg.getChannels();
        if (chArr != null) {
          mChannelArr = dlg.getChannels();
          if (mChannelArr.length == 0) {
            mChannelCb.setSelected(false);
            updateControls();
          }
        }
      }
    });

    mContent = panelBuilder.getPanel();
    mContent.addFocusListener(new FocusAdapter() {

        public void focusGained(FocusEvent e) {
          mChannelCb.requestFocusInWindow();
        }
View Full Code Here

    JPanel pn = new JPanel(new FormLayout("pref, 3dlu, pref", "pref"));
    pn.add(mTimePeriodChooser, cc.xy(1,1));
    pn.add(mLimitDaysCB, cc.xy(3,1));
    limitPn.add(pn, BorderLayout.EAST);

    PanelBuilder panelBuilder = new PanelBuilder(new FormLayout("pref, pref:grow, pref", "pref, 5dlu, pref"));

    panelBuilder.add(mLimitChannelCb, cc.xy(1, 1));
    panelBuilder.add(mChannelLabel, cc.xy(2, 1));
    panelBuilder.add(mChangeChannelsBtn, cc.xy(3, 1));
    panelBuilder.add(mLimitTimeCb, cc.xy(1, 3));
    panelBuilder.add(limitPn, cc.xyw(2, 3, 2));

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

  private JComboBox mDefaultColor;
  private JEditorPane mHelpLabel;
 
  public JPanel createSettingsPanel() {
    CellConstraints cc = new CellConstraints();
    PanelBuilder pb = new PanelBuilder(new FormLayout("5dlu,default:grow","pref,5dlu,pref,10dlu,pref,5dlu,pref,fill:10dlu:grow,default"));
    pb.setDefaultDialogBorder();
   
    JPanel defaultMarkings = new JPanel(new FormLayout("default, 5dlu, default",
    "default,2dlu,default,2dlu,default"));

    String[] colors = {mLocalizer.msg("color.noPriority","Don't highlight"),mLocalizer.msg("color.minPriority","1. Color (minimal priority)"),mLocalizer.msg("color.lowerMediumPriority","2. Color (lower medium priority)"),mLocalizer.msg("color.mediumPriority","3. Color (medium priority)"),mLocalizer.msg("color.higherMediumPriority","4. Color (higher medium priority)"),mLocalizer.msg("color.maxPriority","5. Color (maximum priority)")};

    defaultMarkings.add(mProgramPanelUsesExtraSpaceForMarkIcons = new JCheckBox(mLocalizer.msg("panel.extraSpace","Use additional space for the mark icons"), Settings.propProgramPanelUsesExtraSpaceForMarkIcons.getBoolean()), cc.xyw(1,1,3));
    defaultMarkings.add(mProgramItemWithMarkingsIsShowingBorder = new JCheckBox(mLocalizer.msg("color.showBorder","Show border for highlighted programs"), Settings.propProgramPanelWithMarkingsShowingBoder.getBoolean()), cc.xyw(1,3,3));
    defaultMarkings.add(new JLabel(mLocalizer.msg("color.showColor","Highlight with color (default color):")), cc.xy(1,5));
    defaultMarkings.add(mDefaultColor = new JComboBox(colors), cc.xy(3,5));
    mDefaultColor.setSelectedIndex(Settings.propProgramPanelUsedDefaultMarkPriority.getInt()+1);
   
    mDefaultColor.setRenderer(new MarkPriorityComboBoxRenderer());
   
    JPanel markings = new JPanel(new FormLayout("default, 5dlu, default, 5dlu, default",
        "default, 3dlu, default, 3dlu, default, 3dlu, default, 3dlu, default, 3dlu, default"));
       
    Color programItemMinMarkedColor = Settings.propProgramPanelMarkedMinPriorityColor.getColor();
    Color programItemMinDefaultMarkedColor = Settings.propProgramPanelMarkedMinPriorityColor.getDefaultColor();
   
    markings.add(new JLabel(colors[1]), cc.xy(1,1));
    markings.add(mProgramItemMinMarkedColorLb = new ColorLabel(programItemMinMarkedColor), cc.xy(3,1));
    mProgramItemMinMarkedColorLb.setStandardColor(programItemMinDefaultMarkedColor);
    markings.add(new ColorButton(mProgramItemMinMarkedColorLb), cc.xy(5,1));
   
    Color programItemLowerMediumMarkedColor = Settings.propProgramPanelMarkedLowerMediumPriorityColor.getColor();
    Color programItemDefaultLowerMediumMarkedColor = Settings.propProgramPanelMarkedLowerMediumPriorityColor.getDefaultColor();

    markings.add(new JLabel(colors[2]), cc.xy(1,3));
    markings.add(mProgramItemLowerMediumMarkedColorLb = new ColorLabel(programItemLowerMediumMarkedColor), cc.xy(3,3));
    mProgramItemLowerMediumMarkedColorLb.setStandardColor(programItemDefaultLowerMediumMarkedColor);
    markings.add(new ColorButton(mProgramItemLowerMediumMarkedColorLb), cc.xy(5,3));
   
    Color programItemMediumMarkedColor = Settings.propProgramPanelMarkedMediumPriorityColor.getColor();
    Color programItemMediumDefaultMarkedColor = Settings.propProgramPanelMarkedMediumPriorityColor.getDefaultColor();
   
    markings.add(new JLabel(colors[3]), cc.xy(1,5));
    markings.add(mProgramItemMediumMarkedColorLb = new ColorLabel(programItemMediumMarkedColor), cc.xy(3,5));
    mProgramItemMediumMarkedColorLb.setStandardColor(programItemMediumDefaultMarkedColor);
    markings.add(new ColorButton(mProgramItemMediumMarkedColorLb), cc.xy(5,5));

    Color programItemHigherMediumMarkedColor = Settings.propProgramPanelMarkedHigherMediumPriorityColor.getColor();
    Color programItemHigherMediumDefaultMarkedColor = Settings.propProgramPanelMarkedHigherMediumPriorityColor.getDefaultColor();
   
    markings.add(new JLabel(colors[4]), cc.xy(1,7));
    markings.add(mProgramItemHigherMediumMarkedColorLb = new ColorLabel(programItemHigherMediumMarkedColor), cc.xy(3,7));
    mProgramItemHigherMediumMarkedColorLb.setStandardColor(programItemHigherMediumDefaultMarkedColor);
    markings.add(new ColorButton(mProgramItemHigherMediumMarkedColorLb), cc.xy(5,7));
   
    Color programItemMaxMarkedColor = Settings.propProgramPanelMarkedMaxPriorityColor.getColor();
    Color programItemMaxDefaultMarkedColor = Settings.propProgramPanelMarkedMaxPriorityColor.getDefaultColor();
   
    markings.add(new JLabel(colors[5]), cc.xy(1,9));
    markings.add(mProgramItemMaxMarkedColorLb = new ColorLabel(programItemMaxMarkedColor), cc.xy(3,9));
    mProgramItemMaxMarkedColorLb.setStandardColor(programItemMaxDefaultMarkedColor);
    markings.add(new ColorButton(mProgramItemMaxMarkedColorLb), cc.xy(5,9));

   
    mHelpLabel = UiUtilities.createHtmlHelpTextArea(mLocalizer.msg("color.help","The priority that a plugin uses for a program is used to decide which color have to be used for the marking. A higher priority color replaces a lower priority color. The setting for the default color is only for plugins that do not care about the priority. But it works like for plugins that uses the priorities, so if you select the highest priority color there, all marking of plugin which do not care about the priority will replace lower marking colors."), new HyperlinkListener() {
      public void hyperlinkUpdate(HyperlinkEvent e) {
      }
    });
   
    pb.addSeparator(mLocalizer.msg("color.programMarked","Highlighting by plugins"), cc.xyw(1,1,2));
    pb.add(defaultMarkings, cc.xy(2,3));
    pb.addSeparator(mLocalizer.msg("color.programMarkedAdditional","Additional colors (replacing default color)"), cc.xyw(1,5,2));
    pb.add(markings, cc.xy(2,7));
    pb.add(mHelpLabel, cc.xy(2,9));
   
    return pb.getPanel();
  }
View Full Code Here

        LimitationConfiguration.DAYLIMIT_SUNDAY });
    mDayChooser.setRenderer(new DayListCellRenderer());
    CellConstraints cc = new CellConstraints();
    FormLayout layout = new FormLayout("5dlu, pref, default:grow",
    "pref, 5dlu, pref, 5dlu, pref, 5dlu, pref, 5dlu, pref, 5dlu, pref");
    PanelBuilder panelBuilder = new PanelBuilder(layout);

    mChannelCB = new JComboBox(ChannelList.getSubscribedChannels());

    int rowInx = 3;
    panelBuilder.add(new JLabel(mMainQuestion), cc.xyw(1, 1, 3));

    panelBuilder.add(mTitleCb, cc.xy(2, rowInx));
    panelBuilder.add(mTitleTf, cc.xy(3, rowInx));
    rowInx += 2;

    panelBuilder.add(mTopicCb = new JCheckBox(mTopicQuestion), cc.xy(2, rowInx));
    panelBuilder.add(mTopicTf = new JTextField(), cc.xy(3, rowInx));

    rowInx += 2;

    int filterIndex = rowInx;

    panelBuilder.add(mChannelCb = new JCheckBox(mChannelQuestion), cc.xy(2, rowInx));
    panelBuilder.add(mChannelCB, cc.xy(3, rowInx));
    rowInx += 2;

    panelBuilder.add(mDayCb = new JCheckBox(mDayQuestion), cc.xy(2, rowInx));
    panelBuilder.add(mDayChooser, cc.xy(3, rowInx));

    rowInx += 2;
    panelBuilder.add(mTimeCb = new JCheckBox(mTimeQuestion), cc.xy(2, rowInx));
    panelBuilder.add(mTimePeriodChooser = new TimePeriodChooser(TimePeriodChooser.ALIGN_LEFT), cc.xy(3, rowInx));

    if(mMode == MODE_EDIT_EXCLUSION || mMode == MODE_CREATE_EXCLUSION) {
      layout.insertRow(filterIndex, RowSpec.decode("pref"));
      layout.insertRow(filterIndex+1, RowSpec.decode("5dlu"));

      panelBuilder.add(mFilterCb, cc.xy(2, filterIndex));
      panelBuilder.add(mFilterChooser, cc.xy(3, filterIndex));
    }

    if (mMode == MODE_CREATE_DERIVED_FROM_PROGRAM && mProgram != null) {
      mTitleCb.setSelected(false);

      mDoneBtnText = mLocalizer.msg("doneButton.toBlacklist","Remove this program now");

      mTitleTf.setText(mProgram.getTitle());
      mChannelCB.setSelectedItem(mProgram.getChannel());
      int timeFrom = (mProgram.getHours() - 1) * 60;
      int timeTo = (mProgram.getHours() + 1) * 60;
      if (timeFrom < 0) {
        timeFrom = 0;
      }
      if (timeTo > 24 * 60 - 1) {
        timeTo = 24 * 60 - 1;
      }
      mTimePeriodChooser.setFromTime(timeFrom);
      mTimePeriodChooser.setToTime(timeTo);
      mDayChooser.setSelectedItem(mProgram.getDate().getCalendar().get(
          Calendar.DAY_OF_WEEK));
    } else if (mMode == MODE_EDIT_EXCLUSION) {
      String title = mExclusion.getTitle();
      String topic = mExclusion.getTopic();
      ProgramFilter filter = mExclusion.getFilter();
      Channel channel = mExclusion.getChannel();
      int timeFrom = mExclusion.getTimeLowerBound();
      int timeTo = mExclusion.getTimeUpperBound();
      int dayOfWeek = mExclusion.getDayOfWeek();
      if (title != null) {
        mTitleCb.setSelected(true);
        mTitleTf.setText(title);
      }
      if (topic != null) {
        mTopicCb.setSelected(true);
        mTopicTf.setText(topic);
      }
      if (filter != null) {
        mFilterCb.setSelected(true);
        mFilterChooser.setSelectedItem(filter);
      }
      if (channel != null) {
        mChannelCb.setSelected(true);
        mChannelCB.setSelectedItem(channel);
      }
      if (timeFrom >= 0 && timeTo >= 0) {
        mTimeCb.setSelected(true);
        mTimePeriodChooser.setFromTime(timeFrom);
        mTimePeriodChooser.setToTime(timeTo);
        mDayChooser.setSelectedItem(mExclusion.getDayOfWeek());
      }
      if (dayOfWeek != Exclusion.DAYLIMIT_DAILY) {
        mDayCb.setSelected(true);
        mDayChooser.setSelectedItem(dayOfWeek);
      }
    }

    updateButtons(handler);

    mChannelCb.addItemListener(new ItemListener() {
      public void itemStateChanged(ItemEvent e) {
        updateButtons(handler);
      }
    });

    mTitleCb.addItemListener(new ItemListener() {
      public void itemStateChanged(ItemEvent e) {
        updateButtons(handler);
      }
    });

    mTopicCb.addItemListener(new ItemListener() {
      public void itemStateChanged(ItemEvent e) {
        updateButtons(handler);
      }
    });

    mFilterCb.addItemListener(new ItemListener() {
      public void itemStateChanged(ItemEvent e) {
        updateButtons(handler);
      }
    });

    mTimeCb.addItemListener(new ItemListener() {
      public void itemStateChanged(ItemEvent e) {
        updateButtons(handler);
      }
    });

    mDayCb.addItemListener(new ItemListener() {
      public void itemStateChanged(ItemEvent e) {
        updateButtons(handler);
      }
    });

    mContentPanel = panelBuilder.getPanel();
    return mContentPanel;
  }
View Full Code Here

TOP

Related Classes of com.jgoodies.forms.builder.PanelBuilder

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.