001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019: package org.apache.axis2.tools.component;
020:
021: import javax.swing.*;
022:
023: /**
024: * this is wizardPanel it is extends from Jpanel
025: */
026: public class WizardPanel extends JPanel {
027:
028: //variables
029:
030: private WizardComponents wizardComponents;
031: private String panelTopTitle;
032: private ImageIcon panelImage;
033: private String panelBottomTitle;
034: private String error;
035: private String frametitle;
036: private boolean flag;
037: private boolean progressFlag;
038: public static final int WSDL_2_JAVA_TYPE = 1;
039: public static final int JAVA_2_WSDL_TYPE = 2;
040: public static final int SERVICE_ARCHIVE_TYPE = 3;
041: public static final int UNSPECIFIED_TYPE = 4;
042: private boolean isPageComplete = false;
043:
044: public WizardPanel(WizardComponents wizardComponents) {
045: this (wizardComponents, null);
046: }
047:
048: public WizardPanel(WizardComponents wizardComponents, String title) {
049: this .wizardComponents = wizardComponents;
050: this .frametitle = title;
051: java.net.URL resource = WizardPanel.class
052: .getResource("/icons/asf-feather.png");
053: setPanelImage(new ImageIcon(resource));
054: }
055:
056: public void update() {
057: }
058:
059: public void next() {
060: goNext();
061: }
062:
063: public void back() {
064: goBack();
065: }
066:
067: public WizardComponents getWizardComponents() {
068: return wizardComponents;
069: }
070:
071: public void setWizardComponents(WizardComponents awizardComponents) {
072: wizardComponents = awizardComponents;
073: }
074:
075: // Title
076: public String getPanelTopTitle() {
077: return panelTopTitle;
078: }
079:
080: public void setPanelTopTitle(String title) {
081: panelTopTitle = title;
082: }
083:
084: public String getPanelBottomTitle() {
085: return panelBottomTitle;
086: }
087:
088: public void setPanelBottomTitle(String title) {
089: panelBottomTitle = title;
090: }
091:
092: // Image
093: public ImageIcon getPanelImage() {
094: return panelImage;
095: }
096:
097: public void setPanelImage(ImageIcon image) {
098: panelImage = image;
099: }
100:
101: //error
102: public String getError() {
103: return error;
104: }
105:
106: public boolean getErrorFlag() {
107: return flag;
108: }
109:
110: public void setError(String error, boolean flag) {
111: this .error = error;
112: this .flag = flag;
113: }
114:
115: // progress panel visible flag
116: public void setProgressPanelVisible(boolean flag) {
117: this .progressFlag = flag;
118: }
119:
120: public boolean getProgressPanelVisible() {
121: return progressFlag;
122: }
123:
124: public String getFrameTitle() {
125: return this .frametitle;
126: }
127:
128: public void setFrameTitle(String title) {
129: this .frametitle = title;
130: }
131:
132: // next
133: protected boolean goNext() {
134: if (wizardComponents.getWizardPanelList().size() > wizardComponents
135: .getCurrentIndex() + 1) {
136: wizardComponents.setCurrentIndex(wizardComponents
137: .getCurrentIndex() + 1);
138: wizardComponents.updateComponents();
139: return true;
140: } else {
141: return false;
142: }
143: }
144:
145: //back
146: protected boolean goBack() {
147: if (wizardComponents.getCurrentIndex() - 1 >= 0) {
148: wizardComponents.setCurrentIndex(wizardComponents
149: .getCurrentIndex() - 1);
150: wizardComponents.updateComponents();
151: return true;
152: } else {
153: return false;
154: }
155: }
156:
157: public void switchPanel(int panelIndex) {
158: getWizardComponents().setCurrentIndex(panelIndex);
159: getWizardComponents().updateComponents();
160: }
161:
162: /** this method used for set Button Enabled */
163: protected void setBackButtonEnabled(boolean set) {
164: wizardComponents.getBackButton().setEnabled(set);
165: }
166:
167: protected void setNextButtonEnabled(boolean set) {
168: wizardComponents.getNextButton().setEnabled(set);
169: }
170:
171: protected void setFinishButtonEnabled(boolean set) {
172: wizardComponents.getFinishButton().setEnabled(set);
173: }
174:
175: /** this method used for to get type of wizard panel*/
176: public int getPageType() {
177: return WizardPanel.UNSPECIFIED_TYPE;
178: }
179:
180: /** this method used for check is page complete */
181: public boolean isPageComplete() {
182: return isPageComplete;
183: }
184:
185: /** this method used for set page complete*/
186: public void setPageComplete(boolean complete) {
187: isPageComplete = complete;
188: }
189:
190: }
|