Example usage for javax.swing JToolBar setMinimumSize

List of usage examples for javax.swing JToolBar setMinimumSize

Introduction

In this page you can find the example usage for javax.swing JToolBar setMinimumSize.

Prototype

@BeanProperty(description = "The minimum size of the component.")
public void setMinimumSize(Dimension minimumSize) 

Source Link

Document

Sets the minimum size of this component to a constant value.

Usage

From source file:org.lmn.fc.frameworks.starbase.plugins.observatory.ui.tabs.sda.DatasetViewerUIComponent.java

/***********************************************************************************************
 * Initialise this UIComponent.//  ww w.j  a  v a 2s  . c om
 */

public void initialiseUI() {
    final List<Component> listComponents;
    final JToolBar toolbarViewer;
    final MetadataExplorerUIComponentInterface uiMetadata;

    super.initialiseUI();

    getDatasetSemaphore().setState(SuperposedDataAnalyserHelper.BLOCK_EVENTS);

    // Create the Viewer JToolBar
    listComponents = SuperposedDataAnalyserHelper.createDatasetToolbarComponents(getObservatoryInstrument(),
            getSdaUI(), this, getFontData(), getColourData());
    toolbarViewer = UIComponentHelper.buildToolbar(listComponents);
    toolbarViewer.setFloatable(false);
    toolbarViewer.setMinimumSize(DIM_TOOLBAR_SIZE);
    toolbarViewer.setPreferredSize(DIM_TOOLBAR_SIZE);
    toolbarViewer.setMaximumSize(DIM_TOOLBAR_SIZE);
    toolbarViewer.setBackground(UIComponentPlugin.DEFAULT_COLOUR_TAB_BACKGROUND.getColor());

    // There is only ever one Chart for the DatasetViewer
    // A special version for use in e.g. the Superposed Data Analyser, with no Toolbar
    setChartViewer(new LogLinChartUIComponent(getSdaUI().getHostTask(), getObservatoryInstrument(),
            SuperposedDataAnalyserUIComponentInterface.TITLE_DATASET, null, REGISTRY.getFrameworkResourceKey(),
            DataUpdateType.DECIMATE,
            REGISTRY.getIntegerProperty(
                    getObservatoryInstrument().getHostAtom().getResourceKey() + KEY_DISPLAY_DATA_MAX),
            -SuperposedDataAnalyserUIComponentInterface.DEFAULT_COMPOSITE_RANGE,
            SuperposedDataAnalyserUIComponentInterface.DEFAULT_COMPOSITE_RANGE,
            -SuperposedDataAnalyserUIComponentInterface.DEFAULT_COMPOSITE_RANGE,
            SuperposedDataAnalyserUIComponentInterface.DEFAULT_COMPOSITE_RANGE) {
        final static long serialVersionUID = -2433194350569140263L;

        /**********************************************************************************
         * Customise the XYPlot of a new chart, e.g. for fixed range axes.
         *
         * @param datasettype
         * @param primarydataset
         * @param secondarydatasets
         * @param updatetype
         * @param displaylimit
         * @param channelselector
         * @param debug
         *
         * @return JFreeChart
         */

        public JFreeChart createCustomisedChart(final DatasetType datasettype, final XYDataset primarydataset,
                final List<XYDataset> secondarydatasets, final DataUpdateType updatetype,
                final int displaylimit, final ChannelSelectorUIComponentInterface channelselector,
                final boolean debug) {
            final JFreeChart jFreeChart;

            jFreeChart = super.createCustomisedChart(datasettype, primarydataset, secondarydatasets, updatetype,
                    displaylimit, channelselector, debug);
            // Remove all labels
            jFreeChart.setTitle(EMPTY_STRING);

            if ((jFreeChart.getXYPlot() != null) && (jFreeChart.getXYPlot().getDomainAxis() != null)) {
                jFreeChart.getXYPlot().getDomainAxis().setLabel(EMPTY_STRING);
            }

            if ((jFreeChart.getXYPlot() != null) && (jFreeChart.getXYPlot().getRangeAxis() != null)) {
                jFreeChart.getXYPlot().getRangeAxis().setLabel(EMPTY_STRING);
            }

            return (jFreeChart);
        }

        /**********************************************************************************
         * Initialise the Chart.
         */

        public synchronized void initialiseUI() {
            final String SOURCE = "ChartUIComponent.initialiseUI() ";

            setChannelSelector(false);
            setDatasetDomainControl(false);

            super.initialiseUI();

            // Indicate if the Chart can Autorange, and is currently Autoranging
            setCanAutorange(true);
            setLinearMode(true);

            // Configure the Chart for this specific use
            if (getChannelSelectorOccupant() != null) {
                getChannelSelectorOccupant().setAutoranging(true);
                getChannelSelectorOccupant().setLinearMode(true);
                getChannelSelectorOccupant().setDecimating(true);
                getChannelSelectorOccupant().setLegend(false);
                getChannelSelectorOccupant().setShowChannels(false);
                getChannelSelectorOccupant().debugSelector(LOADER_PROPERTIES.isChartDebug(), SOURCE);
            }
        }
    });

    getChartViewer().initialiseUI();

    // Now add the Viewer Chart as a ChangeListener
    getOffsetControl().addChangeListener(getSdaUI().getDatasetViewer().getChartViewer());

    // Prepare and initialise a Metadata viewer, with no Toolbar
    uiMetadata = new MetadataExplorerUIComponent(getSdaUI().getHostTask(), getObservatoryInstrument(), null,
            REGISTRY.getFrameworkResourceKey(), false);
    setMetadataViewer(uiMetadata);
    getMetadataViewer().initialiseUI();

    // Make sure we are notified if the Composite Metadata changes in any way
    if (uiMetadata.getTheLeafUI() != null) {
        uiMetadata.getTheLeafUI().addMetadataChangedListener(this);
    }

    // The ViewerContainer contains either the Chart viewer or the Metadata viewer
    // Start with the Chart visible
    getViewerContainer().removeAll();
    getViewerContainer().add((Component) getChartViewer(), BorderLayout.CENTER);

    // Assemble the whole Viewer
    removeAll();
    add(toolbarViewer, BorderLayout.NORTH);
    add((Component) getViewerContainer(), BorderLayout.CENTER);
}

From source file:org.lmn.fc.frameworks.starbase.plugins.observatory.ui.tabs.charts.ChartUIHelper.java

/***********************************************************************************************
 * Create the default Toolbar for a Chart.
 *
 * @param obsinstrument/* w w w  .  j a  v a2  s  . co m*/
 * @param chart
 * @param title
 * @param fontdata
 * @param colourforeground
 * @param colourbackground
 * @param debug
 *
 * @return JToolBar
 */

public static JToolBar createDefaultToolbar(final ObservatoryInstrumentInterface obsinstrument,
        final ChartUIComponentPlugin chart, final String title, final FontInterface fontdata,
        final ColourInterface colourforeground, final ColourInterface colourbackground, final boolean debug) {
    final JToolBar toolbar;

    if ((obsinstrument != null) && (chart != null)) {
        final List<Component> listComponentsToAdd;
        final JLabel labelName;

        listComponentsToAdd = new ArrayList<Component>(10);

        //-------------------------------------------------------------------------------------
        // Initialise the Label

        labelName = new JLabel(title, RegistryModelUtilities.getAtomIcon(obsinstrument.getHostAtom(),
                ObservatoryInterface.FILENAME_ICON_CHART_VIEWER), SwingConstants.LEFT) {
            static final long serialVersionUID = 7580736117336162922L;

            // Enable Antialiasing in Java 1.5
            protected void paintComponent(final Graphics graphics) {
                final Graphics2D graphics2D = (Graphics2D) graphics;

                // For antialiasing text
                graphics2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                        RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
                super.paintComponent(graphics2D);
            }
        };

        labelName.setFont(
                fontdata.getFont().deriveFont(ReportTableHelper.SIZE_HEADER_FONT).deriveFont(Font.BOLD));
        labelName.setForeground(colourforeground.getColor());
        labelName.setIconTextGap(UIComponentPlugin.TOOLBAR_ICON_TEXT_GAP);

        listComponentsToAdd.add(new JToolBar.Separator(UIComponentPlugin.DIM_TOOLBAR_SEPARATOR_BUTTON));
        listComponentsToAdd.add(labelName);
        listComponentsToAdd.add(new JToolBar.Separator(UIComponentPlugin.DIM_TOOLBAR_SEPARATOR));

        listComponentsToAdd.add(Box.createHorizontalGlue());

        UIComponentHelper.addToolbarPrintButtons(listComponentsToAdd, chart, chart.getChartPanel(), title,
                fontdata, colourforeground, colourbackground, debug);

        // Build the Toolbar using the Components, if any
        toolbar = UIComponentHelper.buildToolbar(listComponentsToAdd);
    } else {
        toolbar = new JToolBar();
    }

    toolbar.setFloatable(false);
    toolbar.setMinimumSize(UIComponentPlugin.DIM_TOOLBAR_SIZE);
    toolbar.setPreferredSize(UIComponentPlugin.DIM_TOOLBAR_SIZE);
    toolbar.setMaximumSize(UIComponentPlugin.DIM_TOOLBAR_SIZE);
    toolbar.setBackground(colourbackground.getColor());
    NavigationUtilities.updateComponentTreeUI(toolbar);

    return (toolbar);
}

From source file:org.apache.cayenne.modeler.editor.EditorView.java

private void initView() {

    // init widgets
    JButton collapseButton = getAction(CollapseTreeAction.class).buildButton();
    collapseButton.setPreferredSize(new Dimension(30, 20));
    JButton filterButton = getAction(FilterAction.class).buildButton();
    filterButton.setPreferredSize(new Dimension(30, 20));
    actionManager.getAction(CollapseTreeAction.class).setAlwaysOn(true);
    actionManager.getAction(FilterAction.class).setAlwaysOn(true);

    JToolBar barPanel = new JToolBar();
    barPanel.setMinimumSize(new Dimension(75, 25));
    barPanel.setBorder(BorderFactory.createEtchedBorder());
    barPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    barPanel.add(Box.createHorizontalStrut(3));
    barPanel.add(filterButton);/*from   w w w .j  a v  a  2  s.  c  om*/
    barPanel.addSeparator();
    barPanel.add(collapseButton);

    treePanel = new ProjectTreeView(eventController);
    treePanel.setMinimumSize(new Dimension(75, 180));
    JPanel treeNavigatePanel = new JPanel();
    treeNavigatePanel.setMinimumSize(new Dimension(75, 220));
    treeNavigatePanel.setLayout(new BorderLayout());
    treeNavigatePanel.add(treePanel, BorderLayout.CENTER);

    this.detailPanel = new JPanel();
    this.splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true);
    this.leftPanel = new JPanel(new BorderLayout());
    // assemble...

    this.detailLayout = new CardLayout();
    detailPanel.setLayout(detailLayout);

    // some but not all panels must be wrapped in a scroll pane
    // those that are not wrapped usually have there own scrollers
    // in subpanels...

    detailPanel.add(new JPanel(), EMPTY_VIEW);

    dataDomainView = new DataDomainTabbedView(eventController);
    detailPanel.add(dataDomainView, DOMAIN_VIEW);

    DataNodeEditor nodeController = new DataNodeEditor(eventController);
    detailPanel.add(nodeController.getView(), NODE_VIEW);

    dataNodeView = nodeController.getTabComponent();

    dataMapView = new DataMapTabbedView(eventController);
    detailPanel.add(dataMapView, DATA_MAP_VIEW);

    procedureView = new ProcedureTabbedView(eventController);
    detailPanel.add(procedureView, PROCEDURE_VIEW);

    selectQueryView = new SelectQueryTabbedView(eventController);
    detailPanel.add(selectQueryView, SELECT_QUERY_VIEW);

    sqlTemplateView = new SQLTemplateTabbedView(eventController);
    detailPanel.add(sqlTemplateView, SQL_TEMPLATE_VIEW);

    Component procedureQueryView = new ProcedureQueryView(eventController);
    detailPanel.add(new JScrollPane(procedureQueryView), PROCEDURE_QUERY_VIEW);

    ejbqlQueryView = new EjbqlTabbedView(eventController);
    detailPanel.add(ejbqlQueryView, EJBQL_QUERY_VIEW);

    embeddableView = new EmbeddableTabbedView(eventController);
    detailPanel.add(embeddableView, EMBEDDABLE_VIEW);

    objDetailView = new ObjEntityTabbedView(eventController);
    detailPanel.add(objDetailView, OBJ_VIEW);

    dbDetailView = new DbEntityTabbedView(eventController);
    detailPanel.add(dbDetailView, DB_VIEW);

    leftPanel.add(barPanel, BorderLayout.NORTH);
    leftPanel.add(new JScrollPane(treeNavigatePanel), BorderLayout.CENTER);
    splitPane.setLeftComponent(leftPanel);
    splitPane.setRightComponent(detailPanel);

    setLayout(new BorderLayout());
    add(splitPane, BorderLayout.CENTER);

}

From source file:org.zaproxy.zap.extension.browserView.ResponseBrowserView.java

private JToolBar createToolbar() {
    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);//from w  w w.j av a2s .  co m
    toolBar.setMinimumSize(new Dimension(50, 50));
    JButton button = createAdjustHeightButton();
    toolBar.add(button);
    return toolBar;
}