예제 #1
0
파일: MainPanel.java 프로젝트: npk/lcmc
  /** Prepares a new <code>MainPanel</code> object. */
  public MainPanel() {
    super(new BorderLayout());
    // TODO: not new Host() but null
    final TerminalPanel terminalPanel = new TerminalPanel(new Host());
    final JSplitPane splitPane =
        new JSplitPane(JSplitPane.VERTICAL_SPLIT, new ClustersPanel(), terminalPanel);
    Tools.getGUIData().setTerminalSplitPane(splitPane);

    splitPane.setContinuousLayout(true);
    splitPane.setResizeWeight(1);
    splitPane.setOneTouchExpandable(true);

    splitPane.addHierarchyListener(
        new HierarchyListener() {
          public void hierarchyChanged(final HierarchyEvent e) {
            mExpanding.lock();
            if (!expandingDone && (e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {

              expandingDone = true;
              mExpanding.unlock();
              Tools.getGUIData().expandTerminalSplitPane(1);
            } else {
              mExpanding.unlock();
            }
          }
        });
    add(splitPane, BorderLayout.CENTER);
  }
예제 #2
0
  /**
   * Starts file chooser.
   *
   * @param dir whether it needs dir or file
   */
  protected void startFileChooser(
      final Widget paramWi, final String directory, final boolean dirOnly) {
    final Host host = getFirstConnectedHost();
    if (host == null) {
      Tools.appError("Connection to host lost.");
      return;
    }
    final VMSHardwareInfo thisClass = this;
    final JFileChooser fc =
        new JFileChooser(getLinuxDir(directory, host), getFileSystemView(host, directory)) {
          /** Serial version UID. */
          private static final long serialVersionUID = 1L;

          @Override
          public final void setCurrentDirectory(final File dir) {
            super.setCurrentDirectory(new LinuxFile(thisClass, host, dir.toString(), "d", 0, 0));
          }
        };
    fc.setBackground(ClusterBrowser.STATUS_BACKGROUND);
    fc.setDialogType(JFileChooser.CUSTOM_DIALOG);
    if (dirOnly) {
      fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    }
    fc.setDialogTitle(Tools.getString("VMSDiskInfo.FileChooserTitle") + host.getName());
    //        fc.setApproveButtonText(Tools.getString("VMSDiskInfo.Approve"));
    fc.setApproveButtonToolTipText(Tools.getString("VMSDiskInfo.Approve.ToolTip"));
    fc.putClientProperty("FileChooser.useShellFolder", Boolean.FALSE);
    final int ret =
        fc.showDialog(Tools.getGUIData().getMainFrame(), Tools.getString("VMSDiskInfo.Approve"));
    linuxFileCache.clear();
    if (ret == JFileChooser.APPROVE_OPTION && fc.getSelectedFile() != null) {
      final String name = fc.getSelectedFile().getAbsolutePath();
      paramWi.setValue(name);
    }
  }
예제 #3
0
파일: UserConfig.java 프로젝트: npk/lcmc
 /** Starts specified clusters and connects to the hosts of this clusters. */
 public void startClusters(final List<Cluster> selectedClusters) {
   final Set<Cluster> clusters = Tools.getConfigData().getClusters().getClusterSet();
   if (clusters != null) {
     /* clusters */
     for (final Cluster cluster : clusters) {
       if (selectedClusters != null && !selectedClusters.contains(cluster)) {
         continue;
       }
       Tools.getGUIData().addClusterTab(cluster);
       if (cluster.getHosts().isEmpty()) {
         continue;
       }
       final boolean ok = cluster.connect(null, true, 1);
       if (!ok) {
         Tools.getGUIData().getClustersPanel().removeTab(cluster);
         continue;
       }
       final Runnable runnable =
           new Runnable() {
             @Override
             public void run() {
               for (final Host host : cluster.getHosts()) {
                 host.waitOnLoading();
               }
               cluster.getClusterTab().addClusterView();
               SwingUtilities.invokeLater(
                   new Runnable() {
                     public void run() {
                       cluster.getClusterTab().requestFocus();
                     }
                   });
             }
           };
       final Thread thread = new Thread(runnable);
       thread.start();
     }
   }
 }
예제 #4
0
  /** Creates the popup for the host. */
  @Override
  public List<UpdatableItem> createPopup() {
    final List<UpdatableItem> items = new ArrayList<UpdatableItem>();
    final boolean testOnly = false;
    /* host wizard */
    final MyMenuItem hostWizardItem =
        new MyMenuItem(
            Tools.getString("HostBrowser.HostWizard"),
            HostBrowser.HOST_ICON_LARGE,
            "",
            new AccessMode(ConfigData.AccessType.RO, false),
            new AccessMode(ConfigData.AccessType.RO, false)) {
          private static final long serialVersionUID = 1L;

          @Override
          public String enablePredicate() {
            return null;
          }

          @Override
          public void action() {
            final EditHostDialog dialog = new EditHostDialog(host);
            dialog.showDialogs();
          }
        };
    items.add(hostWizardItem);
    Tools.getGUIData().registerAddHostButton(hostWizardItem);
    /* cluster manager standby on/off */
    final HostInfo thisClass = this;
    final MyMenuItem standbyItem =
        new MyMenuItem(
            Tools.getString("HostBrowser.CRM.StandByOn"),
            HOST_STANDBY_ICON,
            ClusterBrowser.STARTING_PTEST_TOOLTIP,
            Tools.getString("HostBrowser.CRM.StandByOff"),
            HOST_STANDBY_OFF_ICON,
            ClusterBrowser.STARTING_PTEST_TOOLTIP,
            new AccessMode(ConfigData.AccessType.OP, false),
            new AccessMode(ConfigData.AccessType.OP, false)) {
          private static final long serialVersionUID = 1L;

          @Override
          public boolean predicate() {
            return !isStandby(testOnly);
          }

          @Override
          public String enablePredicate() {
            if (!getHost().isClStatus()) {
              return NO_PCMK_STATUS_STRING;
            }
            return null;
          }

          @Override
          public void action() {
            final Host dcHost = getBrowser().getClusterBrowser().getDCHost();
            if (isStandby(testOnly)) {
              CRM.standByOff(dcHost, host, testOnly);
            } else {
              CRM.standByOn(dcHost, host, testOnly);
            }
          }
        };
    final ClusterBrowser cb = getBrowser().getClusterBrowser();
    if (cb != null) {
      final ClusterBrowser.ClMenuItemCallback standbyItemCallback =
          cb.new ClMenuItemCallback(standbyItem, host) {
            @Override
            public void action(final Host dcHost) {
              if (isStandby(false)) {
                CRM.standByOff(dcHost, host, true);
              } else {
                CRM.standByOn(dcHost, host, true);
              }
            }
          };
      addMouseOverListener(standbyItem, standbyItemCallback);
    }
    items.add(standbyItem);

    /* Migrate all services from this host. */
    final MyMenuItem allMigrateFromItem =
        new MyMenuItem(
            Tools.getString("HostInfo.CRM.AllMigrateFrom"),
            HOST_STANDBY_ICON,
            ClusterBrowser.STARTING_PTEST_TOOLTIP,
            new AccessMode(ConfigData.AccessType.OP, false),
            new AccessMode(ConfigData.AccessType.OP, false)) {
          private static final long serialVersionUID = 1L;

          @Override
          public boolean predicate() {
            return true;
          }

          @Override
          public String enablePredicate() {
            if (!getHost().isClStatus()) {
              return NO_PCMK_STATUS_STRING;
            }
            if (getBrowser().getClusterBrowser().getExistingServiceList(null).isEmpty()) {
              return "there are no services to migrate";
            }
            return null;
          }

          @Override
          public void action() {
            for (final ServiceInfo si : cb.getExistingServiceList(null)) {
              if (!si.isConstraintPH() && si.getGroupInfo() == null && si.getCloneInfo() == null) {
                final List<String> runningOnNodes = si.getRunningOnNodes(false);
                if (runningOnNodes != null && runningOnNodes.contains(getHost().getName())) {
                  final Host dcHost = getHost();
                  si.migrateFromResource(dcHost, getHost().getName(), false);
                }
              }
            }
          }
        };
    if (cb != null) {
      final ClusterBrowser.ClMenuItemCallback allMigrateFromItemCallback =
          cb.new ClMenuItemCallback(allMigrateFromItem, host) {
            @Override
            public void action(final Host dcHost) {
              for (final ServiceInfo si : cb.getExistingServiceList(null)) {
                if (!si.isConstraintPH() && si.getGroupInfo() == null) {
                  final List<String> runningOnNodes = si.getRunningOnNodes(false);
                  if (runningOnNodes != null && runningOnNodes.contains(host.getName())) {
                    si.migrateFromResource(dcHost, host.getName(), true);
                  }
                }
              }
            }
          };
      addMouseOverListener(allMigrateFromItem, allMigrateFromItemCallback);
    }
    items.add(allMigrateFromItem);
    /* Stop corosync/openais. */
    final MyMenuItem stopCorosyncItem =
        new MyMenuItem(
            Tools.getString("HostInfo.StopCorosync"),
            HOST_STOP_COMM_LAYER_ICON,
            ClusterBrowser.STARTING_PTEST_TOOLTIP,
            Tools.getString("HostInfo.StopOpenais"),
            HOST_STOP_COMM_LAYER_ICON,
            ClusterBrowser.STARTING_PTEST_TOOLTIP,
            new AccessMode(ConfigData.AccessType.ADMIN, true),
            new AccessMode(ConfigData.AccessType.ADMIN, false)) {
          private static final long serialVersionUID = 1L;

          @Override
          public boolean predicate() {
            /* when both are running it's openais. */
            return getHost().isCsRunning() && !getHost().isAisRunning();
          }

          @Override
          public boolean visiblePredicate() {
            return getHost().isCsRunning() || getHost().isAisRunning();
          }

          @Override
          public void action() {
            if (Tools.confirmDialog(
                Tools.getString("HostInfo.confirmCorosyncStop.Title"),
                Tools.getString("HostInfo.confirmCorosyncStop.Desc"),
                Tools.getString("HostInfo.confirmCorosyncStop.Yes"),
                Tools.getString("HostInfo.confirmCorosyncStop.No"))) {
              final Host host = getHost();
              host.setCommLayerStopping(true);
              if (!host.isPcmkStartedByCorosync() && host.isPcmkInit() && host.isPcmkRunning()) {
                Corosync.stopCorosyncWithPcmk(host);
              } else {
                Corosync.stopCorosync(host);
              }

              getBrowser().getClusterBrowser().updateHWInfo(host);
            }
          }
        };
    if (cb != null) {
      final ClusterBrowser.ClMenuItemCallback stopCorosyncItemCallback =
          cb.new ClMenuItemCallback(stopCorosyncItem, host) {
            @Override
            public void action(final Host dcHost) {
              if (!isStandby(false)) {
                CRM.standByOn(dcHost, host, true);
              }
            }
          };
      addMouseOverListener(stopCorosyncItem, stopCorosyncItemCallback);
    }
    items.add(stopCorosyncItem);
    /* Stop heartbeat. */
    final MyMenuItem stopHeartbeatItem =
        new MyMenuItem(
            Tools.getString("HostInfo.StopHeartbeat"),
            HOST_STOP_COMM_LAYER_ICON,
            ClusterBrowser.STARTING_PTEST_TOOLTIP,
            new AccessMode(ConfigData.AccessType.ADMIN, true),
            new AccessMode(ConfigData.AccessType.ADMIN, false)) {
          private static final long serialVersionUID = 1L;

          @Override
          public boolean visiblePredicate() {
            return getHost().isHeartbeatRunning();
          }

          @Override
          public void action() {
            if (Tools.confirmDialog(
                Tools.getString("HostInfo.confirmHeartbeatStop.Title"),
                Tools.getString("HostInfo.confirmHeartbeatStop.Desc"),
                Tools.getString("HostInfo.confirmHeartbeatStop.Yes"),
                Tools.getString("HostInfo.confirmHeartbeatStop.No"))) {
              getHost().setCommLayerStopping(true);
              Heartbeat.stopHeartbeat(getHost());
              getBrowser().getClusterBrowser().updateHWInfo(host);
            }
          }
        };
    if (cb != null) {
      final ClusterBrowser.ClMenuItemCallback stopHeartbeatItemCallback =
          cb.new ClMenuItemCallback(stopHeartbeatItem, host) {
            @Override
            public void action(final Host dcHost) {
              if (!isStandby(false)) {
                CRM.standByOn(dcHost, host, true);
              }
            }
          };
      addMouseOverListener(stopHeartbeatItem, stopHeartbeatItemCallback);
    }
    items.add(stopHeartbeatItem);
    /* Start corosync. */
    final MyMenuItem startCorosyncItem =
        new MyMenuItem(
            Tools.getString("HostInfo.StartCorosync"),
            HOST_START_COMM_LAYER_ICON,
            ClusterBrowser.STARTING_PTEST_TOOLTIP,
            new AccessMode(ConfigData.AccessType.ADMIN, false),
            new AccessMode(ConfigData.AccessType.ADMIN, false)) {
          private static final long serialVersionUID = 1L;

          @Override
          public boolean visiblePredicate() {
            final Host h = getHost();
            return h.isCorosync()
                && h.isCsInit()
                && h.isCsAisConf()
                && !h.isCsRunning()
                && !h.isAisRunning()
                && !h.isHeartbeatRunning()
                && !h.isHeartbeatRc();
          }

          @Override
          public String enablePredicate() {
            final Host h = getHost();
            if (h.isAisRc() && !h.isCsRc()) {
              return "Openais is in rc.d";
            }
            return null;
          }

          @Override
          public void action() {
            getHost().setCommLayerStarting(true);
            if (getHost().isPcmkRc()) {
              Corosync.startCorosyncWithPcmk(getHost());
            } else {
              Corosync.startCorosync(getHost());
            }
            getBrowser().getClusterBrowser().updateHWInfo(host);
          }
        };
    if (cb != null) {
      final ClusterBrowser.ClMenuItemCallback startCorosyncItemCallback =
          cb.new ClMenuItemCallback(startCorosyncItem, host) {
            @Override
            public void action(final Host host) {
              // TODO
            }
          };
      addMouseOverListener(startCorosyncItem, startCorosyncItemCallback);
    }
    items.add(startCorosyncItem);
    /* Start openais. */
    final MyMenuItem startOpenaisItem =
        new MyMenuItem(
            Tools.getString("HostInfo.StartOpenais"),
            HOST_START_COMM_LAYER_ICON,
            ClusterBrowser.STARTING_PTEST_TOOLTIP,
            new AccessMode(ConfigData.AccessType.ADMIN, false),
            new AccessMode(ConfigData.AccessType.ADMIN, false)) {
          private static final long serialVersionUID = 1L;

          @Override
          public boolean visiblePredicate() {
            final Host h = getHost();
            return h.isAisInit()
                && h.isCsAisConf()
                && !h.isCsRunning()
                && !h.isAisRunning()
                && !h.isHeartbeatRunning()
                && !h.isHeartbeatRc();
          }

          @Override
          public String enablePredicate() {
            final Host h = getHost();
            if (h.isCsRc() && !h.isAisRc()) {
              return "Corosync is in rc.d";
            }
            return null;
          }

          @Override
          public void action() {
            getHost().setCommLayerStarting(true);
            Openais.startOpenais(getHost());
            getBrowser().getClusterBrowser().updateHWInfo(host);
          }
        };
    if (cb != null) {
      final ClusterBrowser.ClMenuItemCallback startOpenaisItemCallback =
          cb.new ClMenuItemCallback(startOpenaisItem, host) {
            @Override
            public void action(final Host host) {
              // TODO
            }
          };
      addMouseOverListener(startOpenaisItem, startOpenaisItemCallback);
    }
    items.add(startOpenaisItem);
    /* Start heartbeat. */
    final MyMenuItem startHeartbeatItem =
        new MyMenuItem(
            Tools.getString("HostInfo.StartHeartbeat"),
            HOST_START_COMM_LAYER_ICON,
            ClusterBrowser.STARTING_PTEST_TOOLTIP,
            new AccessMode(ConfigData.AccessType.ADMIN, false),
            new AccessMode(ConfigData.AccessType.ADMIN, false)) {
          private static final long serialVersionUID = 1L;

          @Override
          public boolean visiblePredicate() {
            final Host h = getHost();
            return h.isHeartbeatInit()
                && h.isHeartbeatConf()
                && !h.isCsRunning()
                && !h.isAisRunning()
                && !h.isHeartbeatRunning();
            // && !h.isAisRc()
            // && !h.isCsRc(); TODO should check /etc/defaults/
          }

          @Override
          public void action() {
            getHost().setCommLayerStarting(true);
            Heartbeat.startHeartbeat(getHost());
            getBrowser().getClusterBrowser().updateHWInfo(host);
          }
        };
    if (cb != null) {
      final ClusterBrowser.ClMenuItemCallback startHeartbeatItemCallback =
          cb.new ClMenuItemCallback(startHeartbeatItem, host) {
            @Override
            public void action(final Host host) {
              // TODO
            }
          };
      addMouseOverListener(startHeartbeatItem, startHeartbeatItemCallback);
    }
    items.add(startHeartbeatItem);

    /* Start pacemaker. */
    final MyMenuItem startPcmkItem =
        new MyMenuItem(
            Tools.getString("HostInfo.StartPacemaker"),
            HOST_START_COMM_LAYER_ICON,
            ClusterBrowser.STARTING_PTEST_TOOLTIP,
            new AccessMode(ConfigData.AccessType.ADMIN, false),
            new AccessMode(ConfigData.AccessType.ADMIN, false)) {
          private static final long serialVersionUID = 1L;

          @Override
          public boolean visiblePredicate() {
            final Host h = getHost();
            return !h.isPcmkStartedByCorosync()
                && !h.isPcmkRunning()
                && (h.isCsRunning() || h.isAisRunning())
                && !h.isHeartbeatRunning();
          }

          @Override
          public String enablePredicate() {
            return null;
          }

          @Override
          public void action() {
            host.setPcmkStarting(true);
            Corosync.startPacemaker(host);
            getBrowser().getClusterBrowser().updateHWInfo(host);
          }
        };
    if (cb != null) {
      final ClusterBrowser.ClMenuItemCallback startPcmkItemCallback =
          cb.new ClMenuItemCallback(startPcmkItem, host) {
            @Override
            public void action(final Host host) {
              // TODO
            }
          };
      addMouseOverListener(startPcmkItem, startPcmkItemCallback);
    }
    items.add(startPcmkItem);
    /* change host color */
    final MyMenuItem changeHostColorItem =
        new MyMenuItem(
            Tools.getString("HostBrowser.Drbd.ChangeHostColor"),
            null,
            "",
            new AccessMode(ConfigData.AccessType.RO, false),
            new AccessMode(ConfigData.AccessType.RO, false)) {
          private static final long serialVersionUID = 1L;

          @Override
          public String enablePredicate() {
            return null;
          }

          @Override
          public void action() {
            final Color newColor =
                JColorChooser.showDialog(
                    Tools.getGUIData().getMainFrame(),
                    "Choose " + host.getName() + " color",
                    host.getPmColors()[0]);
            if (newColor != null) {
              host.setSavedColor(newColor);
            }
          }
        };
    items.add(changeHostColorItem);

    /* view logs */
    final MyMenuItem viewLogsItem =
        new MyMenuItem(
            Tools.getString("HostBrowser.Drbd.ViewLogs"),
            LOGFILE_ICON,
            "",
            new AccessMode(ConfigData.AccessType.RO, false),
            new AccessMode(ConfigData.AccessType.RO, false)) {
          private static final long serialVersionUID = 1L;

          @Override
          public String enablePredicate() {
            if (!getHost().isConnected()) {
              return Host.NOT_CONNECTED_STRING;
            }
            return null;
          }

          @Override
          public void action() {
            HostLogs l = new HostLogs(host);
            l.showDialog();
          }
        };
    items.add(viewLogsItem);
    /* advacend options */
    final MyMenu hostAdvancedSubmenu =
        new MyMenu(
            Tools.getString("HostBrowser.AdvancedSubmenu"),
            new AccessMode(ConfigData.AccessType.OP, false),
            new AccessMode(ConfigData.AccessType.OP, false)) {
          private static final long serialVersionUID = 1L;

          @Override
          public String enablePredicate() {
            if (!host.isConnected()) {
              return Host.NOT_CONNECTED_STRING;
            }
            return null;
          }

          @Override
          public void update() {
            super.update();
            getBrowser().addAdvancedMenu(this);
          }
        };
    items.add(hostAdvancedSubmenu);

    /* remove host from gui */
    final MyMenuItem removeHostItem =
        new MyMenuItem(
            Tools.getString("HostBrowser.RemoveHost"),
            HostBrowser.HOST_REMOVE_ICON,
            Tools.getString("HostBrowser.RemoveHost"),
            new AccessMode(ConfigData.AccessType.RO, false),
            new AccessMode(ConfigData.AccessType.RO, false)) {
          private static final long serialVersionUID = 1L;

          @Override
          public String enablePredicate() {
            if (getHost().getCluster() != null) {
              return "it is a member of a cluster";
            }
            return null;
          }

          @Override
          public void action() {
            getHost().disconnect();
            Tools.getConfigData().removeHostFromHosts(getHost());
            Tools.getGUIData().allHostsUpdate();
          }
        };
    items.add(removeHostItem);
    return items;
  }
예제 #5
0
파일: TerminalPanel.java 프로젝트: npk/lcmc
  /** Starts action after cheat was entered. */
  private void startCheat(final String cheat) {
    if (!editEnabled) {
      addCommand(cheat);
    }
    if (!editEnabled && GOD_ON.equals(cheat)) {
      editEnabled = true;
      Tools.getGUIData().godModeChanged(editEnabled);
    } else if (editEnabled && GOD_OFF.equals(cheat)) {
      editEnabled = false;
      Tools.getGUIData().godModeChanged(editEnabled);
    } else if (CHEAT_LIST.equals(cheat)) {
      final StringBuilder list = new StringBuilder();
      for (final String ch : CHEATS_MAP.keySet()) {
        list.append(ch);
        list.append('\n');
      }
      addCommandOutput(list.toString());
    } else if (RUN_GC.equals(cheat)) {
      System.gc();
      Tools.info("run gc");
    } else if (ALLOCATE_10.equals(cheat)) {
      final Thread t =
          new Thread(
              new Runnable() {
                @Override
                public void run() {
                  Tools.info("allocate mem");
                  Byte[] b = new Byte[1024000];
                  Tools.info("allocate mem done.");

                  System.gc();
                  Tools.info("run gc");
                  Tools.sleep(60000);
                  Tools.info("free mem.");
                }
              });
      t.start();
    } else if (CLICKTEST_SHORT.equals(cheat)) {
      RoboTest.startClicker(1, false);
    } else if (CLICKTEST_LONG.equals(cheat)) {
      RoboTest.startClicker(8 * 60, false);
    } else if (CLICKTEST_LAZY_SHORT.equals(cheat)) {
      RoboTest.startClicker(1, true);
    } else if (CLICKTEST_LAZY_LONG.equals(cheat)) {
      RoboTest.startClicker(8 * 60, true); /* 8 hours */
    } else if (RIGHT_CLICKTEST_SHORT.equals(cheat)) {
      RoboTest.startRightClicker(1, false);
    } else if (RIGHT_CLICKTEST_LONG.equals(cheat)) {
      RoboTest.startRightClicker(8 * 60, false);
    } else if (RIGHT_CLICKTEST_LAZY_SHORT.equals(cheat)) {
      RoboTest.startRightClicker(1, true);
    } else if (RIGHT_CLICKTEST_LAZY_LONG.equals(cheat)) {
      RoboTest.startRightClicker(8 * 60, true); /* 8 hours */
    } else if (MOVETEST_SHORT.equals(cheat)) {
      RoboTest.startMover(1, false);
    } else if (MOVETEST_LONG.equals(cheat)) {
      RoboTest.startMover(8 * 60, false);
    } else if (MOVETEST_LAZY_SHORT.equals(cheat)) {
      RoboTest.startMover(1, true);
    } else if (MOVETEST_LAZY_LONG.equals(cheat)) {
      RoboTest.startMover(8 * 60, true);
    } else if (DEBUG_INC.equals(cheat)) {
      Tools.incrementDebugLevel();
    } else if (DEBUG_DEC.equals(cheat)) {
      Tools.decrementDebugLevel();
    } else if (TESTS.containsKey(cheat)) {
      RoboTest.startTest(TESTS.get(cheat), host.getCluster());
    } else if (REGISTER_MOVEMENT.equals(cheat)) {
      RoboTest.registerMovement();
    }
    nextCommand();
  }
예제 #6
0
  /** Prepares a new <code>ClusterViewPanel</code> object. */
  EmptyViewPanel() {
    super();
    browser = new EmptyBrowser();
    Tools.getGUIData().setEmptyBrowser(browser);
    browser.setEmptyViewPanel(this);
    browser.initHosts();

    final JPanel buttonPanel = new JPanel(new FlowLayout());
    buttonPanel.setMinimumSize(new Dimension(0, 110));
    buttonPanel.setPreferredSize(new Dimension(0, 110));
    buttonPanel.setMaximumSize(new Dimension(Short.MAX_VALUE, 110));
    buttonPanel.setBackground(STATUS_BACKGROUND);
    add(buttonPanel, BorderLayout.NORTH);
    final JPanel logoPanel = new JPanel(new CardLayout());
    logoPanel.setBackground(java.awt.Color.WHITE);
    final ImageIcon logoImage = Tools.createImageIcon("startpage_head.jpg");

    final JLabel logo = new JLabel(logoImage);
    final JPanel lPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
    lPanel.setBackground(java.awt.Color.WHITE);
    lPanel.add(logo);
    logoPanel.add(lPanel, LOGO_PANEL_STRING);
    final JPanel smallButtonPanel = new JPanel();
    smallButtonPanel.setBackground(STATUS_BACKGROUND);
    smallButtonPanel.setLayout(new BoxLayout(smallButtonPanel, BoxLayout.Y_AXIS));
    buttonPanel.add(smallButtonPanel);
    /* check for upgrade field. */
    smallButtonPanel.add(Tools.getGUIData().getClustersPanel().registerUpgradeTextField());
    /* add new host button */
    final MyButton addHostButton =
        new MyButton(Tools.getString("ClusterTab.AddNewHost"), HOST_ICON);
    addHostButton.setBackgroundColor(Browser.STATUS_BACKGROUND);
    addHostButton.setPreferredSize(BIG_BUTTON_DIMENSION);
    addHostButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(final ActionEvent e) {
            final Thread thread =
                new Thread(
                    new Runnable() {
                      @Override
                      public void run() {
                        final AddHostDialog ahd = new AddHostDialog();
                        ahd.showDialogs();
                      }
                    });
            thread.start();
          }
        });
    Tools.getGUIData().registerAddHostButton(addHostButton);
    buttonPanel.add(addHostButton);
    createEmptyView();
    add(logoPanel, BorderLayout.SOUTH);
    Tools.getGUIData().registerAllHostsUpdate(this);
    Tools.getGUIData().allHostsUpdate();

    /* add new cluster button */
    final MyButton addClusterButton =
        new MyButton(Tools.getString("ClusterTab.AddNewCluster"), CLUSTER_ICON);
    addClusterButton.setBackgroundColor(Browser.STATUS_BACKGROUND);
    addClusterButton.setPreferredSize(BIG_BUTTON_DIMENSION);
    addClusterButton.setMinimumSize(BIG_BUTTON_DIMENSION);
    addClusterButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(final ActionEvent e) {
            final Thread thread =
                new Thread(
                    new Runnable() {
                      @Override
                      public void run() {
                        AddClusterDialog acd = new AddClusterDialog();
                        acd.showDialogs();
                      }
                    });
            thread.start();
          }
        });
    Tools.getGUIData().registerAddClusterButton(addClusterButton);
    Tools.getGUIData().checkAddClusterButtons();
    buttonPanel.add(addClusterButton);
    if (!Tools.getConfigData().getAutoHosts().isEmpty()) {
      SwingUtilities.invokeLater(
          new Runnable() {
            @Override
            public void run() {
              addHostButton.pressButton();
            }
          });
    }
  }