001 package insertWizard.ide;
002
003 import com.bea.ide.control.ControlWizardSimple;
004 import javax.swing.JComponent;
005 import java.util.ArrayList;
006 import com.bea.ide.control.EditorContext;
007
008 /*
009 * The insert-wizard-class attribute in the jc-jar file for this
010 * control project specifies that this is the class WebLogic Workshop
011 * should use to provide a custom insert wizard.
012 *
013 * This class extends ControlWizardSimple, which provides methods through
014 * which WebLogic Workshop retrieves the user interface to use, the
015 * annotation values to insert into the control's container, and so on.
016 */
017 public class ServerCheckWizard extends ControlWizardSimple
018 {
019 private ServerCheckWizardPanel m_panel;
020 private boolean _createExtension = false;
021 private EditorContext _context;
022
023 /*
024 * Initializes the user interface. UI components
025 * are assembled in the ServerCheckWizardPanel class.
026 */
027 public ServerCheckWizard ()
028 {
029 m_panel = new ServerCheckWizardPanel();
030 }
031
032 /*
033 * Tells WebLogic Workshop whether to display an option
034 * to create a JCX file. The constant returned here
035 * tells it that an instance is all that is needed.
036 */
037 public int getConfigurationInfo()
038 {
039 return CONFIG_INSERT_INSTANCE;
040 }
041 /**
042 * Gives the wizard a way to interact with the IDE.
043 */
044 public void setContext(EditorContext ctx)
045 {
046 _context = ctx;
047 m_panel.setContext(ctx);
048 }
049
050 /**
051 * Provides a way for subclasses to get the context as needed.
052 */
053 public EditorContext getContext()
054 {
055 return _context;
056 }
057
058 /*
059 * Returns the user interface component to use.
060 */
061 public JComponent getComponent()
062 {
063 return m_panel;
064 }
065
066 /*
067 * Provides a place to execute code when the control's user
068 * clicks the "Create" button on the insert dialog.
069 */
070 public boolean onFinish()
071 {
072 if (super.onFinish() == false){
073 return false;
074 } else {
075 return true;
076 }
077 }
078
079 /*
080 * Provides to WebLogic Workshop an ArrayList containing
081 * the annotations it should write preceding the control
082 * instance.
083 */
084 public ArrayList getInstanceAnnotations()
085 {
086 // An ArrayList for the annotation attributes. There are four.
087 ArrayList attributeList = new ArrayList();
088 // An ArrayList for this control's two annotations.
089 ArrayList annotationsList = new ArrayList();
090
091 /*
092 * The attribute ArrayList is filled with TagAttributeValue
093 * instances containing attribute name/value mappings. These
094 * are used below for the jc:server-data annotation.
095 *
096 * Attribute values are retrieved from the insert dialog box UI.
097 */
098 attributeList.add(new TagAttributeValue("server-name", m_panel.getServerName()));
099 attributeList.add(new TagAttributeValue("url", m_panel.getServerURL()));
100 attributeList.add(new TagAttributeValue("user-name", m_panel.getUserName()));
101 attributeList.add(new TagAttributeValue("password", m_panel.getPassword()));
102
103 /*
104 * The annotation ArrayList is filled with TagAttributeList instances
105 * containing the annotation name/attribute-list mappings.
106 * Note that the second annotation uses the attribute ArrayList.
107 */
108 annotationsList.add(new TagAttributeList("common:control", null));
109 annotationsList.add(new TagAttributeList("jc:server-data", attributeList));
110 return annotationsList;
111 }
112 }
|