Beispiel #1
0
  private FieldSet wrapField(
      final Field field, final MetaField metaField, final LayoutContainer container) {
    FieldSet fs = new FieldSet();
    fs.setLayout(new FitLayout());
    fs.setHeading(metaField.getLabel());
    fs.setCheckboxToggle(true);
    fs.addListener(
        Events.Expand,
        new Listener<BaseEvent>() {
          public void handleEvent(BaseEvent be) {
            enabledFields.put(metaField.getName(), field);
          }
        });
    fs.addListener(
        Events.Collapse,
        new Listener<BaseEvent>() {
          public void handleEvent(BaseEvent be) {
            enabledFields.remove(metaField.getName());
          }
        });
    fs.add(field);
    fs.setExpanded(false);

    return fs;
  }
  private void initialize() {
    FieldSet responseFieldSet = new FieldSet();
    responseFieldSet.setHeading("District Comparisons");
    responseFieldSet.setCheckboxToggle(false);

    FormLayout layout = new FormLayout();
    layout.setLabelWidth(75);
    responseFieldSet.setLayout(layout);

    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    //		configs.add(new ColumnConfig("district", "District", 100));
    configs.add(new ColumnConfig("subcounty", "Subcounty", 200));
    configs.add(new ColumnConfig("bh", "Boreholes", 200));
    configs.add(new ColumnConfig("sw", "Shallow Wells", 200));
    configs.add(new ColumnConfig("yt", "Public Taps", 100));
    configs.add(new ColumnConfig("ps", "Protected Springs", 100));
    configs.add(new ColumnConfig("total", "Total", 100));
    store = new ListStore<DistrictComparisonSummary>();
    cm = new ColumnModel(configs);
    setBodyBorder(true);
    setHeading("District Comparisons");
    setButtonAlign(HorizontalAlignment.CENTER);
    setLayout(new FitLayout());
    setSize(600, 300);
    grid = new Grid<DistrictComparisonSummary>(store, cm);
    grid.setStyleAttribute("borderTop", "none");
    grid.setAutoWidth(true);
    grid.setBorders(false);
    grid.setStripeRows(true);
    grid.setColumnLines(true);
    grid.setColumnReordering(true);
    grid.addListener(
        Events.RowDoubleClick,
        new Listener<GridEvent<BeanModel>>() {

          @Override
          public void handleEvent(GridEvent<BeanModel> be) {
            DistrictComparisonSummary summary = grid.getSelectionModel().getSelectedItem();
          }
        });
    grid.getAriaSupport().setLabelledBy(getHeader().getId() + "-label");
    responseFieldSet.add(grid);
    add(grid);
    setLayout(new FitLayout());
  }
Beispiel #3
0
  private FieldSet setupIdentifierfieldSet(int widthPanel, int tabIndex) {
    FieldSet identifierfieldSet = new FieldSet();
    identifierfieldSet.setHeading("Identifiers");
    identifierfieldSet.setCollapsible(true);
    identifierfieldSet.setBorders(false);
    FormLayout identifierlayout = new FormLayout();
    identifierlayout.setLabelWidth(150);
    identifierlayout.setDefaultWidth(390); // It is the real function to set the textField width
    identifierfieldSet.setLayout(identifierlayout);

    ContentPanel cp = new ContentPanel();
    cp.setHeaderVisible(false);
    cp.setWidth(widthPanel);
    cp.add(setupIdentifierGrid(identifierStore, widthPanel - 33, tabIndex));

    identifierfieldSet.add(cp);

    return identifierfieldSet;
  }
  private LayoutContainer getChart() {
    FieldSet fs = new FieldSet();
    fs.setHeading("Chart");
    fs.setLayout(new FitLayout());

    String url = !Examples.isExplorer() ? "../../" : "";
    url += "gxt/chart/open-flash-chart.swf";

    final Chart chart = new Chart(url);
    chart.setBorders(true);
    fs.add(chart, new FitData(0, 0, 20, 0));
    updateCmd =
        new Command() {
          public void execute() {
            chart.setChartModel(example.getChartModel(numSegments));
          }
        };

    adjustUpdateSpeed(updateSpeed);
    return fs;
  }
  private TabItem createRegisterTab() {
    TabItem tabItem = new TabItem("Register");

    FormPanel form = new FormPanel();
    form.setFrame(false);
    form.setHeading("Create a new account.");
    form.setWidth(350);
    form.setLayout(new FlowLayout());

    FieldSet fieldSet = new FieldSet();

    FormLayout layout = new FormLayout();
    layout.setLabelWidth(75);
    fieldSet.setLayout(layout);

    final TextField<String> nameField = new TextField<String>();
    nameField.setFieldLabel("Name");
    fieldSet.add(nameField);

    final TextField<String> passField = new TextField<String>();
    passField.setPassword(true);
    passField.setFieldLabel("Password");
    fieldSet.add(passField);

    final TextField<String> emailField = new TextField<String>();
    emailField.setFieldLabel("Email");
    fieldSet.add(emailField);

    form.add(fieldSet);
    form.setButtonAlign(HorizontalAlignment.CENTER);
    Button registerButton = new Button("Register");
    form.addButton(registerButton);

    registerButton.addListener(
        Events.Select,
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            String name = nameField.getValue();
            String pass = passField.getValue();
            String email = emailField.getValue();

            if (name == null || pass == null || email == null) {
              Info.display(
                  "Incorrect register data", "Name, password and email must not be empty!");
              return;
            }

            userService.register(
                name,
                pass,
                email,
                new AsyncCallback<UserLoginRegisterResponse>() {
                  // @Override
                  public void onFailure(Throwable caught) {
                    Info.display("Error while registering account!", caught.getMessage());
                  }
                  // @Override
                  public void onSuccess(UserLoginRegisterResponse result) {
                    if (!result.isSuccess()) {
                      Info.display("The account not registered!", result.getMessage());
                    } else {
                      User user = result.getUser();
                      Info.display(
                          "Registered :)",
                          "Registered successfuly. You've been automaticly logged in as "
                              + user.getName()
                              + " level: "
                              + user.getUserType());
                      hide();
                      tabs.init(user);
                    }
                  }
                });
          }
        });

    tabItem.add(form);
    return tabItem;
  }
  private TabItem createLoginTab() {
    TabItem tabItem = new TabItem("Login");

    FormPanel form = new FormPanel();
    form.setHeading("Login using existing user.");
    form.setWidth(350);
    form.setLayout(new FlowLayout());

    FieldSet fieldSet = new FieldSet();

    FormLayout layout = new FormLayout();
    layout.setLabelWidth(75);
    fieldSet.setLayout(layout);

    final TextField<String> fieldName = new TextField<String>();
    fieldName.setFieldLabel("Name");
    fieldSet.add(fieldName);

    final TextField<String> fieldPassword = new TextField<String>();
    fieldPassword.setPassword(true);
    fieldPassword.setFieldLabel("Password");
    fieldSet.add(fieldPassword);

    form.add(fieldSet);
    form.setButtonAlign(HorizontalAlignment.CENTER);
    Button loginButton = new Button("Login");
    form.addButton(loginButton);

    loginButton.addListener(
        Events.Select,
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            final String name = fieldName.getValue();
            String pass = fieldPassword.getValue();

            if (name == null || pass == null) {
              Info.display("Loggin in Error!", "Name or password is empty!");
              return;
            }

            // Sprawdza usera
            userService.login(
                name,
                pass,
                new AsyncCallback<UserLoginRegisterResponse>() {
                  public void onSuccess(UserLoginRegisterResponse result) {
                    if (!result.isSuccess()) {
                      Info.display("Couldn't log in", result.getMessage());
                    } else {
                      User user = result.getUser();
                      Info.display(
                          "Logged in",
                          "Logged in successfuly as "
                              + user.getName()
                              + " level: "
                              + user.getUserType());
                      hide();
                      tabs.init(user);
                    }
                  }

                  public void onFailure(Throwable caught) {
                    Info.display("Error while loggin in.", caught.getMessage());
                  };
                });
          }
        });
    tabItem.add(form);
    return tabItem;
  }
Beispiel #7
0
  private FormPanel setupUserRightForm(String title, int tabIndex) {

    FormPanel formPanel = new FormPanel();
    formPanel.setTitle(title);
    formPanel.setHeaderVisible(false);
    formPanel.setBodyBorder(false);
    formPanel.setWidth(400);
    //	    formPanel.setLabelAlign(LabelAlign.RIGHT); // default is LEFT
    formPanel.setLabelWidth(150);

    // Address fields
    FieldSet addressfieldSet = new FieldSet();
    addressfieldSet.setHeading("Address");
    addressfieldSet.setCollapsible(true);
    addressfieldSet.setBorders(false);
    FormLayout addresslayout = new FormLayout();
    addresslayout.setLabelWidth(150);
    addressfieldSet.setLayout(addresslayout);

    address = new TextField<String>();
    address.setFieldLabel("Address");
    address.setTabIndex(tabIndex++);

    city = new TextField<String>();
    city.setFieldLabel("City");
    city.setAllowBlank(false);
    city.setTabIndex(tabIndex++);

    state = new ComboBox<State>();
    state.setFieldLabel("State");
    state.setEmptyText("Select a state...");
    state.setDisplayField("name");
    state.setWidth(150);
    state.setStore(states);
    state.setTypeAhead(true);
    state.setTriggerAction(TriggerAction.ALL);
    state.setTabIndex(tabIndex++);

    zip = new TextField<String>();
    zip.setFieldLabel("Zip Code");
    zip.setAllowBlank(false);
    zip.setTabIndex(tabIndex++);

    country = new ComboBox<Country>();
    country.setFieldLabel("Country");
    country.setEmptyText("Select a country...");
    country.setDisplayField("name");
    country.setTemplate(InputFormat.getFlagTemplate());
    country.setWidth(100);
    country.setStore(countries);
    country.setTypeAhead(true);
    country.setTriggerAction(TriggerAction.ALL);
    country.setTabIndex(tabIndex++);

    addressfieldSet.add(address);
    addressfieldSet.add(city);
    addressfieldSet.add(state);
    addressfieldSet.add(zip);
    addressfieldSet.add(country);

    FieldSet otherfieldSet = new FieldSet();
    otherfieldSet.setHeading("Other");
    otherfieldSet.setCollapsible(true);
    otherfieldSet.setBorders(false);
    FormLayout otherlayout = new FormLayout();
    otherlayout.setLabelWidth(150);
    otherfieldSet.setLayout(otherlayout);

    phoneNumber = new TextField<String>();
    phoneNumber.setFieldLabel("Phone Number");
    phoneNumber.setToolTip("xxx-xxxx");
    phoneNumber.setTabIndex(tabIndex++);

    email = new TextField<String>();
    email.setFieldLabel("Email");
    email.setAllowBlank(false);
    email.setRegex(InputFormat.EMAIL_FORMATS);
    email.getMessages().setRegexText("Invalid email format");
    //		    email.setAutoValidate(true);
    email.setToolTip("*****@*****.**");
    email.setTabIndex(tabIndex++);

    emailConfirm = new TextField<String>();
    emailConfirm.setFieldLabel("Confirm Email");
    emailConfirm.setRegex(InputFormat.EMAIL_FORMATS);
    emailConfirm.getMessages().setRegexText("Invalid email format");
    //		    email.setAutoValidate(true);
    emailConfirm.setToolTip("*****@*****.**");
    emailConfirm.setTabIndex(tabIndex++);

    webSite = new TextField<String>();
    webSite.setFieldLabel("Website");
    webSite.setTabIndex(tabIndex++);

    otherfieldSet.add(phoneNumber);
    otherfieldSet.add(email);
    otherfieldSet.add(emailConfirm);
    otherfieldSet.add(webSite);

    formPanel.add(addressfieldSet);
    formPanel.add(otherfieldSet);

    return formPanel;
  }
Beispiel #8
0
  private FormPanel setupUserLeftForm(String title, int tabIndex) {

    FormPanel formPanel = new FormPanel();
    formPanel.setTitle(title);
    formPanel.setHeaderVisible(false);
    formPanel.setBodyBorder(false);
    formPanel.setWidth(400);
    //	    formPanel.setLabelAlign(LabelAlign.TOP); // default is LEFT
    formPanel.setLabelWidth(150);

    // Name fields
    FieldSet namefieldSet = new FieldSet();
    namefieldSet.setHeading("Username");
    namefieldSet.setCollapsible(true);
    namefieldSet.setBorders(false);
    FormLayout namelayout = new FormLayout();
    namelayout.setLabelWidth(150);
    //		    namelayout.setDefaultWidth(180); // It is the real function to set the textField width.
    // Default width is 200
    namefieldSet.setLayout(namelayout);

    userName = new TextField<String>();
    userName.setFieldLabel("Username");
    userName.setAllowBlank(false);
    //              userName.setReadOnly(true);
    userName.disable();
    userName.setTabIndex(tabIndex++);

    namefieldSet.add(userName);

    // Password fields
    FieldSet passwordfieldSet = new FieldSet();
    passwordfieldSet.setHeading("Password");
    passwordfieldSet.setCollapsible(true);
    passwordfieldSet.setBorders(false);
    FormLayout passwordlayout = new FormLayout();
    passwordlayout.setLabelWidth(150);
    passwordfieldSet.setLayout(passwordlayout);

    password = new TextField<String>();
    password.setFieldLabel("Current Password");
    password.setAllowBlank(false);
    password.setPassword(true);
    password.setTabIndex(tabIndex++);

    passwordNew = new TextField<String>();
    passwordNew.setFieldLabel("New Password");
    passwordNew.setPassword(true);
    passwordNew.setTabIndex(tabIndex++);

    passwordConfirm = new TextField<String>();
    passwordConfirm.setFieldLabel("Confirm Password");
    passwordConfirm.setPassword(true);
    passwordConfirm.setTabIndex(tabIndex++);

    passwordHint = new TextField<String>();
    passwordHint.setFieldLabel("Password Hint");
    passwordHint.setTabIndex(tabIndex++);

    passwordfieldSet.add(password);
    passwordfieldSet.add(passwordNew);
    passwordfieldSet.add(passwordConfirm);
    passwordfieldSet.add(passwordHint);

    FieldSet userInfofieldSet = new FieldSet();
    userInfofieldSet.setHeading("User Info");
    userInfofieldSet.setCollapsible(true);
    userInfofieldSet.setBorders(false);
    FormLayout userInfolayout = new FormLayout();
    userInfolayout.setLabelWidth(150);
    userInfofieldSet.setLayout(userInfolayout);

    firstName = new TextField<String>();
    firstName.setFieldLabel("First Name");
    firstName.setAllowBlank(false);
    // firstName.setLabelStyle("font-size:12px; margin-left: 20px");
    firstName.setTabIndex(tabIndex++);

    lastName = new TextField<String>();
    lastName.setFieldLabel("Last Name");
    lastName.setAllowBlank(false);
    lastName.setTabIndex(tabIndex++);

    userInfofieldSet.add(firstName);
    userInfofieldSet.add(lastName);

    formPanel.add(namefieldSet);
    formPanel.add(passwordfieldSet);
    formPanel.add(userInfofieldSet);

    return formPanel;
  }
  protected void onRender(Element parent, int index) {
    super.onRender(parent, index);
    setLayout(new FitLayout());
    setId("network-dhcp-nat");
    FormData formData = new FormData();
    formData.setWidth(250);

    m_formPanel = new FormPanel();
    m_formPanel.setFrame(false);
    m_formPanel.setBodyBorder(false);
    m_formPanel.setHeaderVisible(false);
    m_formPanel.setLayout(new FlowLayout());
    m_formPanel.setStyleAttribute("min-width", "775px");
    m_formPanel.setStyleAttribute("padding-left", "30px");

    FieldSet fieldSet = new FieldSet();
    FormLayout layoutAccount = new FormLayout();
    layoutAccount.setLabelWidth(Constants.LABEL_WIDTH_FORM);
    fieldSet.setLayout(layoutAccount);
    fieldSet.setBorders(false);

    //
    // Tool Tip Box
    //
    toolTipField.setText(defaultToolTip);
    fieldSet.add(toolTipField);

    //
    // Router Mode
    //
    m_modeCombo = new SimpleComboBox<String>();
    m_modeCombo.setName("comboMode");
    m_modeCombo.setFieldLabel(MSGS.netRouterMode());
    m_modeCombo.setEditable(false);
    m_modeCombo.setTypeAhead(true);
    m_modeCombo.setTriggerAction(TriggerAction.ALL);
    for (GwtNetRouterMode mode : GwtNetRouterMode.values()) {
      m_modeCombo.add(MessageUtils.get(mode.name()));
    }
    m_modeCombo.setSimpleValue(MessageUtils.get(GwtNetRouterMode.netRouterDchpNat.name()));
    m_modeCombo.setValidator(
        new Validator() {
          public String validate(Field<?> field, String value) {
            if (m_tcpIpConfigTab.isDhcp()
                && !value.equals(MessageUtils.get(GwtNetRouterMode.netRouterOff.toString()))) {
              return MSGS.netRouterConfiguredForDhcpError();
            }

            return null;
          }
        });
    m_modeCombo.addSelectionChangedListener(
        new SelectionChangedListener<SimpleComboValue<String>>() {
          @Override
          public void selectionChanged(SelectionChangedEvent<SimpleComboValue<String>> se) {
            refreshForm();
          }
        });
    m_modeCombo.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipMode()));
    m_modeCombo.addStyleName("kura-combobox");
    m_modeCombo.addPlugin(m_dirtyPlugin);
    fieldSet.add(m_modeCombo, formData);

    //
    // DHCP Beginning Address
    //
    m_dhcpBeginAddressField = new TextField<String>();
    m_dhcpBeginAddressField.setAllowBlank(true);
    m_dhcpBeginAddressField.setName("dhcpBeginAddress");
    m_dhcpBeginAddressField.setFieldLabel(MSGS.netRouterDhcpBeginningAddress());
    m_dhcpBeginAddressField.setRegex(IPV4_REGEX);
    m_dhcpBeginAddressField.getMessages().setRegexText(MSGS.netIPv4InvalidAddress());
    m_dhcpBeginAddressField.addPlugin(m_dirtyPlugin);
    m_dhcpBeginAddressField.setStyleAttribute("margin-top", Constants.LABEL_MARGIN_TOP_SEPARATOR);
    m_dhcpBeginAddressField.addStyleName("kura-textfield");
    m_dhcpBeginAddressField.addListener(
        Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipDhcpBeginAddr()));
    fieldSet.add(m_dhcpBeginAddressField, formData);

    //
    // DHCP Ending Address
    //
    m_dhcpEndAddressField = new TextField<String>();
    m_dhcpEndAddressField.setAllowBlank(true);
    m_dhcpEndAddressField.setName("dhcpEndAddress");
    m_dhcpEndAddressField.setFieldLabel(MSGS.netRouterDhcpEndingAddress());
    m_dhcpEndAddressField.setRegex(IPV4_REGEX);
    m_dhcpEndAddressField.getMessages().setRegexText(MSGS.netIPv4InvalidAddress());
    m_dhcpEndAddressField.addListener(
        Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipDhcpEndAddr()));
    m_dhcpEndAddressField.addStyleName("kura-textfield");
    ;
    m_dhcpEndAddressField.addPlugin(m_dirtyPlugin);
    fieldSet.add(m_dhcpEndAddressField, formData);

    //
    // DHCP Subnet Mask
    //
    m_dhcpSubnetMaskField = new TextField<String>();
    m_dhcpSubnetMaskField.setAllowBlank(true);
    m_dhcpSubnetMaskField.setName("dhcpSubnetMask");
    m_dhcpSubnetMaskField.setFieldLabel(MSGS.netRouterDhcpSubnetMask());
    m_dhcpSubnetMaskField.setRegex(IPV4_REGEX);
    m_dhcpSubnetMaskField.addListener(
        Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipDhcpSubnet()));
    m_dhcpSubnetMaskField.getMessages().setRegexText(MSGS.netIPv4InvalidAddress());
    m_dhcpSubnetMaskField.addStyleName("kura-textfield");
    m_dhcpSubnetMaskField.addPlugin(m_dirtyPlugin);
    fieldSet.add(m_dhcpSubnetMaskField, formData);

    //
    // DHCP Default Lease
    //
    m_dhcpLeaseDefaultField = new NumberField();
    m_dhcpLeaseDefaultField.setPropertyEditorType(Integer.class);
    m_dhcpLeaseDefaultField.setAllowDecimals(false);
    m_dhcpLeaseDefaultField.setAllowNegative(false);
    m_dhcpLeaseDefaultField.setMaxValue(Integer.MAX_VALUE);
    m_dhcpLeaseDefaultField.setAllowBlank(true);
    m_dhcpLeaseDefaultField.setName("dhcpDefaultLease");
    m_dhcpLeaseDefaultField.setFieldLabel(MSGS.netRouterDhcpDefaultLease());
    m_dhcpLeaseDefaultField.addListener(
        Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipDhcpDefaultLeaseTime()));
    m_dhcpLeaseDefaultField.addPlugin(m_dirtyPlugin);
    fieldSet.add(m_dhcpLeaseDefaultField, formData);

    //
    // DHCP Max Lease
    //
    m_dhcpLeaseMaxField = new NumberField();
    m_dhcpLeaseMaxField.setPropertyEditorType(Integer.class);
    m_dhcpLeaseMaxField.setAllowDecimals(false);
    m_dhcpLeaseMaxField.setAllowNegative(false);
    m_dhcpLeaseMaxField.setMaxValue(Integer.MAX_VALUE);
    m_dhcpLeaseMaxField.setAllowBlank(true);
    m_dhcpLeaseMaxField.setName("dhcpMaxLease");
    m_dhcpLeaseMaxField.setFieldLabel(MSGS.netRouterDhcpMaxLease());
    m_dhcpLeaseMaxField.addListener(
        Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipDhcpMaxLeaseTime()));
    m_dhcpLeaseMaxField.addPlugin(m_dirtyPlugin);
    fieldSet.add(m_dhcpLeaseMaxField, formData);

    //
    // Pass DNS
    //
    m_passDnsRadioTrue = new Radio();
    m_passDnsRadioTrue.setBoxLabel(MSGS.trueLabel());
    m_passDnsRadioTrue.setItemId("true");

    m_passDnsRadioFalse = new Radio();
    m_passDnsRadioFalse.setBoxLabel(MSGS.falseLabel());
    m_passDnsRadioFalse.setItemId("false");

    m_passDnsRadioGroup = new RadioGroup();
    m_passDnsRadioGroup.setName("dhcpPassDns");
    m_passDnsRadioGroup.setFieldLabel(MSGS.netRouterPassDns());
    m_passDnsRadioGroup.add(m_passDnsRadioTrue);
    m_passDnsRadioGroup.add(m_passDnsRadioFalse);
    m_passDnsRadioGroup.addPlugin(m_dirtyPlugin);
    m_passDnsRadioGroup.addListener(
        Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipPassDns()));
    fieldSet.add(m_passDnsRadioGroup, formData);

    m_formPanel.add(fieldSet);
    add(m_formPanel);
    setScrollMode(Scroll.AUTO);
    m_initialized = true;
  }
  private LayoutContainer getDetails() {
    LayoutContainer lc = new LayoutContainer();
    VBoxLayout vLayout = new VBoxLayout();
    vLayout.setVBoxLayoutAlign(VBoxLayoutAlign.STRETCH);
    lc.setLayout(vLayout);

    FieldSet controls = new FieldSet();
    controls.setHeading("Controls");
    FormLayout fl = new FormLayout();
    fl.setLabelWidth(125);
    controls.setLayout(fl);

    Slider segments = new Slider();
    segments.setMaxValue(12);
    segments.setMinValue(1);
    segments.setIncrement(1);
    segments.setValue(numSegments);
    segments.addListener(
        Events.Change,
        new Listener<SliderEvent>() {
          public void handleEvent(SliderEvent be) {
            numSegments = be.getNewValue();
            adjustUpdateSpeed(updateSpeed);
          }
        });
    SliderField segFld = new SliderField(segments);
    segFld.setFieldLabel("Segments (#)");
    controls.add(segFld);

    final Slider update =
        new Slider() {
          @Override
          protected String onFormatValue(int value) {
            if (value == 0) return "Off";
            return super.onFormatValue(value);
          }
        };
    update.setMinValue(0);
    update.setMaxValue(3000);
    update.setIncrement(100);
    update.setValue(updateSpeed);
    update.setMessage("{0}ms");
    update.addListener(
        Events.Change,
        new Listener<SliderEvent>() {
          public void handleEvent(SliderEvent se) {
            adjustUpdateSpeed(se.getNewValue());
          }
        });
    SliderField updFld = new SliderField(update);
    updFld.setFieldLabel("Update Interval (ms)");
    controls.add(updFld);

    lc.add(controls);

    FieldSet gallery = new FieldSet();
    gallery.setHeading("Gallery");
    gallery.setLayout(new FitLayout());

    ListStore<GalleryChartModel> store = new ListStore<GalleryChartModel>();
    store.add(new GalleryChartModel("Area", "area.gif", new AreaChartExample()));
    store.add(new GalleryChartModel("Pie", "pie.gif", new PieChartExample()));
    store.add(new GalleryChartModel("Filled Bar", "filled.gif", new FilledBarChartExample()));
    store.add(new GalleryChartModel("Bar - Glass", "barglass.gif", new BarGlassChartExample()));
    store.add(new GalleryChartModel("Bar - 3D", "bar3d.gif", new Bar3DChartExample()));
    store.add(new GalleryChartModel("Radar", "radar.gif", new RadarChartExample()));
    store.add(
        new GalleryChartModel("Horizontal Bar", "horizontalbar.gif", new HorizontalChartExample()));
    store.add(new GalleryChartModel("Cylinder", "cylinder.gif", new CylinderChartExample()));
    store.add(new GalleryChartModel("Sketch Bar", "sketchbar.gif", new SketchChartExample()));

    ListView<GalleryChartModel> view =
        new ListView<GalleryChartModel>() {
          @Override
          protected GalleryChartModel prepareData(GalleryChartModel model) {
            String s = model.get("name");
            model.set("shortName", Format.ellipse(s, 15));
            return model;
          }
        };
    view.setId("img-chooser-view");
    view.setTemplate(getTemplate(!Examples.isExplorer() ? "../../" : ""));
    view.setStore(store);
    view.setItemSelector("div.thumb-wrap");
    view.getSelectionModel().select(0, false);
    view.getSelectionModel()
        .addListener(
            Events.SelectionChange,
            new Listener<SelectionChangedEvent<GalleryChartModel>>() {

              public void handleEvent(SelectionChangedEvent<GalleryChartModel> be) {
                example = be.getSelectedItem().getExample();
                adjustUpdateSpeed(updateSpeed);
              }
            });
    gallery.add(view, new FitData(0, 0, 20, 0));

    VBoxLayoutData vFlex = new VBoxLayoutData();
    vFlex.setFlex(1);
    lc.add(gallery, vFlex);
    return lc;
  }