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  
19  import javax.swing.JPanel;
20  import javax.swing.tree.TreePath;
21  
22  import p3j.gui.misc.SubNodeSummary;
23  import p3j.gui.panels.PropertiesShowPanelFactory;
24  import p3j.pppm.parameters.ParameterInstance;
25  import p3j.pppm.parameters.Population;
26  
27  
28  /**
29   * Node that represents a {@link Population}.
30   * 
31   * Created: August 24, 2008
32   * 
33   * @author Christina Bohk
34   * @author Roland Ewald
35   * 
36   */
37  public class PopulationNode extends ProjectionTreeNode<Population> {
38  
39    /**
40     * Serialization ID.
41     */
42    private static final long serialVersionUID = 6366143563278777563L;
43  
44    /**
45     * Default constructor.
46     * 
47     * @param population
48     *          the population to be represented
49     */
50    public PopulationNode(Population population) {
51      super(population, population.toString());
52    }
53  
54    @Override
55    public JPanel selected(TreePath selectionPath, final IProjectionTree projTree) {
56      PropertiesShowPanelFactory pspf = new PropertiesShowPanelFactory();
57      pspf.sep("General Information");
58      pspf.app("Population:", getEntity());
59      pspf.app("Parameters:", this.getChildCount());
60      pspf.appPreview(new SubNodeSummary<ParameterInstance>(this, projTree,
61          ParameterInstance.class));
62      return pspf.constructPanel();
63    }
64  }