Ejemplo n.º 1
0
  public Canvas getViewPanel() {

    Canvas canvas = new Canvas();

    final Label label = new Label(EXAMPLE_TEXT);
    label.setWidth(250);
    label.setPadding(10);
    label.setLeft(160);
    label.setTop(20);
    label.setBackgroundColor("white");
    label.setBorder("1px solid #c0c0c0");
    label.setCanDragReposition(true);
    label.setShowShadow(true);
    label.setShadowSoftness(10);
    label.setShadowOffset(5);
    label.setKeepInParentRect(true);

    final Slider softness = new Slider("Softness");
    softness.setMinValue(1);
    softness.setMaxValue(10);
    softness.setNumValues(11);
    softness.setShowRange(false);
    softness.setLabelWidth(20);
    softness.setValue(10);
    softness.addDrawHandler(
        new DrawHandler() {
          public void onDraw(DrawEvent event) {
            softness.addValueChangedHandler(
                new ValueChangedHandler() {
                  public void onValueChanged(ValueChangedEvent event) {
                    label.setShadowSoftness(event.getValue());
                    label.updateShadow();
                  }
                });
          }
        });

    final Slider offset = new Slider("Offset");
    offset.setMinValue(0);
    offset.setMaxValue(20);
    offset.setNumValues(21);
    offset.setShowRange(false);
    offset.setLabelWidth(20);
    offset.setLeft(60);
    offset.setValue(5);

    offset.addDrawHandler(
        new DrawHandler() {
          public void onDraw(DrawEvent event) {
            offset.addValueChangedHandler(
                new ValueChangedHandler() {
                  public void onValueChanged(ValueChangedEvent event) {
                    label.setShadowOffset(event.getValue());
                    label.updateShadow();
                  }
                });
          }
        });

    canvas.addChild(softness);
    canvas.addChild(offset);
    canvas.addChild(label);

    return canvas;
  }
Ejemplo n.º 2
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);
  }