1 /*
   2  * Copyright (c) 2012, 2014, Oracle and/or its affiliates.
   3  * All rights reserved. Use is subject to license terms.
   4  *
   5  * This file is available and licensed under the following license:
   6  *
   7  * Redistribution and use in source and binary forms, with or without
   8  * modification, are permitted provided that the following conditions
   9  * are met:
  10  *
  11  *  - Redistributions of source code must retain the above copyright
  12  *    notice, this list of conditions and the following disclaimer.
  13  *  - Redistributions in binary form must reproduce the above copyright
  14  *    notice, this list of conditions and the following disclaimer in
  15  *    the documentation and/or other materials provided with the distribution.
  16  *  - Neither the name of Oracle Corporation nor the names of its
  17  *    contributors may be used to endorse or promote products derived
  18  *    from this software without specific prior written permission.
  19  *
  20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31  */
  32 
  33 package com.oracle.javafx.scenebuilder.kit.fxom.sampledata;
  34 
  35 import javafx.scene.paint.Color;
  36 
  37 /**
  38  *
  39  */
  40 abstract class AbstractSampleData {
  41 
  42     private static final String[] lorem = {
  43         "Lorem ipsum ", //NOI18N
  44         "dolor sit amet, ", //NOI18N
  45         "consectetur adipiscing elit. ", //NOI18N
  46         "Donec eu justo ", //NOI18N
  47         "at tortor porta ", //NOI18N
  48         "commodo nec vitae magna. ", //NOI18N
  49         "Maecenas tempus ", //NOI18N
  50         "hendrerit elementum. ", //NOI18N
  51         "Nam sed mi ", //NOI18N
  52         "a lorem tincidunt ", //NOI18N
  53         "luctus sed non sem. ", //NOI18N
  54         "Aliquam erat volutpat. ", //NOI18N
  55         "Donec tempus egestas ", //NOI18N
  56         "libero a cursus. ", //NOI18N
  57         "In lectus nunc, ", //NOI18N
  58         "dapibus vel suscipit vel, ", //NOI18N
  59         "faucibus eget justo. ", //NOI18N
  60         "Aliquam erat volutpat. ", //NOI18N
  61         "Nulla facilisi. ", //NOI18N
  62         "Donec at enim ipsum, ", //NOI18N
  63         "sed facilisis leo. ", //NOI18N
  64         "Aliquam tincidunt ", //NOI18N
  65         "adipiscing euismod. ", //NOI18N
  66         "Sed aliquet eros ", //NOI18N
  67         "ut libero congue ", //NOI18N
  68         "quis bibendum ", //NOI18N
  69         "felis ullamcorper. ", //NOI18N
  70         "Vestibulum ipsum ante, ", //NOI18N
  71         "semper eu sollicitudin rutrum, ", //NOI18N
  72         "consectetur a enim. ", //NOI18N
  73         "Ut eget nisl sed turpis ", //NOI18N
  74         "egestas viverra ", //NOI18N
  75         "ut tristique sem. ", //NOI18N
  76         "Nunc in neque nulla. " //NOI18N
  77     };
  78 
  79     private final static Color[] colors = {
  80         Color.AZURE, Color.CHARTREUSE, Color.CRIMSON, Color.DARKCYAN
  81     };
  82 
  83     private static final String[] alphabet = {
  84         "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", //NOI18N
  85         "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" //NOI18N
  86     };
  87 
  88     public abstract void applyTo(Object sceneGraphObject);
  89     public abstract void removeFrom(Object sceneGraphObject);
  90 
  91 
  92     /*
  93      * Utilites for subclasses
  94      */
  95 
  96     protected static String lorem(int index) {
  97         return lorem[index % lorem.length];
  98     }
  99 
 100     protected static Color color(int index) {
 101         return colors[index % colors.length];
 102     }
 103 
 104     protected static String alphabet(int index) {
 105         return alphabet[index % alphabet.length];
 106     }
 107 }