/** * 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")); }