private SimpleComboBox<String> getVoComboBox() {
    if (voComboBox == null) {
      voComboBox = new SimpleComboBox<String>();
      voComboBox.setAllowBlank(false);
      voComboBox.setForceSelection(true);
      voComboBox.setEditable(false);
      voComboBox.setFieldLabel("Submit as");
      voComboBox.addListener(
          Events.Valid,
          new Listener<BaseEvent>() {

            public void handleEvent(BaseEvent be) {

              //					xxx

              fillVersionsComboBox();
              String fqan = voComboBox.getSimpleValue();
              if (fqan != null && !"".equals(fqan)) {
                UserEnvironment.getInstance().setUserProperty(Constants.DEFAULT_FQAN, fqan);
              }
            }
          });

      String lastFqan = UserEnvironment.getInstance().getUserProperty(Constants.DEFAULT_FQAN);
      boolean useLastFqan = false;
      String firstValue = null;
      for (String vo : UserEnvironment.getInstance().getAllFqans()) {

        // I know, I know.
        if ("/ARCS".equals(vo)) {
          continue;
        }
        if (firstValue == null) {
          firstValue = vo;
        }
        if (vo.equals(lastFqan)) {
          useLastFqan = true;
        }
        voComboBox.add(vo);
      }

      //			if (useLastFqan) {
      //				voComboBox.setSimpleValue(lastFqan);
      //			} else {
      //				voComboBox.setSimpleValue(firstValue);
      //			}
    }
    return voComboBox;
  }
  // ******************************************************
  // Method: getPanel
  //
  // ******************************************************
  private FormPanel getPanel() {
    FormLayout formLayout = new FormLayout(LabelAlign.LEFT);
    formLayout.setLabelWidth(160);

    FormPanel formPanel = new FormPanel();
    formPanel.setHeight(350);
    formPanel.setLayout(formLayout);
    formPanel.setPadding(10);
    formPanel.setFrame(false);
    formPanel.setBorders(false);
    formPanel.setBodyBorder(false);
    formPanel.setHeaderVisible(false);

    FormData formData = new FormData("95%");

    availableJndiNamesComboBox = new SimpleComboBox<String>();
    availableJndiNamesComboBox.add("FIT_DATA_TEST");
    availableJndiNamesComboBox.add("FIT_SOURCE_TEST");
    availableJndiNamesComboBox.add("FIT_CONFIG_TEST");
    availableJndiNamesComboBox.setAllowBlank(false);
    availableJndiNamesComboBox.setForceSelection(true);
    availableJndiNamesComboBox.setEditable(false);
    availableJndiNamesComboBox.setTriggerAction(TriggerAction.ALL);
    availableJndiNamesComboBox.setFieldLabel("Source JNDI*");
    availableJndiNamesComboBox.setSimpleValue("FIT_CONFIG_TEST");
    formPanel.add(availableJndiNamesComboBox, formData);

    sourceSqlQueryTextArea = new TextArea();
    sourceSqlQueryTextArea.setFieldLabel("Sql Query*");
    sourceSqlQueryTextArea.setAllowBlank(false);
    formPanel.add(sourceSqlQueryTextArea, new FormData(314, 200));

    setupRulesCheckBox = new CheckBox();
    setupRulesCheckBox.setFieldLabel("Setup Rules?");
    setupRulesCheckBox.setBoxLabel("");
    formPanel.add(setupRulesCheckBox, formData);
    return formPanel;
  }
Example #3
0
  @Override
  protected void onRender(Element parent, int index) {
    super.onRender(parent, index);

    final Stock stock = TestData.getStocks().get(0);

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

    StringBuffer sb = new StringBuffer();
    sb.append("<div class=text style='line-height: 1.5em'>");
    sb.append("<b>Name:</b> {name}<br>");
    sb.append("<b>Symbol:</b> {symbol}<br>");
    sb.append("<b>Last:</b> {last}<br>");
    sb.append("<b>Change:</b> {[new Number(values.change).toFixed(2)]}<br>");
    sb.append("<b>Updated:</b> {date:date(\"MM/dd/y\")}<br>");
    sb.append("</div>");

    final XTemplate template = XTemplate.create(sb.toString());
    final HTML html = new HTML();
    html.setWidth("160px");
    template.overwrite(html.getElement(), Util.getJsObject(stock));
    hp.add(html);
    // update template when model changes
    stock.addChangeListener(
        new ChangeListener() {
          public void modelChanged(ChangeEvent event) {
            template.overwrite(html.getElement(), Util.getJsObject(stock));
          }
        });

    FormPanel panel = new FormPanel();
    panel.setHeaderVisible(false);
    panel.setWidth(350);

    TextField<String> name = new TextField<String>();
    name.setName("nameField");
    name.setFieldLabel("Name");
    panel.add(name);

    TextField<String> symbol = new TextField<String>();
    symbol.setName("symbol");
    symbol.setFieldLabel("Symbol");
    panel.add(symbol);

    NumberField open = new NumberField();
    open.setName("last");
    open.setFieldLabel("Last");
    panel.add(open);

    NumberField change = new NumberField();
    change.setName("change");
    change.setFieldLabel("Change");
    change.setFormat(NumberFormat.getDecimalFormat());
    panel.add(change);

    DateField last = new DateField();
    last.setName("date");
    last.setFieldLabel("Updated");
    panel.add(last);

    SimpleComboBox<String> scb = new SimpleComboBox<String>();
    for (Stock s : TestData.getStocks()) {
      scb.add(s.getName());
    }
    scb.setFieldLabel("Name");
    scb.setForceSelection(true);
    scb.setTypeAhead(true);
    scb.setName("company");
    scb.setTriggerAction(TriggerAction.ALL);
    panel.add(scb);

    hp.add(panel);

    FormBinding binding = new FormBinding(panel);
    // manually add bindings
    binding.addFieldBinding(new FieldBinding(name, "name"));
    binding.addFieldBinding(new FieldBinding(symbol, "symbol"));
    binding.addFieldBinding(new SimpleComboBoxFieldBinding(scb, "name"));

    // auto bind remaining fields, field name must match model property name
    binding.autoBind();
    binding.bind(stock);

    add(hp);
  }
  public RightPropertiesPanel() {

    setHeading(Constants.MENU_PROPS);
    setLayout(new FitLayout());

    ToolBar toolBarSelection = new ToolBar();
    LabelToolItem labelComponents = new LabelToolItem("Component:   ");
    toolBarSelection.add(labelComponents);
    labelComponents.setVisible(true);
    setTopComponent(toolBarSelection);

    listComponents = new SimpleComboBox<String>();
    updateFileList("Folders", listComponents);
    listComponents.add(Constants.COMPONENT_SPMANAGERWEB_NAME);
    listComponents.add("Test");
    listComponents.setForceSelection(true);
    listComponents.setEditable(false);
    listComponents.setTriggerAction(ComboBox.TriggerAction.ALL);
    listComponents.setEmptyText("- Choose a component -");
    listComponents.setFieldLabel("Component");
    listComponents.setWidth(200);
    toolBarSelection.add(listComponents);

    listComponents.addSelectionChangedListener(
        new SelectionChangedListener() {

          @Override
          public void selectionChanged(SelectionChangedEvent se) {
            selectedComponent = listComponents.getSimpleValue();
            output.setEmptyText(
                "Select a component and configuration file to display and press \"Load\"");
            updateFileList(selectedComponent, listFiles);
          }
        });

    LabelToolItem labelFiles = new LabelToolItem("    File:   ");
    toolBarSelection.add(labelFiles);
    labelFiles.setVisible(true);

    listFiles = new SimpleComboBox<String>();
    listFiles.setForceSelection(true);
    listFiles.setEditable(false);
    listFiles.setTriggerAction(ComboBox.TriggerAction.ALL);
    listFiles.setEmptyText("-Choose a file-");
    listFiles.setFieldLabel("File");
    listFiles.setAutoWidth(false);
    listFiles.setWidth(250);
    toolBarSelection.add(listFiles);

    listFiles.addSelectionChangedListener(
        new SelectionChangedListener() {

          @Override
          public void selectionChanged(SelectionChangedEvent se) {
            output.setEmptyText(
                "Select a component and configuration file to display and press \"Load\"");
            output.clear();
          }
        });

    Button loadButton = new Button("Load");
    toolBarSelection.add(loadButton);

    loadButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(ButtonEvent ce) {
            updateFileContent();
          }
        });

    currentOutput = "Select a component and configuration file to display and press \"Load\"";
    output = new TextArea();
    output.addStyleName("demo-TextArea");
    output.setWidth("800px");
    output.setHeight("400px");
    output.setReadOnly(true);
    output.setEmptyText("Select a component and configuration file to display and press \"Load\"");
    output.setVisible(true);
    add(output);
  }