Пример #1
0
  /** Creates a new context menu. */
  public ContextMenu() {
    popupPanel = new PopupPanel(true); // autoHide

    menuBar = new MenuBar(true);
    menuBar.setStylePrimaryName("ode-ContextMenu");
    popupPanel.add(menuBar);
  }
Пример #2
0
 public AppointmentFormPage() {
   popupPanel = new PopupPanel(true);
   popupPanel.add(uiBinder.createAndBindUi(this));
   close.addClickHandler(closeHandler());
   cancel.addClickHandler(closeHandler());
   submit.addClickHandler(createSaveHandler());
 }
Пример #3
0
 private void createMenu(Date value) {
   popupPanel = new ContextMenuPopupPanel(grid);
   menu = new MenuBar(true);
   menu.setAutoOpen(false);
   menu.addStyleName(ContextMenuPopupPanel.RESOURCES.style().bCellContextMenu());
   menu.addItem(CONSTANTS.lastYr(), lastYearCommand);
   menu.addItem(CONSTANTS.thisYr(), thisYearCommand);
   menu.addItem(CONSTANTS.lastQr(), lastQrCommand);
   menu.addItem(CONSTANTS.thisQr(), thisQrCommand);
   if (value != null) {
     menu.addSeparator();
     menu.addItem(CONSTANTS.inYr(DateUtils.getYear(value)), inYearCommand);
     menu.addItem(
         CONSTANTS.inQrYr(QUARTERS[DateUtils.getMonth(value) / 3], DateUtils.getYear(value)),
         inQrYrCommand);
     menu.addItem(
         CONSTANTS.inMnYr(
             Integer.toString(DateUtils.getMonth(value) + 1), DateUtils.getYear(value)),
         inMnYrCommand);
     menu.addItem(CONSTANTS.date(DateUtils.dateToString(value)), inDayCommand);
   }
   popupPanel.add(menu);
   /*        popupPanel.addCloseHandler(new CloseHandler<PopupPanel>() {
       @Override
       public void onClose(CloseEvent<PopupPanel> event) {
           if (!event.isAutoClosed()) {
               if (lastParent != null) {
                   lastParent.focus();
               }
           }
           lastParent = null;
       }
   });*/
 }
Пример #4
0
  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;
  }
  public InlineMultiSelect() {
    popup.setAutoHideEnabled(true);
    popup.addAutoHidePartner(textbox.getElement());

    multiSelect.addValueChangeHandler(
        new ValueChangeHandler<List<String>>() {

          @Override
          public void onValueChange(ValueChangeEvent<List<String>> event) {
            int size = event.getValue().size();
            textbox.setText(size + " selected");
          }
        });
    popup.add(multiSelect);

    textbox.setText("Make a selection");
    textbox.setReadOnly(true);
    panel.add(textbox);
    panel.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            popup.showRelativeTo(panel);
          }
        });

    initWidget(panel);
  }
Пример #6
0
 public static void init() {
   panel.setSize("300px", "80px");
   panel.add(label);
   panel.add(fileUpload);
   popup.setGlassEnabled(true);
   popup.setAutoHideEnabled(true);
   popup.center();
   popup.add(panel);
 }
Пример #7
0
  @Inject
  public MainView(IndexDisplayer indexDisplayer) {

    c.setStyleName("tab");
    c.addStyleName("first");
    p.setStyleName("tab");

    message.setStyleName("messageBar");
    message.setVisible(false);

    int i;
    for (i = 0; i < 5; i++) {
      startIndex.addItem(indexDisplayer.getDisplay(i), Integer.toString(i));
    }
    for (i = 5; i < 10; i++) {
      lastIndex.addItem(indexDisplayer.getDisplay(i), Integer.toString(i));
    }

    startIndex.setSelectedIndex(0);
    lastIndex.setSelectedIndex(0);

    HorizontalPanel hp = new HorizontalPanel();
    hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hp.add(new Label("Start Index: "));
    hp.add(startIndex);
    hp.add(new Label("End Index: "));
    hp.add(lastIndex);
    hp.setSpacing(5);

    bar.add(c);
    bar.add(p);
    bar.setStyleName("tabs");

    mainPanel = new VerticalPanel();
    mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    clearHistory.setStyleName("link");
    mainPanel.add(clearHistory);

    mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    mainPanel.add(hp);
    mainPanel.add(bar);
    mainPanel.add(message);
    mainPanel.add(bodyContainer);
    mainPanel.add(filter);
    mainPanel.add(filterActivate);
    mainPanel.add(filterModule);
    mainPanel.add(hasBeenThere);
    mainPanel.add(broadcastInfo);
    mainPanel.add(showStatus);
    mainPanel.add(activateStatus);
    wait.add(new Label("Wait"));

    initWidget(mainPanel);

    bodyContainer.setStyleName("body");
    bodyContainer.setWidget(new Label("Click on one of the tab to start."));
  }
Пример #8
0
 private void setupLoadingPopup() {
   FlowPanel fp = new FlowPanel();
   Label label = new Label("Deploying Project...");
   Image loadingImage = new Image(OpusImages.INSTANCE.loadingSpinner());
   loadingImage.setStyleName(style.loadingImage());
   label.setStyleName(style.loadingLabel());
   fp.add(loadingImage);
   fp.add(label);
   loadingPopup.add(fp);
 }
Пример #9
0
  public KscComboboxViewImpl() {
    initWidget(uiBinder.createAndBindUi(this));

    m_layoutPanel.setSize("100%", "23px");
    m_textBox.addKeyDownHandler(
        new KeyDownHandler() {

          @Override
          public void onKeyDown(KeyDownEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
              if (m_presenter != null) {
                m_presenter.onEnterKeyEvent();
              }
            }
          }
        });

    m_selectionModel = new SingleSelectionModel<KscReportDetail>();
    m_selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {

          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            m_presenter.onKscReportSelected();
          }
        });

    m_reportList = new CellList<KscReportDetail>(new KscReportDetailCell());
    m_reportList.setPageSize(10);
    m_reportList.getElement().getStyle().setFontSize(12, Unit.PX);
    m_reportList.setSelectionModel(m_selectionModel);

    m_dataList = new ListDataProvider<KscReportDetail>();
    m_dataList.addDataDisplay(m_reportList);

    m_pager = new SimplePager();
    m_pager.setStyleName("onms-table-no-borders-margin");
    m_pager.getElement().getStyle().setWidth(100, Unit.PCT);
    m_pager.setDisplay(m_reportList);

    FlowPanel flowPanel = new FlowPanel();
    flowPanel.add(m_reportList);
    flowPanel.add(m_pager);
    m_popupPanel = new PopupPanel();
    m_popupPanel.add(flowPanel);
    m_popupPanel.setAutoHideEnabled(true);
    m_popupPanel.setAnimationEnabled(true);
    m_popupPanel.setModal(false);
    m_popupPanel.getElement().getStyle().setBorderWidth(1, Unit.PX);
    m_popupPanel.getElement().getStyle().setBorderColor("#B5B8C8");
    m_popupPanel.getElement().getStyle().setPadding(1, Unit.PX);
  }
Пример #10
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);
  }
Пример #11
0
 private void generateQuickReferencePopup() {
   FlexTable fieldTable = new FlexTable();
   fieldTable.setText(0, 0, "Name");
   fieldTable.setText(0, 1, "Field");
   fieldTable.getRowFormatter().setStyleName(0, "data-row-header");
   int row = 1;
   for (FieldInfo fieldInfo : TkoUtils.getFieldList("all_fields")) {
     fieldTable.setText(row, 0, fieldInfo.name);
     fieldTable.setText(row, 1, fieldInfo.field);
     row++;
   }
   quickReferencePopup = new PopupPanel(false);
   quickReferencePopup.add(fieldTable);
 }
  @UiHandler({"editBtn"})
  public void editBtnCmd(ClickEvent ev) {
    final PopupPanel p = new PopupPanel();
    // p.setTitle("Добавление экземпляра сущности...");
    // p.setModal(false);
    p.setAutoHideEnabled(true);
    Widget source = (Widget) ev.getSource();
    int left = source.getAbsoluteLeft();
    int top = source.getAbsoluteTop();
    p.setPopupPosition(left, top);
    // p.setPopupPosition(200, 200);
    // p.setSize("190px", "100px");
    p.setSize("100%", "100%");

    Anchor editSel = new Anchor("Изменить выбор");
    Anchor editField = new Anchor("Изменить структуру");
    Anchor editItems = new Anchor("К элементам");
    editSel.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent ev) {
            editSelectionCmd(ev);
            p.hide();
          }
        });
    editField.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent ev) {
            editFieldCmd(ev);
            p.hide();
          }
        });
    editItems.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent ev) {
            editItemsCmd(ev);
            p.hide();
          }
        });

    VerticalPanel pnl = new VerticalPanel();
    pnl.add(editSel);
    pnl.add(editField);
    pnl.add(editItems);
    p.add(pnl);
    p.show();
  }
    public InnerItem(Serializable s) {
      close.addStyleDependentName("SMALLER");
      close.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              inner.hide();
            }
          });
      innerLayout.add(close);
      grid.getCellFormatter().setWidth(0, 0, "85%");
      grid.getCellFormatter().setWidth(0, 1, "5%");
      label.setText(s.getName());
      grid.setWidget(0, 0, label);
      if (s instanceof CategorySerializable) {
        CategorySerializable c = (CategorySerializable) s;
        if (c.getDoc() != null || c.getAttributes().get("children_dsid") != null) {
          image.addClickHandler(
              new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                  inner.setPopupPosition(image.getAbsoluteLeft(), image.getAbsoluteTop());
                  inner.show();
                }
              });
          grid.setWidget(0, 1, image);
          if (c.getDoc() != null) {
            String url = c.getDoc();
            if (!c.getDoc().equals("")) {
              Anchor link = new Anchor("Documentation", url, "_blank");
              innerLayout.add(link);
            }
          }
          if (c.getAttributes().get("children_dsid") != null) {
            Anchor meta =
                new Anchor(
                    "Variable and Grid Description",
                    "getMetadata.do?dsid=" + c.getAttributes().get("children_dsid"),
                    "_blank");
            innerLayout.add(meta);
          }
          inner.add(innerLayout);
        }
      }
      initWidget(grid);
    }
Пример #14
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);
  }
Пример #15
0
  public void showPopupMenu(ContextMenuEvent event) {
    final PopupPanel popupPanel = new PopupPanel(true);
    popupPanel.setAnimationEnabled(true);
    popupPanel.setStyleName("popup");
    MenuBar popupMenuBar = new MenuBar(true);

    MenuItem deleteItem =
        new MenuItem(
            "Delete Selected Items",
            true,
            new Command() {

              @Override
              public void execute() {
                popupPanel.hide();

                m_Container.doConfirm(
                    "Are you sure you wish to delete selected items?",
                    new ConfirmDialogBox.ConfirmCallBack() {

                      public void ok() {
                        JSONArray jsa =
                            Utils.extractIds(m_Container.getDragController().getDragContext());

                        m_Container.doJSONRequest(
                            G3Viewer.DELETE_ALL_URL + "?sourceids=" + jsa.toString(),
                            new HttpSuccessHandler() {
                              public void success(JSONValue aValue) {
                                final List<Widget> widgets =
                                    m_Container.getDragController().getSelectedWidgets();
                                Item i;
                                for (Widget widget : widgets) {
                                  i = (Item) widget;
                                  removeFromView(i);
                                  i.removeLinkedAlbum();
                                }
                              }
                            },
                            true,
                            true);
                      }
                    });
              }
            });
    deleteItem.addStyleName("popup-item");
    popupMenuBar.addItem(deleteItem);

    popupMenuBar.setVisible(true);
    popupPanel.add(popupMenuBar);

    MenuItem rotateAllCW =
        new MenuItem(
            "Rotate All Clockwise",
            true,
            new Command() {
              @Override
              public void execute() {
                // change all thumbs into loading
                final List<Widget> widgets = m_Container.getDragController().getSelectedWidgets();

                for (Widget widget : widgets) {
                  final Item i = ((Item) widget);
                  if (i.isPhoto()) {
                    i.setLoadingThumb();
                  }

                  m_Container.doJSONRequest(
                      G3Viewer.ROTATE_URL + i.getID() + "/cw",
                      new HttpSuccessHandler() {

                        public void success(JSONValue aValue) {
                          i.updateImages(aValue);
                        }
                      },
                      false,
                      true);
                }
                popupPanel.hide();
              }
            });

    rotateAllCW.addStyleName("popup-item");
    popupMenuBar.addItem(rotateAllCW);

    MenuItem rotateAllCCW =
        new MenuItem(
            "Rotate All Counter-Clockwise",
            true,
            new Command() {
              @Override
              public void execute() {
                // change all thumbs into loading
                final List<Widget> widgets = m_Container.getDragController().getSelectedWidgets();

                for (Widget widget : widgets) {
                  final Item i = ((Item) widget);
                  if (i.isPhoto()) {
                    i.setLoadingThumb();
                  }
                  m_Container.doJSONRequest(
                      G3Viewer.ROTATE_URL + i.getID() + "/cw",
                      new HttpSuccessHandler() {

                        public void success(JSONValue aValue) {
                          i.updateImages(aValue);
                        }
                      },
                      false,
                      true);
                }
                popupPanel.hide();
              }
            });

    rotateAllCW.addStyleName("popup-item");
    popupMenuBar.addItem(rotateAllCCW);

    int x = DOM.eventGetClientX((Event) event.getNativeEvent());
    int y = DOM.eventGetClientY((Event) event.getNativeEvent());
    popupPanel.setPopupPosition(x, y);

    popupPanel.show();
  }
Пример #16
0
  private SimplePlot createPlot(
      final String id, Markings markings, String xAxisLabel, double yMinimum, boolean isMetric) {
    PlotOptions plotOptions = new PlotOptions();
    plotOptions.setZoomOptions(new ZoomOptions().setAmount(1.02));
    plotOptions.setGlobalSeriesOptions(
        new GlobalSeriesOptions()
            .setLineSeriesOptions(
                new LineSeriesOptions().setLineWidth(1).setShow(true).setFill(0.1))
            .setPointsOptions(new PointsSeriesOptions().setRadius(1).setShow(true))
            .setShadowSize(0d));

    plotOptions.setPanOptions(new PanOptions().setInteractive(true));

    if (isMetric) {
      plotOptions.addXAxisOptions(
          new AxisOptions()
              .setZoomRange(true)
              .setTickDecimals(0)
              .setTickFormatter(
                  new TickFormatter() {
                    @Override
                    public String formatTickValue(double tickValue, Axis axis) {
                      if (tickValue >= 0 && tickValue < chosenSessions.size())
                        return chosenSessions.get((int) tickValue);
                      else return "";
                    }
                  }));
    } else {
      plotOptions.addXAxisOptions(new AxisOptions().setZoomRange(true).setMinimum(0));
    }

    plotOptions.addYAxisOptions(new AxisOptions().setZoomRange(false).setMinimum(yMinimum));

    plotOptions.setLegendOptions(new LegendOptions().setNumOfColumns(2));

    if (markings == null) {
      // Make the grid hoverable
      plotOptions.setGridOptions(new GridOptions().setHoverable(true));
    } else {
      // Make the grid hoverable and add  markings
      plotOptions.setGridOptions(
          new GridOptions().setHoverable(true).setMarkings(markings).setClickable(true));
    }

    // create the plot
    SimplePlot plot = new SimplePlot(plotOptions);
    plot.setHeight(200);
    plot.setWidth("100%");

    final PopupPanel popup = new PopupPanel();
    popup.addStyleName(getResources().css().infoPanel());
    final HTML popupPanelContent = new HTML();
    popup.add(popupPanelContent);

    // add hover listener
    if (isMetric) {
      plot.addHoverListener(
          new ShowCurrentValueHoverListener(popup, popupPanelContent, xAxisLabel, chosenSessions),
          false);
    } else {
      plot.addHoverListener(
          new ShowCurrentValueHoverListener(popup, popupPanelContent, xAxisLabel, null), false);
    }

    if (!isMetric && markings != null && !markingsMap.isEmpty()) {
      final PopupPanel taskInfoPanel = new PopupPanel();
      taskInfoPanel.setWidth("200px");
      taskInfoPanel.addStyleName(getResources().css().infoPanel());
      final HTML taskInfoPanelContent = new HTML();
      taskInfoPanel.add(taskInfoPanelContent);
      taskInfoPanel.setAutoHideEnabled(true);

      plot.addClickListener(
          new ShowTaskDetailsListener(id, markingsMap, taskInfoPanel, 200, taskInfoPanelContent),
          false);
    }

    return plot;
  }
Пример #17
0
  private void makeMenus(RootPanel rootPanel) {
    // set up the popup menu that appears when you click on a person
    popup = new PopupPanel();

    MenuBar personMenu = new MenuBar(true);

    MenuBar addMenu = new MenuBar(true);
    addMenu.addItem(
        "1 son",
        new Command() {
          public void execute() {
            addChildren("1 son");
            popup.hide();
          }
        });
    addMenu.addItem(
        "1 daughter",
        new Command() {
          public void execute() {
            addChildren("1 daughter");
            popup.hide();
          }
        });
    addMenu.addItem(
        "2 sons",
        new Command() {
          public void execute() {
            addChildren("2 sons");
            popup.hide();
          }
        });
    addMenu.addItem(
        "2 daughters",
        new Command() {
          public void execute() {
            addChildren("2 daughters");
            popup.hide();
          }
        });
    addMenu.addItem(
        "3 sons",
        new Command() {
          public void execute() {
            addChildren("3 sons");
            popup.hide();
          }
        });
    addMenu.addItem(
        "3 daughters",
        new Command() {
          public void execute() {
            addChildren("3 daughters");
            popup.hide();
          }
        });
    addMenu.addItem(
        "Spouse+son",
        new Command() {
          public void execute() {
            addSpouse("Spouse+son");
            popup.hide();
          }
        });
    addMenu.addItem(
        "Spouse+daughter",
        new Command() {
          public void execute() {
            addSpouse("Spouse+daughter");
            popup.hide();
          }
        });
    Parents =
        new MenuItem(
            "Parents",
            new Command() {
              public void execute() {
                addParents();
                popup.hide();
              }
            });
    addMenu.addItem(Parents);
    personMenu.addItem("Add", addMenu);

    MenuBar changeMenu = new MenuBar(true);

    MenuBar changeAff = new MenuBar(true);
    changeAff.addItem(
        "Affected",
        new Command() {
          public void execute() {
            currentPerson.affection = PelicanPerson.affected;
            updateDisplay();
            popup.hide();
          }
        });
    changeAff.addItem(
        "Unaffected",
        new Command() {
          public void execute() {
            currentPerson.affection = PelicanPerson.unaffected;
            updateDisplay();
            popup.hide();
          }
        });
    changeMenu.addItem("Affection", changeAff);

    MenuBar changeSex = new MenuBar(true);
    changeSex.addItem(
        "Male",
        new Command() {
          public void execute() {
            currentPerson.sex = PelicanPerson.male;
            updateDisplay();
            popup.hide();
          }
        });
    changeSex.addItem(
        "Female",
        new Command() {
          public void execute() {
            currentPerson.sex = PelicanPerson.female;
            updateDisplay();
            popup.hide();
          }
        });
    changeMenu.addItem("Sex", changeSex);

    personMenu.addItem("Change", changeMenu);

    personMenu.addItem(
        "Delete",
        new Command() {
          public void execute() {
            deletePerson(currentPerson);
            popup.hide();
          }
        });

    personMenu.addItem(
        "Cancel",
        new Command() {
          public void execute() {
            popup.hide();
          }
        });

    MenuBar popupMenu = new MenuBar();
    popupMenu.addItem("Edit", personMenu);
    popupMenu.setAutoOpen(true);
    popup.add(popupMenu);

    // main menu
    MenuBar mainMenu = new MenuBar();
    mainMenu.setWidth("50px");
    mainMenu.setAnimationEnabled(true);

    MenuBar editMenu = new MenuBar(true);
    editMenu.setAnimationEnabled(true);

    editMenu.addItem(
        "New Pedigree",
        new Command() {
          public void execute() {
            newPedigree();
            updateDisplay();
          }
        });
    undoItem =
        new MenuItem(
            "Undo",
            new Command() {
              public void execute() {
                if (historyPosition > 1) {
                  historyPosition--;
                  Vector<PelicanPerson> savedPed =
                      (Vector<PelicanPerson>) history.elementAt(historyPosition - 1);
                  loadPedigree(savedPed);
                  pedHasChanged = true;
                  updateDisplay();
                }
              }
            });
    editMenu.addItem(undoItem);
    redoItem =
        new MenuItem(
            "Redo",
            new Command() {
              public void execute() {
                if (historyPosition < history.size()) {
                  historyPosition++;
                  Vector<PelicanPerson> savedPed =
                      (Vector<PelicanPerson>) history.elementAt(historyPosition - 1);
                  loadPedigree(savedPed);
                  pedHasChanged = true;
                  updateDisplay();
                }
              }
            });
    editMenu.addItem(redoItem);
    editMenu.addItem(
        "Renumber",
        new Command() {
          public void execute() {
            renumberAll();
            updateDisplay();
          }
        });
    mainMenu.addItem(new MenuItem("Edit", editMenu));

    rootPanel.add(mainMenu);
  }
Пример #18
0
  public void showPopupMenu(Event event) {
    m_Label.addStyleName("popped");
    final PopupPanel popupPanel = new PopupPanel(true);
    popupPanel.setAnimationEnabled(true);
    MenuBar popupMenuBar = new MenuBar(true);

    MenuItem editItem =
        new MenuItem(
            "Edit Album",
            true,
            new Command() {

              @Override
              public void execute() {
                m_Container.doDialog(
                    "index.php/form/edit/albums/" + m_ID,
                    new HttpDialogHandler() {
                      @Override
                      public void success(String aResult) {
                        refresh();
                      }
                    });
                popupPanel.hide();
              }
            });

    MenuItem addAlbum =
        new MenuItem(
            "Add Album",
            true,
            new Command() {

              @Override
              public void execute() {
                m_Container.doDialog(
                    "index.php/form/add/albums/" + m_ID + "?type=album",
                    new HttpDialogHandler() {
                      @Override
                      public void success(String aResult) {
                        expand();
                        m_View.getCurrentAlbum().select();
                      }
                    });

                popupPanel.hide();
              }
            });

    MenuItem userPermissions =
        new MenuItem(
            "User Permissions",
            true,
            new Command() {
              @Override
              public void execute() {
                m_Container.doDialog(
                    "index.php/permissions/browse/" + m_ID,
                    new HttpDialogHandler() {
                      @Override
                      public void success(String aResult) {}
                    });

                popupPanel.hide();
              }
            });

    popupPanel.setStyleName("popup");
    editItem.addStyleName("popup-item");
    addAlbum.addStyleName("popup-item");
    userPermissions.addStyleName("popup-item");

    if (m_Container.isUploadEnabled()) {
      MenuItem uploadPhotos =
          new MenuItem(
              "Upload Photos",
              true,
              new Command() {

                @Override
                public void execute() {
                  uploadFiles();
                  popupPanel.hide();
                }
              });
      uploadPhotos.addStyleName("popup-item");
      popupMenuBar.addItem(uploadPhotos);
    }

    popupMenuBar.addItem(editItem);
    popupMenuBar.addItem(addAlbum);
    popupMenuBar.addItem(userPermissions);

    popupMenuBar.setVisible(true);
    popupPanel.add(popupMenuBar);

    int x = DOM.eventGetClientX(event);
    int y = DOM.eventGetClientY(event);
    popupPanel.setPopupPosition(x, y);
    popupPanel.addCloseHandler(
        new CloseHandler<PopupPanel>() {

          @Override
          public void onClose(CloseEvent<PopupPanel> event) {

            m_Label.removeStyleName("popped");
          }
        });

    popupPanel.show();
  }
Пример #19
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());
      }
    }
  }