private ArrayList<LocatableHLayout> createTagLayouts() {
    ArrayList<LocatableHLayout> tagLayouts = new ArrayList<LocatableHLayout>(tags.size());

    for (final Tag tag : tags) {
      LocatableHLayout tagLayout = new LocatableHLayout(extendLocatorId(tag.getName()));
      tagLayout.setHeight(18);
      tagLayout.setHeight(16);

      HTMLFlow tagString =
          new HTMLFlow(
              "<nobr><a href=\""
                  + LinkManager.getTagLink(tag.toString())
                  + "\">"
                  + tag.toString()
                  + "</a></nobr>");
      tagString.setAutoWidth();
      tagLayout.addMember(tagString);

      if (!readOnly) {
        final LayoutSpacer spacer = new LayoutSpacer();
        spacer.setHeight(16);
        spacer.setWidth(16);

        final Img remove =
            new LocatableImg(
                tagLayout.extendLocatorId("Remove"), "[skin]/images/actions/remove.png", 16, 16);
        remove.setTooltip(MSG.view_tags_tooltip_1());
        remove.addClickHandler(
            new ClickHandler() {
              public void onClick(ClickEvent clickEvent) {
                tags.remove(tag);
                save();
              }
            });

        tagLayout.addMember(remove);
        tagLayout.addMember(spacer);
        remove.hide();

        tagLayout.addMouseOverHandler(
            new MouseOverHandler() {
              public void onMouseOver(MouseOverEvent mouseOverEvent) {
                remove.show();
                spacer.hide();
              }
            });
        tagLayout.addMouseOutHandler(
            new MouseOutHandler() {
              public void onMouseOut(MouseOutEvent mouseOutEvent) {
                spacer.show();
                remove.hide();
              }
            });
      }

      tagLayouts.add(tagLayout);
    }

    return tagLayouts;
  }
Esempio n. 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();
  }
Esempio n. 3
0
  @Override
  public Canvas getView() {
    HLayout v = new HLayout();
    v.setAutoHeight();
    v.setAutoWidth();
    v.setAlign(Alignment.CENTER);

    hintlabel = new Label();
    hintlabel.setHeight(30);

    Img img = new Img("loading.gif");
    img.setSize("48px", "48px");

    v.addMember(img);
    v.addMember(hintlabel);
    return v;
  }
    public void onCellOver(CellOverEvent event) {
      ListGridField gridField = AttributeListGrid.this.getField(event.getColNum());
      if (gridField.getName().equals(attributeInfo.getName())) {
        ListGridRecord record = event.getRecord();
        String value = record.getAttribute(attributeInfo.getName());
        if (event.getRowNum() != row) {
          if (img != null) {
            cleanup();
          }
          img = new Img(value);
          img.setMaxWidth(300);
          img.setMaxHeight(300);
          img.setKeepInParentRect(true);
          img.setShowEdges(true);
          img.setLeft(AttributeListGrid.this.getAbsoluteLeft() + 10);
          img.setTop(AttributeListGrid.this.getAbsoluteTop() + 10);
          img.draw();
          killTimer =
              new Timer() {

                public void run() {
                  img.destroy();
                }
              };
          killTimer.schedule(Math.round(3000));
          row = event.getRowNum();
        }
      }
    }
  private void drawTitle() {
    for (String headerIcon : titleIcons) {
      Img img = new Img(headerIcon, 24, 24);
      img.setPadding(4);
      titleLayout.addMember(img);
    }

    if (null != titleBackButton) {
      titleLayout.addMember(titleBackButton);
    }

    titleLayout.addMember(titleCanvas);

    if (titleComponent != null) {
      titleLayout.addMember(new LayoutSpacer());
      titleLayout.addMember(titleComponent);
    }
  }
Esempio n. 6
0
  public Canvas getViewPanel() {

    VLayout layout = new VLayout();
    layout.setMembersMargin(10);

    final Img image = new Img("other/magnifier.png", 48, 48);
    image.setTop(125);
    image.setLeft(100);
    image.setAnimateTime(500); // milliseconds

    IButton zoomButton = new IButton();
    zoomButton.setTitle("Zoom");
    zoomButton.setLeft(40);
    zoomButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            image.animateRect(0, 50, 248, 248);
          }
        });

    IButton shrinkButton = new IButton();
    shrinkButton.setTitle("Shrink");
    shrinkButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            image.animateRect(100, 125, 48, 48);
          }
        });

    HLayout hLayout = new HLayout();
    hLayout.setMembersMargin(10);
    hLayout.addMember(zoomButton);
    hLayout.addMember(shrinkButton);
    layout.addMember(hLayout);

    layout.addChild(image);
    return layout;
  }
  public TagEditorView(
      String locatorId,
      Set<Tag> tags,
      boolean readOnly,
      TagsChangedCallback callback,
      boolean vertical) {

    super(locatorId);

    setVertical(vertical);
    setAutoWidth();
    if (!vertical) {
      setMembersMargin(8);
    }

    if (tags != null) {
      this.tags.addAll(tags);
    }
    this.readOnly = readOnly;
    this.callback = callback;

    // create the following widgets once and re-use as needed
    tagTitleLabel = new HTMLFlow("<nobr><b>" + MSG.view_tags_tags() + ":</b></nobr>");
    tagTitleLabel.setAutoWidth();

    if (!this.readOnly) {
      tagInputDialog = new TagInputDialog(extendLocatorId("tagInputDialog"));

      addImg = new LocatableImg(extendLocatorId("addImg"), "[skin]/images/actions/add.png", 16, 16);
      addImg.setTooltip(MSG.view_tags_tooltip_2());
      addImg.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent clickEvent) {
              showTagInput();
            }
          });
    }
  }
  public Layout getWindowLayout() {
    setWidth(500);
    setHeight(500);
    setTitle("Register");
    setShowMinimizeButton(false);
    setIsModal(true);
    setShowModalMask(true);
    setAutoCenter(true);
    setDismissOnOutsideClick(true);
    setShowShadow(true);
    setShadowOffset(0);
    setShadowSoftness(10);

    addCloseClickHandler(
        new CloseClickHandler() {
          public void onCloseClick(CloseClientEvent event) {
            destroy();
          }
        });

    Img profileImg =
        new Img(
            member.getProfilePic(),
            100,
            ImageUtil.getScaledImageHeight(member.getProfilePic(), 100));
    profileImg.setImageType(ImageStyle.STRETCH);

    HeaderItem header = new HeaderItem();
    header.setDefaultValue("Registration");
    emailItem.setValue(member.getEmail());
    emailItem.setRequired(true);
    firstNameItem.setValue(member.getFirstname());
    firstNameItem.setRequired(true);
    lastNameItem.setValue(member.getLastname());
    lastNameItem.setRequired(true);
    AWSSecretItem.setValue(member.getAWSSecretKey());
    AWSAccessItem.setValue(member.getAWSAccessKey());

    form.setFields(header, emailItem, firstNameItem, lastNameItem, AWSSecretItem, AWSAccessItem);
    form.setAutoFocus(true);

    HLayout buttons = new HLayout();
    buttons.setMembersMargin(15);
    buttons.setAlign(Alignment.CENTER);

    IButton cancelButton = new IButton("Cancel");
    cancelButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            destroy();
            // com.google.gwt.user.client.Window.Location.assign(GWT.getHostPageBaseURL());
          }
        });
    saveButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            final LoginServiceAsync loginService = GWT.create(LoginService.class);
            loginService.memberExists(
                emailItem.getValueAsString(),
                new AsyncCallback<Boolean>() {

                  @Override
                  public void onFailure(Throwable caught) {
                    SC.say("Could not check if member already exists.");
                  }

                  @Override
                  public void onSuccess(Boolean result) {
                    emailItem.setValidators(new MemberExistsValidator(result));
                    if (form.validate()) {
                      member.setEmail(emailItem.getValueAsString());
                      member.setFirstname(firstNameItem.getValueAsString());
                      member.setLastname(lastNameItem.getValueAsString());
                      member.setAWSSecretKey(AWSSecretItem.getValueAsString());
                      member.setAWSAccessKey(AWSAccessItem.getValueAsString());

                      loginService.registerMember(
                          member,
                          new AsyncCallback<Member>() {

                            @Override
                            public void onSuccess(Member result) {
                              if (member != null) {
                                destroy();
                                com.google.gwt.user.client.Window.Location.assign(
                                    GWT.getHostPageBaseURL());
                              } else SC.warn("Email address already in use!");
                            }

                            @Override
                            public void onFailure(Throwable caught) {
                              if (caught instanceof MemberExistsException)
                                SC.warn("Email address already in use!");
                              else SC.warn("Something went wrong!");
                            }
                          });
                    }
                  }
                });
          }
        });

    buttons.addMember(saveButton);
    buttons.addMember(cancelButton);

    VLayout windowLayout = new VLayout();
    windowLayout.setMargin(10);
    windowLayout.setMembersMargin(15);
    windowLayout.addMember(profileImg);
    windowLayout.addMember(form);
    windowLayout.addMember(buttons);

    return windowLayout;
  }
  public Canvas getViewPanel() {

    HStack hStack = new HStack();
    hStack.setWidth(300);
    hStack.setHeight(100);
    hStack.setShowEdges(true);
    hStack.setCanAcceptDrop(true);
    hStack.setAnimateMembers(true);
    hStack.setDropLineThickness(4);

    final Label focusLabel = new Label();
    focusLabel.setID("focusLabel");
    focusLabel.setAlign(Alignment.CENTER);
    focusLabel.setTop(150);
    focusLabel.setWidth(300);
    focusLabel.setHeight(50);

    final Img bluePawn = new Img();
    bluePawn.setID("bluePawn");
    bluePawn.setLayoutAlign(Alignment.CENTER);
    bluePawn.setWidth(48);
    bluePawn.setHeight(48);
    bluePawn.setCanFocus(true);
    bluePawn.setSrc("pieces/48/pawn_blue.png");
    bluePawn.setCanDragReposition(true);
    bluePawn.setCanDrop(true);
    bluePawn.setDragAppearance(DragAppearance.TARGET);
    bluePawn.addDrawHandler(
        new DrawHandler() {
          public void onDraw(DrawEvent event) {
            bluePawn.focus();
          }
        });
    bluePawn.addFocusChangedHandler(
        new FocusChangedHandler() {
          public void onFocusChanged(FocusChangedEvent event) {
            changeLabel(focusLabel, bluePawn.getID(), event.getHasFocus());
          }
        });

    ComboBoxItem field1 = new ComboBoxItem();
    field1.setName("field1");
    field1.setValueMap("Option 1", "Option 2");

    DateItem field2 = new DateItem();
    field2.setName("field2");

    final DynamicForm simpleForm = new DynamicForm();
    simpleForm.setID("simpleForm");
    simpleForm.setLayoutAlign(Alignment.CENTER);
    simpleForm.setHeight(48);
    simpleForm.setFields(field1, field2);
    simpleForm.addFocusChangedHandler(
        new FocusChangedHandler() {
          public void onFocusChanged(FocusChangedEvent event) {
            changeLabel(focusLabel, simpleForm.getID(), event.getHasFocus());
          }
        });

    final Img greenPawn = new Img();
    greenPawn.setID("greenPawn");
    greenPawn.setLayoutAlign(Alignment.CENTER);
    greenPawn.setWidth(48);
    greenPawn.setHeight(48);
    greenPawn.setCanFocus(true);
    greenPawn.setSrc("pieces/48/pawn_green.png");
    greenPawn.setCanDragReposition(true);
    greenPawn.setCanDrop(true);
    greenPawn.setDragAppearance(DragAppearance.TARGET);
    greenPawn.addFocusChangedHandler(
        new FocusChangedHandler() {
          public void onFocusChanged(FocusChangedEvent event) {
            changeLabel(focusLabel, greenPawn.getID(), event.getHasFocus());
          }
        });

    hStack.addMember(bluePawn);
    hStack.addMember(simpleForm);
    hStack.addMember(greenPawn);

    VLayout vLayout = new VLayout();
    vLayout.setMembersMargin(10);
    vLayout.addMember(hStack);
    vLayout.addMember(focusLabel);

    return vLayout;
  }
Esempio n. 10
0
  public RepositoryNameView(final Console console) {
    super();
    setStyleName("repository");
    setLayoutAlign(Alignment.CENTER);
    setLayoutAlign(VerticalAlignment.CENTER);
    setDefaultLayoutAlign(Alignment.CENTER);
    setDefaultLayoutAlign(VerticalAlignment.CENTER);

    setHeight(55);
    setWidth100();

    Img logo = new Img();
    logo.setSrc("icons/attach.png");

    logo.setHeight(55);
    logo.setWidth(45);
    logo.setValign(VerticalAlignment.CENTER);

    HLayout panel0 = new HLayout();

    HLayout panel1 = new HLayout();

    panel1.setLayoutAlign(Alignment.RIGHT);
    panel1.setDefaultLayoutAlign(Alignment.RIGHT);
    panel1.setAlign(Alignment.RIGHT);
    HLayout panel = new HLayout();

    //            panel.setAlign(Alignment.LEFT);
    panel.setLayoutAlign(VerticalAlignment.CENTER);
    panel.setDefaultLayoutAlign(VerticalAlignment.CENTER);

    label.setStyleName("repository-caption");
    label.setWidth("100%");
    label.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            console.showRepositories();
          }
        });
    label.setBorder("1 px solid black");
    label.setValign(VerticalAlignment.CENTER);

    Label explore = new Label("<b>Explore</b>");
    explore.setAlign(Alignment.RIGHT);
    explore.setBorder("1ps solid green");
    explore.setAutoFit(true);
    explore.setStyleName("tab-label");
    explore.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            console.showContent();
          }
        });

    Label nodeTypes = new Label("<b>NodeTypes</b>");
    nodeTypes.setAlign(Alignment.RIGHT);
    nodeTypes.setAutoFit(true);
    nodeTypes.setStyleName("tab-label");
    nodeTypes.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            console.showNodeTypes();
          }
        });

    Label descriptor = new Label("<b>Descriptor</b>");
    descriptor.setAlign(Alignment.RIGHT);
    descriptor.setAutoFit(true);
    descriptor.setStyleName("tab-label");
    descriptor.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            console.showRepositoryInfo();
          }
        });

    Label query = new Label("<b>Query</b>");
    query.setAlign(Alignment.RIGHT);
    query.setAutoFit(true);
    query.setStyleName("tab-label");
    query.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            console.showQuery();
          }
        });

    panel.addMember(logo);
    panel.addMember(label);

    panel1.addMember(explore);
    panel1.addMember(new Spacer(10));
    panel1.addMember(nodeTypes);
    panel1.addMember(new Spacer(10));
    panel1.addMember(descriptor);
    panel1.addMember(new Spacer(10));
    panel1.addMember(query);
    panel1.setHeight(55);

    panel0.setWidth("70%");
    panel0.setHeight(55);

    panel0.addMember(panel);
    panel0.addMember(panel1);

    addMember(new Strut(10));
    addMember(panel0);
    addMember(new Strut(10));
    setVisible(false);
  }
Esempio n. 11
0
 @Override
 public void setHTML(String src) {
   super.setSrc(src);
 }
 private void cleanup() {
   killTimer.cancel();
   img.destroy();
   img = null;
 }
Esempio n. 13
0
 @Override
 public void doAfterFinishUpload(String picUrl) {
   strBookPicUrl = picUrl;
   bookPicUrlItem.setSrc(strBookPicUrl);
 }