private void reset(final UploadComponentOptions options) {
      resetComponents(options);
      clear();

      final Set<String> types = components.keySet();
      currentType = types.iterator().next();

      parentCanvas = new Canvas();
      layout = new VLayout();
      final SelectItem typeItem = new SelectItem("uploadType", "Upload Type");
      typeItem.setValueMap(types.toArray(new String[types.size()]));
      typeItem.setValue(currentType);
      typeItem.setWidth(250);
      typeItem.addChangedHandler(
          new ChangedHandler() {
            public void onChanged(final ChangedEvent event) {
              currentType = typeItem.getValue().toString();
              update();
            }
          });
      final Form form =
          new Form(
              DomConstants.buildConstant(DomConstants.UPLOAD_COMPONENT_TYPE, uploadComponentNumber),
              typeItem);
      form.setPadding(0);
      form.setMargin(0);
      form.setCellSpacing(0);
      form.setCellPadding(0);

      form.setAlign(Alignment.RIGHT);
      form.setWidth(350);
      form.setHeight(20);
      final HLayout header = new HLayout();
      header.setAlign(Alignment.RIGHT);
      header.addMember(form);
      header.setHeight(20);

      layout.setAlign(Alignment.RIGHT);
      layout.addMember(header);
      layout.addMember(parentCanvas);
      layout.setGroupTitle("File Chooser");
      layout.setIsGroup(true);
      layout.setHeight("185px");
      layout.setPadding(2);
      layout.setLayoutAlign(Alignment.CENTER);
      layout.setAlign(Alignment.CENTER);

      for (final UploadComponent uploadComponent : components.values()) {
        final Canvas childCanvas = uploadComponent.get();
        childCanvas.hide();
        parentCanvas.addChild(childCanvas);
      }
      update();
      wrapperLayout.addMember(layout);
    }
Exemple #2
0
  /** This is the entry point method. */
  public void onModuleLoad() {
    loading = new LoadingWindow();

    VLayout main = new VLayout();
    main.setWidth("100%");
    main.setHeight100();
    main.setAlign(Alignment.CENTER);

    Layout imgLayout = new Layout();
    content = new HLayout();
    content.setHeight100();

    Img header = new Img("GarsComLogo.jpg");
    header.setWidth(600);
    header.setHeight(130);
    header.setAlign(Alignment.CENTER);
    imgLayout.addMember(header);
    imgLayout.setWidth("100%");
    imgLayout.setAlign(Alignment.CENTER);

    main.addMember(imgLayout);
    main.addMember(content);

    Tabs tabs = new Tabs();
    content.addMember(tabs);

    main.draw();
  }
Exemple #3
0
  public PrintSign(String[][] values) {
    setMembersMargin(10);
    setHeight(120);

    for (String[] item : values) { // expect size = 3
      if (item.length == 3) {
        VLayout component = new VLayout(20);
        component.setMargin(30);
        // component.setOverflow(Overflow.HIDDEN);
        component.setAlign(Alignment.CENTER);
        SignLabel item_0 = new SignLabel("");
        SignLabel item_1 =
            new SignLabel("(ลงชื่อ).............................................." + item[0]);
        SignLabel item_2 = new SignLabel("(" + item[1] + ")");
        SignLabel item_3 = new SignLabel(item[2]);
        // SignLabel item_4 = new SignLabel("วันที่ "+DateTimeFormat.getFormat( "MM/dd/yyyy"
        // ).format(new Date()));
        SignLabel item_4 = new SignLabel("วันที่ ...../...../.....");
        component.addMembers(item_0, item_1, item_2, item_3, item_4);
        addMember(component);
      }
    }
  }
  private HLayout createSearchLayout() {
    HLayout searchLayout = new HLayout();

    searchLayout.setWidth100();
    searchLayout.setHeight(20);
    searchLayout.setMembersMargin(15);

    i_searchForm = new DynamicForm();
    i_searchForm.setWidth(250);
    i_searchForm.setHeight100();
    i_searchForm.setAlign(Alignment.LEFT);
    i_searchForm.setAutoFocus(true);

    i_searchTextItem = new TextItem();
    i_searchTextItem.setTitle("Search");
    i_searchTextItem.setWidth(200);
    i_searchTextItem.setHint(SEARCH_HINT);
    i_searchTextItem.setShowHintInField(true);
    i_searchTextItem.setCanFocus(true);
    i_searchTextItem.setSelectOnFocus(true);

    i_searchTextItem.addKeyUpHandler(
        new KeyUpHandler() {

          @Override
          public void onKeyUp(KeyUpEvent event) {
            event.getKeyName();

            // ignore the arrow keys
            if (isValidSearchText()) {
              i_searchListGrid.getData(i_searchTextItem.getValueAsString());
              i_addButton.setDisabled(true);
            }
          }
        });

    i_searchForm.setFields(i_searchTextItem);

    // add button to a Vlayout so we can position it correctly with the form
    // search text.
    VLayout buttonVlayout = new VLayout();
    buttonVlayout.setWidth(40);
    buttonVlayout.setAlign(VerticalAlignment.CENTER);
    buttonVlayout.setMargin(2);

    i_clearButton = new IButton(CLEAR_BUTTON_TITLE);
    i_clearButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            i_searchTextItem.setValue("");
            i_rowsRetrievedLabel.setContents("");
            i_searchListGrid.clearData();
            i_addButton.setDisabled(true);
          }
        });
    buttonVlayout.addMember(i_clearButton);

    // add Label to a Vlayout so we can position it correctly with the form
    // search text.
    VLayout labelVlayout = new VLayout();
    labelVlayout.setWidth(100);
    labelVlayout.setAlign(VerticalAlignment.BOTTOM);
    labelVlayout.setMargin(2);

    i_rowsRetrievedLabel = new Label();
    i_rowsRetrievedLabel.setWrap(false);
    i_rowsRetrievedLabel.setWidth100();
    i_rowsRetrievedLabel.setHeight(23);

    labelVlayout.addMember(i_rowsRetrievedLabel);

    searchLayout.addMember(i_searchForm);
    searchLayout.addMember(buttonVlayout);
    searchLayout.addMember(labelVlayout);

    return searchLayout;
  }
  /**
   * Creates this property editor.
   *
   * @param contents Contents view form.
   */
  public MixinValueEditor(Contents contents) {
    super(TITLE);
    this.contents = contents;

    setWidth(WIDTH);
    setHeight(HEIGHT);

    Columns h1 = new Columns(Align.CENTER, Align.CENTER);
    h1.setHeight(15);

    Label l1 = new Label();
    l1.setWidth(150);
    l1.setContents("Mixin Types");

    Label l2 = new Label();
    l2.setWidth(100);
    l2.setContents("");

    Label l3 = new Label();
    l3.setWidth(150);
    l3.setContents("Node's types");

    h1.addMember(l1);
    h1.addMember(l2);
    h1.addMember(l3);

    addMember(h1);

    Columns layout = new Columns(Align.CENTER, Align.CENTER);
    layout.setWidth100();

    mixTypes.setMultiple(true);
    mixTypes.setMultipleAppearance(MultipleAppearance.GRID);
    mixTypes.setWidth(150);
    mixTypes.setHeight(200);

    selectedTypes.setMultiple(true);
    selectedTypes.setMultipleAppearance(MultipleAppearance.GRID);
    selectedTypes.setWidth(150);
    selectedTypes.setHeight(200);

    DynamicForm f1 = new DynamicForm();
    f1.setItems(mixTypes);
    f1.setWidth(150);
    f1.setHeight(200);

    DynamicForm f2 = new DynamicForm();
    f2.setItems(selectedTypes);
    f2.setWidth(150);
    f2.setHeight(200);

    VLayout buttons = new VLayout();
    buttons.setLayoutAlign(Alignment.CENTER);
    buttons.setDefaultLayoutAlign(Alignment.CENTER);
    buttons.setAlign(Alignment.CENTER);
    buttons.setLayoutAlign(VerticalAlignment.CENTER);
    buttons.setWidth(50);

    layout.addMember(f1);
    layout.addMember(buttons);
    layout.addMember(f2);

    Button b1 = new Button(">>");
    b1.setWidth(30);
    b1.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
            allTypes = remove(allTypes, mixTypes.getValueAsString());
            nodeTypes = add(nodeTypes, mixTypes.getValueAsString());
            updateLists();
          }
        });

    Button b2 = new Button("<<");
    b2.setWidth(30);
    b2.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
            nodeTypes = remove(nodeTypes, selectedTypes.getValueAsString());
            allTypes = add(allTypes, selectedTypes.getValueAsString());
            updateLists();
          }
        });

    buttons.addMember(b1);
    buttons.addMember(b2);

    addMember(layout);

    Columns h3 = new Columns(Align.RIGHT, Align.CENTER);
    h3.setHeight(50);

    Button okButton = new Button("OK");
    okButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
            onConfirm(null);
            hide();
          }
        });

    Button cancelButton = new Button("Cancel");
    cancelButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
            hide();
          }
        });

    h3.addMember(okButton);
    h3.addMember(cancelButton);

    addMember(h3);
  }