List of usage examples for com.jgoodies.forms.layout CellConstraints FILL
Alignment FILL
To view the source code for com.jgoodies.forms.layout CellConstraints FILL.
Click Source Link
From source file:com.salas.bb.remixfeeds.editor.PostEditorAdv.java
License:Open Source License
/** * The hook to add more custom panels after the main part. * * @param builder builder./* w ww . ja va2 s . c om*/ */ protected void addCustomPanels(BBFormBuilder builder) { builder.appendRelatedComponentsGapRow(2); builder.appendRow("50dlu"); builder.append(new JScrollPane(tfExcerpt), 2, CellConstraints.FILL, CellConstraints.FILL); builder.append(buildOptionsPanel(), 2); }
From source file:com.salas.bb.remixfeeds.templates.Editor.java
License:Open Source License
/** * Main panel./*from w ww . j a va2s .c o m*/ * * @return panel. */ private Component buildMainPanel() { // Buttons ButtonBarBuilder buttons = new ButtonBarBuilder(); buttons.addFixed(btnNew); buttons.addRelatedGap(); buttons.addFixed(btnCopy); buttons.addRelatedGap(); buttons.addFixed(btnDelete); // --- Panel construction BBFormBuilder builder = new BBFormBuilder("p, 2dlu, max(50dlu;p):grow, 7dlu, p, 0dlu:grow"); // First row builder.append(STR_TEMPLATE, cbTemplates); builder.append(buttons.getPanel()); // Editor builder.appendRelatedComponentsGapRow(); builder.appendRow("200px:grow"); builder.nextLine(2); builder.append(new JScrollPane(taEditor), 6, CellConstraints.FILL, CellConstraints.FILL); // Help section builder.appendUnrelatedComponentsGapRow(2); builder.append(STR_HELP, 6); builder.appendRelatedComponentsGapRow(); builder.appendRow("150px"); builder.nextLine(2); builder.append(ComponentsFactory.createInstructionsBox(STR_HELP_TEXT), 6, CellConstraints.FILL, CellConstraints.FILL); builder.appendUnrelatedComponentsGapRow(2); return builder.getPanel(); }
From source file:com.salas.bb.reports.AbstractMostReadPinnedReport.java
License:Open Source License
/** * Creates a table for stats display./* www . j a v a 2s. c om*/ * * @param table table component to initialize. * @param max maximum number of rows. * * @return table. */ protected JPanel createDataTable(JPanel table, int max) { BBFormBuilder builder = new BBFormBuilder("16px, 4dlu, 50dlu:grow, 2dlu, p, 7dlu, p", table); builder.setDefaultDialogBorder(); // Output header builder.append(UifUtilities.boldFont(new JLabel(headerEntityTitle)), 3); builder.append(UifUtilities.boldFont(new JLabel(Strings.message("report.activity"))), 1, CellConstraints.CENTER, CellConstraints.DEFAULT); builder.append(UifUtilities.boldFont(new JLabel(Strings.message("report.stats"))), 1, CellConstraints.CENTER, CellConstraints.DEFAULT); LineChartConfig config = new SparklineConfig(); config.setValueXStep(2); // Output data if (stats != null) { int i = 0; for (ReadStats stat : stats) { if (i++ == max) break; LineChartData data = new LineChartData(stat.getCounts()); LineChart chart = new LineChart(data, config); builder.appendRelatedComponentsGapRow(2); builder.appendRow("max(p;20px)"); builder.append(new JLabel(itemIcon)); builder.append(createLabel(stat.getObjectId(), stat.getObjectTitle())); builder.append(chart, 1, CellConstraints.CENTER, CellConstraints.FILL); builder.append( new JLabel("<html><b>" + stat.getTotal() + " articles</b><br>" + getAvg(stat) + " a day")); } } return builder.getPanel(); }
From source file:com.salas.bb.reports.AbstractTableReport.java
License:Open Source License
/** Prepares the view for the display. Should be called after the initializeData() method. */ protected void doLayoutView() { // Initialize component if (table == null) table = new JPanel(); createDataTable(table, TOP_ENTITIES_COUNT); JScrollPane sp = new JScrollPane(table); sp.setBorder(null);//from www . j a v a2 s.c o m setBackground(Color.WHITE); table.setBackground(Color.WHITE); // Build the layout BBFormBuilder builder = new BBFormBuilder("p:grow", this); builder.setDefaultDialogBorder(); builder.append(UifUtilities.boldFont(new JLabel(getReportName())), 1, CellConstraints.CENTER, CellConstraints.DEFAULT); builder.appendRelatedComponentsGapRow(2); builder.appendRow("50dlu:grow"); builder.append(sp, 1, CellConstraints.FILL, CellConstraints.FILL); builder.append(new SeeAllLinkLabel(Strings.message("report.see.all"))); }
From source file:com.salas.bb.reports.ArticlesByDayReport.java
License:Open Source License
/** Prepares the view for the display. Should be called after the initializeData() method. */ protected void doLayoutView() { // Initialize data by day String[] days = new String[7]; DateFormatSymbols dfs = new DateFormatSymbols(); for (int i = 0; i < 7; i++) days[i] = dfs.getWeekdays()[Calendar.SUNDAY + i]; LineChartConfig config = new LineChartConfig(); LineChartData dataByDay = new LineChartData(readByDayTotal, days); LineChart chartByDay = new LineChart(dataByDay, config); LineChartData dataByDayReset = new LineChartData(readByDayReset, days); LineChart chartByDayReset = new LineChart(dataByDayReset, config); // Initialize the panel itself setBackground(config.getBackgroundColor()); // Build the layout BBFormBuilder builder = new BBFormBuilder("p:grow", this); builder.setDefaultDialogBorder();// www. j a v a 2 s .c o m JLabel lbByDay = new JLabel(Strings.message("report.articles.read.by.day.title")); Font fntBold = lbByDay.getFont().deriveFont(Font.BOLD); lbByDay.setFont(fntBold); builder.append(lbByDay, 1, CellConstraints.CENTER, CellConstraints.DEFAULT); builder.appendRelatedComponentsGapRow(2); builder.appendRow("p:grow"); builder.append(chartByDay, 1, CellConstraints.FILL, CellConstraints.FILL); builder.appendUnrelatedComponentsGapRow(2); JLabel lbByDayReset = new JLabel(Strings.message("report.articles.read.by.day.title") + " " + Strings.message("report.since.reset.box")); lbByDayReset.setFont(fntBold); builder.append(lbByDayReset, 1, CellConstraints.CENTER, CellConstraints.DEFAULT); builder.appendRelatedComponentsGapRow(2); builder.appendRow("p:grow"); builder.append(chartByDayReset, 1, CellConstraints.FILL, CellConstraints.FILL); }
From source file:com.salas.bb.reports.ArticlesByHourReport.java
License:Open Source License
/** Prepares the view for the display. Should be called after the initializeData() method. */ protected void doLayoutView() { // Initialize data by hour String[] hours = new String[Constants.HOURS_IN_DAY]; System.arraycopy(Constants.HOUR_NAMES, 0, hours, 0, hours.length); hours[0] = Strings.message("report.midnight"); hours[12] = Strings.message("report.noon"); LineChartConfig config = new LineChartConfig(); config.setIndexLabelStep(4);/*ww w . j a v a 2 s.c o m*/ LineChartData dataByHour = new LineChartData(readByHourTotal, hours); LineChart chartByHour = new LineChart(dataByHour, config); LineChartData dataByHourReset = new LineChartData(readByHourReset, hours); LineChart chartByHourReset = new LineChart(dataByHourReset, config); // Initialize the panel itself setBackground(config.getBackgroundColor()); // Build the layout BBFormBuilder builder = new BBFormBuilder("p:grow", this); builder.setDefaultDialogBorder(); JLabel lbByDay = new JLabel(Strings.message("report.articles.read.by.hour.title")); Font fntBold = lbByDay.getFont().deriveFont(Font.BOLD); lbByDay.setFont(fntBold); builder.append(lbByDay, 1, CellConstraints.CENTER, CellConstraints.DEFAULT); builder.appendRelatedComponentsGapRow(2); builder.appendRow("p:grow"); builder.append(chartByHour, 1, CellConstraints.FILL, CellConstraints.FILL); builder.appendUnrelatedComponentsGapRow(2); JLabel lbByWeek = new JLabel(Strings.message("report.articles.read.by.hour.title") + " " + Strings.message("report.since.reset.box")); lbByWeek.setFont(fntBold); builder.append(lbByWeek, 1, CellConstraints.CENTER, CellConstraints.DEFAULT); builder.appendRelatedComponentsGapRow(2); builder.appendRow("p:grow"); builder.append(chartByHourReset, 1, CellConstraints.FILL, CellConstraints.FILL); }
From source file:com.salas.bb.sentiments.AdvancedSettingsDialog.java
License:Open Source License
/** * Returns the main panel.// ww w. ja v a2 s .c o m * * @return panel. */ private Component buildMainPanel() { // Areas BBFormBuilder builder = new BBFormBuilder("p, 14dlu:grow, p, 2dlu, p, 2dlu, p, 7dlu, p, 2dlu, p"); builder.append(ComponentsFactory .createWrappedMultilineLabel(Strings.message("sentiment.analysis.advanced.instructions")), 11); builder.appendUnrelatedComponentsGapRow(2); builder.append(Strings.message("sentiment.analysis.advanced.positive")); builder.append(Strings.message("sentiment.analysis.advanced.positive.factor"), spnPositivePercentage, new JLabel("")); builder.append(Strings.message("sentiment.analysis.advanced.color"), cbPositiveColor); builder.appendRelatedComponentsGapRow(2); builder.appendRow("50dlu:grow"); builder.append(new JScrollPane(taPositive), 11, CellConstraints.FILL, CellConstraints.FILL); builder.appendUnrelatedComponentsGapRow(2); builder.append(Strings.message("sentiment.analysis.advanced.negative")); builder.append(Strings.message("sentiment.analysis.advanced.negative.factor"), spnNegativePercentage, new JLabel("")); builder.append(Strings.message("sentiment.analysis.advanced.color"), cbNegativeColor); builder.appendRelatedComponentsGapRow(2); builder.appendRow("50dlu:grow"); builder.append(new JScrollPane(taNegative), 11, CellConstraints.FILL, CellConstraints.FILL); builder.appendUnrelatedComponentsGapRow(2); return builder.getPanel(); }
From source file:com.salas.bb.updates.ui.NewVersionAvailableDialog.java
License:Open Source License
/** * Builds dialog main panel.// w ww .j a v a2s . c om * * @return content component. */ private Component buildMainPanel() { boolean severalPackagesAvailable = applicableDownloads.length > 1; BBFormBuilder builder = new BBFormBuilder("250dlu"); builder.append(getWordingComponent(), 1, CellConstraints.FILL, CellConstraints.FILL); builder.appendUnrelatedComponentsGapRow(2); builder.append(Strings.message("updates.new.version.changes"), 1); builder.appendRelatedComponentsGapRow(2); builder.appendRow("50dlu"); builder.append(getChangesTableComponent(), 1, CellConstraints.FILL, CellConstraints.FILL); // Show "Show all downloads" checkbox if several packages available. builder.appendRelatedComponentsGapRow(2); if (severalPackagesAvailable || (applicableDownloads.length == 1 && !mainPackageAvailable)) { final Component detailsPanel = createPackagesDetailsPanel(); if (mainPackageAvailable) { builder.append(chShowAllDownloads); } else { builder.append(Strings.message("updates.new.version.availble.downloads"), 1); } builder.appendRelatedComponentsGapRow(2); builder.append(detailsPanel); detailsPanel.setVisible(!mainPackageAvailable); chShowAllDownloads.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { detailsPanel.setVisible(chShowAllDownloads.isSelected()); pack(); } }); } builder.append(lbDownloadSuggestion, 1); builder.appendUnrelatedComponentsGapRow(); return builder.getPanel(); }
From source file:com.salas.bb.updates.ui.NewVersionAvailableDialog.java
License:Open Source License
/** * Creates panel with package details./*from ww w. j av a 2s . com*/ * * @return panel with packages details. */ private Component createPackagesDetailsPanel() { BBFormBuilder builder = new BBFormBuilder("0:grow"); builder.appendRow("50dlu"); builder.append(getPackagesTableComponent(), 1, CellConstraints.FILL, CellConstraints.FILL); builder.appendRelatedComponentsGapRow(); return builder.getPanel(); }
From source file:com.salas.bb.utils.feedscollections.CListTree.java
License:Open Source License
/** * Creates component.//from w ww. j a va 2 s.c om * * @param collection collection to show. * @param treeMode <code>TRUE</code> to set tree mode by default. * @param readingLists <code>TRUE</code> if showing reading lists. */ public CListTree(Collection collection, boolean treeMode, boolean readingLists) { this.collection = collection; this.readingLists = readingLists; itemListener = new CItemListener(); setLayout(new BorderLayout()); setTreeMode(treeMode); BBFormBuilder builder = new BBFormBuilder("p, 2dlu, p, 0:grow"); JComboBox cbViewMode = new JComboBox(new Object[] { Strings.message("collections.viewmode.tree"), Strings.message("collections.viewmode.list") }); cbViewMode.setSelectedIndex(treeMode ? 0 : 1); cbViewMode.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { JComboBox box = (JComboBox) e.getSource(); boolean isTree = box.getSelectedIndex() == 0; setTreeMode(isTree); } }); builder.append(Strings.message("collections.viewmode"), cbViewMode); builder.appendRelatedComponentsGapRow(2); add(builder.getPanel(), BorderLayout.NORTH); // Description area taDescription = new JEditorPane(); Color back = taDescription.getBackground(); taDescription.setEditable(false); taDescription.setBackground(back); taDescription.setEditorKit(new CustomHTMLEditorKit()); HTMLDocument doc = (HTMLDocument) taDescription.getDocument(); Style def = doc.getStyle("default"); Font font = UIManager.getFont("TextArea.font"); if (SystemUtils.IS_OS_MAC) font = UifUtilities.applyFontBias(font, -2); UifUtilities.setFontAttributes(doc.addStyle(TEXT_STYLE, def), font); builder = new BBFormBuilder("0:grow"); builder.appendUnrelatedComponentsGapRow(2); builder.appendRow("p"); builder.append(Strings.message("collections.description"), 1); builder.appendRelatedComponentsGapRow(2); builder.appendRow("50px"); builder.append(taDescription, 1, CellConstraints.FILL, CellConstraints.FILL); add(builder.getPanel(), BorderLayout.SOUTH); }