cbridgha | 012e1be | 2005-10-03 18:11:38 +0000 | [diff] [blame] | 1 | /*************************************************************************************************** |
| 2 | * Copyright (c) 2003, 2005 IBM Corporation and others. All rights reserved. This program and the |
| 3 | * accompanying materials are made available under the terms of the Eclipse Public License v1.0 |
| 4 | * which accompanies this distribution, and is available at |
| 5 | * http://www.eclipse.org/legal/epl-v10.html |
| 6 | * |
| 7 | * Contributors: IBM Corporation - initial API and implementation |
| 8 | **************************************************************************************************/ |
| 9 | package org.eclipse.wst.common.frameworks.internal.datamodel.ui; |
| 10 | |
cbridgha | 6f0ccc9 | 2005-11-17 22:01:07 +0000 | [diff] [blame] | 11 | import java.util.List; |
cbridgha | cea4918 | 2005-10-13 16:30:32 +0000 | [diff] [blame] | 12 | import java.util.Set; |
cbridgha | 012e1be | 2005-10-03 18:11:38 +0000 | [diff] [blame] | 13 | import java.util.Vector; |
cbridgha | c6f9eaa | 2005-12-06 16:35:55 +0000 | [diff] [blame] | 14 | |
| 15 | import org.eclipse.jface.wizard.IWizardPage; |
cbridgha | 012e1be | 2005-10-03 18:11:38 +0000 | [diff] [blame] | 16 | import org.eclipse.wst.common.frameworks.datamodel.IDataModel; |
| 17 | |
| 18 | public class SimplePageGroup implements AddablePageGroup { |
| 19 | private String groupID; |
| 20 | private String wizardID; |
| 21 | private boolean allowExtendedPages; |
| 22 | private String requiredDataOperation; |
cbridgha | cea4918 | 2005-10-13 16:30:32 +0000 | [diff] [blame] | 23 | private Set dataModelIDs; |
cbridgha | 012e1be | 2005-10-03 18:11:38 +0000 | [diff] [blame] | 24 | |
cbridgha | aa96c3b | 2005-10-11 17:02:35 +0000 | [diff] [blame] | 25 | private IDMPageHandler pageHandler; |
| 26 | private IDMPageGroupHandler pageGroupHandler; |
cbridgha | 012e1be | 2005-10-03 18:11:38 +0000 | [diff] [blame] | 27 | private Vector pages; |
| 28 | |
| 29 | public SimplePageGroup(String groupID, String wizardID, boolean allowExtendedPages, String requireDataOperation) { |
| 30 | this.groupID = groupID; |
| 31 | this.wizardID = wizardID; |
| 32 | this.allowExtendedPages = allowExtendedPages; |
| 33 | this.requiredDataOperation = requireDataOperation; |
| 34 | pages = new Vector(); |
| 35 | } |
| 36 | |
| 37 | public SimplePageGroup(String groupID, String wizardID) { |
| 38 | this(groupID, wizardID, true, null); |
| 39 | } |
| 40 | |
cbridgha | c6f9eaa | 2005-12-06 16:35:55 +0000 | [diff] [blame] | 41 | public void addPage(IWizardPage page) { |
cbridgha | 012e1be | 2005-10-03 18:11:38 +0000 | [diff] [blame] | 42 | pages.add(page); |
| 43 | } |
| 44 | |
cbridgha | c6f9eaa | 2005-12-06 16:35:55 +0000 | [diff] [blame] | 45 | public void addPages(IWizardPage[] newPages) { |
cbridgha | 012e1be | 2005-10-03 18:11:38 +0000 | [diff] [blame] | 46 | for (int index = 0; index < newPages.length; index++) { |
| 47 | pages.add(newPages[index]); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | public boolean getAllowsExtendedPages() { |
| 52 | return allowExtendedPages; |
| 53 | } |
| 54 | |
cbridgha | aa96c3b | 2005-10-11 17:02:35 +0000 | [diff] [blame] | 55 | public void setPageGroupHandler(IDMPageGroupHandler handler) { |
cbridgha | 012e1be | 2005-10-03 18:11:38 +0000 | [diff] [blame] | 56 | pageGroupHandler = handler; |
| 57 | } |
| 58 | |
cbridgha | aa96c3b | 2005-10-11 17:02:35 +0000 | [diff] [blame] | 59 | public IDMPageGroupHandler getPageGroupHandler(IDataModel dataModel) { |
cbridgha | 012e1be | 2005-10-03 18:11:38 +0000 | [diff] [blame] | 60 | return pageGroupHandler; |
| 61 | } |
| 62 | |
cbridgha | aa96c3b | 2005-10-11 17:02:35 +0000 | [diff] [blame] | 63 | public void setPageHandler(IDMPageHandler handler) { |
cbridgha | 012e1be | 2005-10-03 18:11:38 +0000 | [diff] [blame] | 64 | pageHandler = handler; |
| 65 | } |
| 66 | |
cbridgha | aa96c3b | 2005-10-11 17:02:35 +0000 | [diff] [blame] | 67 | public IDMPageHandler getPageHandler(IDataModel dataModel) { |
cbridgha | 012e1be | 2005-10-03 18:11:38 +0000 | [diff] [blame] | 68 | return pageHandler; |
| 69 | } |
| 70 | |
cbridgha | 6f0ccc9 | 2005-11-17 22:01:07 +0000 | [diff] [blame] | 71 | public List getPages(IDataModel dataModel) { |
| 72 | return pages; |
| 73 | } |
| 74 | |
cbridgha | c6f9eaa | 2005-12-06 16:35:55 +0000 | [diff] [blame] | 75 | public IWizardPage[] getExtendedPages(IDataModel dataModel) { |
| 76 | return (IWizardPage[]) pages.toArray(new IWizardPage[0]); |
cbridgha | 012e1be | 2005-10-03 18:11:38 +0000 | [diff] [blame] | 77 | } |
| 78 | |
| 79 | public String getPageGroupID() { |
| 80 | return groupID; |
| 81 | } |
| 82 | |
| 83 | public String getPageGroupInsertionID() { |
| 84 | return null; |
| 85 | } |
| 86 | |
| 87 | public String getRequiredDataOperationToRun() { |
| 88 | return requiredDataOperation; |
| 89 | } |
| 90 | |
| 91 | public String getWizardID() { |
| 92 | return wizardID; |
| 93 | } |
| 94 | |
cbridgha | cea4918 | 2005-10-13 16:30:32 +0000 | [diff] [blame] | 95 | public Set getDataModelIDs() { |
| 96 | return dataModelIDs; |
cbridgha | 012e1be | 2005-10-03 18:11:38 +0000 | [diff] [blame] | 97 | } |
| 98 | |
cbridgha | cea4918 | 2005-10-13 16:30:32 +0000 | [diff] [blame] | 99 | public void setDataModelIDs(Set dataModelIDs) { |
| 100 | this.dataModelIDs = dataModelIDs; |
cbridgha | 012e1be | 2005-10-03 18:11:38 +0000 | [diff] [blame] | 101 | } |
| 102 | } |