Example usage for javax.swing Box createHorizontalStrut

List of usage examples for javax.swing Box createHorizontalStrut

Introduction

In this page you can find the example usage for javax.swing Box createHorizontalStrut.

Prototype

public static Component createHorizontalStrut(int width) 

Source Link

Document

Creates an invisible, fixed-width component.

Usage

From source file:org.colombbus.tangara.ConfigurationWindow.java

/**
 * This method initializes bottomPanel/*  w  w w.  ja v a 2  s .  com*/
 *
 * @return javax.swing.JPanel
 */
private JPanel getBottomPanel() {
    if (bottomPanel == null) {
        bottomPanel = new JPanel();
        bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.X_AXIS));
        bottomPanel.add(getRestoreButton());
        bottomPanel.add(Box.createHorizontalStrut(10));
        bottomPanel.add(getSaveButton());
        bottomPanel.add(Box.createHorizontalGlue());
        bottomPanel.add(getCancelButton());
        bottomPanel.setBorder(new EmptyBorder(MARGIN_Y, MARGIN_X, MARGIN_X, MARGIN_Y));
    }
    return bottomPanel;
}

From source file:org.datacleaner.panels.WelcomePanel.java

private JComponent createButtonPanel() {
    final String newJobText = SystemProperties.getString(SystemProperties.UI_DESKTOP_TEXT_NEW_JOB_BUTTON,
            "Build new job");
    final JButton newJobButton = WidgetFactory.createPrimaryButton(newJobText, IconUtils.MODEL_JOB);
    newJobButton.addActionListener(new ActionListener() {

        @Override/*  w  w w. j a v a  2 s  . c  o m*/
        public void actionPerformed(ActionEvent e) {
            getWindow().changePanel(AnalysisWindowPanelType.SELECT_DS);
        }
    });

    final PopupButton recentJobsButton = WidgetFactory.createDefaultPopupButton("Recent jobs",
            IconUtils.FILE_HOME_FOLDER);
    recentJobsButton.setMenuPosition(MenuPosition.TOP);
    recentJobsButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            refreshRecentJobs(recentJobsButton);
        }
    });
    final JButton browseJobsButton = WidgetFactory.createDefaultButton("Browse jobs", IconUtils.FILE_FOLDER);
    browseJobsButton.addActionListener(_openAnalysisJobActionListener);

    final JButton manageDatastoresButton = WidgetFactory.createDefaultButton("Manage datastores",
            IconUtils.GENERIC_DATASTORE_IMAGEPATH);
    manageDatastoresButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            getWindow().changePanel(AnalysisWindowPanelType.MANAGE_DS);
        }
    });

    final DCPanel buttonPanel = new DCPanel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
    buttonPanel.add(newJobButton);
    buttonPanel.add(Box.createHorizontalStrut(10));
    buttonPanel.add(browseJobsButton);
    buttonPanel.add(Box.createHorizontalStrut(10));
    buttonPanel.add(recentJobsButton);
    buttonPanel.add(Box.createHorizontalStrut(10));
    buttonPanel.add(manageDatastoresButton);
    buttonPanel.setBorder(new EmptyBorder(0, 0, 20, 0));

    return wrapContent(buttonPanel);
}

From source file:org.datacleaner.windows.AnalysisJobBuilderWindowImpl.java

private JComponent getWindowPanelContent() {
    if (_datastore != null) {
        setDatastore(_datastore);/* w  w  w  .  j av  a 2 s .c  o  m*/
    }

    final SaveAnalysisJobActionListener saveAnalysisJobActionListener = _saveAnalysisJobActionListenerProvider
            .get();
    _saveButton.addActionListener(saveAnalysisJobActionListener);
    _saveAsButton.addActionListener(saveAnalysisJobActionListener);
    _saveAsButton.setActionCommand(SaveAnalysisJobActionListener.ACTION_COMMAND_SAVE_AS);

    // Run analysis
    _executeButton.addActionListener(execute(_analysisJobBuilder));

    _executionAlternativesButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            final JMenuItem executeNormallyMenutItem = WidgetFactory.createMenuItem("Run normally",
                    IconUtils.ACTION_EXECUTE);
            executeNormallyMenutItem.addActionListener(execute(_analysisJobBuilder));

            final JMenuItem executePreviewMenuItem = WidgetFactory.createMenuItem("Run first N records",
                    IconUtils.ACTION_PREVIEW);
            executePreviewMenuItem.addActionListener(executePreview());

            final JMenuItem executeSingleThreadedMenuItem = WidgetFactory.createMenuItem("Run single-threaded",
                    IconUtils.MODEL_ROW);
            executeSingleThreadedMenuItem.addActionListener(executeSingleThreaded());

            final JPopupMenu menu = new JPopupMenu();
            menu.add(executeNormallyMenutItem);
            menu.addSeparator();
            menu.add(executePreviewMenuItem);
            menu.add(executeSingleThreadedMenuItem);

            final int horizontalPosition = -1 * menu.getPreferredSize().width
                    + _executionAlternativesButton.getWidth();
            menu.show(_executionAlternativesButton, horizontalPosition,
                    _executionAlternativesButton.getHeight());
        }
    });

    final JButton newJobButton = createToolbarButton("New", IconUtils.MENU_NEW);
    newJobButton.addActionListener(_newAnalysisJobActionListenerProvider.get());

    final JButton openJobButton = createToolbarButton("Open", IconUtils.MENU_OPEN);
    openJobButton.addActionListener(_openAnalysisJobActionListenerProvider.get());

    final JToggleButton moreButton = createMoreMenuButton();

    final JButton logoButton = new JButton(imageManager.getImageIcon("images/menu/dc-logo-30.png"));
    logoButton.setToolTipText("About DataCleaner");
    logoButton.setBorder(new EmptyBorder(0, 4, 0, 10));
    logoButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            new AboutDialog(getWindowContext()).open();
        }
    });

    final JToolBar toolBar = WidgetFactory.createToolBar();
    toolBar.add(logoButton);
    toolBar.add(newJobButton);
    toolBar.add(openJobButton);
    toolBar.add(_saveButton);
    toolBar.add(_saveAsButton);
    toolBar.add(DCLabel.bright(" | "));
    toolBar.add(moreButton);

    toolBar.add(WidgetFactory.createToolBarSeparator());
    toolBar.add(_executeButton);
    toolBar.add(DCLabel.bright("|"));
    toolBar.add(_executionAlternativesButton);

    final JXStatusBar statusBar = WidgetFactory.createStatusBar(_statusLabel);
    statusBar.add(_classicViewButton);
    statusBar.add(_graphViewButton);
    statusBar.add(Box.createHorizontalStrut(10));

    final LicenceAndEditionStatusLabel statusLabel = new LicenceAndEditionStatusLabel(_glassPane);
    statusBar.add(statusLabel);

    final DCPanel toolBarPanel = new DCPanel(WidgetUtils.BG_COLOR_DARK);
    toolBarPanel.setLayout(new BorderLayout());
    toolBarPanel.add(toolBar, BorderLayout.CENTER);

    final DCPanel panel = new DCPersistentSizedPanel(_windowSizePreference);
    panel.setLayout(new BorderLayout());
    panel.add(toolBarPanel, BorderLayout.NORTH);
    panel.add(_leftPanel, BorderLayout.WEST);

    // newPanel.add(_tabbedPane, BorderLayout.NORTH);
    panel.add(_contentContainerPanel, BorderLayout.CENTER);

    panel.add(statusBar, BorderLayout.SOUTH);

    // invoke to trigger enablement/disablement of buttons.
    onSourceColumnsChanged();
    updateStatusLabel();

    WidgetUtils.centerOnScreen(this);
    return panel;
}

From source file:org.datacleaner.windows.OpenAnalysisJobAsTemplateDialog.java

@Override
protected JComponent getDialogContent() {
    final DCPanel panel = new DCPanel();

    int row = 0;/*  w w  w. jav  a 2s . c  o  m*/
    WidgetUtils.addToGridBag(DCLabel.bright("<html><b>Original value:</b></html>"), panel, 1, row);
    WidgetUtils.addToGridBag(DCLabel.bright("<html><b>New/mapped value:</b></html>"), panel, 2, row);

    row++;
    WidgetUtils.addToGridBag(new JLabel(imageManager.getImageIcon(IconUtils.GENERIC_DATASTORE_IMAGEPATH)),
            panel, 0, row);
    WidgetUtils.addToGridBag(DCLabel.bright(_metadata.getDatastoreName()), panel, 1, row,
            GridBagConstraints.WEST);

    DCPanel datastoreButtonPanel = new DCPanel();
    datastoreButtonPanel.setLayout(new HorizontalLayout(0));
    datastoreButtonPanel.add(_datastoreCombobox);
    datastoreButtonPanel.add(Box.createHorizontalStrut(4));
    datastoreButtonPanel.add(_autoMapButton);

    WidgetUtils.addToGridBag(datastoreButtonPanel, panel, 2, row, GridBagConstraints.WEST);

    Set<String> tableNames = _sourceColumnComboBoxes.keySet();
    for (final String tableName : tableNames) {
        row++;
        final JLabel tableLabel = DCLabel.bright("<html><b>" + tableName + "</b></html>");
        tableLabel.setIcon(imageManager.getImageIcon(IconUtils.MODEL_TABLE, IconUtils.ICON_SIZE_SMALL));
        WidgetUtils.addToGridBag(tableLabel, panel, 0, row, 2, 1, GridBagConstraints.WEST);

        final JButton clearButton = WidgetFactory.createDefaultButton("Clear");
        clearButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                List<SourceColumnComboBox> comboBoxes = _sourceColumnComboBoxes.get(tableName);
                for (SourceColumnComboBox comboBox : comboBoxes) {
                    comboBox.setModel(_datastore, false);
                }
            }
        });
        final DCPanel clearButtonPanel = new DCPanel();
        clearButtonPanel.add(clearButton);
        WidgetUtils.addToGridBag(clearButtonPanel, panel, 2, row, GridBagConstraints.CENTER);

        final List<SourceColumnComboBox> comboBoxes = _sourceColumnComboBoxes.get(tableName);
        for (SourceColumnComboBox comboBox : comboBoxes) {
            row++;
            WidgetUtils.addToGridBag(
                    new JLabel(imageManager.getImageIcon(IconUtils.MODEL_COLUMN, IconUtils.ICON_SIZE_SMALL)),
                    panel, 0, row);
            WidgetUtils.addToGridBag(DCLabel.bright(comboBox.getName()), panel, 1, row,
                    GridBagConstraints.WEST);
            WidgetUtils.addToGridBag(comboBox, panel, 2, row, GridBagConstraints.WEST);
        }
    }
    row++;

    if (!_variableTextFields.isEmpty()) {
        final JLabel tableLabel = DCLabel.bright("<html><b>Job-level variables</b></html>");
        tableLabel.setIcon(imageManager.getImageIcon(IconUtils.MODEL_JOB, IconUtils.ICON_SIZE_SMALL));
        WidgetUtils.addToGridBag(tableLabel, panel, 0, row, 2, 1, GridBagConstraints.WEST);

        for (Entry<String, JXTextField> entry : _variableTextFields.entrySet()) {
            row++;
            String variableId = entry.getKey();
            JXTextField textField = entry.getValue();

            WidgetUtils.addToGridBag(
                    new JLabel(
                            imageManager.getImageIcon("images/model/variable.png", IconUtils.ICON_SIZE_SMALL)),
                    panel, 0, row);
            WidgetUtils.addToGridBag(DCLabel.bright(variableId), panel, 1, row, GridBagConstraints.WEST);
            WidgetUtils.addToGridBag(textField, panel, 2, row, GridBagConstraints.WEST);
        }
        row++;
    }

    final DCPanel openButtonPanel = new DCPanel();
    openButtonPanel.add(_openButton);
    WidgetUtils.addToGridBag(openButtonPanel, panel, 2, row, GridBagConstraints.EAST);

    return WidgetUtils.scrolleable(panel);
}

From source file:org.ecoinformatics.seek.ecogrid.RegistrySearchDialog.java

/**
 * Construct of this dialog/*from w w  w  .  j a v a2s  . c  o  m*/
 * 
 * @param parent
 *            Frame
 * @param title
 *            String
 */
public RegistrySearchDialog(EcogridPreferencesTab parent, String title, Vector originalServiceList) {
    this.parent = parent;
    this.originalServiceList = originalServiceList;
    this.setLocation(parent.getLocation());
    setSize(new Dimension(WIDTH, HEIGHT));
    initMainPanel();
    getContentPane().add(Box.createVerticalStrut(EcogridPreferencesTab.MARGINGSIZE), BorderLayout.NORTH);
    getContentPane().add(Box.createHorizontalStrut(EcogridPreferencesTab.MARGINGSIZE), BorderLayout.EAST);
    getContentPane().add(mainPanel, BorderLayout.CENTER);
    getContentPane().add(Box.createVerticalStrut(EcogridPreferencesTab.MARGINGSIZE), BorderLayout.SOUTH);
    getContentPane().add(Box.createHorizontalStrut(EcogridPreferencesTab.MARGINGSIZE), BorderLayout.WEST);
    setVisible(true);
}

From source file:org.ecoinformatics.seek.ecogrid.RegistrySearchDialog.java

private void initMainPanel() {
    JPanel selectionPanel = new JPanel();
    selectionPanel.setLayout(new BoxLayout(selectionPanel, BoxLayout.X_AXIS));
    initOptions();//from www .ja va  2 s  .c om
    optionList = new JComboBox(options);
    optionList.setEditable(false);
    optionList.addItemListener(new TextFieldEnableController());
    selectionPanel.add(optionList);
    selectionPanel.add(Box.createHorizontalStrut(EcogridPreferencesTab.GAP));
    JLabel label = new JLabel(CONTAINS);
    selectionPanel.add(label);
    selectionPanel.add(Box.createHorizontalStrut(EcogridPreferencesTab.GAP));
    inputField.setEnabled(false);
    selectionPanel.add(inputField);
    selectionPanel.add(Box.createHorizontalGlue());

    mainPanel.setLayout(new BorderLayout());
    mainPanel.add(selectionPanel, BorderLayout.NORTH);
    mainPanel.add(Box.createVerticalGlue(), BorderLayout.CENTER);

    JPanel buttonPanel = new JPanel();
    JPanel rightButtonPanel = new JPanel();
    rightButtonPanel.setLayout(new BoxLayout(rightButtonPanel, BoxLayout.X_AXIS));
    /*searchButton = new JButton(new SearchRegistryAction("Search", this,
    parent, parent.getLocation()));
    searchButton.setPreferredSize(ServicesDisplayFrame.BUTTONDIMENSION);
    searchButton.setMaximumSize(ServicesDisplayFrame.BUTTONDIMENSION);
    rightButtonPanel.add(searchButton);*/
    rightButtonPanel.add(Box.createHorizontalStrut(EcogridPreferencesTab.MARGINGSIZE));
    cancelButton = new JButton(new CancelSearchAction("Cancel", this, parent));
    cancelButton.setPreferredSize(EcogridPreferencesTab.BUTTONDIMENSION);
    cancelButton.setMaximumSize(EcogridPreferencesTab.BUTTONDIMENSION);
    rightButtonPanel.add(cancelButton);
    buttonPanel.setLayout(new BorderLayout());
    buttonPanel.add(Box.createHorizontalGlue(), BorderLayout.CENTER);
    buttonPanel.add(rightButtonPanel, BorderLayout.EAST);

    mainPanel.add(buttonPanel, BorderLayout.SOUTH);
}

From source file:org.eobjects.datacleaner.panels.WelcomePanel.java

private void updateDatastores() {
    Datastore selectedDatastore = getSelectedDatastore();
    _datastoreListPanel.removeAll();//from w ww .  j  av  a  2 s  .  c  o  m
    _datastorePanels.clear();

    final DCLabel existingDatastoresLabel = DCLabel.dark("Existing datastores:");
    existingDatastoresLabel.setFont(WidgetUtils.FONT_HEADER2);

    final DCPanel searchDatastorePanel = DCPanel.around(_searchDatastoreTextField);
    searchDatastorePanel.setBorder(WidgetUtils.BORDER_SHADOW);

    final DCPanel headerPanel = new DCPanel();
    headerPanel.setLayout(new FlowLayout(Alignment.LEFT.getFlowLayoutAlignment(), 0, 0));
    headerPanel.add(existingDatastoresLabel);
    headerPanel.add(Box.createHorizontalStrut(20));
    headerPanel.add(searchDatastorePanel);

    _datastoreListPanel.add(headerPanel);

    boolean selectFirst = true;

    String[] datastoreNames = _datastoreCatalog.getDatastoreNames();
    for (int i = 0; i < datastoreNames.length; i++) {
        final Datastore datastore = _datastoreCatalog.getDatastore(datastoreNames[i]);
        DatastorePanel datastorePanel = new DatastorePanel(datastore, _datastoreCatalog, this,
                _analysisJobBuilderWindow.getWindowContext(), _injectorBuilder);
        _datastorePanels.add(datastorePanel);
        _datastoreListPanel.add(datastorePanel);

        if (selectedDatastore != null && selectedDatastore.getName().equals(datastore.getName())) {
            selectFirst = false;
            setSelectedDatastore(datastore);
        }
    }

    if (selectFirst) {
        selectFirstVisibleDatastore();
    }
}

From source file:org.eobjects.datacleaner.panels.WelcomePanel.java

private DCPanel createNewDatastorePanel() {
    final DCPanel panel = new DCPanel();
    panel.setBorder(WidgetUtils.BORDER_LIST_ITEM);
    panel.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
    panel.add(createNewDatastoreButton("CSV file",
            "Comma-separated values (CSV) file (or file with other separators)", IconUtils.CSV_IMAGEPATH,
            CsvDatastore.class, CsvDatastoreDialog.class));
    panel.add(createNewDatastoreButton("Excel spreadsheet",
            "Microsoft Excel spreadsheet. Either .xls (97-2003) or .xlsx (2007+) format.",
            IconUtils.EXCEL_IMAGEPATH, ExcelDatastore.class, ExcelDatastoreDialog.class));
    panel.add(createNewDatastoreButton("Access database", "Microsoft Access database file (.mdb).",
            IconUtils.ACCESS_IMAGEPATH, AccessDatastore.class, AccessDatastoreDialog.class));
    panel.add(createNewDatastoreButton("SAS library", "A directory of SAS library files (.sas7bdat).",
            IconUtils.SAS_IMAGEPATH, SasDatastore.class, SasDatastoreDialog.class));
    panel.add(createNewDatastoreButton("DBase database", "DBase database file (.dbf)",
            IconUtils.DBASE_IMAGEPATH, DbaseDatastore.class, DbaseDatastoreDialog.class));
    panel.add(createNewDatastoreButton("Fixed width file",
            "Text file with fixed width values. Each value spans a fixed amount of text characters.",
            IconUtils.FIXEDWIDTH_IMAGEPATH, FixedWidthDatastore.class, FixedWidthDatastoreDialog.class));
    panel.add(createNewDatastoreButton("XML file", "Extensible Markup Language file (.xml)",
            IconUtils.XML_IMAGEPATH, XmlDatastore.class, XmlDatastoreDialog.class));
    panel.add(createNewDatastoreButton("JSON file", "JavaScript Object NOtation file (.json).",
            IconUtils.JSON_IMAGEPATH, JsonDatastore.class, JsonDatastoreDialog.class));
    panel.add(// w w w. j  av  a 2  s  .  co  m
            createNewDatastoreButton("OpenOffice.org Base database", "OpenOffice.org Base database file (.odb)",
                    IconUtils.ODB_IMAGEPATH, OdbDatastore.class, OdbDatastoreDialog.class));

    panel.add(Box.createHorizontalStrut(10));

    panel.add(createNewDatastoreButton("Salesforce.com", "Connect to a Salesforce.com account",
            IconUtils.SALESFORCE_IMAGEPATH, SalesforceDatastore.class, SalesforceDatastoreDialog.class));
    panel.add(createNewDatastoreButton("SugarCRM", "Connect to a SugarCRM system",
            IconUtils.SUGAR_CRM_IMAGEPATH, SugarCrmDatastore.class, SugarCrmDatastoreDialog.class));

    panel.add(Box.createHorizontalStrut(10));

    panel.add(createNewDatastoreButton("MongoDB database", "Connect to a MongoDB database",
            IconUtils.MONGODB_IMAGEPATH, MongoDbDatastore.class, MongoDbDatastoreDialog.class));

    panel.add(createNewDatastoreButton("CouchDB database", "Connect to an Apache CouchDB database",
            IconUtils.COUCHDB_IMAGEPATH, CouchDbDatastore.class, CouchDbDatastoreDialog.class));

    panel.add(createNewDatastoreButton("HBase database", "Connect to an Apache HBase database",
            IconUtils.HBASE_IMAGEPATH, HBaseDatastore.class, HBaseDatastoreDialog.class));

    // set of databases that are displayed directly on panel
    final Set<String> databaseNames = new HashSet<String>();

    createDefaultDatabaseButtons(panel, databaseNames);

    final JButton moreDatastoreTypesButton = new JButton("More",
            imageManager.getImageIcon(IconUtils.FILE_FOLDER, IconUtils.ICON_SIZE_SMALL));
    moreDatastoreTypesButton.setMargin(new Insets(1, 1, 1, 4));
    moreDatastoreTypesButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            final JPopupMenu popup = new JPopupMenu();

            // installed databases
            final List<DatabaseDriverDescriptor> databaseDrivers = _databaseDriverCatalog
                    .getInstalledWorkingDatabaseDrivers();
            for (DatabaseDriverDescriptor databaseDriver : databaseDrivers) {
                final String databaseName = databaseDriver.getDisplayName();
                if (!databaseNames.contains(databaseName)) {
                    final String imagePath = databaseDriver.getIconImagePath();
                    final ImageIcon icon = imageManager.getImageIcon(imagePath, IconUtils.ICON_SIZE_SMALL);
                    final JMenuItem menuItem = WidgetFactory.createMenuItem(databaseName, icon);
                    menuItem.addActionListener(createJdbcActionListener(databaseName));
                    popup.add(menuItem);
                }
            }

            // custom/other jdbc connection
            {
                final ImageIcon icon = imageManager.getImageIcon(IconUtils.GENERIC_DATASTORE_IMAGEPATH,
                        IconUtils.ICON_SIZE_SMALL);
                final JMenuItem menuItem = WidgetFactory.createMenuItem("Other database", icon);
                menuItem.addActionListener(createJdbcActionListener(null));
                popup.add(menuItem);
            }

            // composite datastore
            final JMenuItem compositeMenuItem = WidgetFactory.createMenuItem("Composite datastore",
                    imageManager.getImageIcon(IconUtils.COMPOSITE_IMAGEPATH, IconUtils.ICON_SIZE_SMALL));
            compositeMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    new CompositeDatastoreDialog(_datastoreCatalog,
                            _analysisJobBuilderWindow.getWindowContext()).setVisible(true);
                }
            });

            final JMenuItem databaseDriversMenuItem = WidgetFactory.createMenuItem("Manage database drivers...",
                    imageManager.getImageIcon(IconUtils.MENU_OPTIONS, IconUtils.ICON_SIZE_SMALL));
            databaseDriversMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    OptionsDialog dialog = _optionsDialogProvider.get();
                    dialog.selectDatabaseDriversTab();
                    dialog.setVisible(true);
                }
            });

            popup.add(databaseDriversMenuItem);
            popup.add(new JSeparator(JSeparator.HORIZONTAL));
            popup.add(compositeMenuItem);
            popup.setBorder(WidgetUtils.BORDER_THIN);

            popup.show(moreDatastoreTypesButton, 0, moreDatastoreTypesButton.getHeight());
        }
    });

    panel.add(Box.createHorizontalStrut(10));
    panel.add(moreDatastoreTypesButton);

    return panel;
}

From source file:org.eobjects.datacleaner.windows.OpenAnalysisJobAsTemplateDialog.java

@Override
protected JComponent getDialogContent() {
    final DCPanel panel = new DCPanel();

    int row = 0;/*  w w  w . j  a va 2  s .  c  om*/
    WidgetUtils.addToGridBag(DCLabel.bright("<html><b>Original value:</b></html>"), panel, 1, row);
    WidgetUtils.addToGridBag(DCLabel.bright("<html><b>New/mapped value:</b></html>"), panel, 2, row);

    row++;
    WidgetUtils.addToGridBag(new JLabel(imageManager.getImageIcon("images/model/datastore.png")), panel, 0,
            row);
    WidgetUtils.addToGridBag(DCLabel.bright(_metadata.getDatastoreName()), panel, 1, row,
            GridBagConstraints.WEST);

    DCPanel datastoreButtonPanel = new DCPanel();
    datastoreButtonPanel.setLayout(new HorizontalLayout(0));
    datastoreButtonPanel.add(_datastoreCombobox);
    datastoreButtonPanel.add(Box.createHorizontalStrut(4));
    datastoreButtonPanel.add(_autoMapButton);

    WidgetUtils.addToGridBag(datastoreButtonPanel, panel, 2, row, GridBagConstraints.WEST);

    Set<String> tableNames = _sourceColumnComboBoxes.keySet();
    for (final String tableName : tableNames) {
        row++;
        final JLabel tableLabel = DCLabel.bright("<html><b>" + tableName + "</b></html>");
        tableLabel.setIcon(imageManager.getImageIcon("images/model/table.png", IconUtils.ICON_SIZE_SMALL));
        WidgetUtils.addToGridBag(tableLabel, panel, 0, row, 2, 1, GridBagConstraints.WEST);

        final JButton clearButton = new JButton("Clear");
        clearButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                List<SourceColumnComboBox> comboBoxes = _sourceColumnComboBoxes.get(tableName);
                for (SourceColumnComboBox comboBox : comboBoxes) {
                    comboBox.setModel(_datastore, false);
                }
            }
        });
        final DCPanel clearButtonPanel = new DCPanel();
        clearButtonPanel.add(clearButton);
        WidgetUtils.addToGridBag(clearButtonPanel, panel, 2, row, GridBagConstraints.CENTER);

        final List<SourceColumnComboBox> comboBoxes = _sourceColumnComboBoxes.get(tableName);
        for (SourceColumnComboBox comboBox : comboBoxes) {
            row++;
            WidgetUtils.addToGridBag(
                    new JLabel(imageManager.getImageIcon("images/model/column.png", IconUtils.ICON_SIZE_SMALL)),
                    panel, 0, row);
            WidgetUtils.addToGridBag(DCLabel.bright(comboBox.getName()), panel, 1, row,
                    GridBagConstraints.WEST);
            WidgetUtils.addToGridBag(comboBox, panel, 2, row, GridBagConstraints.WEST);
        }
    }
    row++;

    if (!_variableTextFields.isEmpty()) {
        final JLabel tableLabel = DCLabel.bright("<html><b>Job-level variables</b></html>");
        tableLabel.setIcon(
                imageManager.getImageIcon("images/filetypes/analysis_job.png", IconUtils.ICON_SIZE_SMALL));
        WidgetUtils.addToGridBag(tableLabel, panel, 0, row, 2, 1, GridBagConstraints.WEST);

        for (Entry<String, JXTextField> entry : _variableTextFields.entrySet()) {
            row++;
            String variableId = entry.getKey();
            JXTextField textField = entry.getValue();

            WidgetUtils.addToGridBag(
                    new JLabel(
                            imageManager.getImageIcon("images/model/variable.png", IconUtils.ICON_SIZE_SMALL)),
                    panel, 0, row);
            WidgetUtils.addToGridBag(DCLabel.bright(variableId), panel, 1, row, GridBagConstraints.WEST);
            WidgetUtils.addToGridBag(textField, panel, 2, row, GridBagConstraints.WEST);
        }
        row++;
    }

    final DCPanel openButtonPanel = new DCPanel();
    openButtonPanel.add(_openButton);
    WidgetUtils.addToGridBag(openButtonPanel, panel, 2, row, GridBagConstraints.EAST);

    return WidgetUtils.scrolleable(panel);
}

From source file:org.eobjects.datacleaner.windows.ResultWindow.java

@Override
protected JComponent getWindowContent() {
    DCPanel panel = new DCPanel(WidgetUtils.BG_COLOR_DARK, WidgetUtils.BG_COLOR_DARK);
    panel.setLayout(new BorderLayout());

    String bannerTitle = "Analysis results";
    String datastoreName = getDatastoreName();
    if (!StringUtils.isNullOrEmpty(datastoreName)) {
        bannerTitle = bannerTitle + " | " + datastoreName;

        if (_jobFilename != null) {
            bannerTitle = bannerTitle + " | " + _jobFilename.getName().getBaseName();
        }/*from   w w w. java 2s.  c  o  m*/
    }

    final DCBannerPanel banner = new DCBannerPanel(imageManager.getImage("images/window/banner-results.png"),
            bannerTitle);
    banner.setLayout(null);
    _tabbedPane.bindTabTitleToBanner(banner);

    final FlowLayout layout = new FlowLayout(Alignment.RIGHT.getFlowLayoutAlignment(), 4, 36);
    layout.setAlignOnBaseline(true);
    banner.setLayout(layout);

    for (JComponent pluggableButton : _pluggableButtons) {
        banner.add(pluggableButton);
    }

    banner.add(_publishButton);
    banner.add(_exportButton);
    banner.add(_saveButton);
    banner.add(_cancelButton);
    banner.add(Box.createHorizontalStrut(10));

    panel.add(banner, BorderLayout.NORTH);
    panel.add(_tabbedPane, BorderLayout.CENTER);

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    int screenWidth = screenSize.width;
    int screenHeight = screenSize.height;

    int height = 550;
    if (screenHeight > 1000) {
        height = 900;
    } else if (screenHeight > 750) {
        height = 700;
    }

    int width = 750;
    if (screenWidth > 1200) {
        width = 1100;
    } else if (screenWidth > 1000) {
        width = 900;
    }

    panel.setPreferredSize(width, height);
    return panel;
}