Exemplo 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);
  }
Exemplo n.º 2
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();
          }
        });
  }
Exemplo n.º 3
0
  /* (non-Javadoc)
   * @see de.jwic.base.Application#createRootControl(de.jwic.base.IControlContainer)
   */
  public Control createRootControl(IControlContainer container) {

    // specify an exit URL
    getSessionContext().setExitURL("byebye.html");

    // specify the page
    Page page = new Page(container);
    page.setTitle("jWic Control Demo");
    page.setTemplateName("de.jwic.samples.controls.Page"); // specify a template

    Button btExit = new Button(page, "exit");
    btExit.setTitle("Exit");
    btExit.addSelectionListener(
        new SelectionListener() {
          public void objectSelected(SelectionEvent event) {
            exitApplication();
          };
        });
    btExit.setWidth(80);

    // WindowControl window = new WindowControl(page, "window");
    // window.setTitle("jWic Control Demo");
    ControlContainer sf = new ControlContainer(page, "window");
    // sf.setTitle("jWic Control Demo");

    createControls(sf);

    container.getSessionContext().setActionController(new TestRecorderActionController());

    return page;
  }
Exemplo n.º 4
0
  /** Setup the ActionBar. */
  private void setupActionBar() {
    ToolBar abar = new ToolBar(this, "actionBar");
    ToolBarGroup group = abar.addGroup();
    Button btReturn = group.addButton();
    btReturn.setIconEnabled(ImageLibrary.IMAGE_RETURN);
    btReturn.setTitle("Return");
    btReturn.setConfirmMsg("Changes will get lost!");
    btReturn.addSelectionListener(
        new SelectionListener() {
          public void objectSelected(SelectionEvent event) {
            close();
          }
        });

    btSave = group.addButton();
    btSave.setIconEnabled(ImageLibrary.IMAGE_TABLE_SAVE);
    btSave.setTitle("Save & Close");
    btSave.addSelectionListener(
        new SelectionListener() {
          public void objectSelected(SelectionEvent event) {
            onSaveAndClose();
          }
        });

    Button btAdd = group.addButton();
    btAdd.setTitle("Create Element");
    btAdd.setIconEnabled(ImageLibrary.IMAGE_ADD);
    btAdd.addSelectionListener(
        new SelectionListener() {
          public void objectSelected(SelectionEvent event) {
            mapEditor.createNewElement();
          }
        });

    Button btSortEx = group.addButton();
    btSortEx.setTitle("Sort By Expression");
    btSortEx.setIconEnabled(ImageLibrary.IMAGE_REFRESH);
    btSortEx.addSelectionListener(
        new SelectionListener() {
          public void objectSelected(SelectionEvent event) {
            onSortMappings(true);
          }
        });

    Button btSortPath = group.addButton();
    btSortPath.setTitle("Sort By Element");
    btSortPath.setIconEnabled(ImageLibrary.IMAGE_REFRESH);
    btSortPath.addSelectionListener(
        new SelectionListener() {
          public void objectSelected(SelectionEvent event) {
            onSortMappings(false);
          }
        });

    Button btDeleteAll = group.addButton();
    btDeleteAll.setTitle("Delete All");
    btDeleteAll.setConfirmMsg("Do you really want to delete ALL mapping entries?");
    btDeleteAll.setIconEnabled(ImageLibrary.IMAGE_SCRIPT_DELETE);
    btDeleteAll.addSelectionListener(
        new SelectionListener() {
          public void objectSelected(SelectionEvent event) {
            onDeleteAll();
          }
        });
  }