< prev index next >

functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/PropertyTablesFactory.java

Print this page




  27 import java.lang.reflect.Method;
  28 import java.util.ArrayList;
  29 import java.util.Arrays;
  30 import java.util.Comparator;
  31 import java.util.List;
  32 import javafx.beans.property.*;
  33 import javafx.collections.FXCollections;
  34 import javafx.collections.ObservableList;
  35 import javafx.scene.Cursor;
  36 import javafx.scene.ImageCursor;
  37 import javafx.scene.Node;
  38 import javafx.scene.control.ContextMenu;
  39 import javafx.scene.control.Label;
  40 import javafx.scene.control.MenuItem;
  41 import javafx.scene.control.TableColumn;
  42 import javafx.scene.control.Tooltip;
  43 import javafx.scene.control.test.utils.ComponentsFactory;
  44 import javafx.scene.image.Image;
  45 import javafx.scene.paint.Color;
  46 import javafx.scene.shape.Circle;
  47 import javafx.scene.shape.PolygonBuilder;
  48 import javafx.scene.shape.Rectangle;
  49 import javafx.scene.text.Font;
  50 import javafx.scene.text.Text;
  51 import java.time.chrono.Chronology;

  52 
  53 /**
  54  * @author Alexander Kirov
  55  *
  56  * NOTION: this class should be instantiated on JavaFX thread.
  57  */
  58 public class PropertyTablesFactory {
  59 
  60     static ObservableList<String> excludeList = FXCollections.observableArrayList();
  61 
  62     static {
  63         /*
  64          * These properties are from Node so they are not needed for control
  65          * testing. They can anyway be added manually to the accordiong
  66          * PropertiesTable.
  67          */
  68         excludeList.addAll("id", "blendMode", "cache", "style", "clip", "cacheHint", "depthTest",
  69                 "pickOnBounds", "managed", "layoutX", "layoutY", "layoutZ", "scene", "needsLayout",
  70                 "translateX", "translateY", "translateZ", "scaleX", "scaleY", "scaleZ",
  71                 "minWidth", "maxWidth", "minHeight", "maxHeight", "impl_showMnemonics");


 175     }
 176 
 177     public static ContextMenu provideContextMenuObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) {
 178         ContextMenu cm = new ContextMenu();
 179         cm.getItems().add(new MenuItem("SomeItem"));
 180         List possibleMenus = new ArrayList();
 181         possibleMenus.add(null);
 182         possibleMenus.add(cm);
 183         tb.addObjectEnumPropertyLine(property, possibleMenus, owningObject);
 184         return cm;
 185     }
 186 
 187     public static void provideCustomNodeObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) {
 188         List possibleNodes = new ArrayList();
 189         possibleNodes.add(null);
 190         possibleNodes.add(new Text("This is custom node"));
 191         possibleNodes.add(new Label("Label text", new Text("Label node")));
 192         possibleNodes.add(new Rectangle(0, 0, 10, 10));
 193         possibleNodes.add(ComponentsFactory.createCustomContent(25, 25));
 194         possibleNodes.add(new Circle(6.75, Color.RED));
 195         possibleNodes.add(PolygonBuilder.create().fill(Color.GREEN).points(new Double[]{
 196                     0.0, 7.0,
 197                     5.0, 20.0,
 198                     15.0, 20.0,
 199                     20.0, 7.0,
 200                     10.0, 0.0,}).build());


 201         tb.addObjectEnumPropertyLine(property, possibleNodes, owningObject);
 202     }
 203 
 204 //    public static void provideChronologyObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) {
 205 //        List possibleChronologies = new ArrayList();
 206 //        possibleChronologies.add(null);
 207 //        possibleChronologies.addAll(java.time.chrono.Chronology.getAvailableChronologies());
 208 //        tb.addObjectEnumPropertyLine(property, possibleChronologies, owningObject);
 209 //    }
 210 
 211     public static Cursor provideCursorObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) {
 212         ImageCursor c1 = new ImageCursor(new Image("https://svn.java.net/svn/fxtest-golden~images-svn/ControlsTests/JavaProgBarInd80x80.gif"));
 213         List possibleTooltips = new ArrayList();
 214         possibleTooltips.add(null);
 215         possibleTooltips.add(c1);
 216         tb.addObjectEnumPropertyLine(property, possibleTooltips, owningObject);
 217         return c1;
 218     }
 219 
 220     public static void provideComparatorPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) {




  27 import java.lang.reflect.Method;
  28 import java.util.ArrayList;
  29 import java.util.Arrays;
  30 import java.util.Comparator;
  31 import java.util.List;
  32 import javafx.beans.property.*;
  33 import javafx.collections.FXCollections;
  34 import javafx.collections.ObservableList;
  35 import javafx.scene.Cursor;
  36 import javafx.scene.ImageCursor;
  37 import javafx.scene.Node;
  38 import javafx.scene.control.ContextMenu;
  39 import javafx.scene.control.Label;
  40 import javafx.scene.control.MenuItem;
  41 import javafx.scene.control.TableColumn;
  42 import javafx.scene.control.Tooltip;
  43 import javafx.scene.control.test.utils.ComponentsFactory;
  44 import javafx.scene.image.Image;
  45 import javafx.scene.paint.Color;
  46 import javafx.scene.shape.Circle;

  47 import javafx.scene.shape.Rectangle;
  48 import javafx.scene.text.Font;
  49 import javafx.scene.text.Text;
  50 import java.time.chrono.Chronology;
  51 import javafx.scene.shape.Polygon;
  52 
  53 /**
  54  * @author Alexander Kirov
  55  *
  56  * NOTION: this class should be instantiated on JavaFX thread.
  57  */
  58 public class PropertyTablesFactory {
  59 
  60     static ObservableList<String> excludeList = FXCollections.observableArrayList();
  61 
  62     static {
  63         /*
  64          * These properties are from Node so they are not needed for control
  65          * testing. They can anyway be added manually to the accordiong
  66          * PropertiesTable.
  67          */
  68         excludeList.addAll("id", "blendMode", "cache", "style", "clip", "cacheHint", "depthTest",
  69                 "pickOnBounds", "managed", "layoutX", "layoutY", "layoutZ", "scene", "needsLayout",
  70                 "translateX", "translateY", "translateZ", "scaleX", "scaleY", "scaleZ",
  71                 "minWidth", "maxWidth", "minHeight", "maxHeight", "impl_showMnemonics");


 175     }
 176 
 177     public static ContextMenu provideContextMenuObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) {
 178         ContextMenu cm = new ContextMenu();
 179         cm.getItems().add(new MenuItem("SomeItem"));
 180         List possibleMenus = new ArrayList();
 181         possibleMenus.add(null);
 182         possibleMenus.add(cm);
 183         tb.addObjectEnumPropertyLine(property, possibleMenus, owningObject);
 184         return cm;
 185     }
 186 
 187     public static void provideCustomNodeObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) {
 188         List possibleNodes = new ArrayList();
 189         possibleNodes.add(null);
 190         possibleNodes.add(new Text("This is custom node"));
 191         possibleNodes.add(new Label("Label text", new Text("Label node")));
 192         possibleNodes.add(new Rectangle(0, 0, 10, 10));
 193         possibleNodes.add(ComponentsFactory.createCustomContent(25, 25));
 194         possibleNodes.add(new Circle(6.75, Color.RED));
 195         Polygon temp = new Polygon(new double[]{
 196             0.0, 7.0,
 197             5.0, 20.0,
 198             15.0, 20.0,
 199             20.0, 7.0,
 200             10.0, 0.0,});
 201         temp.setFill(Color.GREEN);
 202         possibleNodes.add(temp);
 203         tb.addObjectEnumPropertyLine(property, possibleNodes, owningObject);
 204     }
 205 
 206 //    public static void provideChronologyObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) {
 207 //        List possibleChronologies = new ArrayList();
 208 //        possibleChronologies.add(null);
 209 //        possibleChronologies.addAll(java.time.chrono.Chronology.getAvailableChronologies());
 210 //        tb.addObjectEnumPropertyLine(property, possibleChronologies, owningObject);
 211 //    }
 212 
 213     public static Cursor provideCursorObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) {
 214         ImageCursor c1 = new ImageCursor(new Image("https://svn.java.net/svn/fxtest-golden~images-svn/ControlsTests/JavaProgBarInd80x80.gif"));
 215         List possibleTooltips = new ArrayList();
 216         possibleTooltips.add(null);
 217         possibleTooltips.add(c1);
 218         tb.addObjectEnumPropertyLine(property, possibleTooltips, owningObject);
 219         return c1;
 220     }
 221 
 222     public static void provideComparatorPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) {


< prev index next >