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:gtu._work.ui.CheckJavaClassPathUI.java

private void initGUI() {
    try {//  w  ww .j av  a 2 s.  c o  m
        BorderLayout thisLayout = new BorderLayout();
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(thisLayout);
        setTitle("??importjava");
        {
            jTabbedPane1 = new JTabbedPane();
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            {
                jPanel1 = new JPanel();
                BorderLayout jPanel1Layout = new BorderLayout();
                jPanel1.setLayout(jPanel1Layout);
                jTabbedPane1.addTab("", null, jPanel1, null);
                {
                    classPathText = new JTextField();
                    jPanel1.add(classPathText, BorderLayout.NORTH);
                    classPathText.addMouseListener(new MouseAdapter() {
                        public void mouseClicked(MouseEvent evt) {
                            if (StringUtils.isNotBlank(classPathText.getText())) {
                                String text = classPathText.getText();
                                DefaultListModel model = (DefaultListModel) classPathList.getModel();
                                boolean findOk = false;
                                for (int ii = 0; ii < model.size(); ii++) {
                                    String val = (String) model.getElementAt(ii);
                                    if (StringUtils.equals(val, text)) {
                                        findOk = true;
                                    }
                                }
                                if (!findOk) {
                                    model.addElement(text);
                                }
                            }
                        }
                    });
                }
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel1.add(jScrollPane1, BorderLayout.CENTER);
                    jScrollPane1.setPreferredSize(new java.awt.Dimension(492, 302));
                    {
                        DefaultListModel classPathListModel = new DefaultListModel();
                        classPathList = new JList();

                        Set<String> clzSet = new HashSet<String>();
                        for (Enumeration<?> enu = configBean.getConfigProp().keys(); enu.hasMoreElements();) {
                            String key = (String) enu.nextElement();
                            if (key.contains(CLASSNAME_KEY)) {
                                clzSet.add(configBean.getConfigProp().getProperty(key));
                            }
                        }
                        for (String clzName : clzSet) {
                            classPathListModel.addElement(clzName);
                        }

                        jScrollPane1.setViewportView(classPathList);
                        classPathList.setModel(classPathListModel);
                        classPathList.addKeyListener(new KeyAdapter() {
                            public void keyPressed(KeyEvent evt) {
                                JListUtil.newInstance(classPathList).defaultJListKeyPressed(evt);
                            }
                        });
                    }
                }
                {
                    executeBtn = new JButton();
                    jPanel1.add(executeBtn, BorderLayout.WEST);
                    executeBtn.setText("\u57f7\u884c");
                    executeBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            executeBtnActionPerformed(evt);
                        }
                    });
                }
                {
                    srcPathText = new JTextField();
                    if (configBean.getConfigProp().containsKey(SRCPATHTEXT_KEY)) {
                        srcPathText.setText(configBean.getConfigProp().getProperty(SRCPATHTEXT_KEY));
                    }

                    jPanel1.add(srcPathText, BorderLayout.SOUTH);
                    JCommonUtil.jTextFieldSetFilePathMouseEvent(srcPathText, true);
                }
            }
            {
                jPanel2 = new JPanel();
                BorderLayout jPanel2Layout = new BorderLayout();
                jPanel2.setLayout(jPanel2Layout);
                jTabbedPane1.addTab("log", null, jPanel2, null);
                {
                    jScrollPane2 = new JScrollPane();
                    jPanel2.add(jScrollPane2, BorderLayout.CENTER);
                    jScrollPane2.setPreferredSize(new java.awt.Dimension(530, 350));
                    {
                        logArea = new JTextArea();
                        jScrollPane2.setViewportView(logArea);
                    }
                }
            }
        }
        pack();
        this.setSize(551, 417);
    } catch (Exception e) {
        //add your error handling code here
        e.printStackTrace();
    }
}

From source file:org.apache.oodt.cas.workflow.gui.perspective.view.impl.GlobalConfigView.java

@Override
public void refreshView(ViewState state) {

    Rectangle visibleRect = null;
    if (this.tree != null) {
        visibleRect = this.tree.getVisibleRect();
    }/*ww w  .  j a  v  a  2  s  .com*/

    DefaultMutableTreeNode root = new DefaultMutableTreeNode("GlobalConfig");

    if (state != null && state.getGlobalConfigGroups() != null) {
        if (globalConfig != null && globalConfig.keySet().equals(state.getGlobalConfigGroups().keySet())
                && globalConfig.values().equals(state.getGlobalConfigGroups().values())) {
            return;
        }

        this.removeAll();

        for (ConfigGroup group : (globalConfig = state.getGlobalConfigGroups()).values()) {
            HashSet<String> keys = new HashSet<String>();
            DefaultMutableTreeNode groupNode = new DefaultMutableTreeNode(new Group(group.getName()));
            root.add(groupNode);
            for (String key : group.getMetadata().getAllKeys()) {
                keys.add(key);
                DefaultMutableTreeNode keyNode = new DefaultMutableTreeNode(new Key(key));
                groupNode.add(keyNode);
                DefaultMutableTreeNode valueNode = new DefaultMutableTreeNode(
                        new Value(StringUtils.join(group.getMetadata().getAllMetadata(key), ",")));
                keyNode.add(valueNode);
            }
            if (group.getExtends() != null) {
                List<String> extendsGroups = new Vector<String>(group.getExtends());
                Collections.reverse(extendsGroups);
                for (String extendsGroup : extendsGroups) {
                    List<String> groupKeys = state.getGlobalConfigGroups().get(extendsGroup).getMetadata()
                            .getAllKeys();
                    groupKeys.removeAll(keys);
                    if (groupKeys.size() > 0) {
                        for (String key : groupKeys) {
                            if (!keys.contains(key)) {
                                keys.add(key);
                                DefaultMutableTreeNode keyNode = new DefaultMutableTreeNode(
                                        new ExtendsKey(extendsGroup, key));
                                groupNode.add(keyNode);
                                DefaultMutableTreeNode valueNode = new DefaultMutableTreeNode(
                                        new ExtendsValue(StringUtils.join(state.getGlobalConfigGroups()
                                                .get(extendsGroup).getMetadata().getAllMetadata(key), ",")));
                                keyNode.add(valueNode);
                            }
                        }
                    }
                }
            }
        }

        tree = new JTree(root);
        tree.setShowsRootHandles(true);
        tree.setRootVisible(false);

        tree.setCellRenderer(new TreeCellRenderer() {

            public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected,
                    boolean expanded, boolean leaf, int row, boolean hasFocus) {
                DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
                if (node.getUserObject() instanceof Key) {
                    JPanel panel = new JPanel();
                    panel.setLayout(new BorderLayout());
                    JLabel label = new JLabel(node.getUserObject().toString());
                    label.setForeground(Color.darkGray);
                    panel.add(label, BorderLayout.CENTER);
                    panel.setBackground(selected ? Color.lightGray : Color.white);
                    return panel;
                } else if (node.getUserObject() instanceof ExtendsKey) {
                    JPanel panel = new JPanel();
                    panel.setLayout(new BorderLayout());
                    ExtendsKey key = (ExtendsKey) node.getUserObject();
                    JLabel groupLabel = new JLabel("(" + key.getGroup() + ") ");
                    groupLabel.setForeground(Color.black);
                    JLabel keyLabel = new JLabel(key.getValue());
                    keyLabel.setForeground(Color.gray);
                    panel.add(groupLabel, BorderLayout.WEST);
                    panel.add(keyLabel, BorderLayout.CENTER);
                    panel.setBackground(selected ? Color.lightGray : Color.white);
                    return panel;
                } else if (node.getUserObject() instanceof Group) {
                    JPanel panel = new JPanel();
                    panel.setLayout(new BorderLayout());
                    JLabel label = new JLabel(node.getUserObject().toString());
                    label.setForeground(Color.black);
                    label.setBackground(Color.white);
                    panel.add(label, BorderLayout.CENTER);
                    panel.setBackground(selected ? Color.lightGray : Color.white);
                    return panel;
                } else if (node.getUserObject() instanceof Value) {
                    JPanel panel = new JPanel();
                    panel.setLayout(new BorderLayout());
                    panel.setBorder(new EtchedBorder(1));
                    JLabel label = new JLabel(node.getUserObject().toString());
                    label.setForeground(Color.black);
                    panel.add(label, BorderLayout.CENTER);
                    panel.setBackground(selected ? Color.lightGray : Color.white);
                    return panel;
                } else if (node.getUserObject() instanceof ExtendsValue) {
                    JPanel panel = new JPanel();
                    panel.setLayout(new BorderLayout());
                    panel.setBorder(new EtchedBorder(1));
                    JLabel label = new JLabel(node.getUserObject().toString());
                    label.setForeground(Color.gray);
                    panel.add(label, BorderLayout.CENTER);
                    panel.setBackground(selected ? Color.lightGray : Color.white);
                    return panel;
                } else {
                    return new JLabel();
                }
            }

        });
    }

    this.setBorder(new EtchedBorder());
    JLabel panelName = new JLabel("Global-Config Groups");
    panelName.setBorder(new EtchedBorder());
    this.add(panelName, BorderLayout.NORTH);
    JScrollPane scrollPane = new JScrollPane(tree, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Tree", scrollPane);
    tabbedPane.addTab("Table", new JPanel());

    this.add(tabbedPane, BorderLayout.CENTER);

    if (visibleRect != null) {
        this.tree.scrollRectToVisible(visibleRect);
    }

    this.revalidate();
}

From source file:joshua.ui.hypergraph_visualizer.HyperGraphViewer.java

public static void visualizeHypergraphInFrame(HyperGraph hg, SymbolTable st) {
    JFrame frame = new JFrame("Joshua Hypergraph");
    frame.setLayout(new BorderLayout());
    HyperGraphViewer vv = new HyperGraphViewer(new JungHyperGraph(hg, st), st);

    frame.getContentPane().add(vv, BorderLayout.CENTER);
    frame.getContentPane().add(new JScrollPane(vv.edgeList), BorderLayout.WEST);
    frame.setSize(500, 500);/*  w ww . j  a v a  2  s.c  o  m*/
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.setVisible(true);
    return;
}

From source file:lu.lippmann.cdb.ext.hydviga.ui.GapFillingFrame.java

/**
 * Constructor./*w  w  w.ja  va  2 s  .  c o m*/
 */
public GapFillingFrame(final AbstractTabView atv, final Instances dataSet, final Attribute attr,
        final int dateIdx, final int valuesBeforeAndAfter, final int position, final int gapsize,
        final StationsDataProvider gcp, final boolean inBatchMode) {
    super();

    setTitle("Gap filling for " + attr.name() + " ("
            + dataSet.attribute(dateIdx).formatDate(dataSet.instance(position).value(dateIdx)) + " -> "
            + dataSet.attribute(dateIdx).formatDate(dataSet.instance(position + gapsize).value(dateIdx)) + ")");
    LogoHelper.setLogo(this);

    this.atv = atv;

    this.dataSet = dataSet;
    this.attr = attr;
    this.dateIdx = dateIdx;
    this.valuesBeforeAndAfter = valuesBeforeAndAfter;
    this.position = position;
    this.gapsize = gapsize;

    this.gcp = gcp;

    final Instances testds = WekaDataProcessingUtil.buildFilteredDataSet(dataSet, 0,
            dataSet.numAttributes() - 1, Math.max(0, position - valuesBeforeAndAfter),
            Math.min(position + gapsize + valuesBeforeAndAfter, dataSet.numInstances() - 1));

    this.attrNames = WekaTimeSeriesUtil.getNamesOfAttributesWithoutGap(testds);

    this.isGapSimulated = (this.attrNames.contains(attr.name()));
    this.originaldataSet = new Instances(dataSet);
    if (this.isGapSimulated) {
        setTitle(getTitle() + " [SIMULATED GAP]");
        /*final JXLabel fictiveGapLabel=new JXLabel("                                                                        FICTIVE GAP");
        fictiveGapLabel.setForeground(Color.RED);
        fictiveGapLabel.setFont(new Font(fictiveGapLabel.getFont().getName(), Font.PLAIN,fictiveGapLabel.getFont().getSize()*2));
        final JXPanel fictiveGapPanel=new JXPanel();
        fictiveGapPanel.setLayout(new BorderLayout());
        fictiveGapPanel.add(fictiveGapLabel,BorderLayout.CENTER);
        getContentPane().add(fictiveGapPanel,BorderLayout.NORTH);*/
        this.attrNames.remove(attr.name());
        this.originalDataBeforeGapSimulation = dataSet.attributeToDoubleArray(attr.index());
        for (int i = position; i < position + gapsize; i++)
            dataSet.instance(i).setMissing(attr);
    }

    final Object[] attrNamesObj = this.attrNames.toArray();

    this.centerPanel = new JXPanel();
    this.centerPanel.setLayout(new BorderLayout());
    getContentPane().add(this.centerPanel, BorderLayout.CENTER);

    //final JXPanel algoPanel=new JXPanel();
    //getContentPane().add(algoPanel,BorderLayout.NORTH);
    final JXPanel filterPanel = new JXPanel();
    //filterPanel.setLayout(new BoxLayout(filterPanel, BoxLayout.Y_AXIS));      
    filterPanel.setLayout(new GridBagLayout());
    final GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 1;
    gbc.weighty = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(10, 10, 10, 10);
    getContentPane().add(filterPanel, BorderLayout.WEST);

    final JXComboBox algoCombo = new JXComboBox(Algo.values());
    algoCombo.setBorder(new TitledBorder("Algorithm"));
    filterPanel.add(algoCombo, gbc);
    gbc.gridy++;

    final JXLabel infoLabel = new JXLabel("Usable = with no missing values on the period");
    //infoLabel.setBorder(new TitledBorder(""));
    filterPanel.add(infoLabel, gbc);
    gbc.gridy++;

    final JList<Object> timeSeriesList = new JList<Object>(attrNamesObj);
    timeSeriesList.setBorder(new TitledBorder("Usable time series"));
    timeSeriesList.setSelectionMode(DefaultListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    final JScrollPane jcpMap = new JScrollPane(timeSeriesList);
    jcpMap.setPreferredSize(new Dimension(225, 150));
    jcpMap.setMinimumSize(new Dimension(225, 150));
    filterPanel.add(jcpMap, gbc);
    gbc.gridy++;

    final JXPanel mapPanel = new JXPanel();
    mapPanel.setBorder(new TitledBorder(""));
    mapPanel.setLayout(new BorderLayout());
    mapPanel.add(gcp.getMapPanel(Arrays.asList(attr.name()), this.attrNames, true), BorderLayout.CENTER);
    filterPanel.add(mapPanel, gbc);
    gbc.gridy++;

    final JXLabel mssLabel = new JXLabel(
            "<html>Most similar usable serie: <i>[... computation ...]</i></html>");
    mssLabel.setBorder(new TitledBorder(""));
    filterPanel.add(mssLabel, gbc);
    gbc.gridy++;

    final JXLabel nsLabel = new JXLabel("<html>Nearest usable serie: <i>[... computation ...]</i></html>");
    nsLabel.setBorder(new TitledBorder(""));
    filterPanel.add(nsLabel, gbc);
    gbc.gridy++;

    final JXLabel ussLabel = new JXLabel("<html>Upstream serie: <i>[... computation ...]</i></html>");
    ussLabel.setBorder(new TitledBorder(""));
    filterPanel.add(ussLabel, gbc);
    gbc.gridy++;

    final JXLabel dssLabel = new JXLabel("<html>Downstream serie: <i>[... computation ...]</i></html>");
    dssLabel.setBorder(new TitledBorder(""));
    filterPanel.add(dssLabel, gbc);
    gbc.gridy++;

    final JCheckBox hideOtherSeriesCB = new JCheckBox("Hide the others series");
    hideOtherSeriesCB.setSelected(DEFAULT_HIDE_OTHER_SERIES_OPTION);
    filterPanel.add(hideOtherSeriesCB, gbc);
    gbc.gridy++;

    final JCheckBox showErrorCB = new JCheckBox("Show error on plot");
    filterPanel.add(showErrorCB, gbc);
    gbc.gridy++;

    final JCheckBox zoomCB = new JCheckBox("Auto-adjusted size");
    zoomCB.setSelected(DEFAULT_ZOOM_OPTION);
    filterPanel.add(zoomCB, gbc);
    gbc.gridy++;

    final JCheckBox multAxisCB = new JCheckBox("Multiple axis");
    filterPanel.add(multAxisCB, gbc);
    gbc.gridy++;

    final JCheckBox showEnvelopeCB = new JCheckBox("Show envelope (all algorithms, SLOW)");
    filterPanel.add(showEnvelopeCB, gbc);
    gbc.gridy++;

    final JXButton showModelButton = new JXButton("Show the model");
    filterPanel.add(showModelButton, gbc);
    gbc.gridy++;

    showModelButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            final JXFrame dialog = new JXFrame();
            dialog.setTitle("Model");
            LogoHelper.setLogo(dialog);
            dialog.getContentPane().removeAll();
            dialog.getContentPane().setLayout(new BorderLayout());
            final JTextPane modelTxtPane = new JTextPane();
            modelTxtPane.setText(gapFiller.getModel());
            modelTxtPane.setBackground(Color.WHITE);
            modelTxtPane.setEditable(false);
            final JScrollPane jsp = new JScrollPane(modelTxtPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                    JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
            jsp.setSize(new Dimension(400 - 20, 400 - 20));
            dialog.getContentPane().add(jsp, BorderLayout.CENTER);
            dialog.setSize(new Dimension(400, 400));
            dialog.setLocationRelativeTo(centerPanel);
            dialog.pack();
            dialog.setVisible(true);
        }
    });

    algoCombo.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
                showModelButton.setEnabled(gapFiller.hasExplicitModel());
            } catch (final Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    timeSeriesList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(final ListSelectionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
                mapPanel.removeAll();
                final List<String> currentlySelected = new ArrayList<String>();
                currentlySelected.add(attr.name());
                for (final Object sel : timeSeriesList.getSelectedValues())
                    currentlySelected.add(sel.toString());
                mapPanel.add(gcp.getMapPanel(currentlySelected, attrNames, true), BorderLayout.CENTER);
            } catch (final Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    hideOtherSeriesCB.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
            } catch (final Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    showErrorCB.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    zoomCB.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    showEnvelopeCB.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    multAxisCB.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    this.inBatchMode = inBatchMode;

    if (!inBatchMode) {
        try {
            refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), new int[0],
                    DEFAULT_HIDE_OTHER_SERIES_OPTION, false, DEFAULT_ZOOM_OPTION, false, false);
            showModelButton.setEnabled(gapFiller.hasExplicitModel());
        } catch (Exception e1) {
            e1.printStackTrace();
        }
    }

    if (!inBatchMode) {
        /* automatically select computed series */
        new AbstractSimpleAsync<Void>(true) {
            @Override
            public Void execute() throws Exception {
                mostSimilar = WekaTimeSeriesSimilarityUtil.findMostSimilarTimeSerie(testds, attr, attrNames,
                        false);
                mssLabel.setText("<html>Most similar usable serie: <b>" + mostSimilar + "</b></html>");

                nearest = gcp.findNearestStation(attr.name(), attrNames);
                nsLabel.setText("<html>Nearest usable serie: <b>" + nearest + "</b></html>");

                upstream = gcp.findUpstreamStation(attr.name(), attrNames);
                if (upstream != null) {
                    ussLabel.setText("<html>Upstream usable serie: <b>" + upstream + "</b></html>");
                } else {
                    ussLabel.setText("<html>Upstream usable serie: <b>N/A</b></html>");
                }

                downstream = gcp.findDownstreamStation(attr.name(), attrNames);
                if (downstream != null) {
                    dssLabel.setText("<html>Downstream usable serie: <b>" + downstream + "</b></html>");
                } else {
                    dssLabel.setText("<html>Downstream usable serie: <b>N/A</b></html>");
                }

                timeSeriesList.setSelectedIndices(
                        new int[] { attrNames.indexOf(mostSimilar), attrNames.indexOf(nearest),
                                attrNames.indexOf(upstream), attrNames.indexOf(downstream) });

                return null;
            }

            @Override
            public void onSuccess(final Void result) {
            }

            @Override
            public void onFailure(final Throwable caught) {
                caught.printStackTrace();
            }
        }.start();
    } else {
        try {
            mostSimilar = WekaTimeSeriesSimilarityUtil.findMostSimilarTimeSerie(testds, attr, attrNames, false);
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        nearest = gcp.findNearestStation(attr.name(), attrNames);
        upstream = gcp.findUpstreamStation(attr.name(), attrNames);
        downstream = gcp.findDownstreamStation(attr.name(), attrNames);
    }
}

From source file:org.nuclos.client.main.mainframe.workspace.WorkspaceEditor.java

public WorkspaceEditor(WorkspaceVO wovo) {
    final SpringLocaleDelegate localeDelegate = SpringLocaleDelegate.getInstance();
    this.wovo = wovo;
    this.backup = new WorkspaceVO();
    this.backup.importHeader(wovo.getWoDesc());

    boolean showAlwaysReset = wovo.isAssigned()
            && SecurityCache.getInstance().isActionAllowed(Actions.ACTION_WORKSPACE_ASSIGN);

    contentPanel = new JPanel();
    initJPanel(contentPanel,//from  w w  w .j a  v a  2  s.c  o  m
            new double[] { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED,
                    TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL },
            new double[] { 20, 20, 20, 20, showAlwaysReset ? 20 : 0, 10, 20, TableLayout.FILL,
                    TableLayout.PREFERRED });
    contentPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    JLabel lbName = new JLabel(localeDelegate.getMessage("WorkspaceEditor.2", "Name"), JLabel.TRAILING);
    contentPanel.add(lbName, "0, 0");
    tfName = new JTextField(15);
    lbName.setLabelFor(tfName);
    contentPanel.add(tfName, "1, 0");
    chckHideName = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.3", "Name ausblenden"));
    contentPanel.add(chckHideName, "2, 0, 3, 0");
    chckHide = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.8", "Auswahl Button ausblenden"));
    if (wovo.isAssigned() && SecurityCache.getInstance().isActionAllowed(Actions.ACTION_WORKSPACE_ASSIGN)) {
        contentPanel.add(chckHide, "4, 0");
    }
    chckAlwaysOpenAtLogin = new JCheckBox(
            localeDelegate.getMessage("WorkspaceEditor.11", "Immer bei Anmeldung ffnen"));
    contentPanel.add(chckAlwaysOpenAtLogin, "1, 1");

    JLabel lbMainFrame = new JLabel(localeDelegate.getMessage("WorkspaceEditor.9", "Hauptfenster"),
            JLabel.TRAILING);
    contentPanel.add(lbMainFrame, "0, 2");
    chckHideMenuBar = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.10", "Nur Standard Menuleiste"));
    contentPanel.add(chckHideMenuBar, "1, 2");
    chckUseLastFrameSettings = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.12",
            "Letzte Fenster Einstellungen bernehmen (Gre und Position)"));
    contentPanel.add(chckUseLastFrameSettings, "1, 3, 5, 3");
    chckAlwaysReset = new JCheckBox(localeDelegate.getMessage("WorkspaceEditor.alwaysreset",
            "Zuletzt geffnete Tabs immer zurcksetzen"));
    if (showAlwaysReset) {
        contentPanel.add(chckAlwaysReset, "1, 4, 5, 4");
    }

    JTabbedPane tbbdPane = new JTabbedPane();
    nuclosIconChooser = new ResourceIconChooser(WorkspaceChooserController.ICON_SIZE,
            NuclosResourceCategory.ENTITY_ICON);
    nuclosIconChooser.removeBorder();
    tbbdPane.addTab(localeDelegate.getMessage("WorkspaceEditor.4", "Icon"), nuclosIconChooser);
    JPanel parameterPanel = new JPanel(new BorderLayout());
    parameterModel = new ParameterModel();
    jtbParameter = new JTable(parameterModel);
    JScrollPane parameterScroller = new JScrollPane(jtbParameter);
    jtbParameter.setFillsViewportHeight(true);
    jtbParameter.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    jtbParameter.getColumnModel().getColumn(0).setPreferredWidth(100);
    jtbParameter.getColumnModel().getColumn(1).setPreferredWidth(400);
    parameterPanel.add(parameterScroller, BorderLayout.CENTER);
    JToolBar parameterTools = UIUtils.createNonFloatableToolBar(JToolBar.VERTICAL);
    parameterTools.add(new ParameterAddButton());
    btRemoveParameter = new ParameterRemoveButton();
    btRemoveParameter.setEnabled(false);
    parameterTools.add(btRemoveParameter);
    parameterPanel.add(parameterTools, BorderLayout.WEST);
    tbbdPane.addTab(localeDelegate.getMessage("WorkspaceEditor.13", "Parameter"), parameterPanel);
    contentPanel.add(tbbdPane, "1, 6, 5, 7");

    JPanel actionsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 2));
    btSave = new JButton(localeDelegate.getMessage("WorkspaceEditor.5", "Speichern"));
    btCancel = new JButton(localeDelegate.getMessage("WorkspaceEditor.6", "Abbrechen"));
    actionsPanel.add(btSave);
    actionsPanel.add(btCancel);
    contentPanel.add(actionsPanel, "0, 8, 5, 8");

    tfName.setText(wovo.getWoDesc().getName());
    chckHide.setSelected(wovo.getWoDesc().isHide());
    chckHideName.setSelected(wovo.getWoDesc().isHideName());
    chckHideMenuBar.setSelected(wovo.getWoDesc().isHideMenuBar());
    chckAlwaysOpenAtLogin.setSelected(wovo.getWoDesc().isAlwaysOpenAtLogin());
    chckUseLastFrameSettings.setSelected(wovo.getWoDesc().isUseLastFrameSettings());
    chckAlwaysReset.setSelected(wovo.getWoDesc().isAlwaysReset());
    nuclosIconChooser.setSelected(wovo.getWoDesc().getNuclosResource());
    parameterModel.setParamters(wovo.getWoDesc().getParameters());

    dialog = new JDialog(Main.getInstance().getMainFrame(),
            localeDelegate.getMessage("WorkspaceEditor.1", "Arbeitsumgebung Eigenschaften"), true);
    dialog.setContentPane(contentPanel);
    dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    dialog.getRootPane().setDefaultButton(btSave);
    Rectangle mfBounds = Main.getInstance().getMainFrame().getBounds();
    dialog.setBounds(mfBounds.x + (mfBounds.width / 2) - 300, mfBounds.y + (mfBounds.height / 2) - 200, 600,
            400);
    dialog.setResizable(false);

    initListener();
    dialog.setVisible(true);
}

From source file:tk.tomby.tedit.core.Buffer.java

/**
 * Creates a new Buffer object./*from w w w.  ja  v  a  2 s.  c  om*/
 */
public Buffer() {
    super();

    setLayout(new BorderLayout());

    JPanel internalPanel = new JPanel();
    internalPanel.setLayout(new BorderLayout());

    editor = new ColourTextArea();

    int red = PreferenceManager.getInt("general.editor.background.red", 0);
    int green = PreferenceManager.getInt("general.editor.background.green", 0);
    int blue = PreferenceManager.getInt("general.editor.background.blue", 0);
    editor.setBackground(new Color(red, green, blue));

    red = PreferenceManager.getInt("general.editor.foreground.red", 0);
    green = PreferenceManager.getInt("general.editor.foreground.green", 0);
    blue = PreferenceManager.getInt("general.editor.foreground.blue", 0);
    editor.setForeground(new Color(red, green, blue));

    red = PreferenceManager.getInt("general.editor.selection.red", 0);
    green = PreferenceManager.getInt("general.editor.selection.green", 0);
    blue = PreferenceManager.getInt("general.editor.selection.blue", 0);
    editor.setSelectionColor(new Color(red, green, blue));

    String font = PreferenceManager.getString("general.editor.font", "Monospaced");
    int size = PreferenceManager.getInt("general.editor.fontSize", 12);
    editor.setFont(new Font(font, Font.PLAIN, size));

    editor.setEditable(true);
    editor.setDragEnabled(true);
    editor.setEditorKit(EditorKitManager.createEditorKit(getExtension(DEFAULT_FILE_NAME)));

    InputMap map = editor.getInputMap(JComponent.WHEN_FOCUSED);

    for (InputMap imap = map; imap != null; imap = imap.getParent()) {
        imap.remove(KeyStroke.getKeyStroke('V', InputEvent.CTRL_MASK, false));
        imap.remove(KeyStroke.getKeyStroke('C', InputEvent.CTRL_MASK, false));
        imap.remove(KeyStroke.getKeyStroke('X', InputEvent.CTRL_MASK, false));
        imap.remove(KeyStroke.getKeyStroke('A', InputEvent.CTRL_MASK, false));
    }

    editor.setInputMap(JComponent.WHEN_FOCUSED, map);

    editor.addCaretListener(new CaretListener() {
        public void caretUpdate(CaretEvent evt) {
            MessageManager.sendMessage(new BufferMessage(evt.getSource(), BufferMessage.CARET_EVENT));
        }
    });

    internalPanel.add(BorderLayout.CENTER, editor);

    if (PreferenceManager.getBoolean("general.editor.lineNumbers", false)) {
        lines = new LineNumbering();
        lines.setPreferredSize(new Dimension(50, 0));
        lines.setFont(new Font(font, Font.PLAIN, size));
        lines.setFocusable(false);
        lines.setDocument(editor.getDocument());

        internalPanel.add(BorderLayout.WEST, lines);
    }

    JScrollPane scroll = new JScrollPane(internalPanel);
    scroll.getVerticalScrollBar().setUnitIncrement(10);
    scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scroll.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE);

    add(BorderLayout.CENTER, scroll);

    editor.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent evt) {
            if (evt.isPopupTrigger()) {
                WorkspaceManager.getPopupMenu().show(evt.getComponent(), evt.getX(), evt.getY());
            }
        }

        public void mouseReleased(MouseEvent evt) {
            if (evt.isPopupTrigger()) {
                WorkspaceManager.getPopupMenu().show(evt.getComponent(), evt.getX(), evt.getY());
            }
        }
    });

    undo = new UndoManager();

    undoableListener = new UndoableEditListener() {
        public void undoableEditHappened(UndoableEditEvent evt) {
            undo.addEdit(evt.getEdit());

            MessageManager.sendMessage(new BufferMessage(evt.getSource(), BufferMessage.UNDOABLE_EDIT_EVENT));

            if (!modifiedState) {
                setModifiedState(true);
            }
        }
    };

    editor.getDocument().addUndoableEditListener(undoableListener);

    MessageManager.addMessageListener(MessageManager.PREFERENCE_GROUP_NAME, this);

    fileName = DEFAULT_FILE_NAME;
}

From source file:Trabalho.HistogramaHSB.java

private void mostraTela() throws IOException {
    JFrame f = new JFrame("PDI - Histograma");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.add(criaHistograma(), BorderLayout.EAST);
    f.add(new JLabel(new ImageIcon(imagem)), BorderLayout.WEST);
    f.add(criaPainel(), BorderLayout.SOUTH);
    f.pack();//  ww w  .j a  va 2  s  .c  om
    f.setLocationRelativeTo(f);
    f.setVisible(true);
}

From source file:org.isatools.gui.datamanager.studyaccess.StudyAccessionGUI.java

private JPanel createEmptyDbPanel() {
    JPanel errorPanel = new JPanel();
    errorPanel.setLayout(new BoxLayout(errorPanel, BoxLayout.PAGE_AXIS));
    errorPanel.setOpaque(false);//from   www . java2s  .c om

    errorPanel.add(new JLabel(noStudiesPresentInfo), JLabel.CENTER);

    // add button to go back to main menu!

    JPanel buttonPanel = new JPanel(new BorderLayout());
    buttonPanel.setOpaque(false);

    buttonPanel.add(createBackToMainMenuButton(), BorderLayout.WEST);

    errorPanel.add(Box.createVerticalStrut(20));
    errorPanel.add(buttonPanel);

    return errorPanel;
}

From source file:hr.fer.zemris.vhdllab.platform.ui.wizard.support.PortWizardPage.java

private Component createButtons() {
    addAction = new ActionCommand(PAGE_ID + ".addRow") {
        @Override/*ww w . j a  v a2  s  . c o  m*/
        protected void doExecuteCommand() {
            Port port = new Port();
            port.setDirection(PortDirection.IN);
            model.addRow(port);
        }
    };
    removeAction = new ActionCommand(PAGE_ID + ".removeRow") {
        @Override
        protected void onButtonAttached(AbstractButton button) {
            this.setEnabled(false); // remove action is initially disabled
            super.onButtonAttached(button);
        }

        @Override
        protected void doExecuteCommand() {
            int selectedRow = table.getSelectedRow();
            if (selectedRow != -1) {
                TableCellEditor cellEditor = table.getCellEditor();
                if (cellEditor != null) {
                    cellEditor.stopCellEditing();
                }
                model.remove(selectedRow);
                int rowToSelect = Math.min(selectedRow, model.getRowCount() - 1);
                if (rowToSelect != -1) {
                    table.getSelectionModel().setSelectionInterval(rowToSelect, rowToSelect);
                }
            }
        }
    };
    getCommandConfigurer().configure(addAction);
    getCommandConfigurer().configure(removeAction);
    JPanel buttonPanel = new JPanel(new FlowLayout());
    buttonPanel.add(addAction.createButton());
    buttonPanel.add(removeAction.createButton());
    JPanel control = new JPanel(new BorderLayout());
    control.add(buttonPanel, BorderLayout.WEST);
    return control;
}

From source file:com.floreantpos.ui.views.order.OrderView.java

/** This method is called from within the constructor to
 * initialize the form./*from ww w.  j av a 2  s  . com*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
    setOpaque(false);
    setLayout(new java.awt.BorderLayout(2, 1));

    midContainer.setOpaque(false);
    midContainer.setBorder(null);
    midContainer.add(groupView, BorderLayout.NORTH);
    midContainer.add(itemView);

    add(categoryView, java.awt.BorderLayout.EAST);
    add(ticketView, java.awt.BorderLayout.WEST);
    add(midContainer, java.awt.BorderLayout.CENTER);
    add(actionButtonPanel, java.awt.BorderLayout.SOUTH);

    //      addView(GroupView.VIEW_NAME, groupView);
    //      addView(MenuItemView.VIEW_NAME, itemView);
    //      addView("VIEW_EMPTY", new com.floreantpos.swing.TransparentPanel()); //$NON-NLS-1$

    addActionButtonPanel();
    btnOrderType.setVisible(false);
    showView("VIEW_EMPTY"); //$NON-NLS-1$
}