Search in sources :

Example 41 with Node

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

the class BigTextView method initialize.

@FXML
public void initialize() {
    //		javaTextArea = new TextArea();
    //		javaTextArea.setPrefSize(TextArea.USE_COMPUTED_SIZE, Double.MAX_VALUE);
    hboxButtons.setVisible(showButtons);
    pagination = new Pagination(TOTAL_PAGE);
    pagination.setCache(true);
    pagination.setPageFactory(new Callback<Integer, Node>() {

        @Override
        public Node call(Integer param) {
            if (isUsePageCache && pageCache.containsValue(param)) {
                return pageCache.get(param);
            }
            String readContent = readPage(param);
            //new PagedSimpleTextView(BigTextView.this, readContent, false);
            SimpleTextView simpleTextView = new SimpleTextView(readContent, false);
            simpleTextView.setPrefSize(TextArea.USE_COMPUTED_SIZE, Double.MAX_VALUE);
            if (isUsePageCache)
                pageCache.put(param, simpleTextView);
            return simpleTextView;
        }
    });
    pagination.setPrefSize(Pagination.USE_COMPUTED_SIZE, Pagination.USE_COMPUTED_SIZE);
    this.setCenter(pagination);
}
Also used : Pagination(javafx.scene.control.Pagination) Node(javafx.scene.Node) PagedSimpleTextView(com.kyj.fx.voeditor.visual.component.text.PagedSimpleTextView) SimpleTextView(com.kyj.fx.voeditor.visual.component.text.SimpleTextView) FXML(javafx.fxml.FXML)

Example 42 with Node

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

the class FxSVNHistoryDataSupplier method createEntryListView.

//	MenuItem createDiffMenu(){
//
//	}
ListView<SVNLogEntry> createEntryListView(ObservableList<SVNLogEntry> list) {
    ListView<SVNLogEntry> listView = new ListView<SVNLogEntry>(list);
    listView.setCellFactory(new Callback<ListView<SVNLogEntry>, ListCell<SVNLogEntry>>() {

        @Override
        public ListCell<SVNLogEntry> call(ListView<SVNLogEntry> param) {
            ListCell<SVNLogEntry> listCell = new ListCell<SVNLogEntry>() {

                /* (non-Javadoc)
					 * @see javafx.scene.control.Cell#updateItem(java.lang.Object, boolean)
					 */
                @Override
                protected void updateItem(SVNLogEntry item, boolean empty) {
                    super.updateItem(item, empty);
                    if (empty) {
                        setText(null);
                    } else {
                        long revision = item.getRevision();
                        String author = item.getAuthor();
                        String dateString = YYYY_MM_DD_HH_MM_SS_PATTERN.format(item.getDate());
                        String message = item.getMessage();
                        setText(String.format("Resivion :%d author %s date :%s message :%s ", revision, author, dateString, message));
                    }
                }
            };
            return listCell;
        }
    });
    listView.setPrefSize(600, ListView.USE_COMPUTED_SIZE);
    listView.addEventHandler(MouseEvent.MOUSE_CLICKED, ev -> {
        if (ev.getClickCount() == 2 && ev.getButton() == MouseButton.PRIMARY) {
            SVNLogEntry selectedItem = listView.getSelectionModel().getSelectedItem();
            if (selectedItem != null) {
                Map<String, SVNLogEntryPath> changedPaths = selectedItem.getChangedPaths();
                if (ValueUtil.isNotEmpty(changedPaths)) {
                    ObservableList<GargoyleSVNLogEntryPath> collect = createStream(Arrays.asList(selectedItem)).collect(FxCollectors.toObservableList());
                    Node showing = null;
                    if (collect.isEmpty()) {
                        showing = new Label("Empty.");
                        showing.setStyle("-fx-text-fill:black");
                    } else {
                        showing = createHistoryListView(collect);
                    }
                    FxUtil.showPopOver(ev.getPickResult().getIntersectedNode(), showing);
                }
            }
        }
    });
    return listView;
}
Also used : SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) ListCell(javafx.scene.control.ListCell) Node(javafx.scene.Node) Label(javafx.scene.control.Label) ListView(javafx.scene.control.ListView) SVNLogEntryPath(org.tmatesoft.svn.core.SVNLogEntryPath)

Example 43 with Node

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

the class NrchRealtimeSrchFlowComposite method defineService.

private void defineService() {
    /*
		 * 비동기 실시간 검색어 조회 처리가 기술.
		 */
    service = new Service<List<RealtimeSearchVO>>() {

        @Override
        protected Task<List<RealtimeSearchVO>> createTask() {
            return new Task<List<RealtimeSearchVO>>() {

                @Override
                protected List<RealtimeSearchVO> call() throws Exception {
                    List<RealtimeSearchVO> meta = Collections.emptyList();
                    try {
                        meta = NaverRealtimeSrchSupplier.getInstance().getMeta();
                    } catch (Exception e) {
                        DialogUtil.showExceptionDailog(e);
                    }
                    return meta;
                }
            };
        }
    };
    service.setOnCancelled(stat -> {
        if (State.CANCELLED == stat.getSource().getState()) {
            LOGGER.debug("Cancel Requested");
        }
    });
    service.setOnSucceeded(stat -> {
        applyResponseTime(DateUtil.getCurrentDateString());
        FlowCardComposite value = new FlowCardComposite();
        flowCardComposite.set(value);
        this.getParent().setCenter(flowCardComposite.get());
        FlowCardComposite tmp = flowCardComposite.get();
        ObservableList<Node> flowChildrens = tmp.getFlowChildrens();
        tmp.setLimitColumn(20);
        data.setAll((List<RealtimeSearchVO>) stat.getSource().getValue());
        List<VBox> collect = data.stream().map(nodeConverter::apply).flatMap(v -> v.stream()).collect(Collectors.toList());
        flowChildrens.setAll(collect);
        if (isRecycle.get()) {
            WaitThread waitThread = new WaitThread(THREAD_RUNNER_GROUP, choWaitItems.getValue()) {

                @Override
                public boolean isContinue() {
                    return isRecycle.get();
                }

                @Override
                public void execute() {
                    Platform.runLater(() -> {
                        if (isContinue())
                            service.restart();
                    });
                }

                @Override
                public boolean isRecycle() {
                    return isRecycle.get();
                }
            };
            waitThread.setDaemon(true);
            waitThread.start();
        }
    });
}
Also used : IntStream(java.util.stream.IntStream) Button(javafx.scene.control.Button) Pos(javafx.geometry.Pos) MouseButton(javafx.scene.input.MouseButton) RealtimeSearchVO(com.kyj.fx.voeditor.visual.framework.RealtimeSearchVO) LoggerFactory(org.slf4j.LoggerFactory) FXCollections(javafx.collections.FXCollections) DialogUtil(com.kyj.fx.voeditor.visual.util.DialogUtil) VBox(javafx.scene.layout.VBox) Function(java.util.function.Function) RealtimeSearchItemVO(com.kyj.fx.voeditor.visual.framework.RealtimeSearchItemVO) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) Task(javafx.concurrent.Task) Insets(javafx.geometry.Insets) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ContextMenu(javafx.scene.control.ContextMenu) State(javafx.concurrent.Worker.State) ExecutorService(java.util.concurrent.ExecutorService) HBox(javafx.scene.layout.HBox) ObjectProperty(javafx.beans.property.ObjectProperty) Logger(org.slf4j.Logger) Label(javafx.scene.control.Label) MenuItem(javafx.scene.control.MenuItem) TitledPane(javafx.scene.control.TitledPane) CloseableParent(com.kyj.fx.voeditor.visual.main.layout.CloseableParent) Node(javafx.scene.Node) IOException(java.io.IOException) ValueUtil(com.kyj.fx.voeditor.visual.util.ValueUtil) Service(javafx.concurrent.Service) Collectors(java.util.stream.Collectors) ChoiceBox(javafx.scene.control.ChoiceBox) GoogleTrendComposite(com.kyj.fx.voeditor.visual.component.google.trend.GoogleTrendComposite) Platform(javafx.application.Platform) Cursor(javafx.scene.Cursor) FxUtil(com.kyj.fx.voeditor.visual.util.FxUtil) List(java.util.List) BooleanProperty(javafx.beans.property.BooleanProperty) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) NaverRealtimeSrchSupplier(com.kyj.fx.voeditor.visual.suppliers.NaverRealtimeSrchSupplier) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) FlowCardComposite(com.kyj.fx.voeditor.visual.component.FlowCardComposite) DateUtil(com.kyj.fx.voeditor.visual.util.DateUtil) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) Collections(java.util.Collections) ExecutorDemons(com.kyj.fx.voeditor.visual.framework.thread.ExecutorDemons) SharedMemory(com.kyj.fx.voeditor.visual.momory.SharedMemory) Task(javafx.concurrent.Task) Node(javafx.scene.Node) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) IOException(java.io.IOException) RealtimeSearchVO(com.kyj.fx.voeditor.visual.framework.RealtimeSearchVO) FlowCardComposite(com.kyj.fx.voeditor.visual.component.FlowCardComposite) List(java.util.List) ObservableList(javafx.collections.ObservableList) VBox(javafx.scene.layout.VBox)

Example 44 with Node

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

the class CrudBaseGridView method saveBtnClickHandler.

/**
	 * 저장버튼 클릭 핸들러
	 *
	 * @param saveClickCallbackProperty2
	 *
	 * @Date 2015. 10. 10.
	 * @return
	 * @User KYJ
	 */
private EventHandler<MouseEvent> saveBtnClickHandler(ObjectProperty<Consumer<List<T>>> saveClickCallbackProperty) {
    return new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent event) {
            try {
                Consumer<List<T>> callback = saveClickCallbackProperty.get();
                if (callback == null) {
                    errorMsgCallback.accept("saveClickCallback 함수에 에러메세지 콜백을 등록하세요.");
                    return;
                }
                gridview.fireEvent(event);
                List<T> items = getItems();
                //필수값 검증로직 추가. 2016.12.08
                AbstractVoNullChecker<T> nullCheckHandler = new DefaultVoNullChecker<>(CrudBaseGridView.this);
                nullCheckHandler.setList(items);
                Optional<Field> findFirst = nullCheckHandler.findFirst();
                boolean present = findFirst.isPresent();
                if (present) {
                    String msgFieldName = nullCheckHandler.getMsgNameByfield();
                    //						String message = ValueUtil.getMessage("MSG_W_000001", msgFieldName);
                    int emptyIndex = nullCheckHandler.getEmptyIndex();
                    Set<Node> findAllByNodes = CrudBaseGridView.this.lookupAll("TableRow");
                    findAllByNodes.stream().map(n -> (TableRow) n).filter(r -> {
                        return emptyIndex == r.getIndex();
                    }).findFirst().ifPresent(n -> {
                        Timeline timeline = new Timeline();
                        timeline.setCycleCount(10);
                        timeline.setAutoReverse(true);
                        KeyFrame keyFrame = new KeyFrame(Duration.millis(500), new KeyValue(n.styleProperty(), "-fx-border-color : red ; -fx-border-width : 1px"));
                        KeyFrame keyFrame2 = new KeyFrame(Duration.millis(500), new KeyValue(n.styleProperty(), ""));
                        KeyValue keyValueX = new KeyValue(n.styleProperty(), "-fx-border-color : red ; -fx-border-width : 1px");
                        KeyValue keyValueY = new KeyValue(n.styleProperty(), "");
                        KeyFrame keyFrame3 = new KeyFrame(Duration.seconds(2), "", keyValueX, keyValueY);
                        timeline.getKeyFrames().add(keyFrame3);
                        timeline.play();
                    });
                    getSelectionModel().select(emptyIndex);
                    //						DialogUtil.showMessageDialog(SharedMemory.getPrimaryStage(), msgFieldName + " Field is empty.");
                    return;
                }
                List<T> arrayList = new ArrayList<T>(items);
                arrayList.addAll(deleteItems);
                callback.accept(arrayList);
                // 사용자 정의 로직이 이상없으면 deleteItems 항목도 비운다.
                deleteItems.clear();
            } catch (Exception e) {
                throw e;
            }
        }
    };
}
Also used : EventHandler(javafx.event.EventHandler) Button(javafx.scene.control.Button) Pos(javafx.geometry.Pos) MouseEvent(javafx.scene.input.MouseEvent) LoggerFactory(org.slf4j.LoggerFactory) FXCollections(javafx.collections.FXCollections) DialogUtil(com.kyj.fx.voeditor.visual.util.DialogUtil) ArrayList(java.util.ArrayList) TableColumn(javafx.scene.control.TableColumn) Insets(javafx.geometry.Insets) KeyValue(javafx.animation.KeyValue) HBox(javafx.scene.layout.HBox) KeyFrame(javafx.animation.KeyFrame) ObjectProperty(javafx.beans.property.ObjectProperty) Logger(org.slf4j.Logger) Node(javafx.scene.Node) TableRow(javafx.scene.control.TableRow) Set(java.util.Set) Timeline(javafx.animation.Timeline) Field(java.lang.reflect.Field) Objects(java.util.Objects) Consumer(java.util.function.Consumer) List(java.util.List) ActionEvent(javafx.event.ActionEvent) Duration(javafx.util.Duration) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) Optional(java.util.Optional) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) TableViewSelectionModel(javafx.scene.control.TableView.TableViewSelectionModel) SharedMemory(com.kyj.fx.voeditor.visual.momory.SharedMemory) MouseEvent(javafx.scene.input.MouseEvent) KeyValue(javafx.animation.KeyValue) Node(javafx.scene.Node) ArrayList(java.util.ArrayList) EventHandler(javafx.event.EventHandler) Field(java.lang.reflect.Field) Timeline(javafx.animation.Timeline) TableRow(javafx.scene.control.TableRow) KeyFrame(javafx.animation.KeyFrame) ArrayList(java.util.ArrayList) List(java.util.List) ObservableList(javafx.collections.ObservableList)

Example 45 with Node

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

the class PMDViolationbyBarChartComposite method style.

/**
	 * @작성자 : KYJ
	 * @작성일 : 2016. 10. 24.
	 * @param barChart2
	 */
private void style(BarChart<String, Number> chart) {
    Color lineColor = Color.web("#58AD58");
    //		chart-bar series0 data2 default-color0
    String style = "-fx-bar-fill: ".concat(FxUtil.toWebString(lineColor)).concat(";");
    Set<Node> lookupAll = chart.lookupAll(".default-color0");
    for (Node n : lookupAll) {
        //				anotherStyleAction.accept(style);
        n.setStyle(style);
    }
}
Also used : Color(javafx.scene.paint.Color) Node(javafx.scene.Node)

Aggregations

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