functional/FxmlTests/src/test/fxmltests/app/LineNumberApp.java.excluded

Print this page



   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 test.fxmltests.app;
  26 
  27 import com.sun.javafx.fxml.LoadListener;
  28 import com.sun.javafx.runtime.VersionInfo;
  29 import java.util.ArrayList;
  30 import java.util.List;
  31 import javafx.application.Application;
  32 import javafx.fxml.FXMLLoader;
  33 import javafx.scene.Node;
  34 import javafx.scene.Scene;
  35 import javafx.scene.layout.VBox;
  36 import javafx.scene.layout.VBoxBuilder;
  37 import javafx.scene.paint.Color;
  38 import javafx.scene.shape.Rectangle;
  39 import javafx.stage.Stage;
  40 import test.javaclient.shared.BasicButtonChooserApp;
  41 import test.javaclient.shared.PageWithSlots;
  42 import test.javaclient.shared.TestNode;
  43 
  44 public class LineNumberApp extends BasicButtonChooserApp {
  45 
  46     private static String FXML_MAIN_RESOURCE = "/test/fxmltests/resources/line_number.fxml";
  47     private static String FXML_TYPE_RESOURCE = "/test/fxmltests/resources/line_number_type.fxml";
  48     private static String FXML_PROPERTY_RESOURCE = "/test/fxmltests/resources/line_number_property.fxml";
  49     public static List<Integer> importProcessingInstruction = new ArrayList<Integer>();
  50     final public static Integer[] importProcessingInstructionMatrix = new Integer[]{3, 4, 5, 6, 7};
  51     public static List<Integer> languageProcessingInstruction = new ArrayList<Integer>();
  52     final public static Integer[] languageProcessingInstructionMatrix = new Integer[]{9};
  53     public static List<Integer> comment = new ArrayList<Integer>();
  54     final public static Integer[] commentMatrix = new Integer[]{12, 15};
  55     public static List<Integer> instanceDeclarationElement = new ArrayList<Integer>();
  56     final public static Integer[] instanceDeclarationElementMatrix = new Integer[]{25, 26, 27, 31, 32, 34, 37};


 110         root.add(pageMain);
 111         root.add(pageType);
 112         root.add(pageProperty);
 113 
 114         return root;
 115     }
 116 
 117     private class FxmlLoadPage extends TestNode {
 118 
 119         private String resource;
 120 
 121         public FxmlLoadPage(String resource) {
 122             this.resource = resource;
 123         }
 124 
 125         @Override
 126         public Node drawNode() {
 127             LineNumberApp.reset();
 128             final FXMLLoader loader = new FXMLLoader(getClass().getResource(resource));
 129             loader.impl_setStaticLoad(true);
 130             loader.impl_setLoadListener(new LoadListener() {


 131 
 132                 @Override
 133                 public void readImportProcessingInstruction(String string) {
 134                     importProcessingInstruction.add(loader.impl_getLineNumber());
 135                 }
 136 
 137                 @Override
 138                 public void readLanguageProcessingInstruction(String string) {
 139                     languageProcessingInstruction.add(loader.impl_getLineNumber());
 140                 }
 141 
 142                 @Override
 143                 public void readComment(String string) {
 144                     comment.add(loader.impl_getLineNumber());
 145                 }
 146 
 147                 @Override
 148                 public void beginInstanceDeclarationElement(Class<?> tye) {
 149                     instanceDeclarationElement.add(loader.impl_getLineNumber());
 150                 }


 203                 public void readPropertyAttribute(String string, Class<?> type, String string1) {
 204                     readPropertyAttribute.add(loader.impl_getLineNumber());
 205                 }
 206 
 207                 @Override
 208                 public void readUnknownStaticPropertyAttribute(String string, String string1) {
 209                     readUnknownStaticProperty.add(loader.impl_getLineNumber());
 210                 }
 211 
 212                 @Override
 213                 public void readEventHandlerAttribute(String string, String string1) {
 214                     readEventHandlerAttribute.add(loader.impl_getLineNumber());
 215                 }
 216 
 217                 @Override
 218                 public void endElement(Object o) {
 219                     endElement.add(loader.impl_getLineNumber());
 220                 }
 221             });
 222             try {
 223                 loader.setRoot(VBoxBuilder.create().prefHeight(200).prefWidth(200).build());


 224                 return (Node) loader.load();
 225             } catch (Exception exc) {
 226                 exc.printStackTrace();
 227                 return new Rectangle(10, 10) {
 228 
 229                     {
 230                         setFill(Color.RED);
 231                     }
 232                 };
 233             }
 234         }
 235     }
 236 
 237     public static void main(String[] args) {
 238         launch(args);
 239     }
 240 
 241     public static void reset() {
 242         importProcessingInstruction.clear();
 243         languageProcessingInstruction.clear();
   1 // https://bugs.openjdk.java.net/browse/INTJDK-7624138
   2 /*
   3  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation. Oracle designates this
   9  * particular file as subject to the "Classpath" exception as provided
  10  * by Oracle in the LICENSE file that accompanied this code.
  11  *
  12  * This code is distributed in the hope that it will be useful, but WITHOUT
  13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  15  * version 2 for more details (a copy is included in the LICENSE file that
  16  * accompanied this code).
  17  *
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *
  22  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  23  * or visit www.oracle.com if you need additional information or have any
  24  * questions.
  25  */
  26 package test.fxmltests.app;
  27 
  28 import javafx.fxml.LoadListener;
  29 import com.sun.javafx.runtime.VersionInfo;
  30 import java.util.ArrayList;
  31 import java.util.List;
  32 import javafx.application.Application;
  33 import javafx.fxml.FXMLLoader;
  34 import javafx.scene.Node;
  35 import javafx.scene.Scene;
  36 import javafx.scene.layout.VBox;

  37 import javafx.scene.paint.Color;
  38 import javafx.scene.shape.Rectangle;
  39 import javafx.stage.Stage;
  40 import test.javaclient.shared.BasicButtonChooserApp;
  41 import test.javaclient.shared.PageWithSlots;
  42 import test.javaclient.shared.TestNode;
  43 
  44 public class LineNumberApp extends BasicButtonChooserApp {
  45 
  46     private static String FXML_MAIN_RESOURCE = "/test/fxmltests/resources/line_number.fxml";
  47     private static String FXML_TYPE_RESOURCE = "/test/fxmltests/resources/line_number_type.fxml";
  48     private static String FXML_PROPERTY_RESOURCE = "/test/fxmltests/resources/line_number_property.fxml";
  49     public static List<Integer> importProcessingInstruction = new ArrayList<Integer>();
  50     final public static Integer[] importProcessingInstructionMatrix = new Integer[]{3, 4, 5, 6, 7};
  51     public static List<Integer> languageProcessingInstruction = new ArrayList<Integer>();
  52     final public static Integer[] languageProcessingInstructionMatrix = new Integer[]{9};
  53     public static List<Integer> comment = new ArrayList<Integer>();
  54     final public static Integer[] commentMatrix = new Integer[]{12, 15};
  55     public static List<Integer> instanceDeclarationElement = new ArrayList<Integer>();
  56     final public static Integer[] instanceDeclarationElementMatrix = new Integer[]{25, 26, 27, 31, 32, 34, 37};


 110         root.add(pageMain);
 111         root.add(pageType);
 112         root.add(pageProperty);
 113 
 114         return root;
 115     }
 116 
 117     private class FxmlLoadPage extends TestNode {
 118 
 119         private String resource;
 120 
 121         public FxmlLoadPage(String resource) {
 122             this.resource = resource;
 123         }
 124 
 125         @Override
 126         public Node drawNode() {
 127             LineNumberApp.reset();
 128             final FXMLLoader loader = new FXMLLoader(getClass().getResource(resource));
 129             loader.impl_setStaticLoad(true);
 130 
 131             // The following line requires --add-exports javafx.fxml/com.sun.javafx.fxml=ALL-UNNAMED
 132             loader.setLoadListener(new LoadListener() {
 133 
 134                 @Override
 135                 public void readImportProcessingInstruction(String string) {
 136                     importProcessingInstruction.add(loader.impl_getLineNumber());
 137                 }
 138 
 139                 @Override
 140                 public void readLanguageProcessingInstruction(String string) {
 141                     languageProcessingInstruction.add(loader.impl_getLineNumber());
 142                 }
 143 
 144                 @Override
 145                 public void readComment(String string) {
 146                     comment.add(loader.impl_getLineNumber());
 147                 }
 148 
 149                 @Override
 150                 public void beginInstanceDeclarationElement(Class<?> tye) {
 151                     instanceDeclarationElement.add(loader.impl_getLineNumber());
 152                 }


 205                 public void readPropertyAttribute(String string, Class<?> type, String string1) {
 206                     readPropertyAttribute.add(loader.impl_getLineNumber());
 207                 }
 208 
 209                 @Override
 210                 public void readUnknownStaticPropertyAttribute(String string, String string1) {
 211                     readUnknownStaticProperty.add(loader.impl_getLineNumber());
 212                 }
 213 
 214                 @Override
 215                 public void readEventHandlerAttribute(String string, String string1) {
 216                     readEventHandlerAttribute.add(loader.impl_getLineNumber());
 217                 }
 218 
 219                 @Override
 220                 public void endElement(Object o) {
 221                     endElement.add(loader.impl_getLineNumber());
 222                 }
 223             });
 224             try {
 225                 VBox vb = new VBox();
 226                 vb.setPrefSize(200, 200);
 227                 loader.setRoot(vb);
 228                 return (Node) loader.load();
 229             } catch (Exception exc) {
 230                 exc.printStackTrace();
 231                 return new Rectangle(10, 10) {
 232 
 233                     {
 234                         setFill(Color.RED);
 235                     }
 236                 };
 237             }
 238         }
 239     }
 240 
 241     public static void main(String[] args) {
 242         launch(args);
 243     }
 244 
 245     public static void reset() {
 246         importProcessingInstruction.clear();
 247         languageProcessingInstruction.clear();