Esempio n. 1
0
  public JDataStorePage(DataStoreFactorySpi format, Map<String, Object> params) {
    super(ID);
    setTitle(format.getDisplayName());
    setDescription(format.getDescription());

    this.format = format;
    if (params == null) {
      params = new HashMap<String, Object>();
      if (format != null) {
        for (Param param : format.getParametersInfo()) {
          params.put(param.key, (Serializable) param.sample);
        }
      }
    }
    this.connectionParameters = params;
  }
Esempio n. 2
0
  public void createControl(Composite parent) {

    Composite mainComposite = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout(2, false);
    mainComposite.setLayout(gridLayout);

    for (Param param : format.getParametersInfo()) {
      if (level != null) {
        String check =
            param.metadata == null ? "user" : (String) param.metadata.get(Parameter.LEVEL);

        if (check == null) {
          check = "user";
        }
        if (level.equals(check)) {
          // we are good this is the one we want
        } else {
          continue; // skip since it is not the one we want
        }
      }
      String txt = param.title.toString();
      if (param.required) {
        txt += "*";
      }

      Label label = new Label(mainComposite, SWT.NONE);
      label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
      label.setText(txt);

      ParamField field = ParamField.create(mainComposite, param);
      field.doLayout();

      fields.put(param, field);

      // if (param.description != null) {
      // JLabel info = new JLabel(formatDescription(param.description.toString()));
      // page.add(info, "skip, span, wrap");
      // }
    }

    setControl(mainComposite);
  }