Package util.ui

Examples of util.ui.EnhancedPanelBuilder


  protected Icon getPictureIcon() {
      return IconLoader.getInstance().getIconFromTheme("mimetypes", "image-x-generic", 16);
  }

  protected JPanel createEmptyPanel(final String title, final String description) {
    EnhancedPanelBuilder panel = new EnhancedPanelBuilder(FormFactory.RELATED_GAP_COLSPEC.encode() + ",pref:grow");
    panel.addParagraph(title);
    panel.addRow();
    panel.add(new JLabel(description), new CellConstraints().xy(2, panel.getRow()));
    return panel.getPanel();
  }
View Full Code Here


    mSoftwareUpdateItemList.addCenterRendererComponent(PluginsSoftwareUpdateItem.class,new SelectableItemRendererCenterComponentIf() {
      private final ImageIcon NEW_VERSION_ICON = IconLoader.getInstance().getIconFromTheme("status", "software-update-available", 16);

      public JPanel createCenterPanel(JList list, Object value, int index, boolean isSelected, boolean isEnabled, JScrollPane parentScrollPane, int leftColumnWidth) {
        FormLayout lay = new FormLayout("5dlu,default,5dlu,default:grow","2dlu,default,2dlu,fill:pref:grow,2dlu");
        EnhancedPanelBuilder pb = new EnhancedPanelBuilder(lay);
        pb.getPanel().setOpaque(false);

        SoftwareUpdateItem item = (SoftwareUpdateItem)value;

        JLabel label = pb.addLabel(HTMLTextHelper.convertHtmlToText(item.getName()) + " " + item.getVersion(), cc.xy(2,2));
        label.setFont(label.getFont().deriveFont(Font.BOLD, label.getFont().getSize2D()+2));

        int width = parentScrollPane.getSize().width - parentScrollPane.getVerticalScrollBar().getWidth() - leftColumnWidth - Sizes.dialogUnitXAsPixel(5,pb.getPanel()) * 4 - parentScrollPane.getInsets().left - parentScrollPane.getInsets().right;

        if (width <= 0) {
          width = Settings.propColumnWidth.getInt();
        }

        TextAreaIcon icon = new TextAreaIcon(HTMLTextHelper.convertHtmlToText(item.getDescription()), new JLabel().getFont(), width, 2);

        JLabel iconLabel = new JLabel("");
        iconLabel.setIcon(icon);

        pb.add(iconLabel, cc.xyw(2,4,3));

        JLabel label3 = new JLabel();

        if (item.isAlreadyInstalled()) {
          Version installedVersion = item.getInstalledVersion();
          if ((installedVersion != null) && (installedVersion.compareTo(item.getVersion()) < 0)) {
            label.setIcon(NEW_VERSION_ICON);

            label3.setText("(" + mLocalizer.msg("installed","Installed version: ") + installedVersion.toString()+")");
            label3.setFont(label3.getFont().deriveFont(label3.getFont().getSize2D()+2));

            pb.add(label3, cc.xy(4,2));
          }
        }

        if (isSelected && isEnabled) {
          label.setForeground(list.getSelectionForeground());

          String author = item.getProperty("author");
          String website = item.getWebsite();

          FormLayout authorAndWebsiteLayout = new FormLayout("default,5dlu,default","default");
          JPanel authorAndWebsite = new JPanel(authorAndWebsiteLayout);
          authorAndWebsite.setOpaque(false);

          if (author != null) {
            lay.appendRow(RowSpec.decode("2dlu"));
            lay.appendRow(RowSpec.decode("default"));
            lay.appendRow(RowSpec.decode("2dlu"));

            pb.add(authorAndWebsite, cc.xyw(2,7,3));

            JLabel authorLabel = new JLabel(mLocalizer.msg("author", "Author"));
            authorLabel.setFont(authorLabel.getFont().deriveFont(Font.BOLD));
            authorLabel.setForeground(list.getSelectionForeground());
            authorLabel.setHorizontalAlignment(SwingConstants.RIGHT);

            JLabel authorName = new JLabel(HTMLTextHelper.convertHtmlToText(author));
            authorName.setForeground(list.getSelectionForeground());

            authorAndWebsite.add(authorLabel, cc.xy(1,1));
            authorAndWebsite.add(authorName, cc.xy(3,1));
          }

          if (website != null) {
            if(author == null) {
              lay.appendRow(RowSpec.decode("2dlu"));
              lay.appendRow(RowSpec.decode("default"));
              lay.appendRow(RowSpec.decode("2dlu"));

              pb.add(authorAndWebsite, cc.xyw(2,7,3));
            }
            else {
              authorAndWebsiteLayout.appendRow(RowSpec.decode("1dlu"));
              authorAndWebsiteLayout.appendRow(RowSpec.decode("default"));
            }

            JLabel webLabel = new JLabel(mLocalizer.msg("website", "Website"));
            webLabel.setFont(webLabel.getFont().deriveFont(Font.BOLD));
            webLabel.setForeground(list.getSelectionForeground());
            webLabel.setHorizontalAlignment(SwingConstants.RIGHT);

            LinkButton webLink = new LinkButton(HTMLTextHelper.convertHtmlToText(website));
            webLink.setForeground(list.getSelectionForeground());

            authorAndWebsite.add(webLabel, cc.xy(1,author == null ? 1 : 3));
            authorAndWebsite.add(webLink, cc.xy(3,author == null ? 1 : 3));
          }

          icon.setMaximumLineCount(-1);
          iconLabel.setForeground(list.getSelectionForeground());

          label3.setForeground(list.getSelectionForeground());
        } else {
          if(!item.isStable()) {
            label.setForeground(new Color(200, 0, 0));
          }
          else {
            label.setForeground(list.getForeground());
          }

          icon.setMaximumLineCount(1);
          iconLabel.setForeground(list.getSelectionForeground());
          iconLabel.setForeground(list.getForeground());
          label3.setForeground(Color.gray);
        }

        return pb.getPanel();
      }

      public void calculateSize(JList list, int index, JPanel contPane) {
        if(list.getUI() instanceof MyListUI) {
          ((MyListUI)list.getUI()).setCellHeight(index, contPane.getPreferredSize().height);
View Full Code Here

        mHighlightButton.setEnabled(mHighlight.isSelected());
      }
    });

    CellConstraints cc = new CellConstraints();
    EnhancedPanelBuilder formatPanel = new EnhancedPanelBuilder(new FormLayout("5dlu,10dlu,pref,pref,5dlu,default:grow,pref,5dlu"));
    formatPanel.setDefaultDialogBorder();
    formatPanel.addParagraph(ProgramInfo.mLocalizer.msg("font","Font settings"));
    formatPanel.addRow();
    formatPanel.add(mAntiAliasing, cc.xyw(2,formatPanel.getRowCount(), formatPanel.getColumnCount() - 2));
    formatPanel.addRow();
    formatPanel.add(mUserFont, cc.xyw(2,formatPanel.getRowCount(),formatPanel.getColumnCount() - 2));
    formatPanel.addRow();
    final JLabel titleLabel = new JLabel(ProgramInfo.mLocalizer.msg("title", "Title font"));
    formatPanel.add(titleLabel, cc.xy(3, formatPanel.getRowCount()));
    formatPanel.add(mTitleFont, cc.xyw(6,formatPanel.getRowCount(),2));
    formatPanel.addRow();
    final JLabel bodyLabel = new JLabel(ProgramInfo.mLocalizer.msg("body", "Description font"));
    formatPanel.add(bodyLabel, cc.xy(3,formatPanel.getRowCount()));
    formatPanel.add(mBodyFont, cc.xyw(6,formatPanel.getRowCount(),2));

    mUserFont.addChangeListener(new ChangeListener() {
      public void stateChanged(ChangeEvent e) {
        mTitleFont.setEnabled(mUserFont.isSelected());
        mBodyFont.setEnabled(mUserFont.isSelected());
        titleLabel.setEnabled(mUserFont.isSelected());
        bodyLabel.setEnabled(mUserFont.isSelected());
      }
    });

    mTitleFont.setEnabled(mUserFont.isSelected());
    mBodyFont.setEnabled(mUserFont.isSelected());
    titleLabel.setEnabled(mUserFont.isSelected());
    bodyLabel.setEnabled(mUserFont.isSelected());

    formatPanel.addParagraph(ProgramInfo.mLocalizer.msg("design","Design"));
    formatPanel.addRow();
    formatPanel.add(mLook, cc.xyw(2,formatPanel.getRowCount(),2));

    formatPanel.addParagraph(ProgramInfoDialog.mLocalizer.msg("functions","Functions"));
    formatPanel.addRow();
    formatPanel.add(mShowFunctions, cc.xyw(2,formatPanel.getRowCount(),formatPanel.getColumnCount() - 2));
    formatPanel.addRow();
    formatPanel.add(mShowTextSearchButton, cc.xyw(3,formatPanel.getRowCount(),formatPanel.getColumnCount() - 3));

    formatPanel.addParagraph(ProgramInfo.mLocalizer.msg("favorites","Favorites"));
    formatPanel.addRow();
    formatPanel.add(mHighlight, cc.xyw(2,formatPanel.getRowCount(),5));
    JPanel panel = new JPanel(new FlowLayout());
    mHighlightColorLb = new ColorLabel(settings.getHighlightColor());
    panel.add(mHighlightColorLb);
    mHighlightColorLb.setStandardColor(settings.getHighlightColor());
    mHighlightButton = new ColorButton(mHighlightColorLb);
    panel.add(mHighlightButton);
    mHighlight.getActionListeners()[0].actionPerformed(null);
    formatPanel.add(panel, cc.xy(7,formatPanel.getRowCount()));

    mOldOrder = settings.getFieldOrder();
    mOldSetupState = ProgramInfo.getInstance().getSettings().getSetupwasdone();

    mList = new OrderChooser(mOldOrder, ProgramTextCreator.getDefaultOrder(),
        true);

    JButton previewBtn = new JButton(ProgramInfo.mLocalizer.msg("preview", "Preview"));
    previewBtn.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        saveSettings();
        ProgramInfo.getInstance().showProgramInformation(
            Plugin.getPluginManager().getExampleProgram(), false);
        restoreSettings();
      }
    });

    JButton defaultBtn = new JButton(ProgramInfo.mLocalizer.msg("default", "Default"));
    defaultBtn.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        resetSettings();
      }
    });

    EnhancedPanelBuilder orderPanel = new EnhancedPanelBuilder("default:grow");
    orderPanel.setDefaultDialogBorder();

    orderPanel.addRow("fill:default:grow");
    orderPanel.add(mList, cc.xy(1, orderPanel.getRowCount()));


    EnhancedPanelBuilder picturePanel = new EnhancedPanelBuilder("default:grow");
    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}});
View Full Code Here

      }
    } else if (Settings.propBlockedPluginArray.isBlocked(mPlugin)) {
      mPluginPanel.add(createEmptyPanel(mLocalizer.msg("blocked", "Blocked"), mLocalizer.msg("blocked.text", "This plugin is blocked and cannot be activated.")), BorderLayout.NORTH);
    } else {
      // The plugin is not activated -> Tell it the user
      EnhancedPanelBuilder panelActivate = new EnhancedPanelBuilder(FormFactory.RELATED_GAP_COLSPEC.encode() + "," + FormFactory.PREF_COLSPEC.encode() + "," + FormFactory.RELATED_GAP_COLSPEC.encode() + "," + FormFactory.PREF_COLSPEC.encode() + ",default:grow");
      CellConstraints cc = new CellConstraints();

      panelActivate.addParagraph(mLocalizer.msg("activation", "Activation"));

      panelActivate.addRow();
      panelActivate.add(new JLabel(mLocalizer.msg("notactivated", "This Plugin is currently not activated.")), cc.xy(2, panelActivate.getRow()));

      final JButton btnActivate = new JButton(mLocalizer.msg("activate", "Activate"));
      btnActivate.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
          try {
            btnActivate.setEnabled(false);
            PluginProxyManager.getInstance().activatePlugin(mPlugin);
            SettingsDialog settingsDialog = SettingsDialog.getInstance();
            settingsDialog.invalidateTree();
            settingsDialog.createPluginTreeItems();
            settingsDialog.showSettingsTab(mPlugin.getId());
            MainFrame.getInstance().getToolbar().updatePluginButtons();
            // Update the settings
            String[] deactivatedPlugins = PluginProxyManager.getInstance().getDeactivatedPluginIds();
            Settings.propDeactivatedPlugins.setStringArray(deactivatedPlugins);
          } catch (TvBrowserException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
          }
        }});

      panelActivate.add(btnActivate, cc.xy(4, panelActivate.getRow()));
      mPluginPanel.add(panelActivate.getPanel(), BorderLayout.NORTH);
    }

    mPluginWasActivatedLastTime = mPlugin.isActivated();

    mContentPanel.repaint();
View Full Code Here

  /**
   * Creates the settings panel for this tab.
   */
  public JPanel createSettingsPanel() {
    EnhancedPanelBuilder panel = new EnhancedPanelBuilder("5dlu, fill:50dlu:grow, 3dlu, fill:50dlu:grow, 3dlu");
    panel.setBorder(Borders.DIALOG_BORDER);

    CellConstraints cc = new CellConstraints();

    panel.addParagraph("");
    // icons
    panel.add(DefaultComponentFactory.getInstance()
        .createSeparator(mLocalizer.msg("pluginIcons", "Plugin icons")), cc.xyw(1, panel.getRowCount(), 2));

    IconPlugin[] allPluginArr = getAvailableIconPlugins();
    IconPlugin[] pluginOrderArr = getSelectedIconPlugins(allPluginArr);
    mIconPluginOCh = new OrderChooser(pluginOrderArr, allPluginArr, IconPlugin.class,
        new SelectableItemRendererCenterComponentIf() {
          private DefaultListCellRenderer mRenderer = new DefaultListCellRenderer();

          @Override
          public JPanel createCenterPanel(JList list, Object value, int index, boolean isSelected, boolean isEnabled,
              JScrollPane parentScrollPane, int leftColumnWidth) {
            DefaultListCellRenderer label = (DefaultListCellRenderer) mRenderer.getListCellRendererComponent(list,
                value, index, isSelected, false);
            IconPlugin iconPlugin = (IconPlugin) value;
            label.setIcon(iconPlugin.getIcon());
            label.setHorizontalAlignment(SwingConstants.LEADING);
            label.setVerticalAlignment(SwingConstants.CENTER);
            label.setOpaque(false);

            JPanel panel = new JPanel(new BorderLayout());
            if (isSelected && isEnabled) {
              panel.setOpaque(true);
              panel.setForeground(list.getSelectionForeground());
              panel.setBackground(list.getSelectionBackground());
            } else {
              panel.setOpaque(false);
              panel.setForeground(list.getForeground());
              panel.setBackground(list.getBackground());
            }
            panel.add(label, BorderLayout.WEST);
            return panel;
          }

          @Override
          public void calculateSize(JList list, int index, JPanel contentPane) {
          }
        });

    // info text
    panel.add(DefaultComponentFactory.getInstance().createSeparator(mLocalizer.msg("infoText", "Info text")), cc
        .xyw(4, panel.getRowCount(), 2));

    ProgramFieldType[] allTypeArr = getAvailableTypes();
    ProgramFieldType[] typeOrderArr = getSelectedTypes();
    mInfoTextOCh = new OrderChooser(typeOrderArr, allTypeArr);

    panel.addGrowingRow();
    panel.add(mIconPluginOCh, cc.xy(2, panel.getRowCount()));
    panel.add(mInfoTextOCh, cc.xy(4, panel.getRowCount()));

    panel.addRow("top:pref");
    panel.add(UiUtilities.createHelpTextArea(mLocalizer.msg("pluginIcons.description", "")), cc.xy(2, panel.getRowCount()));
    panel.add(UiUtilities.createHelpTextArea(mLocalizer.msg("infoText.description", "")), cc.xy(4, panel.getRowCount()));

    panel.addParagraph(mLocalizer.msg("Colors", "Colors"));

    panel.addRow();
    panel.add(mAllowProgramImportance = new JCheckBox(mLocalizer.msg("color.allowTransparency","Allow plugins to set the transparency of a program"),
        Settings.propProgramPanelAllowTransparency.getBoolean()), cc.xyw(2, panel.getRowCount() ,3));
   
    panel.addRow();
    panel.add(mBorderForOnAirPrograms = new JCheckBox(mLocalizer.msg("color.programOnAirWithBorder",
        "Border for programs on air"), Settings.propProgramTableOnAirProgramsShowingBorder.getBoolean()), cc.xyw(2, panel.getRowCount(),
        3));

    JPanel colors = new JPanel();
    Color programItemProgressColor = Settings.propProgramTableColorOnAirDark.getColor();
    Color programItemOnAirColor = Settings.propProgramTableColorOnAirLight.getColor();
    Color programItemKeyboardSelectedColor = Settings.propKeyboardSelectedColor.getColor();

    Color programItemDefaultProgressColor = Settings.propProgramTableColorOnAirDark.getDefaultColor();
    Color programItemDefaultOnAirColor = Settings.propProgramTableColorOnAirLight.getDefaultColor();
    Color programItemDefaultKeyboardSelectedColor = Settings.propKeyboardSelectedColor.getDefaultColor();

    FormLayout formLayout = new FormLayout("default, 5dlu, default, 5dlu, default, 5dlu, default",
        "5dlu, default, 3dlu, default, 3dlu, default");
    colors.setLayout(formLayout);

    colors.add(new JLabel(mLocalizer.msg("color.programOnAir", "Background color for programs on air")), cc.xy(1, 2));
    colors.add(mProgramItemOnAirColorLb = new ColorLabel(programItemOnAirColor), cc.xy(3, 2));
    mProgramItemOnAirColorLb.setStandardColor(programItemDefaultOnAirColor);
    colors.add(new ColorButton(mProgramItemOnAirColorLb), cc.xy(5, 2));

    colors.add(new JLabel(mLocalizer.msg("color.programProgress", "Progress bar for programs on air")), cc.xy(
        1, 4));
    colors.add(mProgramItemProgressColorLb = new ColorLabel(programItemProgressColor), cc.xy(3, 4));
    mProgramItemProgressColorLb.setStandardColor(programItemDefaultProgressColor);
    colors.add(new ColorButton(mProgramItemProgressColorLb), cc.xy(5, 4));

    colors.add(new JLabel(mLocalizer.msg("color.keyboardSelected", "Color for programs selected by keyboard")), cc.xy(1, 6));
    colors.add(mProgramItemKeyboardSelectedLb = new ColorLabel(programItemKeyboardSelectedColor), cc.xy(3, 6));
    mProgramItemKeyboardSelectedLb.setStandardColor(programItemDefaultKeyboardSelectedColor);
    colors.add(new ColorButton(mProgramItemKeyboardSelectedLb), cc.xy(5, 6));

    panel.addRow();
    panel.add(colors, cc.xyw(2, panel.getRowCount(), panel.getColumnCount() - 1));
   
    panel.addParagraph(mLocalizer.msg("text", "Text"));
    panel.addRow();
    panel.add(mHyphenator = new JCheckBox(mLocalizer.msg("hyphenation", "Use hyphenation"), Settings.propProgramPanelHyphenation.getBoolean()), cc.xyw(2, panel.getRowCount(), panel.getColumnCount() - 1));

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

      panel.add(UiUtilities.createHelpTextArea(
          mLocalizer.msg("notinit", "Error, System not init")), BorderLayout.NORTH);
      return panel;
    }
   
    EnhancedPanelBuilder panel = new EnhancedPanelBuilder(FormFactory.RELATED_GAP_COLSPEC.encode() + ", pref:grow, " + FormFactory.RELATED_GAP_COLSPEC.encode() +"," + FormFactory.PREF_COLSPEC.encode());
   
    CellConstraints cc = new CellConstraints();
   
    panel.addRow();
    panel.add(UiUtilities.createHelpTextArea(
        mLocalizer.msg("help", "Help Text")), cc.xyw(2,panel.getRow(), 3));
    panel.addParagraph(mLocalizer.msg("title", "Title"));
    mTitle = new ParamInputField(mSettings.getTitle());
    panel.addGrowingRow();
    panel.add(mTitle, cc.xyw(2,panel.getRow(),3));
   
    panel.addParagraph(mLocalizer.msg("description", "Description"));
   
    mDescription = new ParamInputField(mSettings.getDescription());
    panel.addGrowingRow();
    panel.add(mDescription, cc.xyw(2,panel.getRow(),3));
   
    JButton testGrowl = new JButton(mLocalizer.msg("testKNotify", "Test KNotify"));
    testGrowl.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent e) {
        mPlugin.sendToKNotify(mTitle.getText(), mDescription.getText(), Plugin.getPluginManager().getExampleProgram());
      }
     
    });
    panel.addRow();
    panel.add(testGrowl, cc.xy(4,12));
    return panel.getPanel();
  }
View Full Code Here

  /**
   * Create the SettingsPanel
   */
  public JPanel createSettingsPanel() {
    final EnhancedPanelBuilder settingsPanel = new EnhancedPanelBuilder(FormFactory.RELATED_GAP_COLSPEC.encode() + ","
        + FormFactory.PREF_COLSPEC.encode() + "," + FormFactory.RELATED_GAP_COLSPEC.encode() + ","
        + FormFactory.PREF_COLSPEC.encode() + ", fill:pref:grow");

    String[] services = { "", "Blogger.com", "Wordpress", "b2evolution" };

    mServiceCombo = new JComboBox(services);

    if (mSettings.getBlogService() == BlogService.Blogger) {
      mServiceCombo.setSelectedIndex(1);
    } else if (mSettings.getBlogService() == BlogService.WordPress) {
      mServiceCombo.setSelectedIndex(2);
    } else if (mSettings.getBlogService() == BlogService.B2Evolution) {
      mServiceCombo.setSelectedIndex(3);
    }

    mServiceCombo.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        updateAfterServiceSelection();
      }
    });

    mServiceUrlLabel = new JLabel(mLocalizer.msg("Url", "Url") + ':');
    mServiceUrlLabel.setEnabled(mServiceCombo.getSelectedIndex() >= 2);

    mServiceUrlField = new JTextField();
    mServiceUrlField.setEnabled(mServiceCombo.getSelectedIndex() >= 2);
    mServiceUrlField.setText(mSettings.getBlogUrl());

    CellConstraints cc = new CellConstraints();

    settingsPanel.addRow();
    settingsPanel.add(new JLabel(mLocalizer.msg("Service", "Blog-Service") + ':'), cc.xy(2, settingsPanel.getRow()));
    settingsPanel.add(mServiceCombo, cc.xy(4, settingsPanel.getRow()));

    settingsPanel.addRow();
    settingsPanel.add(mServiceUrlLabel, cc.xy(2, settingsPanel.getRow()));
    settingsPanel.add(mServiceUrlField, cc.xyw(4, settingsPanel.getRow(), 2));

    mConfigPanel = new PluginProgramConfigurationPanel(mPlugin.getSelectedPluginProgramFormattings(), mPlugin
        .getAvailableLocalPluginProgramFormattings(), BlogThisPlugin.getDefaultFormatting(), true, false);

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

    settingsPanel.addGrowingRow();
    settingsPanel.add(mConfigPanel, cc.xyw(1, settingsPanel.getRow(), 5));

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

  /**
   * Create the GUI
   * @return Panel
   */
  public JPanel createSettingsPanel() {
    final EnhancedPanelBuilder panel = new EnhancedPanelBuilder(FormFactory.RELATED_GAP_COLSPEC.encode() + "," + FormFactory.PREF_COLSPEC.encode() + "," + FormFactory.RELATED_GAP_COLSPEC.encode() + ",pref:grow");
    final CellConstraints cc = new CellConstraints();
   
    panel.addRow();
    panel.add(UiUtilities.createHelpTextArea(
        mLocalizer.msg("help", "Help Text")), cc.xyw(2,panel.getRow(), 3));
   
    panel.addParagraph(mLocalizer.msg("title", "Title"));
   
    mTitle = new ParamInputField(mSettings.getTitle());
   
    panel.addRow();
    panel.add(mTitle, cc.xyw(2,panel.getRow(),3));
   
    panel.addParagraph(mLocalizer.msg("description", "Description"));
   
    mDescription = new ParamInputField(mSettings.getDescription());
   
    panel.addGrowingRow();
    panel.add(mDescription, cc.xyw(2,panel.getRow(),3));
   
    final JButton testGrowl = new JButton(mLocalizer.msg("testGrowl",
        "Test Growl"));
    testGrowl.addActionListener(new ActionListener() {

      public void actionPerformed(final ActionEvent e) {
        final GrowlSettings testSettings = new GrowlSettings(null);
        testSettings.setTitle(mTitle.getText());
        testSettings.setDescription(mDescription.getText());
        mGrowlPlugin.getContainer().notifyGrowl(testSettings,
            Plugin.getPluginManager().getExampleProgram());
      }
     
    });
   
    panel.addParagraph(mLocalizer.msg("testGrowl","Test Growl"));
    panel.addRow();
    panel.add(testGrowl, cc.xy(2,panel.getRowCount()));
   
    return panel.getPanel();
  }
View Full Code Here

 
  /**
   * Create the Panel
   */
  public JPanel createSettingsPanel() {
    EnhancedPanelBuilder panel = new EnhancedPanelBuilder(FormFactory.RELATED_GAP_COLSPEC.encode() + ",default:grow");
   
    CellConstraints cc = new CellConstraints();
   
    mShowAtStart = new JCheckBox(mLocalizer.msg("showAtStart", "Show at startup"));
    mShowAtStart.setSelected(mSettings.getProperty("showAtStartup", "false").equals("true"));

    mPictureSettings = new PluginsPictureSettingsPanel(ListViewPlugin.getInstance().getPictureSettings(), false);
   
    panel.addRow();
    panel.add(mShowAtStart, cc.xy(2,panel.getRow()));
   
    panel.addParagraph(PluginsPictureSettingsPanel.getTitle());
   
    panel.addGrowingRow();
    panel.add(mPictureSettings, cc.xy(2,panel.getRow()));
       
    return panel.getPanel();
  }
View Full Code Here

    JTabbedPane tabbedPane = new JTabbedPane();

    /* level list pane */
    CellConstraints cc = new CellConstraints();
    EnhancedPanelBuilder levelList = new EnhancedPanelBuilder("5dlu,default:grow");
    levelList.setDefaultDialogBorder();

    levelList.addRow();
    levelList.addSeparator(mLocalizer.msg("downloadLevel", "Download this data"), cc.xyw(1,levelList.getRow(),2));

    TvDataLevel[] levelArr = DayProgramFile.getLevels();

    String[] levelIds = settings.getLevelIds();

    mLevelCheckboxes = new JCheckBox[levelArr.length];
    for (int i = 0; i < levelArr.length; i++) {
      mLevelCheckboxes[i] = new JCheckBox(levelArr[i].getDescription());
      levelList.addRow();
      levelList.add(mLevelCheckboxes[i], cc.xy(2,levelList.getRow()));
      if (levelArr[i].isRequired()) {
        mLevelCheckboxes[i].setSelected(true);
        mLevelCheckboxes[i].setEnabled(false);
      } else {
        for (String levelId : levelIds) {
          if (levelId.equals(levelArr[i].getId())) {
            mLevelCheckboxes[i].setSelected(true);
          }
        }
      }
    }

    /* group list pane */

    EnhancedPanelBuilder groupListPanel = new EnhancedPanelBuilder("5dlu,0dlu:grow");
    groupListPanel.setDefaultDialogBorder();

    JTextArea ta = UiUtilities.createHelpTextArea(mLocalizer.msg("channelgroup.description","description"));

    groupListPanel.addRow();
    groupListPanel.add(ta, cc.xyw(1,groupListPanel.getRow(),2));

    JPanel panel2 = new JPanel(new BorderLayout(10, 0));

    mGroupListModel = new DefaultListModel();

    mGroupList = new JList(mGroupListModel);
    mGroupList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    panel2.add(new JScrollPane(mGroupList), BorderLayout.CENTER);

    JPanel panel3 = new JPanel(new BorderLayout());
    JPanel btnPn = new JPanel();
    btnPn.setLayout(new GridLayout(0, 1, 0, 4));

    mAddBtn = new JButton(Localizer.getLocalization(Localizer.I18N_ADD),
        TVBrowserIcons.newIcon(TVBrowserIcons.SIZE_SMALL));
    mRemoveBtn = new JButton(mLocalizer.msg("remove", "Remove"),
        TVBrowserIcons.delete(TVBrowserIcons.SIZE_SMALL));

    mInfoBtn = new JButton("Information", AbstractTvDataService
        .getPluginManager().getIconFromTheme(null, "actions", "help-browser",
            16));

    mAddBtn.setHorizontalAlignment(SwingConstants.LEFT);
    mRemoveBtn.setHorizontalAlignment(SwingConstants.LEFT);
    mInfoBtn.setHorizontalAlignment(SwingConstants.LEFT);

    btnPn.add(mAddBtn);
    btnPn.add(mRemoveBtn);
    btnPn.add(mInfoBtn);

    mAddBtn.addActionListener(this);
    mRemoveBtn.addActionListener(this);
    mInfoBtn.addActionListener(this);


    panel3.add(btnPn, BorderLayout.NORTH);
    panel2.add(panel3, BorderLayout.EAST);

    JPanel groupInfoPanel = new JPanel(new BorderLayout(3, 0));
    JPanel westPn = new JPanel(new BorderLayout());

    westPn.add(new JLabel(mLocalizer.msg("description", "Description:")), BorderLayout.NORTH);
    groupInfoPanel.add(westPn, BorderLayout.WEST);

    mGroupDescriptionTA = UiUtilities.createHelpTextArea("");
    mGroupDescriptionTA.setPreferredSize(new Dimension(0, 40));

    groupInfoPanel.add(mGroupDescriptionTA, BorderLayout.CENTER);

    groupListPanel.addGrowingRow();
    groupListPanel.add(panel2, cc.xy(2,groupListPanel.getRow()));

    groupListPanel.addRow();
    groupListPanel.add(groupInfoPanel, cc.xy(2,groupListPanel.getRow()));

    tabbedPane.add(mLocalizer.msg("datalevel", "data level"), levelList.getPanel());
    tabbedPane.add(mLocalizer.msg("channelgroups", "channel groups"), groupListPanel.getPanel());

    add(tabbedPane, cc.xy(1,1));

    mGroupList.addListSelectionListener(new ListSelectionListener() {

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.