Exemplo n.º 1
0
 protected String getResoureName(FVResourceNode resource) {
   if (resource == null) {
     return "";
   }
   if (resource.isPort()) {
     return resource.getParent().getName() + ":" + resource.getName();
   } else {
     return resource.getName();
   }
 }
Exemplo n.º 2
0
  public void setSelectedResources(FVResourceNode[] resources) {
    resourcesPanel.removeAll();
    if (resources == null || resources.length == 0) {
      return;
    }

    GridBagConstraints gc = new GridBagConstraints();
    gc.fill = GridBagConstraints.HORIZONTAL;
    gc.gridwidth = GridBagConstraints.REMAINDER;
    gc.weightx = 1;
    gc.insets = new Insets(0, 2, 0, 2);
    for (int i = 0; i < resources.length; i++) {
      FVResourceNode resource = resources[i];
      JLabel label = ComponentFactory.getH4Label(getResoureName(resource), Font.PLAIN);
      label.setIcon(resource.getType().getIcon());
      label.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.INTEL_BORDER_GRAY));
      style.decorateKey(label, i);
      resourcesPanel.add(label, gc);
    }
    gc.weighty = 1;
    gc.fill = GridBagConstraints.BOTH;
    resourcesPanel.add(Box.createGlue(), gc);
  }