1 /* 2 * Copyright (c) 2014, 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 package javafx.scene.control; 26 27 import java.net.URL; 28 29 import javafx.beans.property.BooleanProperty; 30 import javafx.beans.property.ReadOnlyBooleanProperty; 31 import javafx.beans.property.ReadOnlyDoubleProperty; 32 import javafx.beans.property.StringProperty; 33 import javafx.scene.Node; 34 import javafx.stage.Modality; 35 import javafx.stage.StageStyle; 36 import javafx.stage.Window; 37 38 abstract class FXDialog { 39 40 /************************************************************************** 41 * 42 * Static fields 43 * 44 **************************************************************************/ 45 46 47 /************************************************************************** 48 * 49 * Private fields 50 * 51 **************************************************************************/ 52 53 protected Object owner; 54 55 56 /************************************************************************** 57 * 58 * Constructors 59 * 60 **************************************************************************/ 61 62 protected FXDialog() { 63 // pretty much a no-op, but we expect subclasses to call init(...) once 64 // they have initialised their abstract property methods. 65 } 66 67 68 69 /************************************************************************** 70 * 71 * Public API 72 * 73 **************************************************************************/ 74 75 76 77 78 /*************************************************************************** 79 * 80 * Abstract API 81 * 82 **************************************************************************/ 83 84 public abstract void show(); 85 86 public abstract void showAndWait(); 87 88 // This is called by public API, it is a valid, 'normal' way of closing the 89 // dialog, so we should not be concerned with the result value being null. 90 public abstract void close(boolean closeWasNormal); 91 92 public abstract void initOwner(Window owner); 93 94 public abstract Window getOwner(); 95 96 public abstract void initModality(Modality modality); 97 98 public abstract Modality getModality(); 99 100 public abstract ReadOnlyBooleanProperty showingProperty(); 101 102 public abstract Window getWindow(); 103 104 public abstract void sizeToScene(); 105 106 // --- x 107 public abstract double getX(); 108 public abstract void setX(double x); 109 public abstract ReadOnlyDoubleProperty xProperty(); 110 111 // --- y 112 public abstract double getY(); 113 public abstract void setY(double y); 114 public abstract ReadOnlyDoubleProperty yProperty(); 115 116 // --- resizable 117 abstract BooleanProperty resizableProperty(); 118 119 120 // --- focused 121 abstract ReadOnlyBooleanProperty focusedProperty(); 122 123 124 // --- title 125 abstract StringProperty titleProperty(); 126 127 // --- content 128 public abstract void setDialogPane(DialogPane node); 129 130 // --- root 131 public abstract Node getRoot(); 132 133 134 // --- width 135 /** 136 * Property representing the width of the dialog. 137 */ 138 abstract ReadOnlyDoubleProperty widthProperty(); 139 140 abstract void setWidth(double width); 141 142 143 // --- height 144 /** 145 * Property representing the height of the dialog. 146 */ 147 abstract ReadOnlyDoubleProperty heightProperty(); 148 149 abstract void setHeight(double height); 150 151 152 // stage style 153 abstract void initStyle(StageStyle style); 154 abstract StageStyle getStyle(); 155 156 157 158 159 /*************************************************************************** 160 * 161 * Implementation 162 * 163 **************************************************************************/ 164 165 166 167 168 /*************************************************************************** 169 * 170 * Support Classes 171 * 172 **************************************************************************/ 173 174 175 176 /*************************************************************************** 177 * 178 * Stylesheet Handling 179 * 180 **************************************************************************/ 181 }