示例#1
0
  public CommentSection(int width, int height) {
    getFormLayout().setLabelAlign(LabelAlign.TOP);

    commentField = new TextArea();
    commentField.setName("comments");
    commentField.setFieldLabel(I18N.CONSTANTS.comments());
    if (width > 0) {
      getFormLayout().setDefaultWidth(width);
      commentField.setWidth(width);
    }
    if (height > 0) {
      commentField.setHeight(height);
    }
    add(commentField);
  }
  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);
  }