Example usage for java.awt FlowLayout LEFT

List of usage examples for java.awt FlowLayout LEFT

Introduction

In this page you can find the example usage for java.awt FlowLayout LEFT.

Prototype

int LEFT

To view the source code for java.awt FlowLayout LEFT.

Click Source Link

Document

This value indicates that each row of components should be left-justified.

Usage

From source file:lcmc.gui.resources.ServiceInfo.java

/** Adds new Service and dependence. */
private MyMenu getAddServiceMenuItem(final boolean testOnly, final String name) {
    final ServiceInfo thisClass = this;
    return new MyMenu(name, new AccessMode(ConfigData.AccessType.ADMIN, false),
            new AccessMode(ConfigData.AccessType.OP, false)) {
        private static final long serialVersionUID = 1L;
        private final Lock mUpdateLock = new ReentrantLock();

        @Override/*from   w w w. j a v a2s  . c om*/
        public String enablePredicate() {
            if (getBrowser().clStatusFailed()) {
                return ClusterBrowser.UNKNOWN_CLUSTER_STATUS_STRING;
            } else if (getService().isRemoved()) {
                return IS_BEING_REMOVED_STRING;
            } else if (getService().isOrphaned()) {
                return IS_ORPHANED_STRING;
            } else if (getService().isNew()) {
                return IS_NEW_STRING;
            }
            return null;
        }

        @Override
        public void update() {
            final Thread t = new Thread(new Runnable() {
                @Override
                public void run() {
                    if (mUpdateLock.tryLock()) {
                        try {
                            updateThread();
                        } finally {
                            mUpdateLock.unlock();
                        }
                    }
                }
            });
            t.start();
        }

        private void updateThread() {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    setEnabled(false);
                }
            });
            Tools.invokeAndWait(new Runnable() {
                @Override
                public void run() {
                    removeAll();
                }
            });
            final Point2D pos = getPos();
            final CRMXML crmXML = getBrowser().getCRMXML();
            final ResourceAgent fsService = crmXML.getResourceAgent("Filesystem",
                    ResourceAgent.HEARTBEAT_PROVIDER, ResourceAgent.OCF_CLASS);
            final MyMenu thisMenu = this;
            if (crmXML.isLinbitDrbdPresent()) { /* just skip it, if it
                                                   is not */
                final ResourceAgent linbitDrbdService = crmXML.getHbLinbitDrbd();
                /* Linbit:DRBD */
                try {
                    SwingUtilities.invokeAndWait(new Runnable() {
                        @Override
                        public void run() {
                            addDrbdLinbitMenu(thisMenu, crmXML, pos, fsService, testOnly);
                        }
                    });
                } catch (final InterruptedException ix) {
                    Thread.currentThread().interrupt();
                } catch (final InvocationTargetException x) {
                    Tools.printStackTrace();
                }

            }
            if (crmXML.isDrbddiskPresent()) { /* just skip it,
                                                 if it is not */
                /* drbddisk */
                try {
                    SwingUtilities.invokeAndWait(new Runnable() {
                        @Override
                        public void run() {
                            addDrbddiskMenu(thisMenu, crmXML, pos, fsService, testOnly);
                        }
                    });
                } catch (final InterruptedException ix) {
                    Thread.currentThread().interrupt();
                } catch (final InvocationTargetException x) {
                    Tools.printStackTrace();
                }
            }
            final ResourceAgent ipService = crmXML.getResourceAgent("IPaddr2", ResourceAgent.HEARTBEAT_PROVIDER,
                    ResourceAgent.OCF_CLASS);
            if (ipService != null) { /* just skip it, if it is not*/
                /* ipaddr */
                try {
                    SwingUtilities.invokeAndWait(new Runnable() {
                        @Override
                        public void run() {
                            addIpMenu(thisMenu, pos, ipService, testOnly);
                        }
                    });
                } catch (final InterruptedException ix) {
                    Thread.currentThread().interrupt();
                } catch (final InvocationTargetException x) {
                    Tools.printStackTrace();
                }
            }
            if (fsService != null) { /* just skip it, if it is not*/
                /* Filesystem */
                try {
                    SwingUtilities.invokeAndWait(new Runnable() {
                        @Override
                        public void run() {
                            addFilesystemMenu(thisMenu, pos, fsService, testOnly);
                        }
                    });
                } catch (final InterruptedException ix) {
                    Thread.currentThread().interrupt();
                } catch (final InvocationTargetException x) {
                    Tools.printStackTrace();
                }
            }
            final List<JDialog> popups = new ArrayList<JDialog>();
            for (final String cl : ClusterBrowser.HB_CLASSES) {
                final List<ResourceAgent> services = getAddServiceList(cl);
                if (services.size() == 0) {
                    /* no services, don't show */
                    continue;
                }
                final JCheckBox colocationWi = new JCheckBox("Colo", true);
                final JCheckBox orderWi = new JCheckBox("Order", true);
                colocationWi.setBackground(ClusterBrowser.STATUS_BACKGROUND);
                colocationWi.setPreferredSize(colocationWi.getMinimumSize());
                orderWi.setBackground(ClusterBrowser.STATUS_BACKGROUND);
                orderWi.setPreferredSize(orderWi.getMinimumSize());
                final JPanel colOrdPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
                colOrdPanel.setBackground(ClusterBrowser.STATUS_BACKGROUND);
                colOrdPanel.add(colocationWi);
                colOrdPanel.add(orderWi);
                boolean mode = !AccessMode.ADVANCED;
                if (ResourceAgent.UPSTART_CLASS.equals(cl) || ResourceAgent.SYSTEMD_CLASS.equals(cl)) {
                    mode = AccessMode.ADVANCED;
                }
                if (ResourceAgent.LSB_CLASS.equals(cl)
                        && !getAddServiceList(ResourceAgent.SERVICE_CLASS).isEmpty()) {
                    mode = AccessMode.ADVANCED;
                }
                final MyMenu classItem = new MyMenu(ClusterBrowser.getClassMenu(cl),
                        new AccessMode(ConfigData.AccessType.ADMIN, mode),
                        new AccessMode(ConfigData.AccessType.OP, mode));
                final MyListModel<MyMenuItem> dlm = new MyListModel<MyMenuItem>();
                for (final ResourceAgent ra : services) {
                    try {
                        SwingUtilities.invokeAndWait(new Runnable() {
                            @Override
                            public void run() {
                                addResourceAgentMenu(ra, dlm, pos, popups, colocationWi, orderWi, testOnly);
                            }
                        });
                    } catch (final InterruptedException ix) {
                        Thread.currentThread().interrupt();
                    } catch (final InvocationTargetException x) {
                        Tools.printStackTrace();
                    }
                }
                try {
                    SwingUtilities.invokeAndWait(new Runnable() {
                        @Override
                        public void run() {
                            final boolean ret = Tools.getScrollingMenu(ClusterBrowser.getClassMenu(cl),
                                    colOrdPanel, classItem, dlm, new MyList<MyMenuItem>(dlm, getBackground()),
                                    thisClass, popups, null);
                            if (!ret) {
                                classItem.setEnabled(false);
                            }
                            thisMenu.add(classItem);
                        }
                    });
                } catch (final InterruptedException ix) {
                    Thread.currentThread().interrupt();
                } catch (final InvocationTargetException x) {
                    Tools.printStackTrace();
                }
            }
            super.update();
        }
    };
}

From source file:com.peterbochs.PeterBochsDebugger.java

private JToolBar getJPanel13() {
    if (jPanel13 == null) {
        jPanel13 = new JToolBar();
        FlowLayout jPanel13Layout = new FlowLayout();
        jPanel13Layout.setAlignment(FlowLayout.LEFT);
        {/*  ww w . j  a  va  2  s.  c o m*/
            jLabel3 = new JLabel();
            jPanel13.add(jLabel3);
            jLabel3.setText(MyLanguage.getString("Pause_history"));
        }
        jPanel13.add(getJRadioButton1());
        jPanel13.add(getJRadioButton2());
        jPanel13.add(getJFPURadioButton());
        jPanel13.add(getJMMXRadioButton());
        jPanel13.add(getJButton1());
        jPanel13.add(getJExportHistoryToExcelButton());
        jPanel13.add(getJClearHistoryTableButton());
        jPanel13.add(getJLabel2());
        jPanel13.add(getJHistoryTableRepeatedLabel());
        jPanel13.add(getJFilterHistoryTableTextField());
        jPanel13.add(getJLabel9());
        jPanel13.add(getJLabel8());
        jPanel13.add(getJLabel7());
        jPanel13.add(getJShowAfterwardSpinner());
    }
    return jPanel13;
}

From source file:com.peterbochs.PeterBochsDebugger.java

private JToolBar getJPanel19() {
    if (jPanel19 == null) {
        jPanel19 = new JToolBar();
        FlowLayout jPanel19Layout = new FlowLayout();
        jPanel19Layout.setAlignment(FlowLayout.LEFT);
        jPanel19.add(getJPagingGraphButton());
        jPanel19.add(getJButton21x());//from   w w  w  .j ava  2 s  . c o m
        jPanel19.add(getJButton20());
        jPanel19.add(getJDumpPageDirectoryAddressTextField());
        jPanel19.add(getJButton21());
        jPanel19.add(getJHideIfAddressIsZeroCheckBox());
    }
    return jPanel19;
}

From source file:com.peterbochs.PeterBochsDebugger.java

private JPanel getJPanel25() {
    if (jPanel25 == null) {
        jPanel25 = new JPanel();
        FlowLayout jPanel25Layout = new FlowLayout();
        jPanel25Layout.setHgap(0);//  www  .  ja  v a 2  s.c  o  m
        jPanel25Layout.setVgap(0);
        jPanel25Layout.setAlignment(FlowLayout.LEFT);
        jPanel25.setLayout(jPanel25Layout);
        {
            jStatusLabel = new JLabel();
            jPanel25.add(jStatusLabel);
            jStatusLabel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20));
            jStatusLabel.setForeground(new java.awt.Color(255, 0, 0));
        }
        jPanel25.add(getJCPUModeLabel());
        jPanel25.add(getJBochsVersionLabel());
        jPanel25.add(getJLatestVersionLabel());
    }
    return jPanel25;
}

From source file:com.peterbochs.PeterBochsDebugger.java

private JToolBar getJPanel26() {
    if (jPanel26 == null) {
        jPanel26 = new JToolBar();
        FlowLayout jPanel26Layout = new FlowLayout();
        jPanel26Layout.setAlignment(FlowLayout.LEFT);
        jPanel26.add(getJELFComboBox());
        jPanel26.add(getJButton16x());// ww w  . j a  va2s.  c om
    }
    return jPanel26;
}

From source file:com.peterbochs.PeterBochsDebugger.java

private JToolBar getJPanel27() {
    if (jPanel27 == null) {
        jPanel27 = new JToolBar();
        FlowLayout jPanel27Layout = new FlowLayout();
        jPanel27Layout.setAlignment(FlowLayout.LEFT);
        jPanel27.add(getJTextField1x());
        jPanel27.add(getJSearchObjdumpButton());
    }/*from   w  w w  .  j  a  va2  s  .c o m*/
    return jPanel27;
}