1 19 package org.netbeans.modules.web.jsf.navigation.vwmodel; 20 21 import org.netbeans.modules.web.jsf.navigation.vwmodel.NavigableComponent; 22 import org.netbeans.modules.web.jsf.navigation.vwmodel.Page; 23 import org.netbeans.modules.visualweb.insync.faces.config.NavigationCase; 24 import java.util.Iterator ; 25 import java.util.List ; 26 public class Link { public Link(String outcome, Page from, Page to, NavigationCase navcase) { 28 this.setOutcome(outcome); 29 this.setFrom(from); 30 this.setTo(to); 31 this.setNavcase(navcase); 32 } 33 34 private String outcome; 35 private Page from; 36 private Page to; 37 private NavigationCase navcase; 38 39 44 63 int portnum; 65 public String toString() { 66 return "Link[" + getFrom().getName() +","+getTo().getName()+","+getOutcome()+","+portnum + "]"; 67 } 68 69 73 public String getFromOutcome() { 74 return getNavcase().getFromOutcome(); 75 } 76 77 private NavigableComponent fromComponent = null; 78 79 public NavigableComponent getFromNavigableComponent() { 80 fromComponent = null; 81 List <NavigableComponent> navComps = getFrom().getBeans(); 82 for(NavigableComponent pb : navComps ) { 83 if(pb.getAction() != null && pb.getAction().equals(getOutcome())) { 84 getFrom().setCurrentBean(pb); 85 fromComponent = pb; 86 } 87 } 88 return fromComponent; 89 } 90 91 public void setFromOutcome(String s) { 92 94 if(getFrom().getBeans().size() == 0) 96 getFrom().getDoc().updateBeans(getFrom()); 97 98 List <NavigableComponent> navComps = getFrom().getBeans(); 99 for(NavigableComponent pb : navComps ) { 100 if(pb.getAction() != null && pb.getAction().equals(getOutcome())) { 101 getFrom().setCurrentBean(pb); 102 fromComponent = pb; 103 break; 104 } 105 } 106 107 getFrom().getDoc().setOutcome(this, s, true); 116 } 117 public String getFromView() { 118 return getNavcase().getRule().getFromView(); 119 } 120 public void setFromView(String s) { 121 getNavcase().getRule().setFromView(s); 122 } 123 public String getToView() { 124 return getNavcase().getToView(); 125 } 126 public void setToView(String s) { 127 getNavcase().setToView(s); 128 } 129 130 131 public Page getFromPage() { 132 return getFrom(); 133 } 134 135 public void setFromPage(Page fromPage) { 136 setFrom(fromPage); 137 } 138 139 public Page getToPage() { 140 return getTo(); 141 } 142 143 public void setToPage(Page toPage) { 144 setTo(toPage); 145 } 146 147 public String getOutcome() { 148 return outcome; 149 } 150 151 public void setOutcome(String label) { 152 outcome = label; 153 } 154 155 protected Page getFrom() { 156 return from; 157 } 158 159 protected void setFrom(Page from) { 160 this.from = from; 161 } 162 163 protected Page getTo() { 164 return to; 165 } 166 167 protected void setTo(Page to) { 168 this.to = to; 169 } 170 171 protected NavigationCase getNavcase() { 172 return navcase; 173 } 174 175 protected void setNavcase(NavigationCase navcase) { 176 this.navcase = navcase; 177 } 178 } 179 | Popular Tags |