Package org.openbp.swing.components.popupfield

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


  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 HandlerDefinition))
      return;

    selectionField.addItem(null);

    ModelObject mo = ((HandlerDefinition) o).getOwner();
    String pkg = mo.getOwningModel().getDefaultPackage();
    if (pkg != null)
    {
      String prefix = editor.getParameterParser().getString("prefix");
      String suffix = editor.getParameterParser().getString("suffix");

      StringBuffer className = new StringBuffer(pkg);
      className.append (".");
      if (prefix != null)
      {
        className.append (prefix);
      }
      className.append (mo.getName());
      if (suffix != null)
      {
        className.append (suffix);
      }

      selectionField.addItem(className.toString());
    }
    else
    {
      selectionField.addItem("<no default model package name specified>");
    }

    // 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 ModelObject))
      return;

    TreeMap map = new TreeMap();

    Iterator itItems = null;

    if (o instanceof Model)
    {
      itItems = ModelConnector.getInstance().getModels().iterator();
    }
    else
    {
      Model model = ((ModelObject) o).getOwningModel();
      itItems = model.getItems(null);
    }

    while (itItems.hasNext())
    {
      Item item = (Item) itItems.next();

      String group = item.getFunctionalGroup();
      if (group != null)
      {
        map.put(group, group);
      }
    }

    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$SelectionMouseListener

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.