1 11 12 package org.eclipse.ui.internal.intro.impl.model; 13 14 import java.util.Vector ; 15 16 import org.eclipse.ui.internal.intro.impl.model.util.ModelUtil; 17 import org.osgi.framework.Bundle; 18 import org.w3c.dom.Element ; 19 20 25 public class IntroHomePage extends AbstractIntroPage { 26 27 private static final String ATT_URL = "url"; 29 private String url; 30 private boolean isDynamic = false; 31 private boolean isStandbyPage; 32 33 34 IntroHomePage(Element element, Bundle bundle, String base) { 35 super(element, bundle, base); 36 url = getAttribute(element, ATT_URL); 37 if (url == null) 38 isDynamic = true; 40 else 41 url = ModelUtil.resolveURL(base, url, bundle); 43 } 44 45 46 49 public String getUrl() { 50 return url; 51 } 52 53 54 60 public boolean isDynamic() { 61 return isDynamic; 62 } 63 64 65 70 public int getType() { 71 return AbstractIntroElement.HOME_PAGE; 72 } 73 74 75 78 public boolean isStandbyPage() { 79 return isStandbyPage; 80 } 81 82 86 public void setStandbyPage(boolean isStandbyPage) { 87 this.isStandbyPage = isStandbyPage; 88 } 89 90 91 96 public IntroLink[] getLinks() { 97 Vector linkVector = new Vector (); 98 99 AbstractIntroElement[] children = getChildren(); 100 for (int i = 0; i < children.length; i++) { 101 AbstractIntroElement child = children[i]; 102 if (child.isOfType(AbstractIntroElement.LINK)) 103 linkVector.add(child); 104 else if (child.isOfType(AbstractIntroElement.GROUP)) { 105 addLinks((IntroGroup) child, linkVector); 106 } 107 } 108 109 IntroLink[] links = new IntroLink[linkVector.size()]; 110 linkVector.copyInto(links); 111 return links; 112 } 113 114 private void addLinks(IntroGroup group, Vector linkVector) { 115 AbstractIntroElement[] children = group.getChildren(); 116 for (int i = 0; i < children.length; i++) { 117 AbstractIntroElement child = children[i]; 118 if (child.isOfType(AbstractIntroElement.LINK)) 119 linkVector.add(child); 120 else if (child.isOfType(AbstractIntroElement.GROUP)) { 121 addLinks((IntroGroup) child, linkVector); 122 } 123 } 124 } 125 126 127 } 128 | Popular Tags |