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;
  }
Exemplo n.º 2
0
 public Img(String src, int width, int height) {
   setSrc(src);
   setWidth(width);
   setHeight(height);
   scClassName = "Img";
 }
Exemplo n.º 3
0
 public Img(String src) {
   setSrc(src);
   scClassName = "Img";
 }
Exemplo n.º 4
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);
  }
Exemplo n.º 5
0
 @Override
 public void setHTML(String src) {
   super.setSrc(src);
 }
Exemplo n.º 6
0
 @Override
 public void doAfterFinishUpload(String picUrl) {
   strBookPicUrl = picUrl;
   bookPicUrlItem.setSrc(strBookPicUrl);
 }