/**
   * Creates new component design panel for visible components.
   *
   * @param nonVisibleComponentsPanel corresponding panel for non-visible components
   */
  public SimpleVisibleComponentsPanel(
      final SimpleEditor editor, SimpleNonVisibleComponentsPanel nonVisibleComponentsPanel) {
    this.nonVisibleComponentsPanel = nonVisibleComponentsPanel;
    projectEditor = editor.getProjectEditor();

    // Initialize UI
    phoneScreen = new VerticalPanel();
    phoneScreen.setStylePrimaryName("ode-SimpleFormDesigner");

    checkboxShowHiddenComponents =
        new CheckBox(MESSAGES.showHiddenComponentsCheckbox()) {
          @Override
          protected void onLoad() {
            // onLoad is called immediately after a widget becomes attached to the browser's
            // document.
            boolean showHiddenComponents =
                Boolean.parseBoolean(
                    projectEditor.getProjectSettingsProperty(
                        SettingsConstants.PROJECT_YOUNG_ANDROID_SETTINGS,
                        SettingsConstants.YOUNG_ANDROID_SETTINGS_SHOW_HIDDEN_COMPONENTS));
            checkboxShowHiddenComponents.setValue(showHiddenComponents);
          }
        };
    checkboxShowHiddenComponents.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {
          @Override
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            boolean isChecked = event.getValue(); // auto-unbox from Boolean to boolean
            projectEditor.changeProjectSettingsProperty(
                SettingsConstants.PROJECT_YOUNG_ANDROID_SETTINGS,
                SettingsConstants.YOUNG_ANDROID_SETTINGS_SHOW_HIDDEN_COMPONENTS,
                isChecked ? "True" : "False");
            if (form != null) {
              form.refresh();
            }
          }
        });
    phoneScreen.add(checkboxShowHiddenComponents);

    initWidget(phoneScreen);
  }
 public static void main(String[] args) {
   SimpleEditor editor = new SimpleEditor();
   editor.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   editor.setVisible(true);
 }
Ejemplo n.º 3
0
  public static void main(String[] args) {

    SimpleEditor.main(args);
  }