sticky documentation popup [take 1]
[fedora-idea.git] / platform / platform-impl / src / com / intellij / ui / wizard / WizardStep.java
blobac5511a03023f08b304b8fca07ef8f35b4590da2
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.intellij.ui.wizard;
18 import com.intellij.openapi.util.IconLoader;
20 import javax.swing.*;
22 public abstract class WizardStep<T extends WizardModel> {
24 public static final WizardStep FORCED_GOAL_DROPPED = new Empty();
25 public static final WizardStep FORCED_GOAL_ACHIEVED = new Empty();
27 private String myTitle = "";
28 private String myExplanation = "";
29 //todo:
30 private Icon myIcon = IconLoader.getIcon("/newprojectwizard.png");
31 private String myHelpId;
33 protected WizardStep() {
36 public WizardStep(String title) {
37 myTitle = title;
40 public WizardStep(String title, String explanation) {
41 myTitle = title;
42 myExplanation = explanation;
45 public WizardStep(String title, String explanation, Icon icon) {
46 myTitle = title;
47 myExplanation = explanation;
48 myIcon = icon;
51 public WizardStep(String title, String explanation, Icon icon, String helpId) {
52 myTitle = title;
53 myExplanation = explanation;
54 myIcon = icon;
55 myHelpId = helpId;
58 public String getTitle() {
59 return myTitle;
62 public String getExplanation() {
63 return myExplanation;
66 public abstract JComponent prepare(WizardNavigationState state);
68 public WizardStep onNext(T model) {
69 return model.getNextFor(this);
72 public WizardStep onPrevious(T model) {
73 return model.getPreviousFor(this);
76 public boolean onCancel() {
77 return true;
80 public boolean onFinish() {
81 return true;
84 public Icon getIcon() {
85 return myIcon;
88 public String getHelpId() {
89 return myHelpId;
92 public static class Empty extends WizardStep {
93 public JComponent prepare(WizardNavigationState state) {
94 return null;