Esempio n. 1
0
 /** Hide lightbox */
 public void hide() {
   /** @author Luis Faria check if png is null before removing from parent */
   if (GWT.isScript()) {
     if (png != null) {
       png.removeFromParent();
     }
     png = null;
   }
   showSelects();
   child.hide();
   background.hide();
   Window.removeWindowResizeListener(windowResizeListener);
 }
  void show() {
    if (popup != null) {
      popup.hide();
      popup = null;
      return;
    }

    final PopupPanel p = new PopupPanel(true);
    p.setStyleName(style.popup());
    p.addAutoHidePartner(activatingButton.getElement());
    p.addCloseHandler(
        new CloseHandler<PopupPanel>() {
          @Override
          public void onClose(CloseEvent<PopupPanel> event) {
            if (popup == p) {
              popup = null;
            }
          }
        });
    p.add(this);
    p.showRelativeTo(activatingButton);
    GlobalKey.dialog(p);
    message.setFocus(true);
    popup = p;
  }
Esempio n. 3
0
  public void showPopup(boolean show) {
    if (popup.isShowing() == show) return;

    if (show) {
      popup.center();
    } else popup.hide();
  }
Esempio n. 4
0
 private void closeParent() {
   for (Widget w = getParent(); w != null; w = w.getParent()) {
     if (w instanceof PopupPanel) {
       ((PopupPanel) w).hide(true);
       break;
     }
   }
 }
Esempio n. 5
0
  @Override
  protected void onDetach() {
    // When the menu is detached, make sure to close all of its children.
    if (popup != null) {
      popup.hide();
    }

    super.onDetach();
  }
Esempio n. 6
0
 private void handleQuickReferenceClick() {
   if (isQuickReferenceShowing()) {
     quickReferencePopup.hide();
     quickReferenceLink.setText(SHOW_QUICK_REFERENCE);
   } else {
     quickReferencePopup.setPopupPositionAndShow(this);
     quickReferenceLink.setText(HIDE_QUICK_REFERENCE);
   }
 }
Esempio n. 7
0
 @Override
 public void onClick(ClickEvent event) {
   if (!popup.isShowing()) {
     if (relativeTo == null) popup.showRelativeTo((Widget) event.getSource());
     else popup.showRelativeTo(relativeTo);
   } else {
     popup.hide();
   }
 }
Esempio n. 8
0
 public void setWaitVisible(boolean visible) {
   if (visible) {
     wait.setPopupPosition(bodyContainer.getAbsoluteLeft(), bodyContainer.getAbsoluteTop());
     wait.setPixelSize(bodyContainer.getOffsetWidth(), bodyContainer.getOffsetHeight());
     wait.show();
   } else {
     wait.hide();
   }
 }
Esempio n. 9
0
 public void activateSavedSearch(SavedSearch savedSearch) {
   currentSearchId = savedSearch.getId();
   autoCompletePatternField.setValue(savedSearch.getPattern(), true);
   patternNameField.setValue(savedSearch.getName(), true);
   Log.debug(
       "search results change: [" + savedSearch.getName() + "," + savedSearch.getPattern() + "]");
   turnNameFieldIntoLabel();
   savedSearchesPanel.hide();
   click(searchButton);
 }
Esempio n. 10
0
 /** Popup menu listener */
 public void onClick(ClickEvent event) {
   int x = event.getX();
   int y = event.getY();
   if (screen[x][y] != 0) {
     currentPerson = getPersonById(screen[x][y]);
     popup.showRelativeTo(currentPerson);
     popup.show();
   } else {
     popup.hide();
   }
 }
  @SuppressWarnings("unchecked")
  @Override
  protected void showSuggestions(
      final SuggestBox suggestBox,
      Collection<? extends Suggestion> suggestions,
      boolean isDisplayStringHTML,
      boolean isAutoSelectEnabled,
      final SuggestionCallback callback) {

    // Hide popup if not needed
    boolean anySuggestions = suggestions != null && suggestions.size() > 0;
    if (!anySuggestions) {
      hideSuggestions();
      return;
    }

    // Create suggestion popup and suggestions table widget
    if (suggestionPopup == null) {
      suggestionPopup = createPopup();
    }

    // Hide the popup before we manipulate the menu within it.
    if (suggestionPopup.isAttached()) {
      suggestionPopup.hide();
    }

    // Link the popup autoHide to the TextBox.
    // If the suggest box has changed, free the old one first.
    if (suggestBox != null) {
      suggestionPopup.removeAutoHidePartner(suggestBox.getElement());
      suggestionPopup.addAutoHidePartner(suggestBox.getElement());
    }

    // Create suggestions table widget
    suggestionsTable =
        getSuggestionCellList(
            (Collection<SearchSuggestion>) suggestions, suggestBox, suggestionPopup);

    // Add table to popup
    suggestionPopup.setWidget(suggestionsTable);

    // Show the popup under the TextBox.
    suggestionPopup.showRelativeTo(searchBoxPanel);

    int searchBoxWidth = searchBoxPanel.getElement().getClientWidth();
    Element table =
        (Element)
            suggestionPopup.getElement().getElementsByTagName("table").getItem(0); // $NON-NLS-1$

    suggestionPopup.getElement().getStyle().setWidth(searchBoxWidth, Unit.PX);
    table.getStyle().setWidth(searchBoxWidth, Unit.PX);
  }
Esempio n. 12
0
  private void setupSavedSearches() {
    savedSearchesPanel.add(savedSearchesGrid);
    savedSearchesPanel.setStyleName("savedSearchesPanel");
    savedSearchesGrid.addStyleName("savedSearchesPanel");

    // panel position will be re-calculated on down-arrow click
    savedSearchesPanel.show();
    savedSearchesPanel.hide();

    SavedSearchesEventHandler handler = new SavedSearchesEventHandler();
    savedSearchesPanel.addCloseHandler(handler);
    savedSearchesGrid.setSavedSearchSelectionHandler(handler);
  }
Esempio n. 13
0
 /** Refreshing satus */
 public void refresh() {
   if (flag_getChilds) {
     int left =
         ((Main.get().findFolderSelectPopup.getOffsetWidth() - 200) / 2)
             + Main.get().findFolderSelectPopup.getAbsoluteLeft();
     int top =
         ((Main.get().findFolderSelectPopup.getOffsetHeight() - 40) / 2)
             + Main.get().findFolderSelectPopup.getAbsoluteTop();
     setPopupPosition(left, top);
     Main.get().findFolderSelectPopup.scrollFolderPanel.addStyleName("okm-PanelRefreshing");
     super.show();
   } else {
     super.hide();
     Main.get().findFolderSelectPopup.scrollFolderPanel.removeStyleName("okm-PanelRefreshing");
   }
 }
Esempio n. 14
0
 public void execute() {
   popupMenu.hide();
   if (mode == TABCOMMANDTYPE.RELOAD) {
     reloadTab();
   } else if (mode == TABCOMMANDTYPE.RELOAD_ALL) {
     reloadAllTabs();
   } else if (mode == TABCOMMANDTYPE.CLOSE) {
     closeTab();
   } else if (mode == TABCOMMANDTYPE.CLOSE_OTHERS) {
     closeOtherTabs();
   } else if (mode == TABCOMMANDTYPE.CLOSE_ALL) {
     closeAllTabs();
   } else if (mode == TABCOMMANDTYPE.NEW_WINDOW) {
     openTabInNewWindow();
   } else if (mode == TABCOMMANDTYPE.CREATE_DEEP_LINK) {
     createDeepLink();
   } else if (mode == TABCOMMANDTYPE.BACK) {
     back();
   }
 }
Esempio n. 15
0
  @Override
  public void go(final HasWidgets container) {
    if (m_addGraphView == null) {
      m_addGraphView = new KscAddGraphViewImpl();
      m_addGraphView.setTitle(m_graphInfo.getTitle() == null ? "" : m_graphInfo.getTitle());
    }

    if (m_popupPanel == null) {
      m_popupPanel = new PopupPanel();
      m_popupPanel.setWidth("300px");
      m_popupPanel.setHeight("79px");
      m_popupPanel.add(m_addGraphView);
      m_popupPanel.setAutoHideEnabled(true);
      m_popupPanel.setAnimationEnabled(false);
      m_popupPanel.setModal(false);
      m_popupPanel.setVisible(false);
      m_popupPanel.hide();
    }

    new KscAddGraphPresenter(m_popupPanel, m_addGraphView, m_reports, m_graphInfo).go(container);
  }
Esempio n. 16
0
  /** Status */
  public Status() {
    super(false, true);
    hPanel = new HorizontalPanel();
    image = new Image(OKMBundleResources.INSTANCE.indicator());
    msg = new HTML("");
    space = new HTML("");

    hPanel.add(image);
    hPanel.add(msg);
    hPanel.add(space);

    hPanel.setCellVerticalAlignment(image, HasAlignment.ALIGN_MIDDLE);
    hPanel.setCellVerticalAlignment(msg, HasAlignment.ALIGN_MIDDLE);
    hPanel.setCellHorizontalAlignment(image, HasAlignment.ALIGN_CENTER);
    hPanel.setCellWidth(image, "30px");
    hPanel.setCellWidth(space, "7px");

    hPanel.setHeight("25px");

    msg.setStyleName("okm-NoWrap");

    super.hide();
    setWidget(hPanel);
  }
Esempio n. 17
0
  /*
   * Performs the action associated with the given menu item. If the item has
   * a popup associated with it, the popup will be shown. If it has a command
   * associated with it, and 'fireCommand' is true, then the command will be
   * fired. Popups associated with other items will be hidden.
   *
   * @param item the item whose popup is to be shown. @param fireCommand
   * <code>true</code> if the item's command should be fired,
   * <code>false</code> otherwise.
   */
  protected void doItemAction(final MenuItem item, boolean fireCommand) {
    // If the given item is already showing its menu, we're done.
    if ((shownChildMenu != null) && (item.getSubMenu() == shownChildMenu)) {
      return;
    }

    // If another item is showing its menu, then hide it.
    if (shownChildMenu != null) {
      shownChildMenu.onHide();
      popup.hide();
    }

    // If the item has no popup, optionally fire its command.
    if (item.getSubMenu() == null) {
      if (fireCommand) {
        // Close this menu and all of its parents.
        closeAllParents();

        // Fire the item's command.
        final Command cmd = item.getCommand();
        if (cmd != null) {
          Scheduler.get().scheduleDeferred(cmd);
        }
      }
      return;
    }

    // Ensure that the item is selected.
    selectItem(item);

    // Create a new popup for this item, and position it next to
    // the item (below if this is a horizontal menu bar, to the
    // right if it's a vertical bar).
    popup =
        new VOverlay(true) {
          {
            setWidget(item.getSubMenu());
            item.getSubMenu().onShow();
            setOwner(MenuBar.this);
          }

          @Override
          public boolean onEventPreview(Event event) {
            // Hook the popup panel's event preview. We use this to keep it
            // from
            // auto-hiding when the parent menu is clicked.
            switch (DOM.eventGetType(event)) {
              case Event.ONCLICK:
                // If the event target is part of the parent menu, suppress
                // the
                // event altogether.
                final Element target = DOM.eventGetTarget(event);
                final Element parentMenuElement = item.getParentMenu().getElement();
                if (DOM.isOrHasChild(parentMenuElement, target)) {
                  return false;
                }
                break;
            }

            return super.onEventPreview(event);
          }
        };
    popup.addPopupListener(this);

    if (vertical) {
      popup.setPopupPosition(item.getAbsoluteLeft() + item.getOffsetWidth(), item.getAbsoluteTop());
    } else {
      popup.setPopupPosition(
          item.getAbsoluteLeft(), item.getAbsoluteTop() + item.getOffsetHeight());
    }

    shownChildMenu = item.getSubMenu();
    item.getSubMenu().parentMenu = this;

    // Show the popup, ensuring that the menubar's event preview remains on
    // top
    // of the popup's.
    popup.show();
  }
 @UiHandler("button")
 void onClick(ClickEvent e) {
   parentPopup.hide();
   if (action != null) action.doAction();
 }
Esempio n. 19
0
 /**
  * Hides the popup and detaches it from the page. This has no effect if it is not currently
  * showing.
  *
  * @param autoClosed the value that will be passed to {@link CloseHandler#onClose(CloseEvent)}
  *     when the popup is closed
  */
 @Override
 public void hide(boolean autoClosed) {
   super.hide(autoClosed);
   toggleButton(false);
 }
Esempio n. 20
0
 /** Hides the context menu. */
 public void hide() {
   popupPanel.hide();
 }
Esempio n. 21
0
 /** Hide the date picker. */
 public void hideDatePicker() {
   popup.hide();
 }
Esempio n. 22
0
 public void onBrowserEvent(Event event) {
   // the id's which are set on these menu items must be set AFTER the items are added to their
   // menu
   // when an element is added to a menu an auto-generated id will be assigned, so we must override
   // this
   if (perspective != null) {
     if ((DOM.eventGetType(event) & Event.ONDBLCLICK) == Event.ONDBLCLICK) {
       openTabInNewWindow();
     } else if (DOM.eventGetButton(event) == Event.BUTTON_RIGHT) {
       int left = Window.getScrollLeft() + DOM.eventGetClientX(event);
       int top = Window.getScrollTop() + DOM.eventGetClientY(event);
       popupMenu.setPopupPosition(left, top);
       MenuBar menuBar = new MenuBar(true);
       menuBar.setAutoOpen(true);
       if (tabContent instanceof IFrameTabPanel) {
         MenuItem backMenuItem =
             new MenuItem(
                 Messages.getString("back"),
                 new TabCommand(TABCOMMANDTYPE.BACK, popupMenu)); // $NON-NLS-1$
         menuBar.addItem(backMenuItem);
         backMenuItem.getElement().setId("back"); // $NON-NLS-1$
         menuBar.addSeparator();
         MenuItem reloadTabMenuItem =
             new MenuItem(
                 Messages.getString("reloadTab"),
                 new TabCommand(TABCOMMANDTYPE.RELOAD, popupMenu)); // $NON-NLS-1$
         menuBar.addItem(reloadTabMenuItem);
         reloadTabMenuItem.getElement().setId("reloadTab"); // $NON-NLS-1$
       }
       if (tabPanel.getTabBar().getTabCount() > 1) {
         MenuItem reloadAllTabsMenuItem =
             new MenuItem(
                 Messages.getString("reloadAllTabs"),
                 new TabCommand(TABCOMMANDTYPE.RELOAD_ALL, popupMenu)); // $NON-NLS-1$
         menuBar.addItem(reloadAllTabsMenuItem);
         reloadAllTabsMenuItem.getElement().setId("reloadAllTabs"); // $NON-NLS-1$
       } else {
         MenuItem reloadAllTabsMenuItem =
             new MenuItem(Messages.getString("reloadAllTabs"), (Command) null); // $NON-NLS-1$
         menuBar.addItem(reloadAllTabsMenuItem);
         reloadAllTabsMenuItem.getElement().setId("reloadAllTabs"); // $NON-NLS-1$
         reloadAllTabsMenuItem.setStyleName("disabledMenuItem"); // $NON-NLS-1$
       }
       menuBar.addSeparator();
       if (tabContent instanceof IFrameTabPanel) {
         MenuItem openTabInNewWindowMenuItem =
             new MenuItem(
                 Messages.getString("openTabInNewWindow"),
                 new TabCommand(TABCOMMANDTYPE.NEW_WINDOW, popupMenu)); // $NON-NLS-1$
         menuBar.addItem(openTabInNewWindowMenuItem);
         openTabInNewWindowMenuItem.getElement().setId("openTabInNewWindow"); // $NON-NLS-1$
         MenuItem createDeepLinkMenuItem =
             new MenuItem(
                 Messages.getString("createDeepLink"),
                 new TabCommand(TABCOMMANDTYPE.CREATE_DEEP_LINK, popupMenu)); // $NON-NLS-1$
         menuBar.addItem(createDeepLinkMenuItem);
         createDeepLinkMenuItem.getElement().setId("deepLink"); // $NON-NLS-1$
         menuBar.addSeparator();
       }
       menuBar.addItem(
           new MenuItem(
               Messages.getString("closeTab"),
               new TabCommand(TABCOMMANDTYPE.CLOSE, popupMenu))); // $NON-NLS-1$
       if (tabPanel.getTabBar().getTabCount() > 1) {
         MenuItem closeOtherTabsMenuItem =
             new MenuItem(
                 Messages.getString("closeOtherTabs"),
                 new TabCommand(TABCOMMANDTYPE.CLOSE_OTHERS, popupMenu)); // $NON-NLS-1$
         menuBar.addItem(closeOtherTabsMenuItem);
         closeOtherTabsMenuItem.getElement().setId("closeOtherTabs"); // $NON-NLS-1$
         MenuItem closeAllTabsMenuItem =
             new MenuItem(
                 Messages.getString("closeAllTabs"),
                 new TabCommand(TABCOMMANDTYPE.CLOSE_ALL, popupMenu)); // $NON-NLS-1$
         menuBar.addItem(closeAllTabsMenuItem);
         closeAllTabsMenuItem.getElement().setId("closeAllTabs"); // $NON-NLS-1$
       } else {
         MenuItem closeOtherTabsMenuItem =
             new MenuItem(Messages.getString("closeOtherTabs"), (Command) null); // $NON-NLS-1$
         closeOtherTabsMenuItem.setStyleName("disabledMenuItem"); // $NON-NLS-1$
         MenuItem closeAllTabsMenuItem =
             new MenuItem(Messages.getString("closeAllTabs"), (Command) null); // $NON-NLS-1$
         closeAllTabsMenuItem.setStyleName("disabledMenuItem"); // $NON-NLS-1$
         menuBar.addItem(closeOtherTabsMenuItem);
         menuBar.addItem(closeAllTabsMenuItem);
         closeOtherTabsMenuItem.getElement().setId("closeOtherTabs"); // $NON-NLS-1$
         closeAllTabsMenuItem.getElement().setId("closeAllTabs"); // $NON-NLS-1$
       }
       popupMenu.setWidget(menuBar);
       popupMenu.hide();
       popupMenu.show();
     }
   }
   super.onBrowserEvent(event);
 }
 @Override
 public void hideSuggestions() {
   if (suggestionPopup != null) {
     suggestionPopup.hide(false);
   }
 }
 /** Updates the fields to their previous state before the page the popup is hidden */
 public void hide(boolean autoClosed) {
   updateFieldData();
   super.hide(autoClosed);
 }
 private void hideMessagePopup() {
   if (popupPanel != null) {
     popupPanel.hide();
   }
 }
  /* (non-Javadoc)
   * @see com.google.gwt.event.dom.client.KeyDownHandler#onKeyDown(com.google.gwt.event.dom.client.KeyDownEvent)
   */
  @Override
  public void onKeyDown(KeyDownEvent event) {
    //		System.out.println(event.getNativeKeyCode());
    int keyCode = event.getNativeKeyCode();
    if (selectedNode != null) {
      short nodeType = selectedNode.getNodeType();
      if (event.isControlKeyDown()) {
        if (keyCode == ClauseConstants.COPY_C) { // COPY
          if ((nodeType != CellTreeNode.MASTER_ROOT_NODE) && (nodeType != CellTreeNode.ROOT_NODE)) {
            popupPanel.hide();
            copy();
          }

        } else if (keyCode == ClauseConstants.PASTE_V) { // PASTE
          boolean canPaste = false;
          popupPanel.hide();
          if (copiedNode != null) {
            switch (selectedNode.getNodeType()) {
              case CellTreeNode.ROOT_NODE:
                if (selectedNode.equals(copiedNode.getParent())) {
                  clauseWorkspaceContextMenu.pasteRootNodeTypeItem();
                  isDirty = true;
                }
                break;
              case CellTreeNode.LOGICAL_OP_NODE:
              case CellTreeNode.FUNCTIONS_NODE:
                if (copiedNode.getNodeType() != CellTreeNode.CLAUSE_NODE) {
                  canPaste = true;
                }
                break;
              case CellTreeNode.TIMING_NODE:
                if ((copiedNode.getNodeType() != CellTreeNode.CLAUSE_NODE)
                    && ((selectedNode.getChilds() == null)
                        || (selectedNode.getChilds().size() < 2))) {
                  canPaste = true;
                }
                break;
              default:
                break;
            }
            if (canPaste) {
              paste();
              isDirty = true;
            }
          }

        } else if (keyCode == ClauseConstants.CUT_X) { // CUT
          popupPanel.hide();
          if ((selectedNode.getNodeType() != CellTreeNode.MASTER_ROOT_NODE)
              && (selectedNode.getNodeType() != CellTreeNode.CLAUSE_NODE)
              && (selectedNode.getNodeType() != CellTreeNode.ROOT_NODE)
              && (selectedNode.getParent().getNodeType() != CellTreeNode.CLAUSE_NODE)) {
            copy();
            removeNode();
            isDirty = true;
          }
        }
      } else if (keyCode == ClauseConstants.DELETE_DELETE) { // DELETE
        popupPanel.hide();
        if (((selectedNode.getNodeType() != CellTreeNode.MASTER_ROOT_NODE)
                && (selectedNode.getNodeType() != CellTreeNode.ROOT_NODE)
                && (selectedNode.getParent().getNodeType() != CellTreeNode.CLAUSE_NODE)
                && (selectedNode.getNodeType() != CellTreeNode.CLAUSE_NODE))
            || ((selectedNode.getNodeType() == CellTreeNode.CLAUSE_NODE)
                && (selectedNode.getParent().getChilds().size() > 1))) {
          removeNode();
          isDirty = true;
        }
      }
    }
    if ((event.isShiftKeyDown()
        && ((keyCode == ClauseConstants.PLUS_FF) || (keyCode == ClauseConstants.PLUS_IE)))) {
      // EXPAND/COLLAPSE (+(Shift +) Expand| - Collapse)
      popupPanel.hide();
      openAllNodes(cellTree.getRootTreeNode());
    } else if ((event.isShiftKeyDown()
        && ((keyCode == ClauseConstants.MINUS_FF) || (keyCode == ClauseConstants.MINUS_IE)))) {
      popupPanel.hide();
      closeNodes(cellTree.getRootTreeNode());
    }
    /*if(event.isControlKeyDown() && event.isAltKeyDown() && keyCode == 83){
    	saveBtn.getElement().focus();
    	saveBtn.click();
    }*/
  }
Esempio n. 27
0
 public void hide() {
   dateOfAppointment.setText("");
   doctorName.setText("");
   popupPanel.hide();
 }
Esempio n. 28
0
  public void switchSection(String token) {
    popup.hide();
    tokenHistory.add(token);
    Map<String, String> parameters = getHistoryTokenParameters(token);
    AppPlace place = getPlace(token);

    if (mainPresenter != null) {
      mainPresenter.clearNotifications();
    }

    if (ClientSessionUtil.checkSession()) {
      switch (place) {
        case HOME:
          HomePresenter homePresenter = new HomePresenter(new HomeView(), eventBus);
          homePresenter.bind();
          getLayout().clear();
          getLayout().add(homePresenter.getDisplay().asWidget());
          break;
        case REQUEST:
          RequestPresenter requestPresenter = new RequestPresenter(new RequestView(), eventBus);
          requestPresenter.bind();
          getLayout().clear();
          getLayout().add(requestPresenter.getDisplay().asWidget());
          break;
        case LOGOUT:
          ClientSessionUtil.destroySession();
          eventBus.fireEvent(new LoginRequiredEvent());
          break;
        case REQUESTSTATUS:
          try {
            Integer requestId = Integer.parseInt(parameters.get("requestId"));
            RequestStatusPresenter requestStatusPresenter =
                new RequestStatusPresenter(new RequestStatusView(), eventBus);
            requestStatusPresenter.bind();
            requestStatusPresenter.showRequest(requestId);
            getLayout().clear();
            getLayout().add(requestStatusPresenter.getDisplay().asWidget());
          } catch (Exception e) {
            showNotification(
                "Id incorrecta: No se puede cargar la solicitud", NotificationEventType.ERROR);
          }
          break;
        case EDITREQUEST:
          try {
            Integer requestId = Integer.parseInt(parameters.get("requestId"));
            RequestEditPresenter editPresenter =
                new RequestEditPresenter(new RequestEditView(), eventBus);
            editPresenter.bind();
            editPresenter.showRequest(requestId);
            getLayout().clear();
            getLayout().add(editPresenter.getDisplay().asWidget());
          } catch (Exception e) {
            showNotification(
                "Id incorrecta: No se puede cargar la solicitud", NotificationEventType.ERROR);
          }
          break;
        case RESPONSE:
          try {
            Integer requestId = Integer.parseInt(parameters.get("requestId"));
            RequestResponsePresenter requestResponsePresenter =
                new RequestResponsePresenter(new RequestResponseView(), eventBus);
            requestResponsePresenter.bind();
            requestResponsePresenter.showRequest(requestId);
            getLayout().clear();
            getLayout().add(requestResponsePresenter.getDisplay().asWidget());
          } catch (Exception e) {
            showNotification(
                "Id incorrecta: No se puede cargar la solicitud", NotificationEventType.ERROR);
          }
          break;
        case LIST:
          try {
            String listType = parameters.get("type");
            RequestListPresenter requestListPresenter =
                new RequestListPresenter(new RequestListView(), eventBus);
            requestListPresenter.bind();
            requestListPresenter.loadRequests(0, 100, listType);
            getLayout().clear();
            getLayout().add(requestListPresenter.getDisplay().asWidget());
          } catch (Exception e) {
            showNotification(
                "Tipo de lista incorrecto: No se puede cargar la lista",
                NotificationEventType.ERROR);
          }
          break;
        case STATISTICS:
          StatisticsPresenter statistics = new StatisticsPresenter(new StatisticsView(), eventBus);
          statistics.bind();
          getLayout().clear();
          getLayout().add(statistics.getDisplay().asWidget());
          break;
        case ABOUTPROJECT:
          AboutProjectPresenter aboutProjectPresenter =
              new AboutProjectPresenter(new AboutProjectView(), eventBus);
          aboutProjectPresenter.bind();
          getLayout().clear();
          getLayout().add(aboutProjectPresenter.getDisplay().asWidget());
          break;
        case ASOCIATES:
          AsociatesPresenter asociatesPresenter =
              new AsociatesPresenter(new AsociatesView(), eventBus);
          asociatesPresenter.bind();
          getLayout().clear();
          getLayout().add(asociatesPresenter.getDisplay().asWidget());
          break;
        case USERPROFILE:
          UserProfileEditPresenter userProfilePresenter =
              new UserProfileEditPresenter(new UserProfileEditView(), eventBus);
          userProfilePresenter.bind();
          getLayout().clear();
          getLayout().add(userProfilePresenter.getDisplay().asWidget());
          break;
        default:
          History.newItem(AppPlace.HOME.toString());
      }
    } else {
      switch (place) {
        case HOME:
          HomePresenter homePresenter = new HomePresenter(new HomeView(), eventBus);
          homePresenter.bind();
          getLayout().clear();
          getLayout().add(homePresenter.getDisplay().asWidget());
          break;
        case REQUEST:
        case LOGIN:
          LoginPresenter loginPresenter = new LoginPresenter(new LoginView(), eventBus);
          loginPresenter.bind();
          popup.setModal(true);
          popup.setGlassEnabled(true);
          popup.clear();
          popup.add(loginPresenter.getDisplay().asWidget());
          popup.center();
          break;
        case REGISTER:
          RegisterPresenter registerPresenter = new RegisterPresenter(new RegisterView(), eventBus);
          registerPresenter.bind();
          getLayout().clear();
          getLayout().add(registerPresenter.getDisplay().asWidget());
          break;
        case RESPONSE:
          try {
            Integer requestId = Integer.parseInt(parameters.get("requestId"));
            RequestResponsePresenter requestResponsePresenter =
                new RequestResponsePresenter(new RequestResponseView(), eventBus);
            requestResponsePresenter.bind();
            requestResponsePresenter.showRequest(requestId);
            getLayout().clear();
            getLayout().add(requestResponsePresenter.getDisplay().asWidget());
          } catch (Exception e) {
            showNotification(
                "Id incorrecta: No se puede cargar la solicitud", NotificationEventType.ERROR);
          }
          break;
        case LIST:
          try {
            String listType = parameters.get("type");
            RequestListPresenter requtesListPresenter =
                new RequestListPresenter(new RequestListView(), eventBus);
            requtesListPresenter.bind();
            requtesListPresenter.loadRequests(0, 100, listType);
            getLayout().clear();
            getLayout().add(requtesListPresenter.getDisplay().asWidget());
          } catch (Exception e) {
            showNotification(
                "Tipo de lista incorrecto: No se puede cargar la lista",
                NotificationEventType.ERROR);
          }
          break;
        case STATISTICS:
          StatisticsPresenter statistics = new StatisticsPresenter(new StatisticsView(), eventBus);
          statistics.bind();
          getLayout().clear();
          getLayout().add(statistics.getDisplay().asWidget());
          break;
        case ABOUTPROJECT:
          AboutProjectPresenter aboutProjectPresenter =
              new AboutProjectPresenter(new AboutProjectView(), eventBus);
          aboutProjectPresenter.bind();
          getLayout().clear();
          getLayout().add(aboutProjectPresenter.getDisplay().asWidget());
          break;
        case ASOCIATES:
          AsociatesPresenter asociatesPresenter =
              new AsociatesPresenter(new AsociatesView(), eventBus);
          asociatesPresenter.bind();
          getLayout().clear();
          getLayout().add(asociatesPresenter.getDisplay().asWidget());
          break;
        case PASSWORDRECOVERY:
          PasswordRecoveryPresenter passwordRecoveryPresenter =
              new PasswordRecoveryPresenter(new PasswordRecoveryView(), eventBus);
          passwordRecoveryPresenter.bind();
          getLayout().clear();
          getLayout().add(passwordRecoveryPresenter.getDisplay().asWidget());
          break;
        default:
          History.newItem(AppPlace.HOME.toString());
      }
    }
  }
Esempio n. 29
0
 /*
  * This method is called when a menu bar is hidden, so that it can hide any
  * child popups that are currently being shown.
  */
 private void onHide() {
   if (shownChildMenu != null) {
     shownChildMenu.onHide();
     popup.hide();
   }
 }
Esempio n. 30
0
 private void applyFilter(Date beginDate, Date endDate) {
   grid.getFilter().setFilter(fieldName, createFilter(beginDate, endDate));
   grid.filter();
   popupPanel.hide();
   grid.setFocus(true);
 }