1 9 package org.jboss.portal.server; 10 11 import org.jboss.portal.server.plugins.mode.Mode; 12 import org.jboss.portal.server.plugins.windowstate.WindowState; 13 14 20 public class WindowURL extends ServerURL 21 { 22 23 public static final int TYPE_ACTION = 0; 24 public static final int TYPE_RENDER = 1; 25 public static final int TYPE_NAVIGATION = 2; 26 27 private int type; 28 private Mode mode; 29 private WindowState windowState; 30 31 public WindowURL(ServerObjectID target) 32 { 33 super(target); 34 this.mode = null; 35 this.windowState = null; 36 } 37 38 public int getType() 39 { 40 return type; 41 } 42 43 public void setType(int type) 44 { 45 switch(type) 46 { 47 case TYPE_ACTION: 48 setControlParameter("type", "action"); 49 break; 50 case TYPE_RENDER: 51 setControlParameter("type", "render"); 52 break; 53 case TYPE_NAVIGATION: 54 setControlParameter("type", "nav"); 55 break; 56 default: 57 throw new IllegalArgumentException ("Bad type"); 58 } 59 this.type = type; 60 } 61 62 65 public void setMode(Mode mode) 66 { 67 this.mode = mode; 68 setControlParameter("mode", mode != null ? mode.toString() : null); 69 } 70 71 74 public Mode getMode() 75 { 76 return mode; 77 } 78 79 82 public void setWindowState(WindowState windowState) 83 { 84 this.windowState = null; 85 setControlParameter("windowstate", windowState != null ? windowState.toString() : null); 86 } 87 88 91 public WindowState getWindowState() 92 { 93 return windowState; 94 } 95 96 public boolean isIdempotent() 97 { 98 return type == TYPE_RENDER; 99 } 100 } 101 | Popular Tags |