Пример #1
0
  @Override
  protected Canvas getRollOverCanvas(Integer rowNum, Integer colNum) {
    final ListGridRecord rollOverRecord = this.getRecord(rowNum);
    if (rollOverCanvas == null) {
      rollOverCanvas = new HLayout();
      rollOverCanvas.setSnapTo("TR");
      rollOverCanvas.setWidth(50);
      rollOverCanvas.setHeight(22);
    }

    final String conDate = rollOverRecord.getAttributeAsString(Constants.ATTR_CONVERSION_DATE);
    final Boolean isCon = rollOverRecord.getAttributeAsBoolean(Constants.ATTR_IS_CONVERTED);
    if (conDate != null) {
      ImgButton lockImg = new ImgButton();
      lockImg.setShowDown(false);
      lockImg.setShowRollOver(false);
      lockImg.setLayoutAlign(Alignment.CENTER);

      if (rollOverRecord.getAttributeAsBoolean(Constants.ATTR_IS_CONVERTED)) {
        lockImg.setSrc("icons/16/stillCon.png");
      } else {
        lockImg.setSrc("icons/16/notCon.png");
      }

      lockImg.setPrompt(
          lang.lastConversion()
              + ": "
              + conDate
              + "<br>"
              + (isCon ? lang.stillCon() : lang.notCon()));
      lockImg.setHoverWidth(400);
      lockImg.setHeight(16);
      lockImg.setWidth(16);
      rollOverCanvas.addChild(lockImg);
    } else {
      if (rollOverCanvas.getChildren().length > 0)
        rollOverCanvas.removeChild(rollOverCanvas.getChildren()[0]);
    }
    return rollOverCanvas;
  }
Пример #2
0
 /**
  * Gets the status string.
  *
  * @return the status string
  */
 private String getStatusString() {
   StringBuilder sb = new StringBuilder();
   sb.append("<ul><li>Fedora (<a href='")
       .append(fedoraUrl == null ? "" : fedoraUrl)
       .append("'>link</a>) <span class='");
   switch (fedoraStatus) {
     case (LOADING):
       sb.append("loading'>" + lang.loading() + "...");
       break;
     case (AVAIL):
       sb.append("greenFont'>" + lang.isRunning());
       break;
     case (NOT_AVAIL):
       sb.append("redFont'>" + lang.isNotRunning());
       break;
   }
   sb.append("</span></li><li>Kramerius 4 (<a href='")
       .append(krameriusUrl == null ? "" : krameriusUrl)
       .append("'>link</a>) <span class='");
   switch (krameriusStatus) {
     case (LOADING):
       sb.append("loading'>" + lang.loading() + "...");
       break;
     case (AVAIL):
       sb.append("greenFont'>" + lang.isRunning());
       break;
     case (NOT_AVAIL):
       sb.append("redFont'>" + lang.isNotRunning());
       break;
   }
   sb.append("</span></li></ul>");
   return sb.toString();
 }
  /**
   * Instantiates a new user statistics.
   *
   * @param userId the user id
   * @param model the model
   * @param dateFrom the date from
   * @param dateTo the date to
   * @param segVal the seg val
   * @param dispatcher
   */
  public UserStatisticsLayout(
      Record userRec,
      String model,
      Date dateFrom,
      Date dateTo,
      final String segVal,
      DispatchAsync dispatcher,
      LangConstants lang) {
    this.dispatcher = dispatcher;
    this.userId = userRec != null ? userRec.getAttributeAsString(Constants.ATTR_ID) : UNIFYING;
    this.chartsLayout = new HLayout();
    this.lang = lang;
    this.userName =
        userRec != null
            ? (userRec.getAttributeAsString(Constants.ATTR_NAME)
                + " "
                + userRec.getAttribute(Constants.ATTR_SURNAME))
            : lang.unifyingCharts();
    HTMLFlow nameFlow = new HTMLFlow(HtmlCode.title(userName, 3));
    nameFlow.setHeight(40);
    addMember(nameFlow);
    addMember(chartsLayout);
    setBackgroundColor("white");

    htmlPieFlow = new HTMLFlow(html.replace("%s", PIE_CHART_NESTED_DIV_ID + userId));
    htmlPieFlow.setWidth("40%");
    htmlPieFlow.setHeight(250);
    htmlPieFlow.setExtraSpace((userRec != null) ? 10 : 50);
    chartsLayout.addMember(htmlPieFlow);

    htmlLineFlow = new HTMLFlow(html.replace("%s", LINE_CHART_NESTED_DIV_ID + userId));
    htmlLineFlow.setWidth("*");
    htmlLineFlow.setHeight(250);
    chartsLayout.addMember(htmlLineFlow);

    setShowEdges(true);
    setEdgeSize(3);
    setEdgeOpacity(60);
    setPadding(5);
    setExtraSpace(5);
    setHeight(280);

    final ModalWindow mw = new ModalWindow(chartsLayout);
    mw.setLoadingIcon("loadingAnimation.gif");
    mw.show(true);

    setdata(model, dateFrom, dateTo, segVal, mw);
  }
Пример #4
0
  /**
   * Instantiates a new side nav input tree.
   *
   * @param dispatcher the dispatcher
   * @param lang
   */
  private InputQueueTree(
      final DispatchAsync dispatcher, final LangConstants lang, final EventBus eventBus) {
    this.lang = lang;
    setWidth100();
    setHeight100();
    setCustomIconProperty("icon");
    setAnimateFolderTime(100);
    setAnimateFolders(true);
    setAnimateFolderSpeed(1000);
    setNodeIcon("silk/application_view_list.png");
    setFolderIcon("silk/folder.png");
    setShowOpenIcons(true);
    setShowDropIcons(false);
    setShowSortArrow(SortArrow.CORNER);
    setShowConnectors(true);
    setShowAllRecords(true);
    setLoadDataOnDemand(true);
    setCanSort(true);
    setAutoFetchData(true);
    setShowRoot(false);
    setSelectionType(SelectionStyle.SINGLE);
    setShowRollOverCanvas(true);

    MenuItem showItem = new MenuItem(lang.show(), "icons/16/structure.png");
    final Menu showMenu = new Menu();
    showMenu.setShowShadow(true);
    showMenu.setShadowDepth(10);
    showMenu.setItems(showItem);

    createItem = new MenuItem(lang.create(), "icons/16/structure_into.png");

    final Menu editMenu = new Menu();
    editMenu.setShowShadow(true);
    editMenu.setShadowDepth(10);
    setContextMenu(editMenu);

    dispatcher.execute(
        new HasUserRightsAction(new EDITOR_RIGHTS[] {EDITOR_RIGHTS.LONG_RUNNING_PROCESS}),
        new DispatchCallback<HasUserRightsResult>() {

          @Override
          public void callback(HasUserRightsResult result) {
            canLongProcess = result.getOk()[0];
          }
        });

    addCellContextClickHandler(
        new CellContextClickHandler() {

          @Override
          public void onCellContextClick(CellContextClickEvent event) {

            ListGridRecord record = event.getRecord();
            final String path = record.getAttribute(Constants.ATTR_ID);
            if (path != null && path.length() > 1 && path.substring(1).contains("/")) {
              // String model = path.substring(1, path.substring(1).indexOf("/") + 1);
              String id = path.substring(path.substring(1).indexOf("/") + 2);
              if (id.contains("/")) {
                id = id.substring(0, id.indexOf("/"));
              }

              MenuItem quartz = new MenuItem(lang.addToScheduler(), "icons/16/clock.png");
              quartz.addClickHandler(
                  new ClickHandler() {

                    @Override
                    public void onClick(MenuItemClickEvent event) {

                      String msg = event.getMenu().getEmptyMessage(); // duplicate code
                      String model = msg.substring(0, msg.indexOf("/"));
                      String path = msg.substring(msg.indexOf("/") + 1);

                      QuartzConvertImagesAction action = new QuartzConvertImagesAction(model, path);

                      DispatchCallback<QuartzConvertImagesResult> quartzConvertCallback =
                          new DispatchCallback<QuartzConvertImagesResult>() {

                            @Override
                            public void callback(QuartzConvertImagesResult result) {
                              if (result.getNumberOfImages() != null) {
                                SC.say(
                                    result.getNumberOfImages().toString()
                                        + " images will be converted");
                              } else {
                                SC.say("No images found");
                              }
                            }
                          };

                      dispatcher.execute(action, quartzConvertCallback);
                    }
                  });

              if (record.getAttributeAsBoolean(Constants.ATTR_INGEST_INFO)) {
                MenuItem ingestInfo = new MenuItem(lang.ingestInfo(), "icons/16/export1.png");
                ingestInfo.addClickHandler(
                    new ClickHandler() {

                      @Override
                      public void onClick(MenuItemClickEvent event) {
                        getIngestInfo(path, dispatcher, eventBus);
                      }
                    });
                if (canLongProcess) {
                  editMenu.setItems(createItem, ingestInfo, quartz);
                } else {
                  editMenu.setItems(createItem, ingestInfo);
                }
              } else {
                if (canLongProcess) {
                  editMenu.setItems(createItem, quartz);
                } else {
                  editMenu.setItems(createItem);
                }
              }

              editMenu.setEmptyMessage(path.substring(1, path.length()));
              editMenu.showContextMenu();
            } else {
              showMenu.showContextMenu();
            }
          }
        });
    addShowContextMenuHandler(
        new ShowContextMenuHandler() {

          @Override
          public void onShowContextMenu(ShowContextMenuEvent event) {
            event.cancel();
          }
        });

    eventBus.addHandler(
        RefreshTreeEvent.getType(),
        new RefreshTreeEvent.RefreshTreeHandler() {

          @Override
          public void onRefreshTree(RefreshTreeEvent event) {
            if (event.getTree() == NAME_OF_TREE.INPUT_QUEUE) refreshTree();
          }
        });

    TreeGridField field1 = new TreeGridField();
    field1.setCanFilter(true);
    field1.setName(Constants.ATTR_BARCODE);
    field1.setTitle("ID");
    field1.setCellFormatter(
        new CellFormatter() {

          @Override
          public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
            boolean ingestInfo = record.getAttributeAsBoolean(Constants.ATTR_INGEST_INFO);
            if (ingestInfo) {
              return record.getAttribute(Constants.ATTR_BARCODE) + HTML_TICK_CODE;

            } else {
              return record.getAttribute(Constants.ATTR_BARCODE);
            }
          }
        });
    ListGridField nameField = new ListGridField();
    nameField.setCanFilter(true);
    nameField.setName(Constants.ATTR_NAME);
    nameField.setTitle(lang.name());

    setFields(field1, nameField);
    setDataSource(new InputTreeGwtRPCDS(dispatcher, lang));
  }
Пример #5
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");
    }
  }
Пример #6
0
 public void showSheduler() {
   scheduler = new IButton(lang.scheduler());
   scheduler.setAutoFit(true);
   layout.addMember(scheduler, 3);
 }
Пример #7
0
  /** Instantiates a new home view. */
  @Inject
  public HomeView(LangConstants lang) {
    this.lang = lang;
    layout = new VStack();
    layout.setHeight100();
    layout.setPadding(15);
    HTMLFlow html1 = new HTMLFlow();
    html1.setContents(lang.introduction() + HtmlCode.title(lang.availCoopSys(), 2));
    html1.setExtraSpace(15);

    status = new HTMLFlow(getStatusString());
    status.setExtraSpace(35);

    checkButton = new IButton(lang.checkAvailability());
    checkButton.setAutoFit(true);
    checkButton.setExtraSpace(60);

    HTMLFlow html2 = new HTMLFlow();
    html2.setContents(HtmlCode.title(lang.openDigitalObject(), 2));
    html2.setExtraSpace(30);

    DataSource dataSource = new DataSource();
    dataSource.setID("regularExpression");

    RegExpValidator regExpValidator = new RegExpValidator();
    regExpValidator.setExpression(
        "^.*:([\\da-fA-F]){8}-([\\da-fA-F]){4}-([\\da-fA-F]){4}-([\\da-fA-F]){4}-([\\da-fA-F]){12}$");

    uuidField = new TextItem();
    uuidField.setTitle("PID");
    uuidField.setWidth(255);
    uuidField.setHint(HtmlCode.nobr(lang.withoutPrefix()));
    uuidField.setValidators(regExpValidator);

    form = new DynamicForm();
    form.setWidth(300);
    form.setFields(uuidField);

    open = new IButton();
    open.setTitle(lang.open());
    open.setDisabled(true);
    open.setAutoShowParent(false);

    HLayout hLayout = new HLayout();
    hLayout.setMembersMargin(10);
    hLayout.addMember(form);
    hLayout.addMember(open);

    //        HTMLFlow html3 = new HTMLFlow();
    //        html3.setHeight("*");
    //        html3.setLayoutAlign(VerticalAlignment.BOTTOM);
    //        html3.setContents(lang.credits());
    //        html3.setHeight(20);

    layout.addMember(html1);
    layout.addMember(status);
    layout.addMember(checkButton);
    layout.addMember(html2);
    layout.addMember(hLayout);
    //        layout.addMember(html3);
  }