Example usage for com.jgoodies.forms.layout CellConstraints CENTER

List of usage examples for com.jgoodies.forms.layout CellConstraints CENTER

Introduction

In this page you can find the example usage for com.jgoodies.forms.layout CellConstraints CENTER.

Prototype

Alignment CENTER

To view the source code for com.jgoodies.forms.layout CellConstraints CENTER.

Click Source Link

Document

Put the component in the center.

Usage

From source file:com.floreantpos.ui.dialog.DiscountListDialog.java

License:Open Source License

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL/*from  w  w w  .ja va2 s  .com*/
 */
private void $$$setupUI$$$() {
    contentPane = new JPanel();
    contentPane.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1));
    final JPanel panel1 = new JPanel();
    panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
    contentPane.add(panel1,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_SOUTH, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null,
                    null, 0, false));
    final Spacer spacer1 = new Spacer();
    panel1.add(spacer1,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
    final JPanel panel2 = new JPanel();
    panel2.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
    panel1.add(panel2,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    btnDeleteSelected = new PosButton();
    btnDeleteSelected.setIcon(IconFactory.getIcon("/ui_icons/", "delete.png")); //$NON-NLS-1$ //$NON-NLS-2$
    btnDeleteSelected.setPreferredSize(new Dimension(140, 50));
    btnDeleteSelected.setText(Messages.getString("DiscountListDialog.5")); //$NON-NLS-1$
    panel2.add(btnDeleteSelected);
    buttonOK = new PosButton();
    buttonOK.setIcon(IconFactory.getIcon("/ui_icons/", "finish.png")); //$NON-NLS-1$ //$NON-NLS-2$
    buttonOK.setPreferredSize(new Dimension(120, 50));
    buttonOK.setText(com.floreantpos.POSConstants.OK);
    panel2.add(buttonOK);
    buttonCancel = new PosButton();
    buttonCancel.setIcon(IconFactory.getIcon("/ui_icons/", "cancel.png")); //$NON-NLS-1$ //$NON-NLS-2$
    buttonCancel.setPreferredSize(new Dimension(120, 50));
    buttonCancel.setText(com.floreantpos.POSConstants.CANCEL);
    panel2.add(buttonCancel);
    final JPanel panel3 = new JPanel();
    panel3.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
    contentPane.add(panel3,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null,
                    new Dimension(458, 310), null, 0, false));
    final JScrollPane scrollPane1 = new JScrollPane();
    panel3.add(scrollPane1,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null,
                    null, 0, false));
    tableDiscounts = new JTable();
    scrollPane1.setViewportView(tableDiscounts);
    final JPanel panel4 = new JPanel();
    panel4.setLayout(new FormLayout("fill:p:grow", "center:d:grow,top:4dlu:noGrow,center:d:grow")); //$NON-NLS-1$ //$NON-NLS-2$
    panel3.add(panel4,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null,
                    null, 0, false));
    btnScrollUp = new PosButton();
    btnScrollUp.setIcon(IconFactory.getIcon("/ui_icons/", "up.png")); //$NON-NLS-1$ //$NON-NLS-2$
    btnScrollUp.setPreferredSize(new Dimension(50, 50));
    btnScrollUp.setText(""); //$NON-NLS-1$
    CellConstraints cc = new CellConstraints();
    panel4.add(btnScrollUp, cc.xy(1, 1, CellConstraints.CENTER, CellConstraints.BOTTOM));
    btnScrollDown = new PosButton();
    btnScrollDown.setIcon(IconFactory.getIcon("/ui_icons/", "down.png")); //$NON-NLS-1$ //$NON-NLS-2$
    btnScrollDown.setPreferredSize(new Dimension(50, 50));
    btnScrollDown.setText(""); //$NON-NLS-1$
    panel4.add(btnScrollDown, cc.xy(1, 3, CellConstraints.CENTER, CellConstraints.TOP));
}

From source file:com.salas.bb.dialogs.CleanupWizardDialog.java

License:Open Source License

/**
 * Appends 'Guide' selection subcomponent to content panel.
 * /*from w w  w  .j  a  v a  2s  .c  o m*/
 * @param formBuilder   form builder.
 */
private void appendGuideSelection(BBFormBuilder formBuilder) {
    formBuilder.append(Strings.message("cleanup.wizard.select.guide"), 1);
    formBuilder.append(cbGuides, 1, CellConstraints.FILL, CellConstraints.CENTER);
    formBuilder.nextColumn(4);
}

From source file:com.salas.bb.dialogs.CleanupWizardDialog.java

License:Open Source License

/**
 * Appends 'Delete article that:' selection subcomponent to content panel.
 * /* w  ww .  j a va2  s  .c  om*/
 * @param formBuilder   form builder.
 */
private void appendDeleteArticleSelection(BBFormBuilder formBuilder) {
    formBuilder.appendRow("16dlu");
    formBuilder.appendSeparator(Strings.message("cleanup.wizard.delete.articles"));
    formBuilder.append(chPurgeLimit, 3, CellConstraints.FILL, CellConstraints.CENTER);
    formBuilder.append(spPurgeLimit, 1, CellConstraints.FILL, CellConstraints.CENTER);
    formBuilder.append(Strings.message("cleanup.wizard.articles"), 1);
    formBuilder.append(chNotPinned, 7);
    formBuilder.append(chArticleAge, 3);
    formBuilder.append(spArticleAge);
    formBuilder.append(Strings.message("cleanup.wizard.days"), 1);
}

From source file:com.salas.bb.dialogs.CleanupWizardDialog.java

License:Open Source License

/**
 * Appends 'Delete feed that:' selection subcomponent to content panel.
 * //  w  w  w .jav  a 2  s. c o m
 * @param formBuilder   form builder.
 */
private void appendDeleteFeedSelection(BBFormBuilder formBuilder) {
    formBuilder.appendRow("16dlu");
    formBuilder.appendSeparator(Strings.message("cleanup.wizard.delete.feeds.that"));

    formBuilder.append(this.chRating, 3, CellConstraints.FILL, CellConstraints.CENTER);
    formBuilder.append(this.cRating, 1, CellConstraints.FILL, CellConstraints.CENTER);
    formBuilder.append(Strings.message("cleanup.wizard.starz"), 1);

    formBuilder.append(this.chArticlePublishPeriod, 3, CellConstraints.FILL, CellConstraints.CENTER);
    formBuilder.append(this.spArticlePublishPeriod, 1, CellConstraints.FILL, CellConstraints.CENTER);
    formBuilder.append(Strings.message("cleanup.wizard.days"), 1);

    formBuilder.append(this.chFeedNonAttendancePeriod, 3, CellConstraints.FILL, CellConstraints.CENTER);
    formBuilder.append(this.spFeedNonAttendancePeriod, 1, CellConstraints.FILL, CellConstraints.CENTER);
    formBuilder.append(Strings.message("cleanup.wizard.days"), 1);
}

From source file:com.salas.bb.dialogs.DirectFeedPropertiesDialog.java

License:Open Source License

/**
 * Creates blog starz tab.//from   ww w .jav  a 2s  .co m
 *
 * @return tab.
 */
private Component createBlogStarzTab() {
    ScoresCalculator calc = GlobalModel.SINGLETON.getScoreCalculator();
    double activity = calc.calcActivity(feed);
    double inlinks = calc.calcInlinksScore(feed);
    double views = calc.calcFeedViewsScore(feed);
    double clickthroughs = calc.calcClickthroughsScore(feed);
    blogStarzScore = calc.calcBlogStarzScore(feed);
    rating = feed.getRating();

    StarzPreferences prefs = GlobalModel.SINGLETON.getStarzPreferences();
    int activityWeight = prefs.getActivityWeight();
    int inlinksWeight = prefs.getInlinksWeight();
    int viewsWeight = prefs.getFeedViewsWeight();
    int clickthroughsWeight = prefs.getClickthroughsWeight();

    String msg = feed.getTextualInboundLinks();

    lbFinalScore = new JLabel();
    lbFinalScore.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    lbFinalScore.addMouseListener(new FinalScoreStarzListener());
    updateFinalScoreIcon();

    JLabel lbTechnoratiInlinks = new JLabel(msg);
    JLabel lbActivity = new JLabel(
            MessageFormat.format(Strings.message("show.feed.properties.tab.blogstarz.0.weight.1"),
                    DECIMAL_FORMAT.format(activity), activityWeight));
    JLabel lbInLinks = new JLabel(
            MessageFormat.format(Strings.message("show.feed.properties.tab.blogstarz.0.weight.1"),
                    DECIMAL_FORMAT.format(inlinks), inlinksWeight));
    JLabel lbViews = new JLabel(
            MessageFormat.format(Strings.message("show.feed.properties.tab.blogstarz.0.weight.1"),
                    DECIMAL_FORMAT.format(views), viewsWeight));
    JLabel lbClickthroughs = new JLabel(
            MessageFormat.format(Strings.message("show.feed.properties.tab.blogstarz.0.weight.1"),
                    DECIMAL_FORMAT.format(clickthroughs), clickthroughsWeight));
    JLabel lbRecommendation = new JLabel(FeedFormatter.getStarzIcon(blogStarzScore, true));

    BBFormBuilder builder = new BBFormBuilder("pref, 4dlu, pref, 4dlu, pref:grow");
    builder.setDefaultDialogBorder();

    builder.append(Strings.message("show.feed.properties.tab.blogstarz.technorati.inlinks"),
            lbTechnoratiInlinks, 3);
    builder.append(Strings.message("show.feed.properties.tab.blogstarz.activity"), lbActivity, 3);
    builder.append(Strings.message("show.feed.properties.tab.blogstarz.inlinks"), lbInLinks, 3);
    builder.append(Strings.message("show.feed.properties.tab.blogstarz.views"), lbViews, 3);
    builder.append(Strings.message("show.feed.properties.tab.blogstarz.clickthroughs"), lbClickthroughs, 3);
    builder.append(Strings.message("show.feed.properties.tab.blogstarz.recommendation"), 1);
    builder.append(lbRecommendation, 1, CellConstraints.LEFT, CellConstraints.CENTER);
    builder.appendUnrelatedComponentsGapRow(2);
    builder.append(Strings.message("show.feed.properties.tab.blogstarz.final.rating"), 1);
    builder.append(lbFinalScore, 1, CellConstraints.LEFT, CellConstraints.CENTER);
    builder.append(new JButton(new RevertAction()), 1, CellConstraints.RIGHT, CellConstraints.CENTER);
    builder.appendRow("pref:grow");
    builder.append(
            ComponentsFactory
                    .createWrappedMultilineLabel(Strings.message("show.feed.properties.tab.blogstarz.notes")),
            5, CellConstraints.FILL, CellConstraints.BOTTOM);

    return builder.getPanel();
}

From source file:com.salas.bb.installation.wizard.WelcomePage.java

License:Open Source License

/**
 * Builds the panel using the specified button bar.
 * //  ww w  .j  a  v a 2s  . c om
 * @param buttonBar button bar to use.
 */
public void build(JComponent buttonBar) {
    initComponents();

    JScrollPane sp = new JScrollPane(welcomeText);

    BBFormBuilder builder = new BBFormBuilder("0, pref:grow, 0", this);
    builder.setDefaultDialogBorder();

    builder.append(logo, 3, CellConstraints.CENTER, CellConstraints.DEFAULT);
    builder.appendUnrelatedComponentsGapRow(2);
    builder.appendRow("50dlu:grow");
    builder.append(sp, 3, CellConstraints.FILL, CellConstraints.FILL);
    builder.appendUnrelatedComponentsGapRow(2);
    builder.append(buttonBar, 3, CellConstraints.RIGHT, CellConstraints.DEFAULT);
}

From source file:com.salas.bb.reports.AbstractMostReadPinnedReport.java

License:Open Source License

/**
 * Creates a table for stats display.// ww  w  . ja  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.AbstractMostVisitedReport.java

License:Open Source License

/**
 * Creates a table for stats display./*from   w w w . j a va 2 s .  co m*/
 *
 * @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, max(p;50dlu), 2dlu, max(p;50dlu)",
            table);
    builder.setDefaultDialogBorder();

    // Output header
    builder.append(UifUtilities.boldFont(new JLabel(headerEntityTitle)), 3);
    builder.append(UifUtilities.boldFont(new JLabel(Strings.message("report.since.reset"))), 1,
            CellConstraints.CENTER, CellConstraints.DEFAULT);
    builder.append(UifUtilities.boldFont(new JLabel(Strings.message("report.all.time"))), 1,
            CellConstraints.CENTER, CellConstraints.DEFAULT);

    // Output data
    int i = 0;
    for (VisitStats stat : visitStats) {
        if (i++ == max)
            break;

        builder.append(new JLabel(itemIcon));
        builder.append(createLabel(stat.getObjectId(), stat.getObjectTitle()));
        builder.append(new JLabel(Long.toString(stat.getCountReset())), 1, CellConstraints.CENTER,
                CellConstraints.DEFAULT);
        builder.append(new JLabel(Long.toString(stat.getCountTotal())), 1, CellConstraints.CENTER,
                CellConstraints.DEFAULT);
    }

    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   w w  w.j av  a 2s.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();//from  w ww  . j  av a  2s  .  co 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);
}