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 23 * questions. 24 */ 25 26 package com.sun.javafx.tools.ant; 27 28 import org.apache.tools.ant.types.DataType; 29 30 /** 31 * Deployment preferences of the application. 32 * 33 * Examples: 34 * <pre> 35 * <fx:preferences id="p1" shortcut="true"> 36 * </pre> 37 * Request to create desktop shortcut. 38 * 39 * <pre> 40 * <fx:preferences shortcut="false" install="true" menu="true"> 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 * <fx:resource refid="p1"/> 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; 78 systemWide = b; 79 } 80 81 /** 82 * If true then application requests desktop shortcut to be created. 83 * 84 * @ant.not-required Default is null. 85 */ 86 public void setShortcut(Boolean b) { 87 shortcutRequested = b; 88 } 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 }