View Javadoc

1   /*
2    * Copyright 2006 - 2012 Christina Bohk and Roland Ewald
3    *  
4    * Licensed under the Apache License, Version 2.0 (the "License"); 
5    * you may not use this file except in compliance with the License. 
6    * You may obtain a copy of the License at 
7    *  
8    *  http://www.apache.org/licenses/LICENSE-2.0
9    *  
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
13   * See the License for the specific language governing permissions and 
14   * limitations under the License. 
15   */
16  package p3j.gui.panels.projections;
17  
18  import javax.swing.JPanel;
19  import javax.swing.tree.TreePath;
20  
21  import p3j.gui.misc.SubNodeSummary;
22  import p3j.gui.panels.PropertiesShowPanelFactory;
23  import p3j.pppm.SubPopulation;
24  import p3j.pppm.parameters.ParameterInstance;
25  import p3j.pppm.parameters.Population;
26  
27  /**
28   * Node that represents a {@link Population}.
29   * 
30   * Created: August 24, 2008
31   * 
32   * @author Christina Bohk
33   * @author Roland Ewald
34   * 
35   */
36  public class SubPopulationNode extends ProjectionTreeNode<SubPopulation> {
37  
38    /** Serialization ID. */
39    private static final long serialVersionUID = 6366143563278777563L;
40  
41    /**
42     * Default constructor.
43     * 
44     * @param subPopulation
45     *          the sub-population to be represented
46     */
47    public SubPopulationNode(SubPopulation subPopulation) {
48      super(subPopulation, subPopulation.getName());
49    }
50  
51    @Override
52    public JPanel selected(TreePath selectionPath, final IProjectionTree projTree) {
53      PropertiesShowPanelFactory pspf = new PropertiesShowPanelFactory();
54      pspf.sep("General Information");
55      pspf.app("Subpopulation:", getEntity());
56      pspf.app("Parameters:", this.getChildCount());
57      pspf.appPreview(new SubNodeSummary<ParameterInstance>(this, projTree,
58          ParameterInstance.class));
59      return pspf.constructPanel();
60    }
61  }