예제 #1
0
  private void refreshServerList() {
    if (FilterType.HOST.equals(serverStore.getFilter())) {
      String selectedHost = hostStore.getSelectedHost();

      List<Server> serverModel = Collections.EMPTY_LIST;
      if (selectedHost != null) {
        serverModel = serverStore.getServerForHost(hostStore.getSelectedHost());
      }

      getView().updateServerList(serverModel);
    } else if (FilterType.GROUP.equals(serverStore.getFilter())) {
      List<Server> serverModel = serverStore.getServerForGroup(serverStore.getSelectedGroup());
      getView().updateServerList(serverModel);
    }
  }
예제 #2
0
  @Override
  protected void onBind() {
    super.onBind();
    getView().setPresenter(this);

    HandlerRegistration previewReg = getEventBus().addHandler(PreviewEvent.TYPE, this);

    handlerRegistration =
        serverStore.addChangeHandler(
            new PropagatesChange.Handler() {
              @Override
              public void onChange(Action action) {

                if (!isVisible()) return; // don't process anything when not visible

                if (action instanceof SelectServer) {
                  // changing the server selection: update subsystems on server
                  if (hostStore.hasSelectedServer()) {
                    Scheduler.get()
                        .scheduleDeferred(
                            new Scheduler.ScheduledCommand() {
                              @Override
                              public void execute() {
                                loadSubsystems();
                              }
                            });
                  } else {
                    getView().setSubsystems(Collections.EMPTY_LIST);
                  }
                }

                // clear the view
                else if (action instanceof FilterType) {
                  getView().clearServerList();
                }

                // Refresh the server list when:
                // - changes to host/group filter refresh the server list
                // - group and host selection events
                // - server's are added or removed

                else if ((action instanceof FilterType)
                    || (action instanceof GroupSelection)
                    || (action instanceof HostSelection)
                    || (action instanceof RemoveServer)
                    || (action instanceof AddServer)
                    || (action instanceof CopyServer)
                    || (action instanceof RefreshServer)) {

                  refreshServerList();
                }
              }
            });
  }
예제 #3
0
 public ServerRef getSelectedServer() {
   return serverStore.getSelectServer();
 }
예제 #4
0
 public String getSelectedGroup() {
   return serverStore.getSelectedGroup();
 }
예제 #5
0
 public String getFilter() {
   return serverStore.getFilter();
 }