Example #1
0
  public TaskEditDialog(
      DScrumServiceAsync service,
      ContentPanel center,
      ContentPanel west,
      ContentPanel east,
      ContentPanel north,
      ContentPanel south,
      TaskDTO taskDTO,
      AcceptEditTasksDialog aetd) {
    this.service = service;
    this.center = center;
    this.west = west;
    this.east = east;
    this.north = north;
    this.south = south;
    this.taskDTO = taskDTO;
    this.aetd = aetd;

    // Layout
    setBodyBorder(false);
    setHeadingText("Edit task");

    setWidth(350);
    setHeight(350);
    setHideOnButtonClick(true);

    ClearPanels();

    FlowLayoutContainer layout = new FlowLayoutContainer();
    add(layout);
    TaskEditForm tef =
        new TaskEditForm(this.service, this.center, this.west, this.east, this.taskDTO);
    layout.add(tef.asWidget());
    aetd.disable();
  }
Example #2
0
  private FlowLayoutContainer createButtons(Category cat) {
    VerticalPanel vp = new VerticalPanel();
    vp.setSpacing(10);
    vp.setWidth("400px");

    for (Type type : Type.values()) {
      vp.add(format(type.getText()));

      HorizontalPanel hp = new HorizontalPanel();
      hp.setSpacing(5);

      CellButtonBase<?> small = createButton(cat, type);
      CellButtonBase<?> medium = createButton(cat, type);
      CellButtonBase<?> large = createButton(cat, type);

      configureButton(small, type, ButtonScale.SMALL);
      configureButton(medium, type, ButtonScale.MEDIUM);
      configureButton(large, type, ButtonScale.LARGE);

      hp.add(small);
      hp.add(medium);
      hp.add(large);

      vp.add(hp);
    }

    FlowLayoutContainer f = new FlowLayoutContainer();
    f.getScrollSupport().setScrollMode(ScrollMode.AUTO);
    f.add(vp);

    con.add(f);

    return f;
  }
Example #3
0
 private void addAutoSizeContent(FlowLayoutContainer flc) {
   int widgetCount = flc.getWidgetCount();
   StringBuilder s = new StringBuilder(widgetCount);
   for (int i = 0; i < widgetCount; i++) {
     s.append(" *");
   }
   flc.add(new HTML(new Date().toString() + s));
 }
  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);
  }
Example #5
0
  @Override
  public Widget asWidget() {
    if (buttons == null) {
      // Simple
      final Dialog simple = new Dialog();
      simple.setHeadingText("Dialog Test");
      simple.setPredefinedButtons(PredefinedButton.YES, PredefinedButton.NO);
      simple.setBodyStyleName("pad-text");
      simple.add(new Label(TestData.DUMMY_TEXT_SHORT));
      simple.getBody().addClassName("pad-text");
      simple.setHideOnButtonClick(true);
      simple.setWidth(300);

      // Layout
      final Dialog complex = new Dialog();
      complex.setBodyBorder(false);
      complex.getHeader().setIcon(Resources.IMAGES.side_list());
      complex.setHeadingText("BorderLayout Dialog");
      complex.setWidth(400);
      complex.setHeight(225);
      complex.setHideOnButtonClick(true);

      BorderLayoutContainer layout = new BorderLayoutContainer();
      complex.add(layout);

      // Layout - west
      ContentPanel panel = new ContentPanel();
      panel.setHeadingText("West");
      BorderLayoutData data = new BorderLayoutData(150);
      data.setMargins(new Margins(0, 5, 0, 0));
      panel.setLayoutData(data);
      layout.setWestWidget(panel);

      // Layout - center
      panel = new ContentPanel();
      panel.setHeadingText("Center");
      layout.setCenterWidget(panel);

      // Auto Size - See the JavaDoc for Window for more information on auto size
      final FlowLayoutContainer flc = new FlowLayoutContainer();
      flc.add(new HTML("Press Add or Remove to modify content"));
      final Dialog autoSize = new Dialog();
      autoSize.setBodyBorder(false);
      autoSize.setHeadingText("Auto Size Dialog");
      autoSize.setHideOnButtonClick(true);
      autoSize.setWidget(flc);
      autoSize.setPixelSize(-1, -1);
      autoSize.setMinWidth(0);
      autoSize.setMinHeight(0);
      autoSize.setResizable(false);
      autoSize.setShadow(true);
      autoSize.addButton(
          new TextButton(
              "Add",
              new SelectHandler() {
                @Override
                public void onSelect(SelectEvent event) {
                  addAutoSizeContent(flc);
                  autoSize.forceLayout();
                }
              }));
      autoSize.addButton(
          new TextButton(
              "Remove",
              new SelectHandler() {
                @Override
                public void onSelect(SelectEvent event) {
                  int lastWidget = flc.getWidgetCount() - 1;
                  if (lastWidget > 0) {
                    flc.remove(lastWidget);
                    autoSize.forceLayout();
                  }
                }
              }));

      // Buttons
      buttons = new ButtonBar();
      buttons.setWidth(400);
      buttons.getElement().setMargins(10);

      TextButton b = new TextButton("Simple");
      b.addSelectHandler(
          new SelectHandler() {
            @Override
            public void onSelect(SelectEvent event) {
              simple.show();
            }
          });
      buttons.add(b);

      b = new TextButton("Layout");
      b.addSelectHandler(
          new SelectHandler() {
            @Override
            public void onSelect(SelectEvent event) {
              complex.show();
            }
          });
      buttons.add(b);

      b = new TextButton("Auto Size");
      b.addSelectHandler(
          new SelectHandler() {
            @Override
            public void onSelect(SelectEvent event) {
              autoSize.show();
            }
          });

      buttons.add(b);

      // Add some basic content to begin with
      for (int i = 0; i < 5; i++) {
        addAutoSizeContent(flc);
      }
    }

    return buttons;
  }
  public Widget asWidget() {
    FlowLayoutContainer con = new FlowLayoutContainer();
    con.addStyleName("margin-10");

    TreeStore<BaseDto> store = new TreeStore<BaseDto>(new KeyProvider());

    FolderDto root = TestData.getMusicRootFolder();
    for (BaseDto base : root.getChildren()) {
      store.add(base);
      if (base instanceof FolderDto) {
        processFolder(store, (FolderDto) base);
      }
    }

    StoreFilterField<BaseDto> filter =
        new StoreFilterField<BaseDto>() {

          @Override
          protected boolean doSelect(
              Store<BaseDto> store, BaseDto parent, BaseDto item, String filter) {
            if (item instanceof FolderDto) {
              return false;
            }

            String name = item.getName();
            name = name.toLowerCase();
            if (name.startsWith(filter.toLowerCase())) {
              return true;
            }
            return false;
          }
        };
    filter.bind(store);

    final Tree<BaseDto, String> tree =
        new Tree<BaseDto, String>(
            store,
            new ValueProvider<BaseDto, String>() {

              @Override
              public String getValue(BaseDto object) {
                return object.getName();
              }

              @Override
              public void setValue(BaseDto object, String value) {}

              @Override
              public String getPath() {
                return "name";
              }
            });
    tree.setWidth(300);
    tree.getStyle().setLeafIcon(ExampleImages.INSTANCE.music());
    ButtonBar buttonBar = new ButtonBar();

    buttonBar.add(
        new TextButton(
            "Expand All",
            new SelectHandler() {

              @Override
              public void onSelect(SelectEvent event) {
                tree.expandAll();
              }
            }));
    buttonBar.add(
        new TextButton(
            "Collapse All",
            new SelectHandler() {
              @Override
              public void onSelect(SelectEvent event) {
                tree.collapseAll();
              }
            }));

    buttonBar.setLayoutData(new MarginData(4));
    con.add(filter);
    con.add(buttonBar);
    con.add(tree);
    return con;
  }