1 33 34 package com.icesoft.faces.component.menubar; 35 36 import javax.swing.tree.DefaultMutableTreeNode ; 37 38 public class IceMenuObject { 39 40 protected DefaultMutableTreeNode wrapper; 41 protected String text; 42 protected boolean expanded; 43 protected String tooltip; 44 protected String action; 45 46 protected String leafIcon; 48 protected String branchExpandedIcon; 49 protected String branchContractedIcon; 50 protected String icon; 51 52 public IceMenuObject(DefaultMutableTreeNode wrapper) { 54 this.wrapper = wrapper; 55 } 56 57 public String action() { 58 return action; 59 } 60 61 62 public String getText() { 64 return text; 65 } 66 67 public void setText(String text) { 68 this.text = text; 69 } 70 71 public String getFamily() { 72 return null; 73 } 74 75 public boolean isExpanded() { 76 return expanded; 77 } 78 79 public void setExpanded(boolean isExpanded) { 80 this.expanded = isExpanded; 81 } 82 83 public String getTooltip() { 84 return tooltip; 85 } 86 87 public void setTooltip(String tooltipString) { 88 this.tooltip = tooltipString; 89 } 90 91 public String toString() { 92 return text; 93 } 94 95 public String getLeafIcon() { 96 return leafIcon; 97 } 98 99 public void setLeafIcon(String leafIcon) { 100 this.leafIcon = leafIcon; 101 } 102 103 public String getBranchContractedIcon() { 104 return branchContractedIcon; 105 } 106 107 public void setBranchContractedIcon(String branchContractedIcon) { 108 this.branchContractedIcon = branchContractedIcon; 109 } 110 111 public String getBranchExpandedIcon() { 112 return branchExpandedIcon; 113 } 114 115 public void setBranchExpandedIcon(String branchExpandedIcon) { 116 this.branchExpandedIcon = branchExpandedIcon; 117 } 118 119 125 public String getIcon() { 126 if (wrapper.getChildCount() <= 0) { 127 if (leafIcon != null) { 128 return leafIcon; 129 } 130 } else if (isExpanded()) { 131 if (branchExpandedIcon != null) { 132 return branchExpandedIcon; 133 } 134 } else { 135 if (branchContractedIcon != null) { 136 return branchContractedIcon; 137 } 138 } 139 return icon; 140 } 141 142 public DefaultMutableTreeNode getWrapper() { 143 return wrapper; 144 } 145 146 151 public void setWrapper(DefaultMutableTreeNode wrapper) { 152 this.wrapper = wrapper; 153 } 154 155 public String getAction() { 156 return action; 157 } 158 159 public void setAction(String action) { 160 this.action = action; 161 } 162 } | Popular Tags |