Esempio n. 1
0
  public MailfolderCanvas() {

    super();
    setShowResizeBar(true);

    SectionStackSection section = new SectionStackSection();
    section.setCanCollapse(false);
    section.setExpanded(true);
    section.setResizeable(true);

    createTree();
    section.setItems(this.tree);

    createToolbar(section);
    createContextMenu();

    setSections(section);

    EventBroker.get().addFoldersReloadListener(this);
    EventBroker.get().addMessagesChangedListener(this);

    addDrawHandler(
        new DrawHandler() {

          public void onDraw(DrawEvent event) {

            EventBroker.get().fireFoldersReload();
          }
        });
  }
Esempio n. 2
0
  public AddressbookTree() {
    super();
    SectionStackSection section = new SectionStackSection();
    section.setCanCollapse(false);
    section.setExpanded(true);
    section.setResizeable(true);

    TreeGrid tree = new TreeGrid();
    tree.setWidth100();
    tree.setHeight100();
    tree.setAnimateFolderTime(100);
    tree.setAnimateFolders(true);
    tree.setAnimateFolderSpeed(1000);
    tree.setShowSortArrow(SortArrow.CORNER);
    tree.setShowAllRecords(true);
    tree.setLoadDataOnDemand(false);
    tree.setCanSort(false);
    tree.setCellHeight(17);
    tree.setShowHeader(false);

    TreeGridField field = new TreeGridField();
    field.setCanFilter(true);
    field.setName("name");
    field.setTitle("<b>SmartGWT Showcase</b>");
    tree.setFields(field);

    Tree treeData = new Tree();
    treeData.setModelType(TreeModelType.PARENT);
    treeData.setNameProperty("name");
    treeData.setOpenProperty("isOpen");
    treeData.setIdField("nodeID");
    treeData.setParentIdField("parentNodeID");
    treeData.setRootValue("root");
    treeData.setData(DemoData.getAddressBookTreeData());

    tree.setData(treeData);
    section.setItems(tree);

    setSections(section);
  }
  /*
   * (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");
  }
  /** Instantiates a new digital object menu view. */
  @Inject
  public DigitalObjectMenuView(final LangConstants lang, final EventBus eventBus) {
    this.lang = lang;
    this.eventBus = eventBus;

    layout = new VLayout();

    layout.setHeight100();
    layout.setWidth100();
    layout.setOverflow(Overflow.AUTO);

    relatedGrid = new ListGrid();
    relatedGrid.setWidth100();
    relatedGrid.setHeight100();
    relatedGrid.setShowSortArrow(SortArrow.CORNER);
    relatedGrid.setShowAllRecords(true);
    relatedGrid.setAutoFetchData(false);
    relatedGrid.setCanHover(true);
    relatedGrid.setCanSort(false);
    ListGridField field1 = new ListGridField("relation", lang.relation());
    field1.setWidth("40%");
    ListGridField field2 = new ListGridField("uuid", "PID");
    field2.setWidth("*");
    relatedGrid.setFields(field1, field2);
    sectionRelated = new SectionStackSection();
    sectionRelated.setID(SECTION_RELATED_ID);
    sectionRelated.setTitle(lang.referencedBy());
    sectionRelated.setResizeable(true);
    sectionRelated.setItems(relatedGrid);
    sectionRelated.setExpanded(false);

    sideNavGrid =
        new ListGrid() {

          @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);
            }

            if (rollOverCanvas.getChildren().length > 0) {
              rollOverCanvas.removeChild(rollOverCanvas.getChildren()[0]);
            }
            final String lockOwner = rollOverRecord.getAttributeAsString(Constants.ATTR_LOCK_OWNER);
            if (lockOwner != null) {
              ImgButton lockImg = new ImgButton();
              lockImg.setShowDown(false);
              lockImg.setShowRollOver(false);
              lockImg.setLayoutAlign(Alignment.CENTER);

              if ("".equals(lockOwner)) {
                lockImg.setSrc("icons/16/lock_lock_all.png");
              } else if (lockOwner.length() > 0) {
                lockImg.setSrc("icons/16/lock_lock_all_red.png");
              }

              lockImg.setPrompt(lang.lockInfoButton());
              lockImg.setHeight(16);
              lockImg.setWidth(16);
              lockImg.addClickHandler(
                  new com.smartgwt.client.widgets.events.ClickHandler() {

                    @Override
                    public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
                      EditorSC.objectIsLock(
                          lang,
                          new LockInfo(
                              lockOwner,
                              rollOverRecord.getAttributeAsString(Constants.ATTR_LOCK_DESCRIPTION),
                              rollOverRecord.getAttributeAsStringArray(
                                  Constants.ATTR_TIME_TO_EXP_LOCK)));
                    }
                  });
              rollOverCanvas.addChild(lockImg);
            }
            return rollOverCanvas;
          }
        };
    sideNavGrid.setShowSelectionCanvas(false);

    sideNavGrid.setWidth100();
    sideNavGrid.setHeight100();
    sideNavGrid.setShowSortArrow(SortArrow.CORNER);
    sideNavGrid.setShowAllRecords(true);
    sideNavGrid.setAutoFetchData(true);
    sideNavGrid.setCanHover(true);
    sideNavGrid.setHoverOpacity(75);
    sideNavGrid.setHoverStyle("interactImageHover");
    sideNavGrid.setShowRollOverCanvas(true);

    final DynamicForm form = new DynamicForm();
    form.setHeight(1);
    form.setWidth(60);
    form.setNumCols(1);

    selectItem.setWidth(60);
    selectItem.setShowTitle(false);
    selectItem.setValueMap(lang.me(), lang.all());
    selectItem.setDefaultValue(lang.me());
    selectItem.setHoverOpacity(75);
    selectItem.setHoverStyle("interactImageHover");
    selectItem.addItemHoverHandler(
        new ItemHoverHandler() {

          @Override
          public void onItemHover(ItemHoverEvent event) {
            selectItem.setPrompt(
                DigitalObjectMenuView.this.lang.showModifiedHint() + selectItem.getValue());
          }
        });
    selectItem.addChangedHandler(
        new ChangedHandler() {

          @Override
          public void onChanged(ChangedEvent event) {
            getUiHandlers().refreshRecentlyModified();
          }
        });

    form.setFields(selectItem);
    form.setTitle("by:");

    sectionRecentlyModified = new SectionStackSection();
    sectionRecentlyModified.setTitle(lang.recentlyModified());
    sectionRecentlyModified.setResizeable(true);
    sectionRecentlyModified.setItems(sideNavGrid);
    sectionRecentlyModified.setControls(form);
    sectionRecentlyModified.setExpanded(true);

    sectionStack = new SectionStack();
    sectionStack.addSection(sectionRelated);
    sectionStack.addSection(sectionRecentlyModified);
    sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
    sectionStack.setAnimateSections(true);
    sectionStack.setWidth100();
    sectionStack.setHeight100();
    sectionStack.setOverflow(Overflow.HIDDEN);
    layout.addMember(sectionStack);
  }
Esempio n. 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");
    }
  }
Esempio n. 6
0
  /** This is the entry point method. */
  public void onModuleLoad() {

    final HelpCanvas help1 = new HelpCanvas("help1");
    final HelpCanvas help2 = new HelpCanvas("help2");

    HLayout layout = new HLayout();
    layout.setMembersMargin(20);

    final SectionStack sectionStack = new SectionStack();
    sectionStack.setVisibilityMode(VisibilityMode.MUTEX);
    sectionStack.setWidth(800);
    sectionStack.setHeight(600);

    SectionStackSection section1 = new SectionStackSection("Settings for Stream Recorder");
    section1.setExpanded(true);
    section1.setResizeable(false);

    // VLayout layout = new VLayout(25);

    layout.setAlign(Alignment.CENTER);
    layout.setMargin(23);
    layout.setWidth("93%");

    final DataSource dataSource = SettingsDS.getInstance();

    final DynamicForm form = new DynamicForm();
    form.setIsGroup(true);
    form.setGroupTitle("Update");
    form.setNumCols(4);
    form.setDataSource(dataSource);
    form.setMargin(1);

    final ListGrid listGrid = new ListGrid();
    listGrid.setWidth100();
    listGrid.setHeight(130);
    listGrid.setDataSource(dataSource);
    listGrid.setAutoFetchData(true);
    listGrid.addRecordClickHandler(
        new RecordClickHandler() {
          public void onRecordClick(RecordClickEvent event) {
            form.reset();
            form.editSelectedData(listGrid);
          }
        });

    section1.addItem(listGrid);
    section1.addItem(form);

    IButton butt = new IButton("Save");
    butt.setMargin(2);

    butt.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            form.saveData();
          }
        });
    section1.addItem(butt);

    Button button = new Button("Hello from Admin");
    button.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            Services.getHelloService()
                .hello(
                    "Admin",
                    new AsyncCallback<Void>() {

                      @Override
                      public void onFailure(Throwable caught) {
                        // TODO Auto-generated method stub

                      }

                      @Override
                      public void onSuccess(Void result) {
                        // TODO Auto-generated method stub

                      }
                    });
          }
        });

    sectionStack.addSection(section1);

    SectionStackSection section2 = new SectionStackSection("Help 1");
    section2.setExpanded(true);
    section2.setCanCollapse(true);

    section2.addItem(help1);
    sectionStack.addSection(section2);
    // SectionStackSection section3 = new SectionStackSection("Help 2");
    // section3.setExpanded(true);
    // section3.setCanCollapse(true);
    // section3.addItem(help2);
    // sectionStack.addSection(section3);

    // IButton resizeButton = new IButton("Resize Help 1");
    // resizeButton.setWidth(150);
    // resizeButton.addClickHandler(new ClickHandler() {
    // public void onClick(ClickEvent event) {
    // help1.setHeight(200);
    // }
    // });

    layout.addMember(sectionStack);

    // VLayout buttons = new VLayout(25);
    // buttons.setMembersMargin(10);
    // buttons.addMember(resizeButton);

    // layout.addMember(buttons);

    layout.addMember(button);
    layout.draw();

    // RootPanel.get().add(topTabSet);
  }