Package org.openbp.swing.components.popupfield

Examples of org.openbp.swing.components.popupfield.JSelectionField$DisplayableObject


    JLabel outputDirLabel = new JLabel(resourceCollection.getRequiredString("wizard.result.overwritelabel"));
    outputDirLabel.setBorder(new EmptyBorder(0, 0, 0, 5));
    panel.add(outputDirLabel, BorderLayout.WEST);

    // Text field
    final JSelectionField sf = new JSelectionField();
    sf.addItem(resourceCollection.getRequiredString("wizard.result.overwrite.ask"));
    sf.addItem(resourceCollection.getRequiredString("wizard.result.overwrite.merge"));
    sf.addItem(resourceCollection.getRequiredString("wizard.result.overwrite.overwrite"));
    sf.setEditable(false);
    sf.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent ae)
      {
        String sOverwriteMode = null;
        switch (sf.getSelectedIndex())
        {
        case 1:
          sOverwriteMode = "merge";
          break;

        case 2:
          sOverwriteMode = "overwrite";
          break;
        }
        getContext().setOverwriteMode(sOverwriteMode);
      }
    });

    String sOverwriteMode = getContext().getOverwriteMode();
    int iOverwriteMode = 0;
    if ("merge".equals(sOverwriteMode))
      iOverwriteMode = 1;
    else if ("overwrite".equals(sOverwriteMode))
      iOverwriteMode = 2;
    sf.setSelectedIndex(iOverwriteMode);

    panel.add(sf, BorderLayout.CENTER);

    return panel;
  }
View Full Code Here


  public void popup(SelectionEditor editor, int cause)
  {
    if (cause != PopupEvent.POPUP_OPENING)
      return;

    JSelectionField selectionField = (JSelectionField) editor.getPropertyComponent();

    // Save the text (will be cleared when removing the items)
    String text = selectionField.getText();

    // Clear the item list
    selectionField.clearItems();

    // Get UI adapter registry.
    UIAdapterDescriptorRegistry registry = UIAdapterDescriptorRegistry.getInstance();

    // Get visual types.
    String [] visualTypes = registry.getVisualTypes();

    // Add empty value.
    selectionField.addItem("", null);

    // For each visual type...
    for (int i = 0; i < visualTypes.length; i++)
    {
      // ... add an entry to the drop down.
      selectionField.addItem(registry.getDisplayText(visualTypes [i], UIAdapterDescriptor.COCKPIT_DISPLAY_NAME), visualTypes [i]);
    }

    // Restore the text
    selectionField.setText(text);
  }
View Full Code Here

  public void popup(SelectionEditor editor, int cause)
  {
    if (cause != PopupEvent.POPUP_OPENING)
      return;

    JSelectionField selectionField = (JSelectionField) editor.getPropertyComponent();

    // Save the text (will be cleared when removing the items)
    String text = selectionField.getText();

    // Clear the item list
    selectionField.clearItems();

    Object o = editor.getObject();
    if (!(o instanceof FinalNode))
      return;

    TreeMap map = new TreeMap();

    Iterator itNodes = ((FinalNode) o).getProcess().getNodes();

    while (itNodes.hasNext())
    {
      Node node = (Node) itNodes.next();

      if (!(node instanceof InitialNode))
        continue;

      String name = node.getName();
      map.put(name, name);
    }

    selectionField.addItem(null);
    selectionField.addItem(CoreConstants.JUMPTARGET_DEFAULT_PROCESS);
    for (Iterator itGroups = map.keySet().iterator(); itGroups.hasNext();)
    {
      String s = (String) itGroups.next();
      selectionField.addItem(s);
    }

    // Restore the text
    selectionField.setText(text);
  }
View Full Code Here

  /**
   * Creates the editor component of the property editor.
   */
  public void createComponent()
  {
    JSelectionField c = new JSelectionField();

    c.setEditable(editable && ! readonly);

    textField = c.getTextField();

    // Fill the editor combo box with the list of available selections.
    if (selectionValueList != null && ! readonly)
    {
      int n = selectionValueList.size();
      for (int i = 0; i < n; ++i)
      {
        DescriptionObject d = (DescriptionObject) selectionValueList.get(i);

        String name = d.getName();
        String text = d.getDescription();
        if (text != null)
        {
          c.addItem(text, name);
        }
        else
        {
          c.addItem(name);
        }
      }
    }

    c.addFocusListener(this);
    if (! readonly)
    {
      c.addActionListener(this);
      c.addKeyListener(this);
      c.addPopupListener(this);
    }

    textField.addKeyListener(this);
    textField.getDocument().addDocumentListener(this);
    textField.addFocusListener(this);
View Full Code Here

      ((JLabel) component).setText(display);
    }
    else
    {
      settingValue = true;
      JSelectionField c = (JSelectionField) component;
      c.setSelectedItem(v);
      settingValue = false;
    }
  }
View Full Code Here

        }
      });
    }
    else
    {
      JSelectionField selectionField = (JSelectionField) component;

      if (on && textField.hasFocus())
      {
        selectionField.setHighlight();
      }
      else
      {
        selectionField.resetHighlight();
      }
    }
  }
View Full Code Here

   */
  public void keyPressed(KeyEvent e)
  {
    int keyCode = e.getKeyCode();

    JSelectionField selectionField = (JSelectionField) component;

    // Check for navigation keys
    switch (keyCode)
    {
    case KeyEvent.VK_ESCAPE:
      if (selectionField.isPopupVisible())
      {
        selectionField.setPopupVisible(false);
        e.consume();
        return;
      }
      break;

    case KeyEvent.VK_LEFT:
    case KeyEvent.VK_RIGHT:
    case KeyEvent.VK_HOME:
    case KeyEvent.VK_END:
    case KeyEvent.VK_UP:
    case KeyEvent.VK_DOWN:
      JTextField tf = null;
      boolean shiftPressed = e.isShiftDown();
      Object sourceObject = e.getSource();

      if (selectionField.isPopupVisible())
      {
        // As long as the combo box popup is visible, all keys should be handled by the combo box
        return;
      }

View Full Code Here

  public void popup(SelectionEditor editor, int cause)
  {
    if (cause != PopupEvent.POPUP_OPENING)
      return;

    JSelectionField selectionField = (JSelectionField) editor.getPropertyComponent();

    // Save the text (will be cleared when removing the items)
    String text = selectionField.getText();

    // Clear the item list
    selectionField.clearItems();

    Object o = editor.getObject();
    if (!(o instanceof DisplayObject))
      return;

    selectionField.addItem(null);
    String displayName = NameUtil.makeDisplayName(((DisplayObject) o).getName());
    if (displayName != null)
    {
      selectionField.addItem(displayName);
    }

    // Restore the text
    selectionField.setText(text);
  }
View Full Code Here

   */
  public SelectionWidget(Option option, List values)
  {
    super(option);

    selectionField = new JSelectionField();
    selectionField.setEditable(false);
    selectionField.addActionListener(this);

    for (Iterator it = values.iterator(); it.hasNext();)
    {
View Full Code Here

  public void popup(SelectionEditor editor, int cause)
  {
    if (cause != PopupEvent.POPUP_OPENING)
      return;

    JSelectionField selectionField = (JSelectionField) editor.getPropertyComponent();

    // Save the text (will be cleared when removing the items)
    String text = selectionField.getText();

    // Clear the item list
    selectionField.clearItems();

    Object o = editor.getObject();
    if (!(o instanceof InitialNode))
      return;

    TreeMap map = new TreeMap();

    Iterator itNodes = ((InitialNode) o).getProcess().getNodes();
    while (itNodes.hasNext())
    {
      Node node = (Node) itNodes.next();

      if (!(node instanceof FinalNode))
        continue;

      FinalNode finalNode = (FinalNode) node;
      if (finalNode.getJumpTarget() != null)
      {
        // We skip exit-continue nodes
        continue;
      }

      String name = node.getName();
      map.put(name, name);
    }

    selectionField.addItem(null);
    for (Iterator itGroups = map.keySet().iterator(); itGroups.hasNext();)
    {
      String s = (String) itGroups.next();
      selectionField.addItem(s);
    }

    // Restore the text
    selectionField.setText(text);
  }
View Full Code Here

TOP

Related Classes of org.openbp.swing.components.popupfield.JSelectionField$DisplayableObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.