/*
  * (non-Javadoc)
  * @see
  * cz.fi.muni.xkremser.editor.client.presenter.DigitalObjectMenuPresenter.
  * MyView#setRelatedDocuments(java.util.List)
  */
 @Override
 public void setRelatedDocuments(List<? extends List<String>> data) {
   if (data != null && data.size() != 0) {
     sectionStack.getSection(SECTION_RELATED_ID).setExpanded(true);
     // sectionRelated.setExpanded(true);
     Record[] records = new Record[data.size()];
     for (int i = 0; i < data.size(); i++) {
       records[i] = new ListGridRecord();
       records[i].setAttribute("uuid", data.get(i).get(0));
       records[i].setAttribute("relation", data.get(i).get(1));
     }
     relatedGrid.setData(records);
   } else sectionStack.getSection(SECTION_RELATED_ID).setExpanded(false);
 }
Exemplo n.º 2
0
 public SectionStackSection getMainSection(String sectionID) {
   return mainSectionStack.getSection(sectionID);
 }
  /*
   * (non-Javadoc)
   * @see
   * cz.fi.muni.xkremser.editor.client.presenter.DigitalObjectMenuPresenter.
   * MyView#showInputQueue(com.gwtplatform.dispatch.client.DispatchAsync)
   */
  @Override
  public void showInputQueue(
      InputQueueTree tree, DispatchAsync dispatcher, final PlaceManager placeManager) {
    SectionStackSection section1 = new SectionStackSection();
    section1.setTitle(lang.inputQueue());
    if (tree == null) {
      inputTree = new InputQueueTree(dispatcher, lang, eventBus);
      inputTree
          .getCreateMenuItem()
          .addClickHandler(
              new com.smartgwt.client.widgets.menu.events.ClickHandler() {

                @Override
                public void onClick(final MenuItemClickEvent event) {
                  String msg = event.getMenu().getEmptyMessage();
                  String model = msg.substring(0, msg.indexOf("/"));
                  String path = msg.substring(msg.indexOf("/") + 1);
                  String id = path;
                  if (path.contains("/")) {
                    id = path.substring(0, path.indexOf("/"));
                  }

                  placeManager.revealRelativePlace(
                      new PlaceRequest(NameTokens.FIND_METADATA)
                          .with(Constants.ATTR_MODEL, model)
                          .with(Constants.URL_PARAM_SYSNO, id)
                          .with(Constants.URL_PARAM_PATH, path));
                }
              });
    } else {
      String isInputSection = sectionStack.getSection(0).getAttribute(SECTION_INPUT_ID);
      if (isInputSection != null && "yes".equals(isInputSection)) {
        sectionStack.removeSection(0);
      }
      inputTree = tree;
    }
    section1.setItems(inputTree);
    refreshButton = new ImgButton();
    refreshButton.setSrc("[SKIN]headerIcons/refresh.png");
    refreshButton.setSize(16);
    refreshButton.setShowRollOver(true);
    refreshButton.setCanHover(true);
    refreshButton.setShowDownIcon(false);
    refreshButton.setShowDown(false);
    refreshButton.setHoverStyle("interactImageHover");
    refreshButton.setHoverOpacity(75);
    refreshButton.addHoverHandler(
        new HoverHandler() {

          @Override
          public void onHover(HoverEvent event) {
            refreshButton.setPrompt(lang.inputQueueRescan());
          }
        });

    section1.setControls(refreshButton);
    section1.setResizeable(true);
    section1.setExpanded(true);
    sectionStack.addSection(section1, 0);
    section1.setAttribute(SECTION_INPUT_ID, "yes");
  }
Exemplo n.º 4
0
  public static void setInputTreeToSection(
      final DispatchAsync dispatcher,
      final LangConstants lang,
      final EventBus eventBus,
      SectionStack sectionStack,
      final PlaceManager placeManager,
      final MessageBus messageBus,
      boolean force) {

    SectionStackSection section1 = new SectionStackSection();
    section1.setTitle(lang.inputQueue());
    String isInputSection = sectionStack.getSection(0).getAttribute(Constants.SECTION_INPUT_ID);
    boolean notContains = isInputSection == null || !"yes".equals(isInputSection);
    if (notContains || force) {
      if (!notContains) {
        sectionStack.collapseSection(0);
        sectionStack.removeSection(0);
      }
      if (inputQueueTree == null) {
        inputQueueTree = new InputQueueTree(dispatcher, lang, eventBus);
        inputQueueTree
            .getCreateMenuItem()
            .addClickHandler(
                new com.smartgwt.client.widgets.menu.events.ClickHandler() {

                  @Override
                  public void onClick(final MenuItemClickEvent event) {
                    String msg = event.getMenu().getEmptyMessage();
                    String model = msg.substring(0, msg.indexOf("/"));
                    String path = msg.substring(msg.indexOf("/") + 1);
                    String id = path;
                    if (path.contains("/")) {
                      id = path.substring(0, path.indexOf("/"));
                    }

                    placeManager.revealRelativePlace(
                        new PlaceRequest(NameTokens.FIND_METADATA)
                            .with(Constants.ATTR_MODEL, model)
                            .with(Constants.URL_PARAM_SYSNO, id)
                            .with(Constants.URL_PARAM_PATH, path));
                  }
                });

        messageBus.subscribe(
            "InputQueueBroadcastReceiver",
            new MessageCallback() {
              @Override
              public void callback(Message message) {
                String inputItem = message.get(String.class, "ingested");
                for (ListGridRecord record : inputQueueTree.getRecords()) {
                  if (record.getAttribute(Constants.ATTR_ID).equals(inputItem)) {
                    record.setAttribute(Constants.ATTR_INGEST_INFO, true);
                    inputQueueTree.redraw();
                  }
                }
              }
            });
      }

      section1.setItems(inputQueueTree);
      section1.setControls(getRefreshButton(lang, eventBus, dispatcher));
      section1.setResizeable(true);
      section1.setExpanded(true);
      sectionStack.addSection(section1, 0);
      section1.setAttribute(Constants.SECTION_INPUT_ID, "yes");
    }
  }