KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > dialogs > PageChangingEvent


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * Chris Gross (schtoo@schtoo.com) - initial API and implementation for bug 16179
10  * IBM Corporation - revisions to initial contribution
11  *******************************************************************************/

12 package org.eclipse.jface.dialogs;
13
14 import java.util.EventObject JavaDoc;
15
16 import org.eclipse.core.runtime.Assert;
17
18 /**
19  * Event object describing an <code>IDialogPage</code> in the midst of changing.
20  *
21  * @see IPageChangingListener
22  * @since 3.3
23  */

24 public class PageChangingEvent extends EventObject JavaDoc {
25
26
27     private static final long serialVersionUID = 1L;
28     
29     private Object JavaDoc currentPage;
30     
31     private Object JavaDoc targetPage;
32     
33     /**
34      * Public field that dictates if the page change will successfully change.
35      *
36      * Set this field to <code>false</code> to prevent the page from changing.
37      *
38      * Default value is <code>true</code>.
39      */

40     public boolean doit = true;
41
42     /**
43      * Creates a new event for the given source, selected (current) page and
44      * direction.
45      *
46      * @param source
47      * the page changing provider (the source of this event)
48      * @param currentPage
49      * the current page. In the JFace provided dialogs this will be
50      * an <code>IDialogPage</code>.
51      * @param targetPage
52      * the target page. In the JFace provided dialogs this will be an
53      * <code>IDialogPage</code>.
54      */

55     public PageChangingEvent(Object JavaDoc source, Object JavaDoc currentPage, Object JavaDoc targetPage) {
56         super(source);
57         Assert.isNotNull(currentPage);
58         Assert.isNotNull(targetPage);
59         this.currentPage = currentPage;
60         this.targetPage = targetPage;
61     }
62
63     /**
64      * Returns the current page from which the page change originates.
65      *
66      * @return the current page. In dialogs implemented by JFace,
67      * this will be an <code>IDialogPage</code>.
68      */

69     public Object JavaDoc getCurrentPage() {
70         return currentPage;
71     }
72
73     /**
74      * Returns the target page to change to.
75      *
76      * @return the target page. In dialogs implemented by JFace,
77      * this will be an <code>IDialogPage</code>.
78      */

79     public Object JavaDoc getTargetPage() {
80         return targetPage;
81     }
82
83 }
84
Popular Tags