コード例 #1
0
 private static void addChildFrameworks(
     final List<FrameworkSupportNodeBase> list, final List<FrameworkSupportNode> result) {
   for (FrameworkSupportNodeBase node : list) {
     if (node.isChecked() || node instanceof FrameworkGroupNode) {
       if (node instanceof FrameworkSupportNode) {
         result.add((FrameworkSupportNode) node);
       }
       //noinspection unchecked
       addChildFrameworks(node.getChildren(), result);
     }
   }
 }
コード例 #2
0
  public void setAssociatedFrameworks() {

    if (myAssociatedFrameworksPanel == null) return;
    for (FrameworkSupportNodeBase nodeBase : myAssociatedFrameworks) {
      if (nodeBase instanceof FrameworkSupportNode) {
        ((FrameworkSupportNode) nodeBase).getConfigurable().onFrameworkSelectionChanged(true);
        FrameworkSupportOptionsComponent component =
            initializeOptionsPanel((FrameworkSupportNode) nodeBase, false);
        addAssociatedFrameworkComponent(component.getMainPanel(), myAssociatedFrameworksPanel);
      } else {
        JPanel panel = initializeGroupPanel((FrameworkGroup<?>) nodeBase.getUserObject(), false);
        addAssociatedFrameworkComponent(panel, myAssociatedFrameworksPanel);
      }
    }
  }
コード例 #3
0
  private Collection<FrameworkSupportNodeBase> createNodes(
      List<FrameworkSupportInModuleProvider> providers,
      Set<String> associated,
      final Set<String> preselected) {
    Map<String, FrameworkSupportNode> nodes = new HashMap<String, FrameworkSupportNode>();
    Map<FrameworkGroup<?>, FrameworkGroupNode> groups =
        new HashMap<FrameworkGroup<?>, FrameworkGroupNode>();
    List<FrameworkSupportNodeBase> roots = new ArrayList<FrameworkSupportNodeBase>();
    Map<String, FrameworkSupportNodeBase> associatedNodes =
        new LinkedHashMap<String, FrameworkSupportNodeBase>();
    for (FrameworkSupportInModuleProvider provider : providers) {
      createNode(provider, nodes, groups, roots, providers, associated, associatedNodes);
    }

    FrameworkSupportNodeBase.sortByName(
        roots,
        new Comparator<FrameworkSupportNodeBase>() {
          @Override
          public int compare(FrameworkSupportNodeBase o1, FrameworkSupportNodeBase o2) {
            return Comparing.compare(
                preselected.contains(o2.getId()), preselected.contains(o1.getId()));
          }
        });
    myRoots = roots;
    return associatedNodes.values();
  }
コード例 #4
0
 private void updateOptionsPanel() {
   final FrameworkSupportNodeBase node = getSelectedNode();
   if (node instanceof FrameworkSupportNode) {
     FrameworkSupportNode frameworkSupportNode = (FrameworkSupportNode) node;
     initializeOptionsPanel(frameworkSupportNode, true);
     showCard(frameworkSupportNode.getId());
     UIUtil.setEnabled(myOptionsPanel, frameworkSupportNode.isChecked(), true);
     frameworkSupportNode.getConfigurable().onFrameworkSelectionChanged(node.isChecked());
   } else if (node instanceof FrameworkGroupNode) {
     FrameworkGroup<?> group = ((FrameworkGroupNode) node).getUserObject();
     initializeGroupPanel(group, true);
     showCard(group.getId());
     UIUtil.setEnabled(myOptionsPanel, true, true);
   } else {
     showCard(EMPTY_CARD);
   }
 }
コード例 #5
0
  public void setProviders(
      List<FrameworkSupportInModuleProvider> providers,
      Set<String> associated,
      Set<String> preselected) {
    myProviders = providers;

    myAssociatedFrameworks = createNodes(myProviders, associated, preselected);
    for (FrameworkSupportNodeBase node : myRoots) {
      if (preselected.contains(node.getId())) {
        node.setChecked(true);
      }
    }
    setAssociatedFrameworks();

    myFrameworksTree.setRoots(myRoots);
    myFrameworksTree.setSelectionRow(0);
  }