01: package org.drools.brms.client;
02:
03: /*
04: * Copyright 2005 JBoss Inc
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: import java.util.Collection;
20: import java.util.Collections;
21: import java.util.HashMap;
22: import java.util.Map;
23:
24: import com.google.gwt.user.client.ui.Composite;
25:
26: /**
27: * A 'feature' is a single panel of the JBRMS console. They are meant to be
28: * lazily instantiated so that the application doesn't pay for all of them on
29: * startup.
30: */
31: public abstract class JBRMSFeature extends Composite {
32:
33: static Map openedViewers = new HashMap();
34:
35: /**
36: * Encapsulated information about a JBRMS Feature. Each component is
37: * expected to have a static <code>init()</code> method that will be
38: * called by the layout on startup.
39: */
40: public abstract static class ComponentInfo {
41: private JBRMSFeature instance;
42: private String name, description;
43:
44: public ComponentInfo(String name, String desc) {
45: this .name = name;
46: description = desc;
47: }
48:
49: public abstract JBRMSFeature createInstance();
50:
51: public String getDescription() {
52: return description;
53: }
54:
55: public final JBRMSFeature getInstance() {
56: if (instance != null)
57: return instance;
58: return (instance = createInstance());
59: }
60:
61: public String getName() {
62: return name;
63: }
64: }
65:
66: /**
67: * Called just before this sink is hidden.
68: */
69: public void onHide() {
70: }
71:
72: /**
73: * Called just after this sink is shown.
74: */
75: public void onShow() {
76: }
77: }
|