View Javadoc

1   package org.ximtec.igesture.tool.core;
2   
3   import javax.swing.JSplitPane;
4   
5   import org.ximtec.igesture.tool.util.ComponentFactory;
6   
7   public class DefaultSplitPane extends JSplitPane {
8   
9     private static final int DIVIDER_LOCATION = 240;
10    private Controller controller;
11  
12    public DefaultSplitPane(Controller controller) {
13      super(JSplitPane.HORIZONTAL_SPLIT);
14      
15      setDividerLocation(DIVIDER_LOCATION);
16      
17      this.controller = controller;
18      if (this.controller == null) {
19        throw new RuntimeException("Controller must not be null.");
20      }
21    }
22  
23    /**
24     * Returns the controller instance of the view
25     * 
26     * @return the controller of the view
27     */
28    public Controller getController() {
29      return controller;
30    }
31  
32    /**
33     * Returns the component factory
34     * 
35     * @return the component factory
36     */
37    public ComponentFactory getComponentFactory() {
38      return controller.getLocator().getService(ComponentFactory.class.getName(), ComponentFactory.class);
39    }
40  
41  }