コード例 #1
0
  public ColumnInformationsDialog() {
    FormLayout layout = new FormLayout();
    layout.setLabelWidth(90);
    layout.setDefaultWidth(155);
    setLayout(layout);

    setButtons(Dialog.CLOSE);
    setHideOnButtonClick(true);
    setButtonAlign(HorizontalAlignment.LEFT);
    setIcon(IconHelper.create("images/folder_go.png"));
    setHeading("Column Informations");
    setModal(true);
    setBlinkModal(true);
    setBodyBorder(true);
    setBodyStyle("padding: 8px;background: none");
    setWidth(1000);
    setResizable(true);
    setMaximizable(true);

    ColumnConfig fieldNameColumn =
        new ColumnConfig(ColumnInformationWeb.FIELD_NAME, "Column Name", 130);
    ColumnConfig fieldTypeColumn =
        new ColumnConfig(ColumnInformationWeb.FIELD_TYPE, "Column Type", 70);
    ColumnConfig fieldTypeModifierColumn =
        new ColumnConfig(ColumnInformationWeb.FIELD_TYPE_MODIFIER, "Typ.Modif.", 70);
    ColumnConfig fieldMeaningColumn =
        new ColumnConfig(ColumnInformationWeb.FIELD_MEANING, "Column Meaning", 130);
    ColumnConfig fieldTransformationColumn =
        new ColumnConfig(ColumnInformationWeb.FIELD_TRANSFORMATION, "Column Transformation", 230);
    ColumnConfig bloomFilterMParameterColumn =
        new ColumnConfig(ColumnInformationWeb.BLOOM_FILTER_M_PARAMETER, "BloomF M", 60);
    ColumnConfig bloomFilterKParameterColumn =
        new ColumnConfig(ColumnInformationWeb.BLOOM_FILTER_K_PARAMETER, "BloomF K", 60);
    ColumnConfig averageFieldLengthColumn =
        new ColumnConfig(ColumnInformationWeb.AVERAGE_FIELD_LENGTH, "Avg.Col.Len.", 80);
    ColumnConfig numberOfMissingColumn =
        new ColumnConfig(ColumnInformationWeb.NUMBER_OF_MISSING, "No.Of.Missing", 80);
    List<ColumnConfig> config = new ArrayList<ColumnConfig>();
    config.add(fieldNameColumn);
    config.add(fieldTypeColumn);
    config.add(fieldTypeModifierColumn);
    config.add(fieldMeaningColumn);
    config.add(fieldTransformationColumn);
    config.add(bloomFilterMParameterColumn);
    config.add(bloomFilterKParameterColumn);
    config.add(averageFieldLengthColumn);
    config.add(numberOfMissingColumn);

    final ColumnModel cm = new ColumnModel(config);

    grid = new Grid<ColumnInformationWeb>(store, cm);
    grid.setBorders(true);
    grid.setAutoWidth(true);
    grid.setHeight(500);

    add(grid);
  }
コード例 #2
0
 private LayoutContainer getLayoutContainer_1() {
   if (layoutContainer_1 == null) {
     layoutContainer_1 = new LayoutContainer();
     FormLayout formLayout = new FormLayout();
     formLayout.setLabelAlign(LabelAlign.TOP);
     layoutContainer_1.setLayout(formLayout);
     layoutContainer_1.add(getVersionComboBox(), new FormData("100%"));
   }
   return layoutContainer_1;
 }
コード例 #3
0
 private LayoutContainer getTextAreaContainer() {
   if (textAreaContainer == null) {
     textAreaContainer = new LayoutContainer();
     FormLayout formLayout = new FormLayout();
     formLayout.setLabelAlign(LabelAlign.TOP);
     textAreaContainer.setLayout(formLayout);
     textAreaContainer.add(getCommandLineTextArea(), new FormData("-40 -35"));
   }
   return textAreaContainer;
 }
コード例 #4
0
 private LayoutContainer getLayoutContainer() {
   if (layoutContainer == null) {
     layoutContainer = new LayoutContainer();
     layoutContainer.setWidth("167px");
     FormLayout formLayout = new FormLayout();
     formLayout.setLabelAlign(LabelAlign.TOP);
     layoutContainer.setLayout(formLayout);
     layoutContainer.add(getCpusComboBox(), new FormData("100%"));
   }
   return layoutContainer;
 }
コード例 #5
0
 private LayoutContainer getHoursContainer() {
   if (hoursContainer == null) {
     hoursContainer = new LayoutContainer();
     FormLayout formLayout = new FormLayout();
     formLayout.setLabelAlign(LabelAlign.TOP);
     hoursContainer.setLayout(formLayout);
     FormData formData = new FormData("");
     formData.setWidth(70);
     hoursContainer.add(getHoursComboBox(), formData);
   }
   return hoursContainer;
 }
コード例 #6
0
 private LayoutContainer getMinutesContainer() {
   if (minutesContainer == null) {
     minutesContainer = new LayoutContainer();
     FormLayout formLayout = new FormLayout();
     formLayout.setLabelAlign(LabelAlign.TOP);
     minutesContainer.setLayout(formLayout);
     FormData formData = new FormData(null);
     formData.setWidth(70);
     minutesContainer.add(getMinutesComboBox(), formData);
   }
   return minutesContainer;
 }
コード例 #7
0
  private void init() {
    FormLayout formLayout = new FormLayout();
    formLayout.setLabelAlign(LabelAlign.TOP);
    formLayout.setLabelWidth(200);
    formLayout.setDefaultWidth(340);
    setLayout(formLayout);

    AdapterField contentField = new AdapterField(createContentContainer());
    contentField.setFieldLabel("Commands,sensors,switches and sliders");
    add(contentField);
    onSubmit();
    getAccount();
  }
コード例 #8
0
 private LayoutContainer getDaysContainer() {
   if (daysContainer == null) {
     daysContainer = new LayoutContainer();
     FormLayout formLayout = new FormLayout();
     formLayout.setLabelAlign(LabelAlign.TOP);
     daysContainer.setLayout(formLayout);
     FormData formData = new FormData("");
     formData.setWidth(70);
     formData.setMargins(new Margins(0, 0, 0, 0));
     daysContainer.add(getDaysComboBox(), formData);
   }
   return daysContainer;
 }
コード例 #9
0
 private LayoutContainer getFirstRowRightSide() {
   if (firstRowRightSide == null) {
     firstRowRightSide = new LayoutContainer();
     FormLayout formLayout = new FormLayout();
     formLayout.setLabelWidth(50);
     firstRowRightSide.setLayout(formLayout);
     firstRowRightSide.add(getCheckBox(), new FormData("100%"));
     FormData formData = new FormData("");
     formData.setWidth(150);
     firstRowRightSide.add(getEmailTextField(), formData);
   }
   return firstRowRightSide;
 }
コード例 #10
0
  private final LayoutContainer createAccountPanel() {
    LayoutContainer panel = new LayoutContainer();
    FormLayout layout = new FormLayout();
    layout.setLabelAlign(LabelAlign.LEFT);
    layout.setPadding(0);
    layout.setLabelWidth(80);
    panel.setLayout(layout);
    FormData formData = new FormData("100%");

    // add alias field editor;
    accounts = new AccountComboBox(constants.account(), constants.lowerCaseAccount());
    //				"Account");
    ComboBox<XObjectModel> accountsCombo = accounts.getComboBox();
    panel.add(accountsCombo, formData);

    return panel;
  }
コード例 #11
0
  /**
   * DOC bessaies Comment method "build".
   *
   * @param configGroups
   */
  public void build(ConfigGroup[] configGroups) {
    for (ConfigGroup configGroup : configGroups) {
      ImageResource imageResource = IconConfigProvider.provideIcon(configGroup);
      ContentPanel cPanel = buildConfigBloc(configGroup, imageResource);
      cPanel.setVisible(false);
      FormLayout formLayout1 = new FormLayout();
      formLayout1.setLabelWidth(200);

      FormLayout formLayout2 = new FormLayout();

      final LayoutContainer fieldPart = new LayoutContainer(formLayout1);
      final LayoutContainer messagePart = new LayoutContainer(formLayout2);

      fieldPart.setStyleAttribute("padding-left", "10px");
      fieldPart.setStyleAttribute("padding-top", "10px");
      fieldPart.setStyleAttribute("padding-bottom", "10px");
      messagePart.setStyleAttribute("padding-top", "12px");
      messagePart.setStyleAttribute("padding-bottom", "12px");

      cPanel.add(fieldPart, new ColumnData(0.7));
      cPanel.add(messagePart, new ColumnData(0.25));

      for (Config config : configGroup.configs) {
        Field<?> field = null;
        switch (config.type) {
          case txt:
            field = buildTextField(fieldPart, messagePart, config);
            break;
          case password:
            field = buildPasswordField(fieldPart, messagePart, config);
            break;
          case list:
            field = buildListField(fieldPart, messagePart, config);
            break;
          default:
            break;
        }
        if (null != field) {
          mapKeyField.put(config, field);
        }
      }

      add(cPanel);
    }
  }
コード例 #12
0
  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());
  }
コード例 #13
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;
  }
コード例 #14
0
  // ******************************************************
  // 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;
  }
コード例 #15
0
  public void addOtherComponent() {
    fieldSet = new FieldSet();
    fieldSet.setHeading("Additional Information");
    fieldSet.setCheckboxToggle(true);

    FormLayout layout = new FormLayout();
    layout.setLabelWidth(150);
    layout.setPadding(10);
    fieldSet.setLayout(layout);

    passAdministrationUserRole = new TextField<String>();
    passAdministrationUserRole.setAllowBlank(false);
    passAdministrationUserRole.setFieldLabel("Password Administration");
    passAdministrationUserRole.setPassword(true);
    fieldSet.add(passAdministrationUserRole);

    repeatPassAdministrationUserRole = new TextField<String>();
    repeatPassAdministrationUserRole.setAllowBlank(false);
    repeatPassAdministrationUserRole.setFieldLabel("Repeat Password");
    repeatPassAdministrationUserRole.setPassword(true);

    repeatPassAdministrationUserRole.setValidator(
        new Validator<String, Field<String>>() {

          public String validate(Field<String> field, String value) {
            if (passAdministrationUserRole.getValue() != null) {
              if (!field.getValue().equalsIgnoreCase(passAdministrationUserRole.getValue()))
                return "Attention! The two passwords must match.";
            }
            return null;
          }
        });

    fieldSet.add(repeatPassAdministrationUserRole);

    this.formPanel.add(fieldSet);
  }
コード例 #16
0
  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;
  }
コード例 #17
0
  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;
  }
コード例 #18
0
  private void initUI() {
    long time = new java.util.Date().getTime();
    GWT.log("Initializing the UI ", null);

    container = new LayoutContainer();
    container.setLayout(new CenterLayout());

    // Rpc Proxy setup
    pagingToolBar = setupRpcProxy();

    // Audit event grid setup
    grid = setupGrid();

    // Panel
    ContentPanel cp = new ContentPanel();
    cp.setHeading("Entity Event Viewer");
    cp.setFrame(true);
    cp.setIcon(IconHelper.create("images/search_icon_16x16.png"));
    cp.setLayout(new FormLayout());
    cp.setSize(1100, 630);

    // Search Container
    ContentPanel searchContainer = new ContentPanel();
    searchContainer.setHeaderVisible(false);
    FormLayout searchFormLayout = new FormLayout();
    searchFormLayout.setLabelWidth(130);
    searchFormLayout.setDefaultWidth(770);

    searchContainer.setLayout(searchFormLayout);

    selectedEvenyTypes = new TextField<String>();
    selectedEvenyTypes.setFieldLabel("Selected Event Types");
    selectedEvenyTypes.setReadOnly(true);

    evenyTypes = new ListView<AuditEventTypeWeb>();
    evenyTypes.setDisplayProperty("auditEventTypeName");
    evenyTypes.setWidth(220);
    evenyTypes.setHeight(110);
    evenyTypes.setStore(eventTypesStore);
    evenyTypes
        .getSelectionModel()
        .addListener(
            Events.SelectionChange,
            new Listener<SelectionChangedEvent<AuditEventTypeWeb>>() {

              public void handleEvent(SelectionChangedEvent<AuditEventTypeWeb> be) {
                List<AuditEventTypeWeb> selections = be.getSelection();
                String selectedTypes = "";
                for (AuditEventTypeWeb type : selections) {
                  if (selectedTypes.isEmpty()) {
                    selectedTypes = type.getAuditEventTypeName();
                  } else {
                    selectedTypes = selectedTypes + ", " + type.getAuditEventTypeName();
                  }
                }
                selectedEvenyTypes.setValue(selectedTypes);

                if (selectedTypes.isEmpty()) {
                  searchButton.disable();
                } else {
                  searchButton.enable();
                }
              }
            });

    DateTimePropertyEditor dateFormat = new DateTimePropertyEditor("yyyy-MM-dd HH:mm");
    startDate = new DateField();
    startDate.setFieldLabel("Start Date Time");
    startDate.setToolTip("yyyy-MM-dd HH:mm");
    startDate.setPropertyEditor(dateFormat);

    endDate = new DateField();
    endDate.setFieldLabel("End Date Time");
    endDate.setToolTip("yyyy-MM-dd HH:mm");
    endDate.setPropertyEditor(dateFormat);

    LayoutContainer main = new LayoutContainer();
    main.setLayout(new ColumnLayout());

    LayoutContainer left = new LayoutContainer();
    left.setStyleAttribute("paddingRight", "10px");
    FormLayout layout = new FormLayout();
    layout.setLabelWidth(130);
    layout.setDefaultWidth(220);
    // layout.setLabelAlign(LabelAlign.TOP);
    left.setLayout(layout);
    left.add(startDate);

    LayoutContainer right = new LayoutContainer();
    right.setStyleAttribute("paddingLeft", "10px");
    layout = new FormLayout();
    // layout.setLabelAlign(LabelAlign.TOP);
    layout.setLabelWidth(130);
    layout.setDefaultWidth(220);
    right.setLayout(layout);
    right.add(endDate);

    main.add(left, new ColumnData(.5));
    main.add(right, new ColumnData(.5));

    HBoxLayoutData dataSelectedTypes = new HBoxLayoutData(new Margins(5, 0, 0, 0));
    searchContainer.add(selectedEvenyTypes, dataSelectedTypes);
    HBoxLayoutData dataTypes = new HBoxLayoutData(new Margins(5, 0, 5, 135));
    searchContainer.add(evenyTypes, dataTypes);

    searchContainer.add(main);
    HBoxLayoutData dataButtons = new HBoxLayoutData(new Margins(0, 0, 5, 0));
    searchContainer.add(setupButtonPanel(3), dataButtons);

    cp.add(searchContainer);
    cp.add(grid);
    cp.setBottomComponent(pagingToolBar);

    container.add(cp);

    LayoutContainer wrapper = (LayoutContainer) Registry.get(Constants.CENTER_PANEL);
    wrapper.removeAll();
    wrapper.add(container);
    wrapper.layout();
    GWT.log("Done Initializing the UI in " + (new java.util.Date().getTime() - time), null);
  }
コード例 #19
0
  private void createForm() {
    FormLayout layout = new FormLayout();
    layout.setLabelAlign(LabelAlign.TOP);
    fp.setLayout(layout);
    fp.setFrame(false);
    fp.setHeaderVisible(false);
    fp.setAutoWidth(true);
    fp.setBodyBorder(true);
    fp.setButtonAlign(HorizontalAlignment.CENTER);

    eMail = new TextField<String>();
    eMail.setFieldLabel("E-mail address"); // ID
    eMail.setValue("*****@*****.**");
    eMail.setAllowBlank(false);

    eMail.setRegex("^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$");
    fp.add(eMail);

    pass = new TextField<String>();
    pass.setPassword(true);
    pass.setValue("pass");
    pass.setFieldLabel("Password");
    fp.add(pass);

    fp.addButton(loginButton);
    fp.addButton(newAccountButton);

    loginButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {

            ArrayList eventData = new ArrayList();
            if (!eMail.isValid()) {
              eventData = new ArrayList();
              eventData.add("e-mail is invalid!");
              Dispatcher.get().dispatch(MainEvents.login, eventData);
              return;
            } else if (eMail.getValue() == null) {
              eventData = new ArrayList();
              eventData.add("Please enter your e-mail address!");
              Dispatcher.get().dispatch(MainEvents.login, eventData);
              return;
            } else if (pass.getValue() == null) {
              eventData = new ArrayList();
              eventData.add("Please enter the password!");
              Dispatcher.get().dispatch(MainEvents.login, eventData);
              return;
            } else service = (ServiceManagerWebServiceAsync) Registry.get("guiservice");

            String email = eMail.getValue();
            String password = pass.getValue();
            service.loginUser(
                email,
                password,
                new AsyncCallback<ArrayList<Object>>() {
                  public void onFailure(Throwable caught) {
                    System.out.println("loginUser: error");
                  }

                  public void onSuccess(ArrayList<Object> result) {
                    System.out.println("loginUser: success; result.get(0) = \n" + result.get(0));
                    System.out.println("loginUser: session_id = \n" + result.get(1));
                    session_id = (String) result.get(1);
                    ArrayList eventData = new ArrayList();
                    if (!result
                        .get(0)
                        .equals(
                            "User/pass are wrong! Please correct input data or register an account")) {
                      eventData.add("Please select the option");
                      eventData.add(result.get(0));
                      Dispatcher.get().dispatch(MainEvents.login, eventData);
                      fp.remove(eMail);
                      fp.remove(pass);
                      fp.clear();
                      remove(fp);
                      FormLayout layout = new FormLayout();
                      layout.setLabelAlign(LabelAlign.TOP);
                      fp = new FormPanel();
                      fp.setLayout(layout);
                      fp.setFrame(false);
                      fp.setHeaderVisible(false);
                      fp.setAutoWidth(true);
                      fp.setBodyBorder(true);
                      fp.setButtonAlign(HorizontalAlignment.CENTER);
                      fp.addText((String) result.get(0));
                      fp.addButton(logoutButton);
                      add(fp);
                    } else {
                      eventData.add("You need to log in");
                      eventData.add(result.get(0));
                      Dispatcher.get().dispatch(MainEvents.newAccount, eventData);
                    }

                    layout(true);
                  }
                });
          }
        });

    logoutButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            fp.clear();
            remove(fp);
            FormLayout layout = new FormLayout();
            layout.setLabelAlign(LabelAlign.TOP);
            fp = new FormPanel();
            fp.setLayout(layout);
            fp.setFrame(false);
            fp.setHeaderVisible(false);
            fp.setAutoWidth(true);
            fp.setBodyBorder(true);
            fp.setButtonAlign(HorizontalAlignment.CENTER);

            fp.add(eMail);
            fp.add(pass);
            fp.addButton(loginButton);
            fp.addButton(newAccountButton);
            add(fp);

            layout(true);

            ArrayList eventData = new ArrayList();
            eventData.add("You are logged out!");
            eventData.add("You are logged out, " + eMail.getValue() + "!");
            Dispatcher.get().dispatch(MainEvents.logout, eventData);

            service.logoutUser(
                session_id,
                eMail.getValue(),
                new AsyncCallback<Boolean>() {
                  public void onFailure(Throwable caught) {
                    System.out.println("logoutUser: error");
                  }

                  public void onSuccess(Boolean result) {
                    System.out.println("logoutUser: success");
                  }
                });
          }
        });

    newAccountButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            ArrayList eventData = new ArrayList();
            eventData.add("Please select the option");
            Dispatcher.get().dispatch(MainEvents.newAccount, eventData);
          }
        });

    /*
    skipButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
    	@Override
    	public void componentSelected(ButtonEvent ce) {
    		ArrayList eventData = new ArrayList();
    		eventData.add("Please select the option");
    		Dispatcher.get().dispatch(MainEvents.login, eventData);
    	}

    });
    */
    this.add(fp);
  }
コード例 #20
0
ファイル: ProfileView.java プロジェクト: openhie/os-cr
  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;
  }
コード例 #21
0
ファイル: ProfileView.java プロジェクト: openhie/os-cr
  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;
  }
コード例 #22
0
  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;
  }
コード例 #23
0
  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;
  }