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 {
022
023 public static final int SELECTED_NODE_CHANGED = 1;
024 public static final int NODE_EXPANDED = 2;
025 public static final int NODE_COLLAPSED = 4;
026
027 private int m_nEventType;
028 private transient ITreeStateModel m_objTreeStateModel = null;
029 private transient Object m_objNodeUID = null;
030
031 /**
032 * Constructor for TreeStateEvent.
033 */
034 public TreeStateEvent(int nEventType, Object objNodeUID,
035 ITreeStateModel objTreeStateModel)
036 {
037 super();
038 m_nEventType = nEventType;
039 m_objNodeUID = objNodeUID;
040 m_objTreeStateModel = objTreeStateModel;
041 }
042
043 /**
044 * Returns the EventType.
045 *
046 * @return int
047 */
048 public int getEventType()
049 {
050 return m_nEventType;
051 }
052
053 public boolean isEvent(int nEventType)
054 {
055 return (getEventType() & nEventType) > 0;
056 }
057
058 public Object getNodeUID()
059 {
060 return m_objNodeUID;
061 }
062
063 public ITreeStateModel getTreeStateModel()
064 {
065 return m_objTreeStateModel;
066 }
067 }