01: /*
02: * (C) Copyright 2000 - 2006 Nabh Information Systems, Inc.
03: *
04: * This program is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU General Public License
06: * as published by the Free Software Foundation; either version 2
07: * of the License, or (at your option) any later version.
08: *
09: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17: *
18: */
19: package com.nabhinc.portal.model;
20:
21: import javax.xml.bind.Unmarshaller;
22: import javax.xml.bind.annotation.XmlAttribute;
23: import javax.xml.bind.annotation.XmlElement;
24: import javax.xml.bind.annotation.XmlElements;
25: import javax.xml.bind.annotation.XmlRootElement;
26:
27: /**
28: *
29: *
30: * @author Padmanabh Dabke
31: * (c) 2006 Nabh Information Systems, Inc. All Rights Reserved.
32: */
33: @XmlRootElement(name="nav-option")
34: public class NavigationOption {
35: public static final int OPTION_TYPE_PORTLET = 0;
36: public static final int OPTION_TYPE_HEADER = 1;
37: public static final int OPTION_TYPE_URL = 2;
38:
39: public static final String OPTION_TYPE_STR_PORTLET = "portlet";
40: public static final String OPTION_TYPE_STR_HEADER = "header";
41: public static final String OPTION_TYPE_STR_URL = "url";
42:
43: public transient int type = NavigationOption.OPTION_TYPE_PORTLET;
44:
45: @XmlAttribute(name="label")
46: public String label = null;
47:
48: @XmlAttribute(name="level")
49: public int level = 0;
50:
51: @XmlAttribute(name="url")
52: public String url = null;
53:
54: public transient boolean isSelected = false;
55:
56: @XmlElements({@XmlElement(name="renderable-map",type=RenderableMap.class),@XmlElement(name="portlet-window",type=PortletWindow.class),@XmlElement(name="renderable-list",type=RenderableList.class),@XmlElement(name="menu",type=MenuLayout.class),@XmlElement(name="tree",type=TreeLayout.class),@XmlElement(name="tabbed-panel",type=TabLayout.class),@XmlElement(name="horizontal-menu",type=HorizontalMenuLayout.class),@XmlElement(name="solo",type=SoloLayout.class),@XmlElement(name="cascading-menu",type=CascadingMenuLayout.class)})
57: public Renderable renderable = null;
58:
59: public void afterUnmarshal(Unmarshaller um, Object parent) {
60: if (url != null)
61: this.type = NavigationOption.OPTION_TYPE_URL;
62: else if (this.renderable != null)
63: this.type = NavigationOption.OPTION_TYPE_PORTLET;
64: else
65: this.type = NavigationOption.OPTION_TYPE_HEADER;
66: }
67: }
|