Пример #1
0
    @SuppressWarnings("LeakingThisInConstructor")
    public StylesheetItem(EditorItemDelegate editor, String url) {
      //            System.out.println("New StylesheetItem.");
      this.editor = editor;
      Parent parentRoot = EditorUtils.loadFxml("StylesheetEditorItem.fxml", this);
      assert parentRoot instanceof Pane;
      root = (Pane) parentRoot;

      initialize(url);
    }
Пример #2
0
  @SuppressWarnings("LeakingThisInConstructor")
  public StylesheetEditor(
      IMetadata metadata,
      ValuePropertyMetadata propMeta,
      Set<Class<?>> selectedClasses,
      URL fxmlFileLocation) {
    super(metadata, propMeta, selectedClasses);
    this.fxmlFileLocation = fxmlFileLocation;
    setLayoutFormat(PropertyEditor.LayoutFormat.DOUBLE_LINE);
    // Add initial button
    rootInitialBt = EditorUtils.loadFxml("StylesheetEditorInitialBt.fxml", this); // NOI18N
    root.getChildren().add(rootInitialBt);
    // Set the initial value to empty list (instead of null)
    valueProperty().setValue(FXCollections.observableArrayList());

    documentRelativeMenuItem.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            switchType(Type.DOCUMENT_RELATIVE_PATH);
          }
        });
    classPathRelativeMenuItem.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            switchType(Type.CLASSLOADER_RELATIVE_PATH);
          }
        });
    absoluteMenuItem.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            switchType(Type.PLAIN_STRING);
          }
        });
    getMenu()
        .getItems()
        .addAll(documentRelativeMenuItem, classPathRelativeMenuItem, absoluteMenuItem);
  }