Example usage for java.awt BorderLayout WEST

List of usage examples for java.awt BorderLayout WEST

Introduction

In this page you can find the example usage for java.awt BorderLayout WEST.

Prototype

String WEST

To view the source code for java.awt BorderLayout WEST.

Click Source Link

Document

The west layout constraint (left side of container).

Usage

From source file:org.pentaho.reporting.ui.datasources.jdbc.ui.JdbcDataSourceDialog.java

private JPanel createQueryDetailsPanel() {
    final JPanel queryNamePanel = new JPanel(new BorderLayout());
    queryNamePanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8));
    queryNamePanel.add(new JLabel(Messages.getString("JdbcDataSourceDialog.QueryStringLabel")),
            BorderLayout.NORTH);/*from  w  w w.java2s  .  co m*/
    queryNamePanel.add(queryNameTextField, BorderLayout.SOUTH);

    final InvokeQueryDesignerAction queryDesignerAction = new InvokeQueryDesignerAction();
    dialogModel.addPropertyChangeListener(queryDesignerAction);

    final JPanel queryButtonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 5));
    queryButtonsPanel.add(new BorderlessButton(queryDesignerAction));

    final JPanel queryControlsPanel = new JPanel(new BorderLayout());
    queryControlsPanel.add(new JLabel(Messages.getString("JdbcDataSourceDialog.QueryDetailsLabel")),
            BorderLayout.WEST);
    queryControlsPanel.add(queryButtonsPanel, BorderLayout.EAST);

    final JPanel queryPanel = new JPanel(new BorderLayout());
    queryPanel.add(queryControlsPanel, BorderLayout.NORTH);
    queryPanel.add(new RTextScrollPane(500, 300, queryTextArea, true), BorderLayout.CENTER);
    queryPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8));

    final JTabbedPane queryScriptTabPane = new JTabbedPane();
    queryScriptTabPane.addTab(Messages.getString("JdbcDataSourceDialog.StaticQuery"), queryPanel);
    queryScriptTabPane.addTab(Messages.getString("JdbcDataSourceDialog.QueryScripting"),
            createQueryScriptTab());

    // Create the query details panel
    final JPanel queryDetailsPanel = new JPanel(new BorderLayout());
    queryDetailsPanel.add(BorderLayout.NORTH, queryNamePanel);
    queryDetailsPanel.add(BorderLayout.CENTER, queryScriptTabPane);
    return queryDetailsPanel;
}

From source file:com.net2plan.gui.utils.viewEditTopolTables.specificTables.AdvancedJTable_demand.java

private List<JComponent> getExtraOptions(final int row, final Object itemId) {
    List<JComponent> options = new LinkedList<JComponent>();
    final int numRows = model.getRowCount();
    final NetPlan netPlan = callback.getDesign();
    final List<Demand> tableVisibleDemands = getVisibleElementsInTable();

    JMenuItem offeredTrafficToAll = new JMenuItem("Set offered traffic to all");
    offeredTrafficToAll.addActionListener(new ActionListener() {
        @Override/*from w  w  w  .j  a  v  a2 s .co m*/
        public void actionPerformed(ActionEvent e) {
            double h_d;

            while (true) {
                String str = JOptionPane.showInputDialog(null, "Offered traffic volume",
                        "Set traffic value to all demands in the table", JOptionPane.QUESTION_MESSAGE);
                if (str == null)
                    return;

                try {
                    h_d = Double.parseDouble(str);
                    if (h_d < 0)
                        throw new RuntimeException();

                    break;
                } catch (Throwable ex) {
                    ErrorHandling.showErrorDialog("Please, introduce a non-negative number",
                            "Error setting offered traffic");
                }
            }

            NetPlan netPlan = callback.getDesign();

            try {
                for (Demand d : tableVisibleDemands)
                    d.setOfferedTraffic(h_d);
                callback.getVisualizationState().resetPickedState();
                callback.updateVisualizationAfterChanges(Collections.singleton(NetworkElementType.DEMAND));
                callback.getUndoRedoNavigationManager().addNetPlanChange();
            } catch (Throwable ex) {
                ErrorHandling.showErrorDialog(ex.getMessage(),
                        "Unable to set offered traffic to all demands in the table");
            }
        }
    });
    options.add(offeredTrafficToAll);

    JMenuItem scaleOfferedTrafficToAll = new JMenuItem("Scale offered traffic all demands in the table");
    scaleOfferedTrafficToAll.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            double scalingFactor;

            while (true) {
                String str = JOptionPane.showInputDialog(null,
                        "Scaling factor to multiply to all offered traffics", "Scale offered traffic",
                        JOptionPane.QUESTION_MESSAGE);
                if (str == null)
                    return;

                try {
                    scalingFactor = Double.parseDouble(str);
                    if (scalingFactor < 0)
                        throw new RuntimeException();

                    break;
                } catch (Throwable ex) {
                    ErrorHandling.showErrorDialog("Please, introduce a non-negative number",
                            "Error setting offered traffic");
                }
            }

            try {
                for (Demand d : tableVisibleDemands)
                    d.setOfferedTraffic(d.getOfferedTraffic() * scalingFactor);
                callback.getVisualizationState().resetPickedState();
                callback.updateVisualizationAfterChanges(Collections.singleton(NetworkElementType.DEMAND));
                callback.getUndoRedoNavigationManager().addNetPlanChange();
            } catch (Throwable ex) {
                ErrorHandling.showErrorDialog(ex.getMessage(), "Unable to scale demand offered traffics");
            }
        }
    });
    options.add(scaleOfferedTrafficToAll);

    JMenuItem setServiceTypes = new JMenuItem(
            "Set traversed resource types (to one or all demands in the table)");
    setServiceTypes.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {

            NetPlan netPlan = callback.getDesign();
            try {
                Demand d = netPlan.getDemandFromId((Long) itemId);
                String[] headers = StringUtils.arrayOf("Order", "Type");
                Object[][] data = { null, null };
                DefaultTableModel model = new ClassAwareTableModelImpl(data, headers);
                AdvancedJTable table = new AdvancedJTable(model);
                JButton addRow = new JButton("Add new traversed resource type");
                addRow.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        Object[] newRow = { table.getRowCount(), "" };
                        ((DefaultTableModel) table.getModel()).addRow(newRow);
                    }
                });
                JButton removeRow = new JButton("Remove selected");
                removeRow.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        ((DefaultTableModel) table.getModel()).removeRow(table.getSelectedRow());
                        for (int t = 0; t < table.getRowCount(); t++)
                            table.getModel().setValueAt(t, t, 0);
                    }
                });
                JButton removeAllRows = new JButton("Remove all");
                removeAllRows.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        while (table.getRowCount() > 0)
                            ((DefaultTableModel) table.getModel()).removeRow(0);
                    }
                });
                List<String> oldTraversedResourceTypes = d.getServiceChainSequenceOfTraversedResourceTypes();
                Object[][] newData = new Object[oldTraversedResourceTypes.size()][headers.length];
                for (int i = 0; i < oldTraversedResourceTypes.size(); i++) {
                    newData[i][0] = i;
                    newData[i][1] = oldTraversedResourceTypes.get(i);
                }
                ((DefaultTableModel) table.getModel()).setDataVector(newData, headers);
                JPanel pane = new JPanel();
                JPanel pane2 = new JPanel();
                pane.setLayout(new BorderLayout());
                pane2.setLayout(new BorderLayout());
                pane.add(new JScrollPane(table), BorderLayout.CENTER);
                pane2.add(addRow, BorderLayout.WEST);
                pane2.add(removeRow, BorderLayout.EAST);
                pane2.add(removeAllRows, BorderLayout.SOUTH);
                pane.add(pane2, BorderLayout.SOUTH);
                final String[] optionsArray = new String[] { "Set to selected demand", "Set to all demands",
                        "Cancel" };
                int result = JOptionPane.showOptionDialog(null, pane, "Set traversed resource types",
                        JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, optionsArray,
                        optionsArray[0]);
                if ((result != 0) && (result != 1))
                    return;
                final boolean setToAllDemands = (result == 1);
                List<String> newTraversedResourcesTypes = new LinkedList<>();
                for (int j = 0; j < table.getRowCount(); j++) {
                    String travResourceType = table.getModel().getValueAt(j, 1).toString();
                    newTraversedResourcesTypes.add(travResourceType);
                }
                if (setToAllDemands) {
                    for (Demand dd : tableVisibleDemands)
                        if (!dd.getRoutes().isEmpty())
                            throw new Net2PlanException(
                                    "It is not possible to set the resource types traversed to demands with routes");
                    for (Demand dd : tableVisibleDemands)
                        dd.setServiceChainSequenceOfTraversedResourceTypes(newTraversedResourcesTypes);
                } else {
                    if (!d.getRoutes().isEmpty())
                        throw new Net2PlanException(
                                "It is not possible to set the resource types traversed to demands with routes");
                    d.setServiceChainSequenceOfTraversedResourceTypes(newTraversedResourcesTypes);
                }
                callback.getVisualizationState().resetPickedState();
                callback.updateVisualizationAfterChanges(Collections.singleton(NetworkElementType.DEMAND));
                callback.getUndoRedoNavigationManager().addNetPlanChange();
            } catch (Throwable ex) {
                ErrorHandling.showErrorDialog(ex.getMessage(), "Unable to set traversed resource types");
            }
        }

    });
    options.add(setServiceTypes);

    if (itemId != null && netPlan.isMultilayer()) {
        final long demandId = (long) itemId;
        if (netPlan.getDemandFromId(demandId).isCoupled()) {
            JMenuItem decoupleDemandItem = new JMenuItem("Decouple demand");
            decoupleDemandItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    netPlan.getDemandFromId(demandId).decouple();
                    model.setValueAt("", row, 3);
                    callback.getVisualizationState().resetPickedState();
                    callback.updateVisualizationAfterChanges(Collections.singleton(NetworkElementType.DEMAND));
                    callback.getUndoRedoNavigationManager().addNetPlanChange();
                }
            });

            options.add(decoupleDemandItem);
        } else {
            JMenuItem createUpperLayerLinkFromDemandItem = new JMenuItem("Create upper layer link from demand");
            createUpperLayerLinkFromDemandItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    Collection<Long> layerIds = netPlan.getNetworkLayerIds();
                    final JComboBox layerSelector = new WiderJComboBox();
                    for (long layerId : layerIds) {
                        if (layerId == netPlan.getNetworkLayerDefault().getId())
                            continue;

                        final String layerName = netPlan.getNetworkLayerFromId(layerId).getName();
                        String layerLabel = "Layer " + layerId;
                        if (!layerName.isEmpty())
                            layerLabel += " (" + layerName + ")";

                        layerSelector.addItem(StringLabeller.of(layerId, layerLabel));
                    }

                    layerSelector.setSelectedIndex(0);

                    JPanel pane = new JPanel();
                    pane.add(new JLabel("Select layer: "));
                    pane.add(layerSelector);

                    while (true) {
                        int result = JOptionPane.showConfirmDialog(null, pane,
                                "Please select the upper layer to create the link",
                                JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
                        if (result != JOptionPane.OK_OPTION)
                            return;

                        try {
                            long layerId = (long) ((StringLabeller) layerSelector.getSelectedItem())
                                    .getObject();
                            netPlan.getDemandFromId(demandId)
                                    .coupleToNewLinkCreated(netPlan.getNetworkLayerFromId(layerId));
                            callback.getVisualizationState()
                                    .recomputeCanvasTopologyBecauseOfLinkOrNodeAdditionsOrRemovals();
                            callback.updateVisualizationAfterChanges(
                                    Sets.newHashSet(NetworkElementType.DEMAND, NetworkElementType.LINK));
                            callback.getUndoRedoNavigationManager().addNetPlanChange();
                            break;
                        } catch (Throwable ex) {
                            ErrorHandling.showErrorDialog(ex.getMessage(),
                                    "Error creating upper layer link from demand");
                        }
                    }
                }
            });

            options.add(createUpperLayerLinkFromDemandItem);

            JMenuItem coupleDemandToLink = new JMenuItem("Couple demand to upper layer link");
            coupleDemandToLink.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    Collection<Long> layerIds = netPlan.getNetworkLayerIds();
                    final JComboBox layerSelector = new WiderJComboBox();
                    final JComboBox linkSelector = new WiderJComboBox();
                    for (long layerId : layerIds) {
                        if (layerId == netPlan.getNetworkLayerDefault().getId())
                            continue;

                        final String layerName = netPlan.getNetworkLayerFromId(layerId).getName();
                        String layerLabel = "Layer " + layerId;
                        if (!layerName.isEmpty())
                            layerLabel += " (" + layerName + ")";

                        layerSelector.addItem(StringLabeller.of(layerId, layerLabel));
                    }

                    layerSelector.addItemListener(new ItemListener() {
                        @Override
                        public void itemStateChanged(ItemEvent e) {
                            if (layerSelector.getSelectedIndex() >= 0) {
                                long selectedLayerId = (Long) ((StringLabeller) layerSelector.getSelectedItem())
                                        .getObject();
                                NetworkLayer selectedLayer = netPlan.getNetworkLayerFromId(selectedLayerId);

                                linkSelector.removeAllItems();
                                Collection<Link> links_thisLayer = netPlan.getLinks(selectedLayer);
                                for (Link link : links_thisLayer) {
                                    if (link.isCoupled())
                                        continue;

                                    String originNodeName = link.getOriginNode().getName();
                                    String destinationNodeName = link.getDestinationNode().getName();

                                    linkSelector.addItem(StringLabeller.unmodifiableOf(link.getId(),
                                            "e" + link.getIndex() + " [n" + link.getOriginNode().getIndex()
                                                    + " (" + originNodeName + ") -> n"
                                                    + link.getDestinationNode().getIndex() + " ("
                                                    + destinationNodeName + ")]"));
                                }
                            }

                            if (linkSelector.getItemCount() == 0) {
                                linkSelector.setEnabled(false);
                            } else {
                                linkSelector.setSelectedIndex(0);
                                linkSelector.setEnabled(true);
                            }
                        }
                    });

                    layerSelector.setSelectedIndex(-1);
                    layerSelector.setSelectedIndex(0);

                    JPanel pane = new JPanel(new MigLayout("", "[][grow]", "[][]"));
                    pane.add(new JLabel("Select layer: "));
                    pane.add(layerSelector, "growx, wrap");
                    pane.add(new JLabel("Select link: "));
                    pane.add(linkSelector, "growx, wrap");

                    while (true) {
                        int result = JOptionPane.showConfirmDialog(null, pane,
                                "Please select the upper layer link", JOptionPane.OK_CANCEL_OPTION,
                                JOptionPane.QUESTION_MESSAGE);
                        if (result != JOptionPane.OK_OPTION)
                            return;

                        try {
                            long layerId = (long) ((StringLabeller) layerSelector.getSelectedItem())
                                    .getObject();
                            long linkId;
                            try {
                                linkId = (long) ((StringLabeller) linkSelector.getSelectedItem()).getObject();
                            } catch (Throwable ex) {
                                throw new RuntimeException("No link was selected");
                            }

                            netPlan.getDemandFromId(demandId)
                                    .coupleToUpperLayerLink(netPlan.getLinkFromId(linkId));
                            callback.getVisualizationState().resetPickedState();
                            callback.updateVisualizationAfterChanges(
                                    Sets.newHashSet(NetworkElementType.DEMAND, NetworkElementType.LINK));
                            callback.getUndoRedoNavigationManager().addNetPlanChange();
                            break;
                        } catch (Throwable ex) {
                            ErrorHandling.showErrorDialog(ex.getMessage(),
                                    "Error coupling upper layer link to demand");
                        }
                    }
                }
            });

            options.add(coupleDemandToLink);
        }

        if (numRows > 1) {
            JMenuItem decoupleAllDemandsItem = null;
            JMenuItem createUpperLayerLinksFromDemandsItem = null;

            final Set<Demand> coupledDemands = tableVisibleDemands.stream().filter(d -> d.isCoupled())
                    .collect(Collectors.toSet());
            if (!coupledDemands.isEmpty()) {
                decoupleAllDemandsItem = new JMenuItem("Decouple all demands");
                decoupleAllDemandsItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        for (Demand d : new LinkedHashSet<Demand>(coupledDemands))
                            d.decouple();
                        int numRows = model.getRowCount();
                        for (int i = 0; i < numRows; i++)
                            model.setValueAt("", i, 3);
                        callback.getVisualizationState().resetPickedState();
                        callback.updateVisualizationAfterChanges(Sets.newHashSet(NetworkElementType.DEMAND));
                        callback.getUndoRedoNavigationManager().addNetPlanChange();
                    }
                });
            }

            if (coupledDemands.size() < tableVisibleDemands.size()) {
                createUpperLayerLinksFromDemandsItem = new JMenuItem(
                        "Create upper layer links from uncoupled demands");
                createUpperLayerLinksFromDemandsItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        Collection<Long> layerIds = netPlan.getNetworkLayerIds();
                        final JComboBox layerSelector = new WiderJComboBox();
                        for (long layerId : layerIds) {
                            if (layerId == netPlan.getNetworkLayerDefault().getId())
                                continue;

                            final String layerName = netPlan.getNetworkLayerFromId(layerId).getName();
                            String layerLabel = "Layer " + layerId;
                            if (!layerName.isEmpty())
                                layerLabel += " (" + layerName + ")";

                            layerSelector.addItem(StringLabeller.of(layerId, layerLabel));
                        }

                        layerSelector.setSelectedIndex(0);

                        JPanel pane = new JPanel();
                        pane.add(new JLabel("Select layer: "));
                        pane.add(layerSelector);

                        while (true) {
                            int result = JOptionPane.showConfirmDialog(null, pane,
                                    "Please select the upper layer to create links",
                                    JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
                            if (result != JOptionPane.OK_OPTION)
                                return;

                            try {
                                long layerId = (long) ((StringLabeller) layerSelector.getSelectedItem())
                                        .getObject();
                                NetworkLayer layer = netPlan.getNetworkLayerFromId(layerId);
                                for (Demand demand : tableVisibleDemands)
                                    if (!demand.isCoupled())
                                        demand.coupleToNewLinkCreated(layer);

                                callback.getVisualizationState()
                                        .recomputeCanvasTopologyBecauseOfLinkOrNodeAdditionsOrRemovals();
                                callback.updateVisualizationAfterChanges(
                                        Sets.newHashSet(NetworkElementType.DEMAND, NetworkElementType.LINK));
                                callback.getUndoRedoNavigationManager().addNetPlanChange();
                                break;
                            } catch (Throwable ex) {
                                ErrorHandling.showErrorDialog(ex.getMessage(),
                                        "Error creating upper layer links");
                            }
                        }
                    }
                });
            }

            if (!options.isEmpty()
                    && (decoupleAllDemandsItem != null || createUpperLayerLinksFromDemandsItem != null)) {
                options.add(new JPopupMenu.Separator());
                if (decoupleAllDemandsItem != null)
                    options.add(decoupleAllDemandsItem);
                if (createUpperLayerLinksFromDemandsItem != null)
                    options.add(createUpperLayerLinksFromDemandsItem);
            }

        }
    }

    return options;
}

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

/**
 * This method initializes msgButtonsPanel
 *
 * @return javax.swing.JPanel/*from  w ww.j  av  a 2  s .c  o m*/
 */
private JPanel getMsgButtonsMainPanel() {
    if (msgButtonsMainPanel == null) {
        msgButtonsMainPanel = new JPanel();
        msgButtonsMainPanel.setLayout(new BorderLayout());

        msgButtonsMainPanel.setBackground(Color.white);

        msgButtonsMainPanel.setSize(new Dimension(811, 34));
        msgButtonsMainPanel.setPreferredSize(new Dimension(84, 25));
        msgButtonsMainPanel.add(getMsgButtonsPanel(), BorderLayout.WEST);
    }
    return msgButtonsMainPanel;
}

From source file:op.controlling.PnlControlling.java

private JPanel createContentPanel4Nursing() {
    JPanel pnlContent = new JPanel(new VerticalLayout());

    /***/*from w  w  w.ja v a  2  s . c  om*/
     *     __        __                    _
     *     \ \      / /__  _   _ _ __   __| |___
     *      \ \ /\ / / _ \| | | | '_ \ / _` / __|
     *       \ V  V / (_) | |_| | | | | (_| \__ \
     *        \_/\_/ \___/ \__,_|_| |_|\__,_|___/
     *
     */
    JPanel pnlWounds = new JPanel(new BorderLayout());
    final JButton btnWounds = GUITools.createHyperlinkButton("opde.controlling.nursing.wounds", null, null);
    int woundsMonthsBack;
    try {
        woundsMonthsBack = Integer.parseInt(OPDE.getProps().getProperty("opde.controlling::woundsMonthsBack"));
    } catch (NumberFormatException nfe) {
        woundsMonthsBack = 7;
    }
    final JTextField txtWoundsMonthsBack = GUITools.createIntegerTextField(1, 12, woundsMonthsBack);
    txtWoundsMonthsBack.setToolTipText(SYSTools.xx("misc.msg.monthsback"));

    btnWounds.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            OPDE.getMainframe().setBlocked(true);
            SwingWorker worker = new SwingWorker() {
                @Override
                protected Object doInBackground() throws Exception {
                    SYSPropsTools.storeProp("opde.controlling::woundsMonthsBack", txtWoundsMonthsBack.getText(),
                            OPDE.getLogin().getUser());
                    SYSFilesTools.print(
                            getWounds(Integer.parseInt(txtWoundsMonthsBack.getText()), progressClosure), false);
                    return null;
                }

                @Override
                protected void done() {
                    OPDE.getDisplayManager().setProgressBarMessage(null);
                    OPDE.getMainframe().setBlocked(false);
                }
            };
            worker.execute();
        }
    });
    pnlWounds.add(btnWounds, BorderLayout.WEST);
    pnlWounds.add(txtWoundsMonthsBack, BorderLayout.EAST);
    pnlContent.add(pnlWounds);

    /***
     *      ____             _       _   _____ _
     *     / ___|  ___   ___(_) __ _| | |_   _(_)_ __ ___   ___  ___
     *     \___ \ / _ \ / __| |/ _` | |   | | | | '_ ` _ \ / _ \/ __|
     *      ___) | (_) | (__| | (_| | |   | | | | | | | | |  __/\__ \
     *     |____/ \___/ \___|_|\__,_|_|   |_| |_|_| |_| |_|\___||___/
     *
     */
    JPanel pblSocialTimes = new JPanel(new BorderLayout());
    final JButton btnSocialTimes = GUITools.createHyperlinkButton("opde.controlling.nursing.social", null,
            null);
    final JComboBox cmbSocialTimes = new JComboBox(
            SYSCalendar.createMonthList(new LocalDate().minusYears(1), new LocalDate()));
    btnSocialTimes.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            OPDE.getMainframe().setBlocked(true);
            SwingWorker worker = new SwingWorker() {
                @Override
                protected Object doInBackground() throws Exception {
                    LocalDate month = (LocalDate) cmbSocialTimes.getSelectedItem();
                    SYSFilesTools.print(NReportTools.getTimes4SocialReports(month, progressClosure), false);
                    return null;
                }

                @Override
                protected void done() {
                    OPDE.getDisplayManager().setProgressBarMessage(null);
                    OPDE.getMainframe().setBlocked(false);
                }
            };
            worker.execute();
        }
    });
    cmbSocialTimes.setRenderer(new ListCellRenderer() {
        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            return new DefaultListCellRenderer().getListCellRendererComponent(list,
                    monthFormatter.format(((LocalDate) value).toDate()), index, isSelected, cellHasFocus);
        }
    });
    cmbSocialTimes.setSelectedIndex(cmbSocialTimes.getItemCount() - 2);
    pblSocialTimes.add(btnSocialTimes, BorderLayout.WEST);
    pblSocialTimes.add(cmbSocialTimes, BorderLayout.EAST);
    pnlContent.add(pblSocialTimes);

    return pnlContent;
}

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

/**
 * This method initializes msgButtonsPanel
 *
 * @return javax.swing.JPanel// w ww  . j  a  va  2  s  .  c  o m
 */
private JPanel getMsgButtonsPanel() {
    if (msgButtonsPanel == null) {
        msgButtonsPanel = new JPanel();
        msgButtonsPanel.setLayout(new BorderLayout());
        msgButtonsPanel.setBackground(Color.white);

        msgButtonsPanel.add(getMsgButtons(), BorderLayout.WEST);

        JLabel endIcon = new JLabel();
        endIcon.setText(""); //$NON-NLS-1$
        endIcon.setBackground(Color.white);
        endIcon.setIcon(new ImageIcon(getClass().getResource("/org/colombbus/tangara/main_end.png"))); //$NON-NLS-1$
        msgButtonsPanel.add(endIcon, BorderLayout.EAST);
    }
    return msgButtonsPanel;
}

From source file:org.pentaho.reporting.ui.datasources.jdbc.ui.JdbcDataSourceDialog.java

private JPanel createQueryListPanel() {
    // Create the query list panel
    final QueryRemoveAction queryRemoveAction = new QueryRemoveAction();
    dialogModel.addPropertyChangeListener(queryRemoveAction);

    final JPanel theQueryButtonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 5));
    theQueryButtonsPanel.add(new BorderlessButton(new QueryAddAction()));
    theQueryButtonsPanel.add(new BorderlessButton(queryRemoveAction));

    final JPanel theQueryControlsPanel = new JPanel(new BorderLayout());
    theQueryControlsPanel.add(new JLabel(Messages.getString("JdbcDataSourceDialog.AvailableQueries")),
            BorderLayout.WEST);
    theQueryControlsPanel.add(theQueryButtonsPanel, BorderLayout.EAST);

    final JPanel queryListPanel = new JPanel(new BorderLayout());
    queryListPanel.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8));
    queryListPanel.add(BorderLayout.NORTH, theQueryControlsPanel);
    queryListPanel.add(BorderLayout.CENTER, new JScrollPane(queryNameList));
    return queryListPanel;
}

From source file:de.whiledo.iliasdownloader2.swing.service.MainController.java

protected void chooseServer() {
    final TwoObjectsX<String, String> serverAndClientId = new TwoObjectsX<String, String>(
            iliasProperties.getIliasServerURL(), iliasProperties.getIliasClient());
    final boolean noConfigDoneYet = serverAndClientId.getObjectA() == null
            || serverAndClientId.getObjectA().trim().isEmpty();

    final JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());

    final JLabel labelServer = new JLabel("Server: " + serverAndClientId.getObjectA());
    final JLabel labelClientId = new JLabel("Client Id: " + serverAndClientId.getObjectB());

    JComboBox<LoginType> comboboxLoginType = null;
    JComboBox<DownloadMethod> comboboxDownloadMethod = null;

    final Runnable findOutClientId = new Runnable() {

        @Override//w  w w .  j  a  v a 2 s.  c om
        public void run() {
            try {
                String s = IliasUtil.findClientByLoginPageOrWebserviceURL(serverAndClientId.getObjectA());
                serverAndClientId.setObjectB(s);
                labelClientId.setText("Client Id: " + s);
            } catch (Exception e1) {
                showError("Client Id konnte nicht ermittelt werden", e1);
            }
        }
    };

    final Runnable promptInputServer = new Runnable() {

        @Override
        public void run() {

            String s = JOptionPane.showInputDialog(panel,
                    "Geben Sie die Ilias Loginseitenadresse oder Webserviceadresse ein",
                    serverAndClientId.getObjectA());
            if (s != null) {
                try {
                    s = IliasUtil.findSOAPWebserviceByLoginPage(s.trim());

                    if (!s.toLowerCase().startsWith("https://")) {
                        JOptionPane.showMessageDialog(mainFrame,
                                "Achtung! Die von Ihnen angegebene Adresse beginnt nicht mit 'https://'.\nDie Verbindung ist daher nicht ausreichend gesichert. Ein Angreifer knnte Ihre Ilias Daten und Ihr Passwort abgreifen",
                                "Achtung, nicht geschtzt", JOptionPane.WARNING_MESSAGE);
                    }

                    serverAndClientId.setObjectA(s);
                    labelServer.setText("Server: " + serverAndClientId.getObjectA());

                    if (noConfigDoneYet) {
                        findOutClientId.run();
                    }
                } catch (IliasException e1) {
                    showError(
                            "Bitte geben Sie die Adresse der Ilias Loginseite oder die des Webservice an. Die Adresse der Loginseite muss 'login.php' enthalten",
                            e1);
                }
            }
        }
    };

    {
        JPanel panel2 = new JPanel(new BorderLayout());

        panel2.add(labelServer, BorderLayout.NORTH);
        panel2.add(labelClientId, BorderLayout.SOUTH);

        panel.add(panel2, BorderLayout.NORTH);
    }
    {
        JPanel panel2 = new JPanel(new BorderLayout());

        JPanel panel3 = new JPanel(new GridLayout());
        {
            JButton b = new JButton("Server ndern");
            b.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    promptInputServer.run();
                }
            });
            panel3.add(b);

            b = new JButton("Client Id ndern");
            b.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    String s = JOptionPane.showInputDialog(panel, "Client Id eingeben",
                            serverAndClientId.getObjectB());
                    if (s != null) {
                        serverAndClientId.setObjectB(s);
                        labelClientId.setText("Client Id: " + serverAndClientId.getObjectB());
                    }

                }
            });
            panel3.add(b);

            b = new JButton("Client Id automatisch ermitteln");
            b.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    findOutClientId.run();
                }
            });
            panel3.add(b);
        }
        panel2.add(panel3, BorderLayout.NORTH);

        panel3 = new JPanel(new GridLayout(0, 2, 5, 2));
        {
            panel3.add(new JLabel("Loginmethode: "));
            comboboxLoginType = new JComboBox<LoginType>();
            FunctionsX.setComboBoxLayoutString(comboboxLoginType, new ObjectDoInterface<LoginType, String>() {

                @Override
                public String doSomething(LoginType loginType) {
                    switch (loginType) {
                    case DEFAULT:
                        return "Standard";
                    case LDAP:
                        return "LDAP";
                    case CAS:
                        return "CAS";
                    default:
                        return "<Fehler>";
                    }
                }

            });
            val model = ((DefaultComboBoxModel<LoginType>) comboboxLoginType.getModel());
            for (LoginType loginType : LoginType.values()) {
                model.addElement(loginType);
            }
            model.setSelectedItem(iliasProperties.getLoginType());
            panel3.add(comboboxLoginType);

            JLabel label = new JLabel("Dateien herunterladen ber:");
            label.setToolTipText("Die restliche Kommunikation luft immer ber den SOAP Webservice");
            panel3.add(label);
            comboboxDownloadMethod = new JComboBox<DownloadMethod>();
            FunctionsX.setComboBoxLayoutString(comboboxDownloadMethod,
                    new ObjectDoInterface<DownloadMethod, String>() {

                        @Override
                        public String doSomething(DownloadMethod downloadMethod) {
                            switch (downloadMethod) {
                            case WEBSERVICE:
                                return "SOAP Webservice (Standard)";
                            case WEBDAV:
                                return "WEBDAV";
                            default:
                                return "<Fehler>";
                            }
                        }

                    });
            val model2 = ((DefaultComboBoxModel<DownloadMethod>) comboboxDownloadMethod.getModel());
            for (DownloadMethod downloadMethod : DownloadMethod.values()) {
                model2.addElement(downloadMethod);
            }
            model2.setSelectedItem(iliasProperties.getDownloadMethod());
            panel3.add(comboboxDownloadMethod);
        }
        panel2.add(panel3, BorderLayout.WEST);

        panel.add(panel2, BorderLayout.SOUTH);
    }

    if (noConfigDoneYet) {
        promptInputServer.run();
    }

    if (JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog(mainFrame, panel, "Server konfigurieren",
            JOptionPane.OK_CANCEL_OPTION)) {
        if (syncService != null) {
            syncService.logoutIfLoggedIn();
        }
        iliasProperties.setIliasServerURL(serverAndClientId.getObjectA());
        iliasProperties.setIliasClient(serverAndClientId.getObjectB());
        iliasProperties.setLoginType((LoginType) comboboxLoginType.getSelectedItem());
        iliasProperties.setDownloadMethod((DownloadMethod) comboboxDownloadMethod.getSelectedItem());
        saveProperties(iliasProperties);
        updateTitleCaption();
    }

}

From source file:com.att.aro.ui.view.diagnostictab.GraphPanel.java

private JPanel getScollableChartLabelPanel() {
    if (scrollChart == null) {
        scrollChart = new JPanel();
        scrollChart.setLayout(new BorderLayout());

        scrollChart.add(getInternalScrollableContainer(), BorderLayout.CENTER);
        scrollChart.add(getLabelsPanel(), BorderLayout.WEST);
    }/*from  ww w  .  ja v  a2s  .c  om*/
    return scrollChart;
}

From source file:edu.ucla.stat.SOCR.chart.demo.SOCR_EM_MixtureModelChartDemo.java

protected void setMixPanel() {
    dataPanel2.removeAll();//from  ww w. j a  v a  2s  .c o  m
    graphPanel2.removeAll();

    if (chartPaneltest != null) {
        chartPaneltest.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 3));
        graphPanel2.add(chartPaneltest);
        graphPanel2.validate();
    }

    dataPanel2.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y));

    dataPanel2.add(new JLabel(" "));
    dataPanel2.add(new JLabel("Data"));

    JScrollPane st = new JScrollPane(layoutResults());

    JScrollPane dt = new JScrollPane(dataTable);
    dt.setRowHeaderView(headerTable);

    //dt.setPreferredSize(new Dimension(CHART_SIZE_X*2/3, CHART_SIZE_Y/2));
    JSplitPane container = new JSplitPane(JSplitPane.VERTICAL_SPLIT, dt, st);
    container.setMinimumSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y / 2));
    container.setContinuousLayout(true);
    container.setDividerLocation(0.7);
    dataPanel2.add(container);

    dataPanel2.add(new JLabel(" "));
    dataPanel2.add(new JLabel("Mapping"));
    mapPanel.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y / 2));
    dataPanel2.add(mapPanel);

    dataPanel2.validate();

    mixPanel.removeAll();
    mixPanel.add(graphPanel2, BorderLayout.WEST);
    mixPanel.add(dataPanel2, BorderLayout.CENTER);
    mixPanel.validate();
}

From source file:edu.ucla.stat.SOCR.analyses.gui.NormalPower.java

protected void setSelectPanel() {
    selectPanel.removeAll();//from w w  w. j a  v a2  s. c om
    selectPanel.setPreferredSize(new Dimension(400, 400));
    selectPanel.add(subPanel, BorderLayout.EAST);
    selectPanel.add(subPanel, BorderLayout.CENTER);
    selectPanel.add(subPanel, BorderLayout.WEST);

    subPanel.add(parameterPanel, BorderLayout.SOUTH);
    subPanel.add(hypothesisPanel, BorderLayout.CENTER);
    subPanel.add(choicePanel, BorderLayout.NORTH);

    hypothesisPanel.setBackground(Color.LIGHT_GRAY);
    parameterPanel.setBackground(Color.LIGHT_GRAY);
    choicePanel.setBackground(Color.LIGHT_GRAY);
    /*********** Begin Check/Choice Setting ********************/
    //choicePanel.setLayout(new BoxLayout(choicePanel, BoxLayout.Y_AXIS));
    choicePanel.setLayout(new BorderLayout());
    choicePanel.add(checkSampleSizeBox, BorderLayout.NORTH);
    choicePanel.add(checkPowerBox, BorderLayout.CENTER);
    choicePanel.add(criticalValueBox, BorderLayout.SOUTH);

    /*********** End Check/Choice Setting ********************/

    /*********** Begin Hypothesis Setting ********************/

    h0Label = new JLabel("Null: mu      =       mu_0;  ");
    hALabelPrefix = new JLabel("Alternative: mu_A ");
    hALabelSurfix = new JLabel(" mu_0");

    h0Panel.setBackground(Color.LIGHT_GRAY);

    hAPanel.setBackground(Color.LIGHT_GRAY);
    hACheckBoxPanel.setBackground(Color.LIGHT_GRAY);

    hypothesisPanel.add(h0Panel, BorderLayout.CENTER);
    hypothesisPanel.add(hAPanel, BorderLayout.SOUTH);

    h0Panel.add(h0Label, BorderLayout.CENTER);

    hAPanel.add(hALabelPrefix, BorderLayout.WEST);
    hAPanel.add(hACheckBoxPanel, BorderLayout.CENTER);
    hAPanel.add(hALabelSurfix, BorderLayout.EAST);

    hACheckBoxPanel.add(checkNE, BorderLayout.CENTER);
    hACheckBoxPanel.add(checkLT, BorderLayout.EAST);
    hACheckBoxPanel.add(checkGT, BorderLayout.WEST);
    /*********** End Hypothesis Setting ********************/

    /*********** Begin Parameter Setting *******************/
    sampleSizePanel = new JPanel();
    sigmaPanel = new JPanel();
    mu0Panel = new JPanel();
    sigmaZTestPanel = new JPanel();
    mu0ZTestPanel = new JPanel();
    muAPanel = new JPanel();
    alphaPanel = new JPanel();
    powerPanel = new JPanel();
    xValuePanel = new JPanel();

    sampleSizePanel.add(sampleSizeLabel, BorderLayout.WEST);
    sampleSizePanel.add(sampleSizeBar, BorderLayout.CENTER);
    sampleSizePanel.add(sampleSizeText, BorderLayout.EAST);
    sigmaPanel.add(sigmaLabel, BorderLayout.WEST);
    sigmaPanel.add(sigmaText, BorderLayout.EAST);
    sigmaZTestPanel.add(sigmaZTestLabel, BorderLayout.WEST);
    sigmaZTestPanel.add(sigmaZTestText, BorderLayout.EAST);
    mu0Panel.add(mu0Label, BorderLayout.WEST);
    mu0Panel.add(mu0Text, BorderLayout.EAST);
    mu0ZTestPanel.add(mu0ZTestLabel, BorderLayout.WEST);
    mu0ZTestPanel.add(mu0ZTestText, BorderLayout.EAST);
    muAPanel.add(muALabel, BorderLayout.WEST);
    muAPanel.add(muAText, BorderLayout.EAST);
    alphaPanel.add(alphaLabel, BorderLayout.WEST);
    alphaPanel.add(alphaCombo, BorderLayout.EAST);
    powerPanel.add(powerLabel, BorderLayout.WEST);
    powerPanel.add(powerBar, BorderLayout.CENTER);
    powerPanel.add(powerText, BorderLayout.EAST);
    xValuePanel.add(xValueLabel, BorderLayout.WEST);
    xValuePanel.add(xValueText, BorderLayout.EAST);

    parameterPanel.setLayout(new BoxLayout(parameterPanel, BoxLayout.Y_AXIS));

    parameterPanel.add(sampleSizePanel);
    parameterPanel.add(powerPanel);

    parameterPanel.add(xValuePanel);
    parameterPanel.add(sigmaPanel);
    parameterPanel.add(mu0Panel);
    parameterPanel.add(muAPanel);
    parameterPanel.add(alphaPanel);

    parameterPanel.add(sigmaZTestPanel);
    parameterPanel.add(mu0ZTestPanel);

    parameterPanel.add(alphaPanel);
    parameterPanel.add(alphaPanel);

    hypothesisPanel.setVisible(true);
    sampleSizePanel.setVisible(true);
    powerPanel.setVisible(false);
    xValuePanel.setVisible(false);
    sigmaZTestPanel.setVisible(false);
    mu0ZTestPanel.setVisible(false);

}