apps/samples/Ensemble8/src/app/java/ensemble/samplepage/SamplePage.java

Print this page




  91 
  92     @Override public ReadOnlyStringProperty titleProperty() {
  93         return titleProperty;
  94     }
  95 
  96     @Override public String getTitle() {
  97         return titleProperty.get();
  98     }
  99 
 100     @Override public String getUrl() {
 101         return "sample://" + sampleInfoProperty.get().ensemblePath;
 102     }
 103 
 104     @Override public Node getNode() {
 105         return this;
 106     }
 107     
 108     String apiClassToUrl(String classname) {
 109         String urlEnd = classname.replaceAll("\\.([a-z])", "/$1").replaceFirst("\\.([A-Z])", "/$1");
 110         if (classname.startsWith("javafx")) {
 111             return "http://download.java.net/jdk8/jfxdocs/"+urlEnd+".html";
 112         } else {
 113             return "http://download.java.net/jdk8/docs/api/"+urlEnd+".html";
 114         }
 115     }
 116 
 117     /**
 118      * This method is equivalent to bind(ObjectBinding) as it would invoke
 119      * updater immediately as well as on any change to SampleInfo
 120      * @param updater a method that updates content for a given SampleInfo
 121      */
 122     void registerSampleInfoUpdater(final Callback<SampleInfo, Void> updater) {
 123         sampleInfoProperty.addListener((ObservableValue<? extends SampleInfo> ov, SampleInfo t, SampleInfo sampleInfo) -> {
 124             updater.call(sampleInfo);
 125         });
 126         updater.call(sampleInfoProperty.get());
 127     }
 128 }


  91 
  92     @Override public ReadOnlyStringProperty titleProperty() {
  93         return titleProperty;
  94     }
  95 
  96     @Override public String getTitle() {
  97         return titleProperty.get();
  98     }
  99 
 100     @Override public String getUrl() {
 101         return "sample://" + sampleInfoProperty.get().ensemblePath;
 102     }
 103 
 104     @Override public Node getNode() {
 105         return this;
 106     }
 107     
 108     String apiClassToUrl(String classname) {
 109         String urlEnd = classname.replaceAll("\\.([a-z])", "/$1").replaceFirst("\\.([A-Z])", "/$1");
 110         if (classname.startsWith("javafx")) {
 111             return "https://docs.oracle.com/javase/8/javafx/api/"+urlEnd+".html";
 112         } else {
 113             return "http://docs.oracle.com/javase/8/docs/api/"+urlEnd+".html";
 114         }
 115     }
 116 
 117     /**
 118      * This method is equivalent to bind(ObjectBinding) as it would invoke
 119      * updater immediately as well as on any change to SampleInfo
 120      * @param updater a method that updates content for a given SampleInfo
 121      */
 122     void registerSampleInfoUpdater(final Callback<SampleInfo, Void> updater) {
 123         sampleInfoProperty.addListener((ObservableValue<? extends SampleInfo> ov, SampleInfo t, SampleInfo sampleInfo) -> {
 124             updater.call(sampleInfo);
 125         });
 126         updater.call(sampleInfoProperty.get());
 127     }
 128 }