Пример #1
0
  public ProfileEditorViewImpl() {
    ContentPanel panel = new ContentPanel();
    panel.setShadow(true);
    panel.setHeadingText("Your Profile");

    FlowLayoutContainer container = new FlowLayoutContainer();

    container.add(new FieldLabel(username, "username"));
    container.add(new FieldLabel(displayName, "display name"));
    container.add(new FieldLabel(organization, "organization"));
    container.add(new FieldLabel(description, "about me"));
    description.setHeight(100);
    compiledTodayCount.setReadOnly(true);
    compiledTodayCount.setEnabled(false);
    container.add(new FieldLabel(compiledTodayCount, "times compiled today"));

    panel.add(container, new MarginData(10));

    panel.addButton(
        new TextButton(
            "Back",
            new SelectHandler() {
              @Override
              public void onSelect(SelectEvent event) {
                getPresenter().back();
              }
            }));
    panel.addButton(
        new TextButton(
            "Save",
            new SelectHandler() {
              @Override
              public void onSelect(SelectEvent event) {
                getPresenter().save();
              }
            }));

    driver.initialize(this);

    CenterLayoutContainer center = new CenterLayoutContainer();
    center.setWidget(panel);

    initWidget(center);
  }
Пример #2
0
  @Override
  public Widget asWidget() {
    if (cp == null) {
      ExampleResources bundle = GWT.create(ExampleResources.class);

      this.style = bundle.style();
      this.style.ensureInjected();

      cp = new ContentPanel(GWT.<ContentPanelAppearance>create(FramedPanelAppearance.class));
      cp.addStyleName("margin-10");
      cp.setPixelSize(500, 400);
      cp.getBody().getStyle().setBackgroundColor("white");
      cp.getBody().addClassName(ThemeStyles.getStyle().border());

      con = new CardLayoutContainer();
      cp.add(con);

      ToggleGroup group = new ToggleGroup();

      for (Category cat : Category.values()) {
        final ToggleButton btn = new ToggleButton(cat.desc);
        btn.setData("cat", cat);
        btn.addValueChangeHandler(
            new ValueChangeHandler<Boolean>() {

              @Override
              public void onValueChange(ValueChangeEvent<Boolean> event) {
                if (event.getValue() == true) {
                  onClick((Category) btn.getData("cat"));
                }
              }
            });

        group.add(btn);
        cp.addButton(btn);
      }

      ToggleButton normal = (ToggleButton) cp.getButtonBar().getWidget(0);
      normal.setValue(true, true);
    }
    return cp;
  }