001: /**
002: * ChainBuilder ESB
003: * Visual Enterprise Integration
004: *
005: * Copyright (C) 2006 Bostech Corporation
006: *
007: * This program is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License as published by the
009: * Free Software Foundation; either version 2 of the License, or (at your option)
010: * any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
014: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
015: * for more details.
016: *
017: * You should have received a copy of the GNU General Public License along with
018: * this program; if not, write to the Free Software Foundation, Inc.,
019: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: *
021: *
022: * $Id$
023: */package com.bostechcorp.cbesb.ui.ide.customcomponent.wizard;
024:
025: import java.util.List;
026:
027: import org.eclipse.jface.viewers.ICellEditorValidator;
028: import org.eclipse.jface.wizard.WizardPage;
029: import org.eclipse.swt.SWT;
030: import org.eclipse.swt.widgets.Composite;
031:
032: import com.bostechcorp.cbesb.common.i18n.I18N;
033: import com.bostechcorp.cbesb.common.i18n.Messages;
034: import com.bostechcorp.cbesb.ui.ide.customcomponent.wizard.UIPagesPropertiesComposite.UIErrorsEnum;
035:
036: /**
037: * @author LPS
038: *
039: */
040: public class ProviderEditorWizardPage extends WizardPage {
041:
042: CBCCProjectCreationWizardPage mainPage;
043: UIPagesPropertiesComposite composite = null;
044:
045: protected ProviderEditorWizardPage(String pageName,
046: CBCCProjectCreationWizardPage mainPage) {
047: super (pageName);
048: this .mainPage = mainPage;
049: setTitle(I18N.getString(Messages.CBCC_PROVIDER_PAGE_TITLE));
050: setDescription(I18N
051: .getString(Messages.CBCC_PROVIDER_PAGE_DESCRIPTION));
052: }
053:
054: /* (non-Javadoc)
055: * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
056: */
057: public void createControl(Composite parent) {
058: composite = new UIPagesPropertiesComposite(parent, SWT.NULL);
059: composite.setFont(parent.getFont());
060:
061: composite.getPropertyNameEditor().setValidator(
062: new ICellEditorValidator() {
063:
064: public String isValid(Object value) {
065: updatePageComplete();
066: return null;
067: }
068: });
069:
070: composite.getPageNameEditor().setValidator(
071: new ICellEditorValidator() {
072:
073: public String isValid(Object value) {
074: updatePageComplete();
075: return null;
076: }
077: });
078:
079: setPageComplete(true);
080: // Show description on opening
081: setMessage(null);
082: setControl(composite);
083: }
084:
085: protected void updatePageComplete() {
086: setPageComplete(isPageValid());
087:
088: }
089:
090: public List<PagesModelTableItem> getPages() {
091: return composite.getPages();
092: }
093:
094: private boolean isPageValid() {
095: boolean valid = composite.isTableValid()
096: && composite.isTable1Valid();
097:
098: if (composite.ERROR == UIErrorsEnum.IDENTICAL_NAME_PAGE) {
099: setErrorMessage(I18N
100: .getString(Messages.CBCC_ERROR_IDENTICAL_PAGE_NAMES));
101: composite.ERROR = UIErrorsEnum.NO_ERROR;
102: //setPageComplete(valid);
103: return valid;
104: }
105: if (composite.ERROR == UIErrorsEnum.IDENTICAL_NAME_PROPERTY) {
106: setErrorMessage(I18N
107: .getString(Messages.CBCC_ERROR_IDENTICAL_PROPERTY_NAMES));
108: composite.ERROR = UIErrorsEnum.NO_ERROR;
109: //setPageComplete(valid);
110: return valid;
111: }
112: setErrorMessage(null);
113: composite.ERROR = UIErrorsEnum.NO_ERROR;
114: //setPageComplete(valid);
115: return valid;
116: }
117: }
|