@Override public void handlePageChanging(final PageChangingEvent event) { // Assume success event.doit = true; // Get the current and target pages WizardPage currPage = (WizardPage)event.getCurrentPage(); WizardPage targetPage = (WizardPage)event.getTargetPage(); if ((currPage instanceof AlwStartPage) && (targetPage instanceof AlwPropertiesPage)) { // Moving from first to second page LayoutConfig lc = getStartPage().getSelectedLayoutConfig(); if (lc != null) { String errorMsg = "This configuration is in a library that is not yet enabled in this application.\nEnabling the library will add it as a dependency in Xsp Properties.\nXsp Properties is currently open in another editor and cannot be modified.\nClose Xsp Properties in order to proceed."; // $NLX-ApplicationLayoutDropWizard.Thisconfigurationisinalibrarythat-1$ String proceedMsg = "This configuration is in a library that is not yet enabled in this application.\nEnabling the library will add it as a dependency in Xsp Properties.\nClick Continue to update your Xsp Properties."; // $NLX-ApplicationLayoutDropWizard.Thisconfigurationisinalibrarythat.1-1$ event.doit = WizardUtils.findStandardDefAndAddDependency(lc.facesDef.getNamespaceUri(), lc.tagName, _panelData.getDesignerProject(), errorMsg, proceedMsg); } } }
@Override public void handlePageChanging(PageChangingEvent event) { event.doit = true; advancing = false; if (event.getCurrentPage() == _viewPage) { if (event.getTargetPage() == _restPage) { if (_viewPage.hasChanged()) { // We want the rest page to reload it's data _restPage.setFirstDisplay(true); _viewPage.setHasChanged(false); } advancing = true; } } else if (event.getCurrentPage() == _restPage) { if (event.getTargetPage() == _actionPage) { advancing = true; } } else if (event.getCurrentPage() == _actionPage) { if (event.getTargetPage() == _eventPage) { advancing = true; } } }
/** * Notifies any page changing listeners that the currently selected dialog * page is changing. Only listeners registered at the time this method is * called are notified. * * @param event * a selection changing event * * @see IPageChangingListener#handlePageChanging(PageChangingEvent) * @since 3.3 */ protected void firePageChanging(final PageChangingEvent event) { Object[] listeners = pageChangingListeners.getListeners(); for (int i = 0; i < listeners.length; ++i) { final IPageChangingListener l = (IPageChangingListener) listeners[i]; SafeRunnable.run(new SafeRunnable() { public void run() { l.handlePageChanging(event); } }); } }
@Override public void handlePageChanging(PageChangingEvent event) { if (event.getTargetPage() == fixesPage) { if (!runFixViolations()) { event.doit = false; } } }
@Override public void handlePageChanging(PageChangingEvent event) { event.doit = true; advancing = false; if (event.getCurrentPage() == _zipFilePage) { if (event.getTargetPage() == _importCopyMethodPage) { advancing = true; } } else if (event.getCurrentPage() == _importCopyMethodPage) { if (event.getTargetPage() == _dirPage) { advancing = true; } } else if (event.getCurrentPage() == _dirPage) { if (event.getTargetPage() == _deployCopyMethodPage) { advancing = true; } } else if (event.getCurrentPage() == _deployCopyMethodPage) { if (event.getTargetPage() == _orgSpacePage) { advancing = true; if (_orgSpacePage.isFirstDisplay()) { if (!runJob(_orgSpacePage.getOrgsAndSpaces)) { event.doit = false; } } } } }
@Override public void handlePageChanging(PageChangingEvent event) { // Get the current and target pages WizardBasePage currPage = (WizardBasePage)event.getCurrentPage(); WizardBasePage targetPage = (WizardBasePage)event.getTargetPage(); // Check that the Next button has been pressed if ((currPage.getStepNumber() < targetPage.getStepNumber()) || (targetPage.getStepNumber() < 0)) { event.doit = currPage.validatePage(); } else { event.doit = true; } }
@Override public void handlePageChanging(final PageChangingEvent event) { if (isCurrentPage() && !event.getTargetPage().equals(getPreviousPage())) { // Check that Codenvy authentication is OK try { CodenvyPlugin.getDefault() .getCodenvyBuilder(getURL(), getUsername()) .withCredentials(CodenvyAPI.getClient().newCredentialsBuilder().withUsername(getUsername()) .withPassword(getPassword()).build()) .build() .user() .current() .execute(); // Add the new location to preferences final IPreferenceStore codenvyPreferenceStore = CodenvyUIPlugin.getDefault().getPreferenceStore(); final String[] locations = CodenvyPreferencesInitializer.parseString(codenvyPreferenceStore.getString(CodenvyPreferencesInitializer.REMOTE_REPOSITORIES_LOCATION_KEY_NAME)); if (!asList(locations).contains(urls.getText())) { codenvyPreferenceStore.setValue(CodenvyPreferencesInitializer.REMOTE_REPOSITORIES_LOCATION_KEY_NAME, CodenvyPreferencesInitializer.createList(ObjectArrays.concat(urls.getText(), locations))); } setErrorMessage(null); } catch (CodenvyException e) { setErrorMessage(AUTHENTICATION_ERROR_MESSAGE); event.doit = false; } } }
@Override public void handlePageChanging(PageChangingEvent event) { Object currentPage = event.getCurrentPage(); Object nextPage = event.getTargetPage(); if(currentPage == getFirstPage() && nextPage == getSecondPage()) { event.doit = changeToNewProject(); } else if(currentPage == getSecondPage() && nextPage == getFirstPage()) { removeProject(); } }
@Override public void handlePageChanging(PageChangingEvent event) { event.doit = true; advancing = false; if (event.getCurrentPage() == _dirPage) { if (_dirPage.hasChanged()) { _configPage.setFirstDisplay(true); _manifestPage.setFirstDisplay(true); _dirPage.setHasChanged(false); } if (event.getTargetPage() == _configPage) { advancing = true; } else if (event.getTargetPage() == _copyMethodPage) { advancing = true; } } else if (event.getCurrentPage() == _configPage) { if (event.getTargetPage() == _copyMethodPage) { advancing = true; } } else if (event.getCurrentPage() == _copyMethodPage) { if (event.getTargetPage() == _cloudSpacePage) { advancing = true; if(_cloudSpacePage.isFirstDisplay()) { if (!runJob(_cloudSpacePage.getOrgsAndSpaces)) { event.doit = false; } } } } else if (event.getCurrentPage() == _cloudSpacePage) { if (_cloudSpacePage.hasChanged()) { _namePage.setFirstDisplay(true); _cloudSpacePage.setHasChanged(false); } if (event.getTargetPage() == _namePage) { advancing = true; if (_namePage.isFirstDisplay()) { _namePage.setCloudSpace(_cloudSpacePage.getOrg(), _cloudSpacePage.getSpace()); if (!runJob(_namePage.getApplications)) { event.doit = false; } } } else if (event.getTargetPage() == _manifestPage) { advancing = true; } } else if (event.getCurrentPage() == _manifestPage) { if (event.getTargetPage() == _namePage) { advancing = true; if (_namePage.isFirstDisplay()) { _namePage.setCloudSpace(_cloudSpacePage.getOrg(), _cloudSpacePage.getSpace()); if (!runJob(_namePage.getApplications)) { event.doit = false; } } } } }
@Override public void handlePageChanging(PageChangingEvent event) { }
@Override public void setContainer(IWizardContainer wizardContainer) { // TODO Auto-generated method stub super.setContainer(wizardContainer); if (wizardContainer == null) { if (this.dialog != null) { this.dialog = null; } return; } this.dialog = (WizardDialog)wizardContainer; this.dialog.addPageChangingListener(new IPageChangingListener() { @Override public void handlePageChanging(PageChangingEvent event) { // TODO Auto-generated method stub Object current = event.getCurrentPage(); Object target = event.getTargetPage(); List<IWizardPage> list = Arrays.asList(getPages()); int idxCurrent = list.indexOf(current); int idxTarget = list.indexOf(target); java.lang.System.out.println("Current: "+current.getClass().getName()+" ;; Target: "+target.getClass().getName()); if (current instanceof IWizardPageControll) { if (idxCurrent < idxTarget) { // perform Next ((IWizardPageControll)current).performNext(); } else { // perform Back ((IWizardPageControll)current).performBack(); } } if (target instanceof IWizardPageControll) { ((IWizardPageControll)target).performUpdate(); currentPage = (IWizardPageControll)target; } else { currentPage = null; } } }); }
/** * @see IDialogPage#createControl(Composite) */ public void createControl(Composite parent) { int columns = 6; //定义列数 ScrolledComposite scroll = new ScrolledComposite(parent, SWT.NULL | SWT.V_SCROLL); scroll.setLayoutData(new GridData(GridData.FILL_VERTICAL)); //强制显示滚动条 scroll.setAlwaysShowScrollBars(false); scroll.setExpandVertical(true); scroll.setExpandHorizontal(true); //拖动滚动条里可以看到的Composite的最大高度 //(int)Toolkit.getDefaultToolkit().getScreenSize().getHeight() scroll.setMinHeight(700); scroll.setLayout(new GridLayout(1, false)); Composite container = new Composite(scroll, SWT.NULL); GridLayout glContainer = new GridLayout(); glContainer.numColumns = columns; //glContainer.verticalSpacing = 2; container.setLayout(glContainer); scroll.setContent(container); createDatabaseArea(container, columns); createListTableArea(container, columns); createBaseProjectPath(container, columns); //定义Next事件 WizardDialog dialog = (WizardDialog) getContainer(); dialog.addPageChangingListener(new IPageChangingListener() { public void handlePageChanging(PageChangingEvent event) { if(event.getCurrentPage() instanceof Config1MainRuleWizardPage && event.getTargetPage() instanceof Config2TableRelationWizardPage) { try { gcRule.save(); updateStatus("成功保存配置到" + RmXmlHelper.formatToFile(gcRule.getMainRulePath())); } catch (Exception e1) { updateStatus("保存失败:" + e1.toString()); e1.printStackTrace(); event.doit = false; } } } }); initialize(); setControl(container); }
public void createControl(Composite parent) { final int columns = 7; //定义列数 Composite container = null; //从父容器获得ScrolledComposite if(parent.getChildren() != null && parent.getChildren().length > 1 && parent.getChildren()[1] instanceof ScrolledComposite) { ScrolledComposite scroll = (ScrolledComposite)parent.getChildren()[1]; container = new Composite(scroll, SWT.NULL); scroll.setContent(container); } else { container = new Composite(parent, SWT.NULL); } container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); container.setLayout(new GridLayout(columns, false)); final Composite containerFinal = container; //添加一组关系的按钮 Button addRelationGroup = new Button(container, SWT.CENTER); GridData gd = new GridData(GridData.CENTER); gd.horizontalSpan = columns; addRelationGroup.setLayoutData(gd); addRelationGroup.setText("添加一组关系"); addRelationGroup.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { relations.add(addRelationGroup(containerFinal, columns, null)); } }); initTableRelationWidget(container, columns); //定义Next事件 final TableRelation tableRelationFinal = tableRelation; WizardDialog dialog = (WizardDialog) getContainer(); dialog.addPageChangingListener(new IPageChangingListener() { public void handlePageChanging(PageChangingEvent event) { if(event.getCurrentPage() instanceof Config2TableRelationWizardPage && event.getTargetPage() instanceof Config3MvmWizardPage) { try { //把界面上的表关系体现到Xml tableRelationFinal.buildTableRelationXml(relations); //把子表合并到主表的xml中 tableRelationFinal.mergeChildTable(); gcRule.save(); updateStatus("成功保存配置到" + RmXmlHelper.formatToFile(gcRule.getMainRulePath())); } catch (Exception e1) { updateStatus("保存失败:" + e1.toString()); e1.printStackTrace(); event.doit = false; } } } }); setControl(container); initialize(); dialogChanged(); }
/** * Notifies page changing listeners and returns result of page changing * processing to the sender. * * @param eventType * @return <code>true</code> if page changing listener completes * successfully, <code>false</code> otherwise */ private boolean doPageChanging(IWizardPage targetPage) { PageChangingEvent e = new PageChangingEvent(this, getCurrentPage(), targetPage); firePageChanging(e); // Prevent navigation if necessary return e.doit; }
/** * Notifies page changing listeners and returns result of page changing * processing to the sender. * * @param eventType * @return <code>true</code> if page changing listener completes successfully, * <code>false</code> otherwise */ private boolean doPageChanging(IWizardPage targetPage) { PageChangingEvent e = new PageChangingEvent(this, getCurrentPage(), targetPage); firePageChanging(e); // Prevent navigation if necessary return e.doit; }