Example #1
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);
  }
 /**
  * On right click.
  *
  * @param value the value
  * @param event the event
  * @param element the element
  */
 public void onRightClick(CellTreeNode value, Event event, Element element) {
   clearMessages();
   selectedNode = value;
   selectionModel.setSelected(selectedNode, true);
   int x = element.getAbsoluteRight() - 10;
   int y = element.getAbsoluteBottom() + 5;
   popupPanel.setPopupPosition(x, y);
   popupPanel.setAnimationEnabled(true);
   //		popupPanel.setSize("175px", "75px");
   popupPanel.show();
   popupPanel.setStyleName("popup");
   clauseWorkspaceContextMenu.displayMenuItems(popupPanel);
 }
 private void showWaitPanelIfRequired(RequestContext context) {
   if (getServicePropertyBoolean(context.getMethodName(), "showWaitPanel", false)) {
     GwtUtils.log(getClass(), "showWaitPanelIfRequired", "showWaitPanel = true");
     if (waitPanel == null) {
       waitPanel = new PopupPanel();
       GwtUtils.setStyleAttribute(waitPanel, "border", "none");
       GwtUtils.setStyleAttribute(waitPanel, "background", "transparent");
       waitPanel.setGlassEnabled(false);
       waitPanel.setAnimationEnabled(true);
       Image waitingImg =
           new Image(UriUtils.fromTrustedString("/images/commons/transp-loading.gif"));
       waitPanel.setWidget(waitingImg);
     }
     GwtUtils.showWait(waitPanel);
   }
 }
 // @UiHandler({"edit_selection"})
 public void editSelectionCmd(ClickEvent ev) {
   // DialogBox dialogBox = createDialogBox("Редактирование выбора...");
   // dialogBox.setGlassEnabled(true);
   // dialogBox.setAnimationEnabled(true);
   PopupPanel p = new PopupPanel(true);
   p.setModal(false);
   // p.setPopupPosition(200, 200);
   p.setAnimationEnabled(true);
   // p.setTitle("Редактирование выбора...");
   // dialogBox.setModal(true);
   // dialogBox.center();
   p.setSize("100%", "100%");
   p.setWidget(new MultiselectionEditor(this, p));
   p.setVisible(true);
   p.show();
   p.center();
 }
Example #5
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);
  }
Example #6
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();
  }
Example #7
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();
  }
Example #8
0
  private void showSuggestions(Collection<? extends Suggestion> suggestions) {
    if (suggestions.size() > 0) {

      // Hide the popup before we manipulate the menu within it. If we do not
      // do this, some browsers will redraw the popup as items are removed
      // and added to the menu.
      boolean isAnimationEnabled = suggestionPopup.isAnimationEnabled();
      if (suggestionPopup.isAttached()) {
        suggestionPopup.hide();
      }

      suggestionMenu.clearItems();

      for (Suggestion curSuggestion : suggestions) {
        final SuggestionMenuItem menuItem =
            new SuggestionMenuItem(
                curSuggestion,
                oracle.isDisplayStringHTML(),
                new SuggestionCompletionCommand(curSuggestion));

        suggestionMenu.addItem(menuItem);
      }

      class TextBoxSkewWrapper extends TextBox {
        private TextBoxBase wrapped;
        private int skewWidth;
        private int skewHeight;

        public TextBoxSkewWrapper(TextBoxBase textBoxBase, int skewWidth, int skewHeight) {
          this.wrapped = textBoxBase;
          this.skewWidth = skewWidth;
          this.skewHeight = skewHeight;
        }

        @Override
        public int getOffsetWidth() {
          return wrapped.getOffsetWidth();
        }

        @Override
        public int getOffsetHeight() {
          return wrapped.getOffsetHeight();
        }

        @Override
        public int getAbsoluteLeft() {
          return wrapped.getAbsoluteLeft() + skewWidth;
        }

        @Override
        public int getAbsoluteTop() {
          return wrapped.getAbsoluteTop() + skewHeight;
        }
      }

      suggestionPopup.showRelativeTo(new TextBoxSkewWrapper(getTextBox(), 0, 5));
      suggestionPopup.setAnimationEnabled(isAnimationEnabled);
    } else {
      suggestionPopup.hide();
    }

    setFocus(true);
  }