1 /***
2 *
3 */
4 package org.astrogrid.desktop.modules.ui;
5
6 import java.util.List;
7
8 import org.astrogrid.acr.ivoa.resource.Resource;
9
10 /*** Factory that builds instances of astroscope.
11 * used to enable more than one instance under hivemind.
12 * also can be used later to pre-fetch shared resources (e.g. registry queries)
13 * and as a point to hang 'SendTo' actions, Tupperware processors, and AR methods
14 * that imply creating a new instance of astroscope.
15 * @author Noel Winstanley
16 * @since Jun 21, 20066:49:30 PM
17 */
18 public class AstroScopeFactory implements AstroScopeInternal{
19
20 public AstroScopeFactory(final TypesafeObjectBuilder builder) {
21 this.builder = builder;
22 }
23 private final TypesafeObjectBuilder builder;
24 public void show() {
25 newWindow();
26 }
27
28 public void runSubset(final List<? extends Resource> resources) {
29 final AstroScopeInternal i = newWindow();
30 i.runSubset(resources) ;
31 }
32 public void runSubsetAsHelioscope(final List<? extends Resource> resources) {
33 final AstroScopeInternal i = newWindow();
34 i.runSubsetAsHelioscope(resources) ;
35 }
36
37 public Object create() {
38 return newWindow();
39 }
40
41 private AstroScopeLauncherImpl newWindow() {
42 final AstroScopeLauncherImpl i = builder.createAstroscope();
43 i.show();
44 return i;
45 }
46
47 }