Ejemplo n.º 1
1
  /**
   * @param control
   * @param string
   * @param model2
   * @param rootFile
   */
  public PathInfoControl(
      IControlContainer container, String name, DirectoryModel model, File root) {
    super(container, name);
    this.model = model;
    this.root = root;

    txtPath = new InputBox(this, "txtPath");
    txtPath.setWidth(500);
    txtPath.setListenKeyCode(13); // Listen to the ENTER key
    txtPath.addKeyListener(
        new KeyListener() {
          public void keyPressed(de.jwic.events.KeyEvent event) {
            gotoPath(txtPath.getText());
          };
        });

    LabelControl lblPath = new LabelControl(this, "label");
    lblPath.setText("Path:");

    Button btGo = new Button(this, "btGo");
    btGo.setTitle("Go there");
    btGo.addSelectionListener(
        new SelectionListener() {
          public void objectSelected(SelectionEvent event) {
            gotoPath(txtPath.getText());
          }
        });

    updatePath();
    model.addPropertyChangeListener(this);
  }
Ejemplo n.º 2
1
  private void createControls() {
    lblName = new Label(this, "lblName");

    lblDescription = new Label(this, "lblDescription");

    lblDate = new Label(this, "lblDate");

    lblOwner = new Label(this, "lblOwner");

    ibName = new InputBox(this, "ibName");
    ibName.setWidth(340);

    ibDescription = new InputBox(this, "ibDescription");
    ibDescription.setEmptyInfoText("Enter a description of this list profile");
    ibDescription.setMultiLine(true);
    ibDescription.setWidth(340);
    ibDescription.setHeight(50);

    rbtnYes = new RadioButton(this, "rbtnYes");
    rbtnYes.setTitle("Yes");

    rbtnNo = new RadioButton(this, "rbtnNo", rbtnYes);
    rbtnNo.setTitle("No");

    updateFieldsValues();
  }
Ejemplo n.º 3
1
  public void actionUpdate() {
    if (ibName.getText().isEmpty()) {
      editError = "You must enter a name";
      requireRedraw();
      return;
    } else {
      editError = "";
    }

    if (tableModel.getUserConfigHandler().configNameExists(ibName.getText(), userConfig.getId())) {
      editError = "A configuration with this name already exists";
      requireRedraw();
      return;
    }

    userConfig =
        tableModel
            .getUserConfigHandler()
            .updateConfig(
                userConfig, ibName.getText(), ibDescription.getText(), rbtnYes.isSelected());

    updateFieldsValues();
    editMode = false;
    requireRedraw();

    fireEvent(EVENT_TYPE_UPDATE);
  }
Ejemplo n.º 4
1
  public void actionCancelUpdate() {
    // if it's a new config we need to fire the delete event to have the
    // control removed, since the entity will not be saved
    if (userConfig.getId() < 1) {
      fireEvent(EVENT_TYPE_DELETE);
      return;
    }

    ibName.setText(userConfig.getName());
    ibDescription.setText(userConfig.getDescription());
    if (userConfig.isPublic()) {
      rbtnYes.setSelected(true);
    } else {
      rbtnNo.setSelected(true);
    }

    editMode = false;
    requireRedraw();
  }
Ejemplo n.º 5
1
  private void updateFieldsValues() {
    lblName.setText(userConfig.getName());
    lblDescription.setText(userConfig.getDescription() != null ? userConfig.getDescription() : "");
    lblDate.setText(sdf.format(userConfig.getCreatedAt()));
    if (userConfig.getOwner() != null) {
      lblOwner.setText(
          userConfig.getOwner().getNachname() + ", " + userConfig.getOwner().getVorname());
    } else {
      lblOwner.setText("- Unknown -");
    }

    ibName.setText(userConfig.getName());
    ibDescription.setText(userConfig.getDescription() != null ? userConfig.getDescription() : "");
    if (userConfig.isPublic()) {
      rbtnYes.setSelected(true);
    } else {
      rbtnNo.setSelected(true);
    }
  }
Ejemplo n.º 6
1
  protected void applyTest() {

    mapEditor.setTestString(inpTestString.getText());
  }
Ejemplo n.º 7
1
  private void createDimMappingEditor() {
    inpKey = new InputBox(this, "inpKey");
    inpKey.setWidth(300);

    inpDescription = new InputBox(this, "inpDescription");
    inpDescription.setMultiLine(true);
    inpDescription.setRows(3);
    inpDescription.setWidth(300);

    lbcDimension = new ListBox(this, "lbcDimension");
    lbcDimension.setChangeNotification(true);
    lbcDimension.addElementSelectedListener(
        new ElementSelectedListener() {
          public void elementSelected(ElementSelectedEvent event) {
            onDimensionSelection((String) event.getElement());
          }
        });
    for (IDimension dim : dataPool.getDimensions()) {
      String title =
          dim.getTitle() != null ? dim.getKey() + "(" + dim.getTitle() + ")" : dim.getKey();
      lbcDimension.addElement(title, dim.getKey());
    }

    chkOnUnmapped = new RadioGroup(this, "chkOnUnmapped");
    chkOnUnmapped.setChangeNotification(true);
    chkOnUnmapped.addElement("Create", "CREATE");
    chkOnUnmapped.addElement("Skip", "SKIP");
    chkOnUnmapped.addElement("Assign To", "ASSIGN");
    chkOnUnmapped.addElement("Fail", "FAIL");

    chkOptions = new CheckBoxGroup(this, "chkOptions");
    chkOptions.addElement("Autocreate Mapping", "autocreate");

    new Label(this, "elmSelector").setText("");
    elmSelector = null;

    /*
     * Load Initial Values
     */
    if (dimMapping.getKey() != null) {
      inpKey.setText(dimMapping.getKey());
      inpKey.setEnabled(false);
    }
    inpDescription.setText(dimMapping.getDescription() != null ? dimMapping.getDescription() : "");
    lbcDimension.setSelectedKey(
        dimMapping.getDimensionKey() != null ? dimMapping.getDimensionKey() : "");

    chkOnUnmapped.setSelectedKey(dimMapping.getOnUnmapped().name());

    if (dimMapping.isAutoCreateMapping()) {
      chkOptions.setSelectedKey("autocreate");
    }

    if (elmSelector != null
        && dimMapping.getUnmappedPath() != null
        && dimMapping.getUnmappedPath().length() != 0) {
      IDimension dimension = elmSelector.getDimension();
      try {
        IDimensionElement elm = dimension.parsePath(dimMapping.getUnmappedPath());
        elmSelector.setDimensionElement(elm);
      } catch (Exception e) {
        errInfo.showError("Error restoring unmapped value - element removed?: " + e);
      }
    }

    inpTestString = new InputBox(this, "inpTestString");
    inpTestString.setWidth(600);

    Button btTest = new Button(this, "btTest");
    btTest.setTitle("Test");
    btTest.addSelectionListener(
        new SelectionListener() {
          /* (non-Javadoc)
           * @see de.jwic.events.SelectionListener#objectSelected(de.jwic.events.SelectionEvent)
           */
          public void objectSelected(SelectionEvent event) {
            applyTest();
          }
        });
  }
Ejemplo n.º 8
1
  protected void onSaveAndClose() {

    String key = inpKey.getText().trim();
    if (key.length() == 0) {
      errInfo.showError("You must specify a key.");
      return;
    }

    String dimKey = lbcDimension.getSelectedKey();
    if (dimKey == null || dimKey.length() == 0) {
      errInfo.showError("You must select a dimension.");
      return;
    }
    DimMappingDef.Action onUnmapped = DimMappingDef.Action.valueOf(chkOnUnmapped.getSelectedKey());

    String unmappedElement =
        elmSelector.getDimensionElement() != null
            ? elmSelector.getDimensionElement().getPath()
            : null;
    if (onUnmapped == DimMappingDef.Action.ASSIGN) {
      if (unmappedElement == null) {
        errInfo.showError("An Unmapped Element must be specified.");
        return;
      } else if (!elmSelector.getDimensionElement().isLeaf()) {
        errInfo.showError("An Unmapped Element must be specified that is NOT a leaf!");
        return;
      }
    }

    // now check the dimension mapping table
    List<DimMappingElementDef> mappingList = mapEditor.getMappingList();
    for (DimMappingElementDef me : mappingList) {
      if (me.getDimensionKey() == null || !me.getDimensionKey().equals(dimKey)) {
        errInfo.showError(
            "The mapping table contains elements for other dimensions then the selected one.");
        return;
      }
      me.setDimMapKey(key);
    }

    dimMapping.setKey(key);
    dimMapping.setDimensionKey(dimKey);
    dimMapping.setDescription(inpDescription.getText());
    dimMapping.setOnUnmapped(onUnmapped);
    dimMapping.setUnmappedPath(unmappedElement);
    dimMapping.setAutoCreateMapping(chkOptions.isKeySelected("autocreate"));

    ServerContext context = ETLgineServer.getInstance().getServerContext();
    String syncTableConnectionName =
        context.getProperty(dpManagerKey + ".datapool.syncTables.connection");
    try {
      Connection connection = JDBCUtil.openConnection(context, syncTableConnectionName);
      try {
        connection.setAutoCommit(false);
        DimMappingDefDAO dao = new DimMappingDefDAO(connection);
        if (isNew) {
          dao.insert(dimMapping);
        } else {
          dao.update(dimMapping);
        }

        // insert dimMappings
        DimMappingElementDefDAO daoME = new DimMappingElementDefDAO(connection);
        daoME.deleteByDimMapKey(key);
        daoME.setOrderIndex(0);
        for (DimMappingElementDef me : mappingList) {
          daoME.insert(me);
        }

        connection.commit();
        connection.setAutoCommit(true);
        close();
      } finally {
        if (!connection.getAutoCommit()) {
          connection.rollback();
        }
        connection.close();
      }
    } catch (Exception e) {
      log.error("Error saving to sync table.", e);
      errInfo.showError(e);
    }
  }
Ejemplo n.º 9
0
  private void updatePath() {

    File path = model.getDirectory();
    int l = root.getAbsolutePath().length();
    txtPath.setText(path.getAbsolutePath().substring(l));
  }