/** * Creates Publishing tab. * * @return component. */ protected JComponent buildPublishingTab() { JComponent wording = ComponentsFactory.createWrappedMultilineLabel( Strings.message("guide.dialog.publishing.publish")); return publishingAvailable ? (isReachedPublishingLimit() ? buildPublishingTabLimitReached(wording) : buildPublishingTabAvailable(wording)) : buildPublishingTabUnavailable(wording); }
/** * Builds panel for publishing tab when publishing is unavailable. * * @param aWording wording to put on the page. * @return component. */ private JPanel buildPublishingTabUnavailable(JComponent aWording) { // Panel BBFormBuilder builder = new BBFormBuilder("0:grow"); builder.setDefaultDialogBorder(); builder.append(aWording); builder.appendUnrelatedComponentsGapRow(2); builder.append( ComponentsFactory.createWrappedMultilineLabel( Strings.message("guide.dialog.publishing.you.need.bbservice.account"))); return builder.getPanel(); }
/** * Builds main part. * * @return main part. */ protected JComponent buildMain() { BBFormBuilder builder = new BBFormBuilder("pref, 4dlu, max(pref;200px):grow, 4dlu, p"); builder.setDefaultDialogBorder(); JComponent wording = ComponentsFactory.createWrappedMultilineLabel( Strings.message("guide.dialog.readinglists.add.wording")); builder.append(wording, 3); builder.appendUnrelatedComponentsGapRow(2); builder.append(Strings.message("guide.dialog.readinglists.add.address"), tfAddress); builder.append(btnSuggest); builder.append(Strings.message("guide.dialog.readinglists.add.status"), lbStatus); return builder.getPanel(); }
/** * Builds the panel for publishing tab when too many guides are already published. * * @param wording wording to put on the page. * @return component. */ private JPanel buildPublishingTabLimitReached(JComponent wording) { BBFormBuilder builder = new BBFormBuilder("0:grow"); builder.setDefaultDialogBorder(); builder.append(wording); builder.appendUnrelatedComponentsGapRow(2); builder.append( ComponentsFactory.createWrappedMultilineLabel( MessageFormat.format( Strings.message("guide.dialog.publishing.limit.reached"), publishingLimit))); builder.appendUnrelatedComponentsGapRow(2); LinkLabel link = new LinkLabel(Strings.message("guide.dialog.publishing.limit.reached.link"), SERVICE_LINK); builder.append(link); return builder.getPanel(); }
/** * Builds panel for publishing tab when publishing is available. * * @param aWording wording to put on the page. * @return component. */ private JPanel buildPublishingTabAvailable(JComponent aWording) { JPanel sscPanel = new JPanel(new BorderLayout()); sscPanel.add(sscPublishingRating, BorderLayout.WEST); // Panel BBFormBuilder builder = new BBFormBuilder("7dlu, p, 2dlu, 100dlu, 0:grow, 2dlu, p"); builder.setDefaultDialogBorder(); builder.append(aWording, 7); builder.appendUnrelatedComponentsGapRow(2); builder.append(chPublishingEnabled, 7); builder.setLeadingColumnOffset(1); builder.append(lbPublishingTitle, tfPublishingTitle); builder.nextLine(); builder.append(lbPublishingTags, tfPublishingTags); builder.nextLine(); builder.append(lbPublishingPublic, chPublishingPublic); builder.nextLine(); builder.append(lbPublishingRating, sscPanel); builder.appendUnrelatedComponentsGapRow(2); builder.append(lbPublishingURL); builder.append(lnkPublishingURL, 2); builder.append(btnCopyToClipboard); builder.append(lbLastPublishingDate, tfLastPublishingDate); builder.setLeadingColumnOffset(0); builder.appendUnrelatedComponentsGapRow(2); builder.appendRow("min:grow"); JComponent instructionsBox = ComponentsFactory.createInstructionsBox( Strings.message("guide.dialog.publishing.instructions")); builder.append(instructionsBox, 7, CellConstraints.FILL, CellConstraints.FILL); return builder.getPanel(); }
private JComponent msg(String msg) { return ComponentsFactory.createWrappedMultilineLabel(msg); }
/** * Creates dialog. * * @param aFrame parent frame. * @param aTitle dialog title. * @param aPublishingAvailable <code>TRUE</code> if publishing is available. * @param aPublishingLimit the number of guides the user can have published. * @param aPublishingLimitReached <code>TRUE</code> if the limit is reached. */ public BasicGuideDialog( Frame aFrame, String aTitle, boolean aPublishingAvailable, int aPublishingLimit, boolean aPublishingLimitReached) { super(aFrame, aTitle); publishingAvailable = aPublishingAvailable; publishingLimit = aPublishingLimit; publishingLimitReached = aPublishingLimitReached; presentTitles = Collections.EMPTY_SET; model = new GuideIcons.ComboBoxModel(); renderer = new IconListCellRenderer(); readingListsModel = new ReadingListsTableModel(); tblReadingLists = new JTable(readingListsModel); tblReadingLists.setDefaultRenderer( String.class, new ReadingListsTableCellRenderer(readingListsModel)); UifUtilities.setTableColWidth(tblReadingLists, 2, 90); btnAddReadingList = new JButton(null, ResourceUtils.getIcon("add.icon")); btnAddReadingList.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { onAddReadingList(); } }); btnRemoveList = new JButton(null, ResourceUtils.getIcon("delete.icon")); btnRemoveList.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { onRemoveReadingList(); } }); // Publishing components chPublishingEnabled = ComponentsFactory.createCheckBox(Strings.message("guide.dialog.enable.publishing")); lbPublishingPublic = new JLabel(Strings.message("guide.dialog.public.visibility")); chPublishingPublic = new JCheckBox(); lbPublishingTitle = ComponentsFactory.createLabel(Strings.message("guide.dialog.reading.list.title")); lbPublishingTags = ComponentsFactory.createLabel(Strings.message("guide.dialog.tags")); lbPublishingURL = new JLabel(Strings.message("guide.dialog.publicationurl")); lnkPublishingURL = new LinkLabel(Strings.message("guide.dialog.not.published.yet")); lbLastPublishingDate = new JLabel(Strings.message("guide.dialog.last.update.date")); tfLastPublishingDate = new JLabel(Strings.message("guide.dialog.never.updated")); tfPublishingTitle = new JTextField(); lbPublishingTitle.setLabelFor(tfPublishingTitle); tfPublishingTags = new JTextField(); lbPublishingTags.setLabelFor(tfPublishingTags); vhPublishingRating = new ValueHolder(1); sscPublishingRating = new StarsSelectionComponent(new BoundedRangeAdapter(vhPublishingRating, 0, 1, 5)); lbPublishingRating = new JLabel(Strings.message("guide.dialog.rating")); btnCopyToClipboard = new JButton(Strings.message("guide.dialog.copy")); btnCopyToClipboard.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { CommonUtils.copyTextToClipboard(lnkPublishingURL.getText()); } }); onPublishingEnabled(); chPublishingEnabled.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { onPublishingEnabled(); } }); chAllowNotifications = ComponentsFactory.createCheckBox(Strings.message("guide.dialog.allow.notifications")); }