Search in sources :

Example 91 with Node

use of javafx.scene.Node in project Gargoyle by callakrsos.

the class FileTreeItem method createGraphcis.

/********************************
	 * 작성일 : 2016. 7. 11. 작성자 : KYJ
	 *
	 *이 함수에서 리턴되는 노드가 트리를 구성하는 주 Node가 된다.
	 *
	 * @param fileWrapper
	 * @return
	 ********************************/
protected Node createGraphcis(FileWrapper fileWrapper) {
    String meta = getMetadata();
    ImageView createImageView = getImage(fileWrapper);
    HBox value = new HBox(createImageView, new Label(fileWrapper.getFile().getName()), new Label(meta));
    List<Node> createAttachLabels = createAttachNodes();
    if (createAttachLabels != null && !createAttachLabels.isEmpty())
        value.getChildren().addAll(createAttachLabels);
    return value;
}
Also used : HBox(javafx.scene.layout.HBox) Node(javafx.scene.Node) Label(javafx.scene.control.Label) ImageView(javafx.scene.image.ImageView)

Example 92 with Node

use of javafx.scene.Node in project Gargoyle by callakrsos.

the class FxControlsTreeItem method getChildrens.

/**
	 * node로부터 구성된 하위 노드들을 반환받음.
	 * 
	 * @param node
	 * @return
	 */
public List<Node> getChildrens(Node node) {
    List<Node> controls = new ArrayList<>();
    if (node instanceof Control) {
        Control c = (Control) node;
        controls.add(c);
        controls = c.getChildrenUnmodifiable();
    } else if (node instanceof Parent) {
        Parent p = (Parent) node;
        controls = p.getChildrenUnmodifiable();
    } else {
        controls.add(node);
    }
    return controls;
}
Also used : Control(javafx.scene.control.Control) Parent(javafx.scene.Parent) Node(javafx.scene.Node) ArrayList(java.util.ArrayList)

Example 93 with Node

use of javafx.scene.Node in project Gargoyle by callakrsos.

the class IExcelScreenHandler method columnHeaderMapper.

/**
	 * 헤더로  표현하기 위한 커스터마이즈한 값을 리턴해주는 코드작성.
	 * 정의하지않는경우 TableColumn Header텍스트로 표현.
	 * 
	 * 1. 우선 헤더텍스트값을 먼저 살펴봄
	 * 2. JAVAFX의 경우 헤더텍스트가 커스텀으로 구현되어 Graphics가 적용된 경우도 있으므로 
	 *   텍스트가 빈값으로 인지된경우 Graphics객체를 리턴받은후 라벨을 리턴받아 적용
	 *   
	 * @작성자 : KYJ
	 * @작성일 : 2016. 9. 6.
	 * @param table
	 * @param tableColumn
	 * @return
	 */
public default default <T> String columnHeaderMapper(TableView<?> table, TableColumn<?, ?> tableColumn) {
    String headerText = tableColumn.getText();
    /* 2016-09-19 만약 headerText값이 null이라면 graphics에서 리턴받아 처리 시도. */
    if (ValueUtil.isEmpty(headerText)) {
        Node graphic = tableColumn.getGraphic();
        if (graphic != null && graphic instanceof Labeled) {
            Labeled lbl = (Labeled) graphic;
            headerText = lbl.getText();
        }
    }
    return headerText;
}
Also used : Node(javafx.scene.Node) Labeled(javafx.scene.control.Labeled)

Example 94 with Node

use of javafx.scene.Node in project Gargoyle by callakrsos.

the class DockTabPaneSkin method addTabs.

private void addTabs(List<? extends DockTab> addedList, int from) {
    int i = 0;
    // RT-39984: check if any other tabs are animating - they must be completed first.
    List<Node> headers = new ArrayList<>(tabHeaderArea.headersRegion.getChildren());
    for (Node n : headers) {
        TabHeaderSkin header = (TabHeaderSkin) n;
        if (header.animationState == TabAnimationState.HIDING) {
            stopCurrentAnimation(header.tab);
        }
    }
    for (final DockTab tab : addedList) {
        // Note that this must happen before addTab() call below
        stopCurrentAnimation(tab);
        // A new tab was added - animate it out
        if (!tabHeaderArea.isVisible()) {
            tabHeaderArea.setVisible(true);
        }
        int index = from + i++;
        tabHeaderArea.addTab(tab, index);
        addTabContent(tab);
        final TabHeaderSkin tabRegion = tabHeaderArea.getTabHeaderSkin(tab);
        if (tabRegion != null) {
            if (openTabAnimation.get() == TabAnimation.GROW) {
                tabRegion.animationState = TabAnimationState.SHOWING;
                tabRegion.animationTransition.setValue(0.0);
                tabRegion.setVisible(true);
                tabRegion.currentAnimation = createTimeline(tabRegion, Duration.millis(ANIMATION_SPEED), 1.0, event -> {
                    tabRegion.animationState = TabAnimationState.NONE;
                    tabRegion.setVisible(true);
                    tabRegion.inner.requestLayout();
                });
                tabRegion.currentAnimation.play();
            } else {
                tabRegion.setVisible(true);
                tabRegion.inner.requestLayout();
            }
        }
    }
}
Also used : EventHandler(javafx.event.EventHandler) Button(javafx.scene.control.Button) HPos(javafx.geometry.HPos) Pos(javafx.geometry.Pos) PseudoClass(javafx.css.PseudoClass) Rotate(javafx.scene.transform.Rotate) EnumConverter(com.sun.javafx.css.converters.EnumConverter) LoggerFactory(org.slf4j.LoggerFactory) StackPane(javafx.scene.layout.StackPane) Side(javafx.geometry.Side) InvalidationListener(javafx.beans.InvalidationListener) TabPane(javafx.scene.control.TabPane) ListChangeListener(javafx.collections.ListChangeListener) ContextMenu(javafx.scene.control.ContextMenu) BehaviorSkinBase(com.sun.javafx.scene.control.skin.BehaviorSkinBase) ControlResources.getString(com.sun.javafx.scene.control.skin.resources.ControlResources.getString) DockPos(com.kyj.fx.voeditor.visual.component.dock.pane.DockPos) DockPane(com.kyj.fx.voeditor.visual.component.dock.pane.DockPane) Point2D(javafx.geometry.Point2D) Pane(javafx.scene.layout.Pane) MultiplePropertyChangeListenerHandler(com.sun.javafx.scene.control.MultiplePropertyChangeListenerHandler) MenuItem(javafx.scene.control.MenuItem) AccessibleAttribute(javafx.scene.AccessibleAttribute) SingleSelectionModel(javafx.scene.control.SingleSelectionModel) DockEvent(com.kyj.fx.voeditor.visual.component.dock.pane.DockEvent) CssMetaData(javafx.css.CssMetaData) Timeline(javafx.animation.Timeline) Rectangle(javafx.scene.shape.Rectangle) TraversalEngine(com.sun.javafx.scene.traversal.TraversalEngine) Observable(javafx.beans.Observable) FxUtil(com.kyj.fx.voeditor.visual.util.FxUtil) WeakInvalidationListener(javafx.beans.WeakInvalidationListener) List(java.util.List) Duration(javafx.util.Duration) Region(javafx.scene.layout.Region) Interpolator(javafx.animation.Interpolator) WeakListChangeListener(javafx.collections.WeakListChangeListener) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty) ObservableList(javafx.collections.ObservableList) AccessibleRole(javafx.scene.AccessibleRole) Styleable(javafx.css.Styleable) Bounds(javafx.geometry.Bounds) SkinBase(javafx.scene.control.SkinBase) RadioMenuItem(javafx.scene.control.RadioMenuItem) MouseButton(javafx.scene.input.MouseButton) MouseEvent(javafx.scene.input.MouseEvent) FXCollections(javafx.collections.FXCollections) DoubleProperty(javafx.beans.property.DoubleProperty) DockNode(com.kyj.fx.voeditor.visual.component.dock.pane.DockNode) SwipeEvent(javafx.scene.input.SwipeEvent) ArrayList(java.util.ArrayList) TabClosingPolicy(javafx.scene.control.TabPane.TabClosingPolicy) VPos(javafx.geometry.VPos) AccessibleAction(javafx.scene.AccessibleAction) Direction(com.sun.javafx.scene.traversal.Direction) StyleableProperty(javafx.css.StyleableProperty) KeyValue(javafx.animation.KeyValue) Animation(javafx.animation.Animation) Tooltip(javafx.scene.control.Tooltip) Color(javafx.scene.paint.Color) KeyFrame(javafx.animation.KeyFrame) ObjectProperty(javafx.beans.property.ObjectProperty) Logger(org.slf4j.Logger) Label(javafx.scene.control.Label) Iterator(java.util.Iterator) Node(javafx.scene.Node) ScrollEvent(javafx.scene.input.ScrollEvent) DropShadow(javafx.scene.effect.DropShadow) ContextMenuEvent(javafx.scene.input.ContextMenuEvent) Popup(javafx.stage.Popup) ActionEvent(javafx.event.ActionEvent) ToggleGroup(javafx.scene.control.ToggleGroup) StyleableObjectProperty(javafx.css.StyleableObjectProperty) Utils(com.sun.javafx.util.Utils) ImageView(javafx.scene.image.ImageView) WritableValue(javafx.beans.value.WritableValue) Collections(java.util.Collections) SharedMemory(com.kyj.fx.voeditor.visual.momory.SharedMemory) DockNode(com.kyj.fx.voeditor.visual.component.dock.pane.DockNode) Node(javafx.scene.Node) ArrayList(java.util.ArrayList)

Example 95 with Node

use of javafx.scene.Node in project Gargoyle by callakrsos.

the class DockNode method setFloating.

/**
	 * Whether the node is currently floating.
	 *
	 * @param floating Whether the node is currently floating.
	 * @param translation null The offset of the node after being set floating. Used for aligning it
	 *        with its layout bounds inside the dock pane when it becomes detached. Can be null
	 *        indicating no translation.
	 *
	 *
	 *        tansalation param value is value set (screenX,screenY)
	 */
public void setFloating(boolean floating, Point2D translation) {
    if (floating && !this.isFloating()) {
        // position the new stage relative to the old scene offset
        Point2D floatScene = this.localToScene(0, 0);
        Point2D floatScreen = this.localToScreen(0, 0);
        // setup window stage
        dockTitleBar.setVisible(this.isCustomTitleBar());
        dockTitleBar.setManaged(this.isCustomTitleBar());
        if (this.isDocked()) {
            this.undock();
        }
        stage = new Stage();
        stage.initStyle(stageStyle);
        stage.titleProperty().bind(titleProperty);
        if (dockPane != null && dockPane.getScene() != null && dockPane.getScene().getWindow() != null) {
            stage.initOwner(dockPane.getScene().getWindow());
        }
        if (null == stage.getOwner() && null != this.owner)
            stage.initOwner(this.owner);
        /* append close handler. 2017-05-29 by kyj.*/
        EventHandler<WindowEvent> closeHandler = ev -> {
            try {
                ObservableList<Node> childrenUnmodifiable = null;
                if (dockPane != null)
                    dockPane.getChildrenUnmodifiable();
                else
                    childrenUnmodifiable = FXCollections.observableArrayList(getContents());
                Consumer<Closeable> clo = n -> {
                    try {
                        n.close();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                };
                childrenUnmodifiable.stream().filter(n -> n instanceof Closeable).map(n -> (Closeable) n).forEach(clo);
            } catch (Exception e) {
                e.printStackTrace();
            }
        };
        //			stage.setOnCloseRequest(value);
        stage.addEventHandler(WindowEvent.WINDOW_CLOSE_REQUEST, closeHandler);
        // offset the new stage to cover exactly the area the dock was local to the scene
        // this is useful for when the user presses the + sign and we have no information
        // on where the mouse was clicked
        // the border pane allows the dock node to
        // have a drop shadow effect on the border
        // but also maintain the layout of contents
        // such as a tab that has no content
        borderPane = new BorderPane();
        borderPane.getStyleClass().add("dock-node-border");
        borderPane.setCenter(this);
        borderPane.applyCss();
        Scene scene = new Scene(borderPane);
        scene.getStylesheets().add(SkinManager.getInstance().getSkin());
        // apply the floating property so we can get its padding size
        // while it is floating to offset it by the drop shadow
        // this way it pops out above exactly where it was when docked
        this.floatingProperty.set(floating);
        this.applyCss();
        /*
			 * 2016-10-26 apply default value by kyj
			 * tanslation param value is empty , i call api that stage will be located center
			 */
        if (translation != null) {
            Point2D stagePosition = new Point2D(0, 0);
            if (this.isDecorated()) {
                Window owner = this.owner;
                if (null != owner)
                    stagePosition = floatScene.add(new Point2D(owner.getX(), owner.getY()));
                else
                    stagePosition = floatScene.add(new Point2D(0, 0));
            } else {
                if (floatScreen != null)
                    stagePosition = floatScreen;
            }
            if (translation != null) {
                stagePosition = stagePosition.add(translation);
            }
            //				Insets insetsDelta = borderPane.getInsets();
            stage.setX(/*stagePosition.getX() - insetsDelta.getLeft()*/
            translation.getX());
            stage.setY(/*stagePosition.getY() - insetsDelta.getTop()*/
            translation.getY());
        } else
            stage.centerOnScreen();
        if (stageStyle == StageStyle.TRANSPARENT) {
            scene.setFill(null);
        }
        stage.setResizable(this.isStageResizable());
        if (this.isStageResizable()) {
            stage.addEventFilter(MouseEvent.MOUSE_PRESSED, this);
            stage.addEventFilter(MouseEvent.MOUSE_MOVED, this);
            stage.addEventFilter(MouseEvent.MOUSE_DRAGGED, this);
        }
        // we want to set the client area size
        // without this it subtracts the native border sizes from the scene
        // size
        stage.sizeToScene();
        stage.setScene(scene);
        stage.show();
    } else if (!floating && this.isFloating()) {
        this.floatingProperty.set(floating);
        stage.removeEventFilter(MouseEvent.MOUSE_PRESSED, this);
        stage.removeEventFilter(MouseEvent.MOUSE_MOVED, this);
        stage.removeEventFilter(MouseEvent.MOUSE_DRAGGED, this);
        stage.close();
    }
}
Also used : EventHandler(javafx.event.EventHandler) StageStyle(javafx.stage.StageStyle) Scene(javafx.scene.Scene) PseudoClass(javafx.css.PseudoClass) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) MouseEvent(javafx.scene.input.MouseEvent) FXCollections(javafx.collections.FXCollections) VBox(javafx.scene.layout.VBox) Insets(javafx.geometry.Insets) Point2D(javafx.geometry.Point2D) WindowEvent(javafx.stage.WindowEvent) ObjectProperty(javafx.beans.property.ObjectProperty) Rectangle2D(javafx.geometry.Rectangle2D) Node(javafx.scene.Node) Screen(javafx.stage.Screen) Consumer(java.util.function.Consumer) Cursor(javafx.scene.Cursor) Priority(javafx.scene.layout.Priority) BooleanProperty(javafx.beans.property.BooleanProperty) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) Stage(javafx.stage.Stage) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) Closeable(java.io.Closeable) Window(javafx.stage.Window) SkinManager(com.kyj.fx.voeditor.visual.momory.SkinManager) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) StringProperty(javafx.beans.property.StringProperty) Window(javafx.stage.Window) BorderPane(javafx.scene.layout.BorderPane) Consumer(java.util.function.Consumer) Point2D(javafx.geometry.Point2D) ObservableList(javafx.collections.ObservableList) Closeable(java.io.Closeable) WindowEvent(javafx.stage.WindowEvent) Stage(javafx.stage.Stage) Scene(javafx.scene.Scene)

Aggregations

Node (javafx.scene.Node)118 Label (javafx.scene.control.Label)18 Stage (javafx.stage.Stage)17 Parent (javafx.scene.Parent)16 Button (javafx.scene.control.Button)16 ArrayList (java.util.ArrayList)15 ObservableList (javafx.collections.ObservableList)14 FXML (javafx.fxml.FXML)14 List (java.util.List)12 BorderPane (javafx.scene.layout.BorderPane)12 HBox (javafx.scene.layout.HBox)11 IOException (java.io.IOException)10 Platform (javafx.application.Platform)10 Insets (javafx.geometry.Insets)10 Color (javafx.scene.paint.Color)10 FXCollections (javafx.collections.FXCollections)9 MouseEvent (javafx.scene.input.MouseEvent)9 VBox (javafx.scene.layout.VBox)9 FadeTransition (javafx.animation.FadeTransition)8 MenuItem (javafx.scene.control.MenuItem)8