Example #1
0
 protected PanelElementAbstract createPanelElement(BasicDBObject DBO, int idx) {
   T t;
   try {
     t = clazz.newInstance();
     t.setIdx(idx);
     t.setDisplayer(panelDisplayer);
     t.setData(DBO);
     t.initPanel();
     PanelElementAbstract b;
     if (t instanceof ParameterPanel) {
       b = new PanelElementMono((ParameterPanel) t, this, maxNb > 1 && idx >= minNb, idx);
     } else {
       b =
           new PanelElementPlugin(
               (ParameterPanelPlugin) t, this, maxNb > 1 && idx >= minNb, enableTest);
       if (template != null && idx < template.panelElements.size())
         ((PanelElementPlugin) b)
             .setTemplate((PanelElementPlugin) template.panelElements.get(idx));
     }
     // System.out.println("panelElement null:"+(b==null)+ " idx:"+idx+ " "+DBO);
     return b;
   } catch (Exception e) {
     exceptionPrinter.print(e, "", Core.GUIMode);
   }
   return null;
 }
Example #2
0
  private <T extends Enum<T>> String getPropertyValue(T algo) {
    StringBuilder strb = new StringBuilder();

    for (T it : active.algos(algo)) {
      strb.append(it.name());
      strb.append(';');
    }
    return strb.toString();
  }
  /** should be invoked in read action */
  private DefaultTreeModel buildModel() {
    final DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode();
    final Ref<Integer> count = new Ref<Integer>(0);
    final FactoryMap<MemberChooserObject, ParentNode> map =
        new FactoryMap<MemberChooserObject, ParentNode>() {
          @Override
          protected ParentNode create(final MemberChooserObject key) {
            ParentNode node = null;
            DefaultMutableTreeNode parentNode = rootNode;

            if (supportsNestedContainers() && key instanceof ClassMember) {
              MemberChooserObject parentNodeDelegate = ((ClassMember) key).getParentNodeDelegate();

              if (parentNodeDelegate != null) {
                parentNode = get(parentNodeDelegate);
              }
            }
            if (isContainerNode(key)) {
              final ContainerNode containerNode = new ContainerNode(parentNode, key, count);
              node = containerNode;
              myContainerNodes.add(containerNode);
            }
            if (node == null) {
              node = new ParentNode(parentNode, key, count);
            }
            return node;
          }
        };

    for (T object : myElements) {
      final ParentNode parentNode = map.get(object.getParentNodeDelegate());
      final MemberNode elementNode = createMemberNode(count, object, parentNode);
      myNodeToParentMap.put(elementNode, parentNode);
      myElementToNodeMap.put(object, elementNode);
    }
    return new DefaultTreeModel(rootNode);
  }
Example #4
0
 public static <T extends Enum<T>> String getPropertyID(T algo) {
   Class<T> clazz = algo.getDeclaringClass();
   return "net.java.sip.communicator." + clazz.getName().replace('$', '_');
 }