/** * Gets the ID for this URL. * * @param url The URL to get the ID for. * @return The id (Map.ID) or null if URL is not an ID. */ public ID getIDFromURL(URL url) { String tmp; URL tmpURL; if (url == null) return null; String urlString = url.toExternalForm(); for (Enumeration e = resource.getKeys() ; e.hasMoreElements() ;) { String key = (String) e.nextElement(); try { tmp = resource.getString(key); tmpURL = new URL(base, tmp); // Sometimes tmp will be null because not all keys are ids if (tmpURL == null) continue; String tmpString = tmpURL.toExternalForm(); if (urlString.compareTo(tmpString) == 0) { return ID.create(key, helpset); } } catch (Exception ex) { } } return null; }
String imageID = (String)params.get("imageID"); if (imageID != null) this.imageID = Map.ID.create(imageID, hs); this.mergeType = (String)params.get("mergetype");
public Object nextElement() { Object back = null; try { back = ID.create((String) e.nextElement(), hs); } catch (Exception ex) { } return back; } }
String imageID = (String) act.attr.get("image"); try { Map.ID id = Map.ID.create(imageID, hs); javax.swing.ImageIcon icon = null; Map map = hs.getCombinedMap();
Map.ID itemID = null; try{ itemID = Map.ID.create(target,favorites.getModel().getHelpSet());
Map.ID itemID = null; try{ itemID = Map.ID.create(target,index.getModel().getHelpSet());
Map.ID itemID = null; try{ itemID = Map.ID.create(target,toc.getModel().getHelpSet());
Map.ID itemID = null; try{ itemID = Map.ID.create(target,glossary.getModel().getHelpSet());
imageMapID = ID.create(imageID, hs); } catch (BadIDException bex2) {
/** * Sets the icon in the activator by id. * @see getIcon */ public void setIconByID(String name) { debug ("setIconByID"); ImageIcon ig = null; URL url=null; Map map = hs.getCombinedMap(); try { url = map.getURLFromID(ID.create(name, hs)); } catch (java.net.MalformedURLException e2) { return; } // Valid URLs try the Icon ig = new ImageIcon(url); if (ig != null) { setIcon(ig); // if the text is the default text then make it blank String text = getText(); if (text.compareTo(">") == 0) { setText(""); } } }
/** * Returns * the ID to visit when the user makes a "go home" gesture. * This can be identified in the project file, but may also be changed * programmatically or (possibly) via the UI. * * @return The ID of home. A null is returned if homeID is null * or if an ID cannot be created for the homeID. */ public ID getHomeID() { if (homeID == null) { return null; } else { try { return ID.create(homeID, this); } catch (Exception ex) { return null; } } }
/** * Shows this ID as content relative to the (top) HelpSet for the Presentation * instance--HelpVisitListeners are notified. * * @param id A string that identifies the topic to show for the loaded (top) HelpSet * @exception BadIDException The ID is not valid for the HelpSet */ public void setCurrentID(String id) throws BadIDException { debug("setCurrentID - String"); try { setCurrentID(ID.create(id, helpset)); } catch (InvalidHelpSetContextException ex) { // this should not happen new Error("internal error?"); } }
/** * Convenience version of the above. The implicit HelpSet is * the current HelpSet. * * @param id The String to visit. Null id is valid for TextHelpModel.setCurrentID. * @exception BadIDException if the string is not in the map for the HelpSet. */ public void setCurrentID(String id) throws BadIDException { try { helpModel.setCurrentID(ID.create(id, getModel().getHelpSet())); } catch (InvalidHelpSetContextException ex) { // cannot happen } }
/** * Set the topic image ID * * param String ID for the topic image */ public void setTopicImageID(String imageID) { if (imageID == null) { topicImageID = null; return; } try { topicImageID = ID.create(imageID, getHelpSet()); } catch (BadIDException bex) { } }
/** * Shows this ID as content relative to the (top) HelpSet for the HelpBroker * instance--HelpVisitListeners are notified. * * @param id A string that identifies the topic to show for the loaded (top) HelpSet * @exception BadIDException The ID is not valid for the HelpSet */ public void setCurrentID(String id) throws BadIDException { try { setCurrentID(ID.create(id, helpset)); } catch (InvalidHelpSetContextException ex) { // this should not happen new Error("internal error?"); } }
/** * Visits a given ID. Propagates down into the model. * * @param id The String to visit. Relative to the HS of the current model. * @exception BadIDException The ID is not valid for the HelpSet for the current model. */ public void setCurrentID(String id) throws BadIDException { try { model.setCurrentID(ID.create(id, getModel().getHelpSet())); } catch (InvalidHelpSetContextException ex) { // cannot happen } }
/** * Set the default category closed image ID. * * param String ID of catagory closed image */ public void setCategoryClosedImageID(String imageID) { if (imageID == null) { return; } try { categoryClosedImageID = ID.create(imageID, getHelpSet()); } catch (BadIDException bex) { } }
/** * Set the default category open image ID. * * param String ID of catagory open image */ public void setCategoryOpenImageID(String imageID) { if (imageID == null) { return; } try { categoryOpenImageID = ID.create(imageID, getHelpSet()); } catch (BadIDException bex) { } }
public static URL getURLFromID(String id) throws BadIDException, MalformedURLException { initialize(); logger.info("Looking for id: " + id); ID theId = ID.create(id, hs); if (theId == null) { return null; } return (hs.getCombinedMap().getURLFromID(theId)); }
/** * Set the ID for content in the secondary viewer * @param content a valid URL */ public void setId(String id) { debug ("setID"); ident = Map.ID.create(id, hs); content = ""; }