001 // Copyright 2004, 2005 The Apache Software Foundation
002 //
003 // Licensed under the Apache License, Version 2.0 (the "License");
004 // you may not use this file except in compliance with the License.
005 // You may obtain a copy of the License at
006 //
007 // http://www.apache.org/licenses/LICENSE-2.0
008 //
009 // Unless required by applicable law or agreed to in writing, software
010 // distributed under the License is distributed on an "AS IS" BASIS,
011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012 // See the License for the specific language governing permissions and
013 // limitations under the License.
014
015 package org.apache.tapestry.contrib.tree.model;
016
017 /**
018 * @author ceco
019 */
020 public class TreeStateEvent {
021 public static final int SELECTED_NODE_CHANGED = 1;
022 public static final int NODE_EXPANDED = 2;
023 public static final int NODE_COLLAPSED = 4;
024
025 private int m_nEventType;
026 private transient ITreeStateModel m_objTreeStateModel = null;
027 private transient Object m_objNodeUID = null;
028
029 /**
030 * Constructor for TreeStateEvent.
031 */
032 public TreeStateEvent(int nEventType, Object objNodeUID, ITreeStateModel objTreeStateModel) {
033 super();
034 m_nEventType = nEventType;
035 m_objNodeUID = objNodeUID;
036 m_objTreeStateModel = objTreeStateModel;
037 }
038
039 /**
040 * Returns the EventType.
041 * @return int
042 */
043 public int getEventType() {
044 return m_nEventType;
045 }
046
047 public boolean isEvent(int nEventType){
048 return (getEventType() & nEventType) > 0;
049 }
050
051 public Object getNodeUID() {
052 return m_objNodeUID;
053 }
054
055 public ITreeStateModel getTreeStateModel() {
056 return m_objTreeStateModel;
057 }
058 }