| | |
| | | |
| | | import org.opends.quicksetup.event.ButtonActionListener; |
| | | import org.opends.quicksetup.installer.FieldName; |
| | | import org.opends.quicksetup.installer.Installer; |
| | | import org.opends.quicksetup.*; |
| | | import org.opends.quicksetup.util.Utils; |
| | | |
| | | /** |
| | | * This is the class that contains the panel on the right-top part of the |
| | |
| | | { |
| | | private static final long serialVersionUID = 5474803491510999334L; |
| | | |
| | | private HashMap<Step, QuickSetupStepPanel> hmPanels = |
| | | new HashMap<Step, QuickSetupStepPanel>(); |
| | | private HashMap<WizardStep, QuickSetupStepPanel> hmPanels = |
| | | new HashMap<WizardStep, QuickSetupStepPanel>(); |
| | | |
| | | private Application application; |
| | | |
| | | /** |
| | | * The constructor of this class. |
| | |
| | | */ |
| | | public CurrentStepPanel(Application app) |
| | | { |
| | | this.application = app; |
| | | createLayout(app); |
| | | } |
| | | |
| | |
| | | public Object getFieldValue(FieldName fieldName) |
| | | { |
| | | Object value = null; |
| | | for (Step s : hmPanels.keySet()) |
| | | for (WizardStep s : hmPanels.keySet()) |
| | | { |
| | | value = getPanel(s).getFieldValue(fieldName); |
| | | if (value != null) |
| | |
| | | */ |
| | | public void displayFieldInvalid(FieldName fieldName, boolean invalid) |
| | | { |
| | | for (Step s : hmPanels.keySet()) |
| | | for (WizardStep s : hmPanels.keySet()) |
| | | { |
| | | getPanel(s).displayFieldInvalid(fieldName, invalid); |
| | | } |
| | |
| | | private void createLayout(Application app) |
| | | { |
| | | |
| | | Set<Step> steps = app.getWizardSteps(); |
| | | Set<WizardStep> steps = app.getWizardSteps(); |
| | | if (steps != null) { |
| | | for (Step step : steps) { |
| | | for (WizardStep step : steps) { |
| | | QuickSetupStepPanel panel = app.createWizardStepPanel(step); |
| | | if (panel != null) { |
| | | hmPanels.put(step, panel); |
| | |
| | | int minWidth = 0; |
| | | int minHeight = 0; |
| | | setLayout(new CardLayout()); |
| | | for (Step s : hmPanels.keySet()) |
| | | for (WizardStep s : hmPanels.keySet()) |
| | | { |
| | | minWidth = Math.max(minWidth, getPanel(s).getMinimumWidth()); |
| | | minHeight = Math.max(minHeight, getPanel(s).getMinimumHeight()); |
| | |
| | | } |
| | | |
| | | // For aesthetical reasons we add a little bit of height |
| | | if (!Utils.isUninstall()) |
| | | // TODO: remove this hack |
| | | if (application instanceof Installer) |
| | | { |
| | | minHeight += UIFactory.EXTRA_DIALOG_HEIGHT; |
| | | } |
| | |
| | | */ |
| | | public void addButtonActionListener(ButtonActionListener l) |
| | | { |
| | | for (Step s : hmPanels.keySet()) |
| | | for (WizardStep s : hmPanels.keySet()) |
| | | { |
| | | getPanel(s).addButtonActionListener(l); |
| | | } |
| | |
| | | */ |
| | | public void removeButtonActionListener(ButtonActionListener l) |
| | | { |
| | | for (Step s : hmPanels.keySet()) |
| | | for (WizardStep s : hmPanels.keySet()) |
| | | { |
| | | getPanel(s).removeButtonActionListener(l); |
| | | } |
| | |
| | | * @param userData the UserData object that must be used to populate |
| | | * the panels. |
| | | */ |
| | | public void setDisplayedStep(Step step, UserData userData) |
| | | public void setDisplayedStep(WizardStep step, UserData userData) |
| | | { |
| | | CardLayout cl = (CardLayout) (getLayout()); |
| | | getPanel(step).beginDisplay(userData); |
| | |
| | | */ |
| | | public void displayProgress(ProgressDescriptor descriptor) |
| | | { |
| | | for (Step s : hmPanels.keySet()) |
| | | for (WizardStep s : hmPanels.keySet()) |
| | | { |
| | | getPanel(s).displayProgress(descriptor); |
| | | } |
| | |
| | | * @param step the step for which we want to get the panel. |
| | | * @return the panel for the provided step. |
| | | */ |
| | | private QuickSetupStepPanel getPanel(Step step) |
| | | private QuickSetupStepPanel getPanel(WizardStep step) |
| | | { |
| | | return hmPanels.get(step); |
| | | } |