modules/jdk.packager/src/antplugin/java/com/sun/javafx/tools/ant/Preferences.java

Print this page


   1 /*
   2  * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  38  *
  39  * <pre>
  40  *    &lt;fx:preferences shortcut="false" install="true" menu="true"&gt;
  41  * </pre>
  42  * Request to add reference to the start menu and mark application as installed
  43  * (in particular, it will be added to Add/Remove programs).
  44  *
  45  * <pre>
  46  *    &lt;fx:resource refid="p1"/&gt;
  47  * </pre>
  48  * Same as first example - request to create shortcut.
  49  *
  50  * @ant.type name="preferences" category="javafx"
  51  */
  52 public class Preferences extends DataType {
  53     private boolean installRequested = false;
  54     private Boolean shortcutRequested = null;
  55     private Boolean menuRequested = null;
  56     private Boolean systemWide = null;
  57     private Boolean installdirChooserRequested = null;

  58 
  59     Boolean getSystemInstall() {
  60         return systemWide;
  61     }
  62 
  63     /**
  64      * For Web applications "true" is request for app to be installed,
  65      * i.e. stay in the cache permanently.
  66      *
  67      * For native bundles "true" is request to install into system wide location.
  68      * Specific bundler may ignore this preference if it is not supported.
  69      *
  70      * If not specified then default is
  71      *    - not to install for web apps (i.e. same as "false")
  72      *    - bundler-specific for native bundlers
  73      *
  74      * @ant.not-required    Default is false.
  75      */
  76     public void setInstall(boolean b) {
  77         installRequested = b;


  89 
  90     /**
  91      * If true then application requests to add entry to the system Start Menu.
  92      *
  93      * @ant.not-required    Default is null.
  94      */
  95     public void setMenu(Boolean b) {
  96         menuRequested = b;
  97     }
  98 
  99     /**
 100      * If true then installer adds a dialog to let the user choose a directory
 101      * where the product will be installed.
 102      *
 103      * @ant.not-required    Default is null.
 104      */
 105     public void setInstalldirChooser(Boolean b) {
 106         installdirChooserRequested = b;
 107     }
 108 




 109     private Preferences get() {
 110         if (isReference()) {
 111             return (Preferences) getRefid().getReferencedObject();
 112         }
 113         return this;
 114     }
 115 
 116     Boolean getMenu() {
 117         return get().menuRequested;
 118     }
 119 
 120     Boolean getShortcut() {
 121         return get().shortcutRequested;
 122     }
 123 
 124     boolean getInstall() {
 125         return get().installRequested;
 126     }
 127 
 128     Boolean getInstalldirChooser() {
 129         return get().installdirChooserRequested;
 130     }




 131 }
   1 /*
   2  * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  38  *
  39  * <pre>
  40  *    &lt;fx:preferences shortcut="false" install="true" menu="true"&gt;
  41  * </pre>
  42  * Request to add reference to the start menu and mark application as installed
  43  * (in particular, it will be added to Add/Remove programs).
  44  *
  45  * <pre>
  46  *    &lt;fx:resource refid="p1"/&gt;
  47  * </pre>
  48  * Same as first example - request to create shortcut.
  49  *
  50  * @ant.type name="preferences" category="javafx"
  51  */
  52 public class Preferences extends DataType {
  53     private boolean installRequested = false;
  54     private Boolean shortcutRequested = null;
  55     private Boolean menuRequested = null;
  56     private Boolean systemWide = null;
  57     private Boolean installdirChooserRequested = null;
  58     private Boolean singletonRequested = null;
  59 
  60     Boolean getSystemInstall() {
  61         return systemWide;
  62     }
  63 
  64     /**
  65      * For Web applications "true" is request for app to be installed,
  66      * i.e. stay in the cache permanently.
  67      *
  68      * For native bundles "true" is request to install into system wide location.
  69      * Specific bundler may ignore this preference if it is not supported.
  70      *
  71      * If not specified then default is
  72      *    - not to install for web apps (i.e. same as "false")
  73      *    - bundler-specific for native bundlers
  74      *
  75      * @ant.not-required    Default is false.
  76      */
  77     public void setInstall(boolean b) {
  78         installRequested = b;


  90 
  91     /**
  92      * If true then application requests to add entry to the system Start Menu.
  93      *
  94      * @ant.not-required    Default is null.
  95      */
  96     public void setMenu(Boolean b) {
  97         menuRequested = b;
  98     }
  99 
 100     /**
 101      * If true then installer adds a dialog to let the user choose a directory
 102      * where the product will be installed.
 103      *
 104      * @ant.not-required    Default is null.
 105      */
 106     public void setInstalldirChooser(Boolean b) {
 107         installdirChooserRequested = b;
 108     }
 109 
 110     public void setSingleton(Boolean b) {
 111         singletonRequested = b;
 112     }
 113 
 114     private Preferences get() {
 115         if (isReference()) {
 116             return (Preferences) getRefid().getReferencedObject();
 117         }
 118         return this;
 119     }
 120 
 121     Boolean getMenu() {
 122         return get().menuRequested;
 123     }
 124 
 125     Boolean getShortcut() {
 126         return get().shortcutRequested;
 127     }
 128 
 129     boolean getInstall() {
 130         return get().installRequested;
 131     }
 132 
 133     Boolean getInstalldirChooser() {
 134         return get().installdirChooserRequested;
 135     }
 136     
 137     Boolean getSingleton() {
 138         return get().singletonRequested;
 139     }
 140 }