Search in sources :

Example 61 with ImageView

use of javafx.scene.image.ImageView in project Gargoyle by callakrsos.

the class TextBaseDiffAppController method initialize.

@FXML
public void initialize() {
    /* initControls */
    ivReviced = new ImageView();
    ivpReviced = new ImageViewPane(ivReviced);
    ivpReviced.setPrefWidth(200);
    ivpReviced.setPrefHeight(150);
    ivOrigin = new ImageView();
    ivpOrigin = new ImageViewPane(ivOrigin);
    ivpOrigin.setPrefWidth(200);
    ivpOrigin.setPrefHeight(150);
    gpSnap.add(ivpReviced, 0, 0);
    gpSnap.add(ivpOrigin, 1, 0);
    lvOrinal.setCellFactory(param -> new DefaultTextFieldListCell(ORIGINAL));
    lvRevice.setCellFactory(param -> new DefaultTextFieldListCell(REVICED));
    fileCompareResultProperty.addListener(compareResultListener);
    lvRevice.setOnMouseClicked(event -> {
        if (event.getClickCount() == 2) {
            int movePosition = -1;
            ChunkWrapper selectedItem = lvRevice.getSelectionModel().getSelectedItem();
            Delta delta = selectedItem.getDelta();
            if (delta != null && delta.getOriginal() != null) {
                movePosition = selectedItem.getPosition();
                lvOrinal.scrollTo(movePosition - 1);
                lvOrinal.getSelectionModel().select(movePosition);
            }
        }
    });
    lvOrinal.setOnMouseClicked(event -> {
        if (event.getClickCount() == 2) {
            int movePosition = -1;
            ChunkWrapper selectedItem = lvOrinal.getSelectionModel().getSelectedItem();
            if (selectedItem != null) {
                Delta delta = selectedItem.getDelta();
                if (delta != null && delta.getRevised() != null) {
                    movePosition = delta.getRevised().getPosition();
                    lvRevice.scrollTo(movePosition - 1);
                    lvRevice.getSelectionModel().select(movePosition);
                }
            }
        }
    });
    lvOrinal.addEventFilter(ScrollEvent.SCROLL, event -> {
        snappOriginShot();
    });
    lvRevice.addEventFilter(ScrollEvent.SCROLL, event -> {
        snappReviceShot();
    });
    btnCompare.setOnMouseClicked(event -> {
        String ori = txtOrigin.getText();
        String rev = txtRevice.getText();
        if (!(ori.isEmpty() && rev.isEmpty())) {
            clear();
            try {
                this.compare.setOriginal(ori);
                this.compare.setRevised(rev);
                CompareResult chunkResult = this.compare.getChunkResult();
                this.fileCompareResultProperty.set(chunkResult);
                snappOriginShot();
                snappReviceShot();
            } catch (Exception e) {
                LOGGER.error(ValueUtil.toString(e));
            }
        }
    });
    colStatus.setCellValueFactory(new Callback<CellDataFeatures<ChunkWrapper, String>, ObservableValue<String>>() {

        @Override
        public ObservableValue<String> call(CellDataFeatures<ChunkWrapper, String> param) {
            TYPE type = param.getValue().getType();
            StringProperty prop = new SimpleStringProperty();
            if (type != null)
                prop.set(type.name());
            return prop;
        }
    });
    colPosition.setCellValueFactory(param -> new SimpleIntegerProperty(new Integer(param.getValue().getPosition() + 1)));
    colRevice.setCellValueFactory(param -> {
        Delta delta = param.getValue().getDelta();
        SimpleStringProperty prop = new SimpleStringProperty();
        if (delta != null) {
            Chunk c = delta.getRevised();
            prop.setValue(c.getLines().toString());
        }
        return prop;
    });
    colOrigin.setCellValueFactory(param -> {
        Delta delta = param.getValue().getDelta();
        SimpleStringProperty prop = new SimpleStringProperty();
        if (delta != null) {
            Chunk c = delta.getOriginal();
            prop.setValue(c.getLines().toString());
        }
        return prop;
    });
}
Also used : CellDataFeatures(javafx.scene.control.TableColumn.CellDataFeatures) ObservableValue(javafx.beans.value.ObservableValue) ChunkWrapper(com.kyj.fx.voeditor.visual.diff.ChunkWrapper) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) StringProperty(javafx.beans.property.StringProperty) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) Chunk(difflib.Chunk) CompareResult(com.kyj.fx.voeditor.visual.diff.CompareResult) IOException(java.io.IOException) Delta(difflib.Delta) ImageView(javafx.scene.image.ImageView) TYPE(difflib.Delta.TYPE) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) FXML(javafx.fxml.FXML)

Example 62 with ImageView

use of javafx.scene.image.ImageView in project Gargoyle by callakrsos.

the class TextSameLineDiffAppController method initialize.

@FXML
public void initialize() {
    /* initControls */
    ivReviced = new ImageView();
    ivpReviced = new ImageViewPane(ivReviced);
    ivpReviced.setPrefWidth(200);
    ivpReviced.setPrefHeight(150);
    ivOrigin = new ImageView();
    ivpOrigin = new ImageViewPane(ivOrigin);
    ivpOrigin.setPrefWidth(200);
    ivpOrigin.setPrefHeight(150);
    gpSnap.add(ivpReviced, 0, 0);
    gpSnap.add(ivpOrigin, 1, 0);
    lvOrinal.setCellFactory(param -> new DefaultTextFieldListCell(ORIGINAL));
    lvRevice.setCellFactory(param -> new DefaultTextFieldListCell(REVICED));
    fileCompareResultProperty.addListener((oba, oldresult, newresult) -> {
        if (newresult == null)
            return;
        List<ChunkWrapper> wrapperedOrigin = extractedWrapperedChunk(DeltaType.ORIGINAL, newresult);
        List<ChunkWrapper> wrapperedReviced = extractedWrapperedChunk(DeltaType.REVICED, newresult);
        lvOrinal.getItems().addAll(wrapperedOrigin);
        lvRevice.getItems().addAll(wrapperedReviced);
        tvChgHis.getItems().addAll(wrapperedOrigin.stream().filter(w -> w.getDelta() != null).collect(Collectors.toList()));
    });
    lvRevice.setOnMouseClicked(event -> {
        if (event.getClickCount() == 2) {
            int movePosition = -1;
            ChunkWrapper selectedItem = lvRevice.getSelectionModel().getSelectedItem();
            Delta delta = selectedItem.getDelta();
            if (delta != null && delta.getOriginal() != null) {
                movePosition = selectedItem.getPosition();
                lvOrinal.scrollTo(movePosition - 1);
                lvOrinal.getSelectionModel().select(movePosition);
            }
        }
    });
    lvOrinal.setOnMouseClicked(event -> {
        if (event.getClickCount() == 2) {
            int movePosition = -1;
            ChunkWrapper selectedItem = lvOrinal.getSelectionModel().getSelectedItem();
            Delta delta = selectedItem.getDelta();
            if (delta != null && delta.getRevised() != null) {
                movePosition = delta.getRevised().getPosition();
                lvRevice.scrollTo(movePosition - 1);
                lvRevice.getSelectionModel().select(movePosition);
            }
        }
    });
    lvOrinal.addEventFilter(ScrollEvent.SCROLL, event -> {
        snappOriginShot();
    });
    lvRevice.addEventFilter(ScrollEvent.SCROLL, event -> {
        snappReviceShot();
    });
    btnCompare.setOnMouseClicked(event -> {
        String ori = txtOrigin.getText();
        String rev = txtRevice.getText();
        if (!(ori.isEmpty() && rev.isEmpty())) {
            clear();
            try {
                this.compare.setOriginal(ori);
                this.compare.setRevised(rev);
                CompareResult chunkResult = this.compare.getChunkResult();
                this.fileCompareResultProperty.set(chunkResult);
                snappOriginShot();
                snappReviceShot();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
    colStatus.setCellValueFactory(new Callback<CellDataFeatures<ChunkWrapper, String>, ObservableValue<String>>() {

        @Override
        public ObservableValue<String> call(CellDataFeatures<ChunkWrapper, String> param) {
            TYPE type = param.getValue().getType();
            StringProperty prop = new SimpleStringProperty();
            if (type != null)
                prop.set(type.name());
            return prop;
        }
    });
    colPosition.setCellValueFactory(param -> new SimpleIntegerProperty(new Integer(param.getValue().getPosition() + 1)));
    colRevice.setCellValueFactory(param -> {
        Delta delta = param.getValue().getDelta();
        SimpleStringProperty prop = new SimpleStringProperty();
        if (delta != null) {
            Chunk c = delta.getRevised();
            prop.setValue(c.getLines().toString());
        }
        return prop;
    });
    colOrigin.setCellValueFactory(param -> {
        Delta delta = param.getValue().getDelta();
        SimpleStringProperty prop = new SimpleStringProperty();
        if (delta != null) {
            Chunk c = delta.getOriginal();
            prop.setValue(c.getLines().toString());
        }
        return prop;
    });
}
Also used : CellDataFeatures(javafx.scene.control.TableColumn.CellDataFeatures) ObservableValue(javafx.beans.value.ObservableValue) ChunkWrapper(com.kyj.fx.voeditor.visual.diff.ChunkWrapper) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) StringProperty(javafx.beans.property.StringProperty) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) Chunk(difflib.Chunk) CompareResult(com.kyj.fx.voeditor.visual.diff.CompareResult) IOException(java.io.IOException) Delta(difflib.Delta) ImageView(javafx.scene.image.ImageView) TYPE(difflib.Delta.TYPE) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) FXML(javafx.fxml.FXML)

Example 63 with ImageView

use of javafx.scene.image.ImageView in project Gargoyle by callakrsos.

the class CaptureScreenController method createPicutre.

public void createPicutre(String image) throws FileNotFoundException {
    ImageView ivPicture = new ImageView();
    File file = new File(snapShotDir, "tmpImage.png");
    try {
        ivPicture.getTransforms().add(new Scale(1.3, 1.3));
        ivPicture.setImage(new Image(new FileInputStream(file)));
    } catch (FileNotFoundException e) {
        throw e;
    }
    addItemEvent(ivPicture);
    //		ivPicture.getTransforms().add(scale);
    //
    //		ivPicture.setOnMouseDragged(ev -> {
    //			double dragX = ev.getSceneX() - dragAnchor.getX();
    //			double dragY = ev.getSceneY() - dragAnchor.getY();
    //			//calculate new position of the circle
    //
    //			double newXPosition = initX + dragX;
    //			double newYPosition = initY + dragY;
    //
    //			//if new position do not exceeds borders of the rectangle, translate to this position
    //			ivPicture.setTranslateX(newXPosition);
    //			ivPicture.setTranslateY(newYPosition);
    //
    //		});
    //
    //		ivPicture.setOnMousePressed(ev -> {
    //			initX = ivPicture.getTranslateX();
    //			initY = ivPicture.getTranslateY();
    //			dragAnchor = new Point2D(ev.getSceneX(), ev.getSceneY());
    //		});
    anchorBoard.getChildren().add(ivPicture);
//		spPic.getcon
}
Also used : FileNotFoundException(java.io.FileNotFoundException) Scale(javafx.scene.transform.Scale) ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image) File(java.io.File) FileInputStream(java.io.FileInputStream)

Example 64 with ImageView

use of javafx.scene.image.ImageView in project Gargoyle by callakrsos.

the class FxUtil method printJob.

/********************************
	 * 작성일 : 2016. 6. 29. 작성자 : KYJ
	 *
	 * print 처리.
	 *
	 * @param window
	 * @param target
	 ********************************/
public static void printJob(Window window, Node target) {
    Printer printer = Printer.getDefaultPrinter();
    // PrinterAttributes printerAttributes = printer.getPrinterAttributes();
    //
    Paper a4 = Paper.A4;
    // Paper a4 = PrintHelper.createPaper("Rotate A4", Paper.A4.getHeight(),
    // Paper.A4.getWidth(), Units.MM);
    PageLayout pageLayout = printer.createPageLayout(a4, PageOrientation.REVERSE_PORTRAIT, MarginType.DEFAULT);
    PrinterJob printerJob = PrinterJob.createPrinterJob();
    // JobSettings jobSettings = printerJob.getJobSettings();
    // jobSettings.setPrintSides(PrintSides.TUMBLE);
    ImageView imageView = new ImageView();
    // 화면 사이즈에 맞게 크기 조절.
    Callback<SnapshotResult, Void> callback = param -> {
        final WritableImage image = param.getImage();
        imageView.setImage(image);
        final double scaleX = pageLayout.getPrintableWidth() / imageView.getBoundsInParent().getWidth();
        final double scaleY = pageLayout.getPrintableHeight() / imageView.getBoundsInParent().getHeight();
        imageView.getTransforms().add(new Scale(scaleX, scaleY));
        return null;
    };
    target.snapshot(callback, null, null);
    if (printerJob.showPrintDialog(window) && printerJob.printPage(pageLayout, imageView))
        printerJob.endJob();
}
Also used : StageStyle(javafx.stage.StageStyle) PageOrientation(javafx.print.PageOrientation) Printer(javafx.print.Printer) SnapshotParameters(javafx.scene.SnapshotParameters) Transition(javafx.animation.Transition) AnimationType(jidefx.animation.AnimationType) PageLayout(javafx.print.PageLayout) TabPane(javafx.scene.control.TabPane) FontPosture(javafx.scene.text.FontPosture) Map(java.util.Map) Point2D(javafx.geometry.Point2D) PopOver(org.controlsfx.control.PopOver) Rectangle2D(javafx.geometry.Rectangle2D) Pair(javafx.util.Pair) Set(java.util.Set) SnapshotResult(javafx.scene.SnapshotResult) KeyEvent(javafx.scene.input.KeyEvent) Screen(javafx.stage.Screen) ScmCommitComposite(com.kyj.fx.voeditor.visual.component.scm.ScmCommitComposite) Platform(javafx.application.Platform) Stream(java.util.stream.Stream) Region(javafx.scene.layout.Region) FxContextManager(com.kyj.fx.voeditor.visual.framework.contextmenu.FxContextManager) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) MouseButton(javafx.scene.input.MouseButton) TreeItem(javafx.scene.control.TreeItem) DockNode(com.kyj.fx.voeditor.visual.component.dock.pane.DockNode) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) FXMLLoader(javafx.fxml.FXMLLoader) GargoyleButtonBuilder(com.kyj.fx.voeditor.visual.framework.builder.GargoyleButtonBuilder) Color(javafx.scene.paint.Color) Properties(java.util.Properties) TitledPane(javafx.scene.control.TitledPane) Node(javafx.scene.Node) PopupFeatures(javafx.scene.web.PopupFeatures) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) File(java.io.File) FileChooser(javafx.stage.FileChooser) Tab(javafx.scene.control.Tab) ImageView(javafx.scene.image.ImageView) ObservableValue(javafx.beans.value.ObservableValue) SkinManager(com.kyj.fx.voeditor.visual.momory.SkinManager) Image(javafx.scene.image.Image) Button(javafx.scene.control.Button) URL(java.net.URL) LoggerFactory(org.slf4j.LoggerFactory) JavaTextArea(com.kyj.fx.voeditor.visual.component.text.JavaTextArea) ToExcelFileFunction(com.kyj.fx.voeditor.visual.functions.ToExcelFileFunction) WebEvent(javafx.scene.web.WebEvent) JavaSVNManager(com.kyj.scm.manager.svn.java.JavaSVNManager) SvnChagnedCodeComposite(com.kyj.fx.voeditor.visual.component.scm.SvnChagnedCodeComposite) Parent(javafx.scene.Parent) FileSystemView(javax.swing.filechooser.FileSystemView) Task(javafx.concurrent.Task) InstanceTypes(com.kyj.fx.voeditor.visual.framework.InstanceTypes) ImageIO(javax.imageio.ImageIO) WindowEvent(javafx.stage.WindowEvent) TableView(javafx.scene.control.TableView) Method(java.lang.reflect.Method) AutoCompletionTextFieldBinding(impl.org.controlsfx.autocompletion.AutoCompletionTextFieldBinding) FxSVNHistoryDataSupplier(com.kyj.fx.voeditor.visual.component.scm.FxSVNHistoryDataSupplier) TextField(javafx.scene.control.TextField) GargoyleLoadBar(com.kyj.fx.voeditor.visual.component.bar.GargoyleLoadBar) Paper(javafx.print.Paper) BufferedImage(java.awt.image.BufferedImage) Predicate(java.util.function.Predicate) FXMLController(com.kyj.fx.voeditor.visual.framework.annotation.FXMLController) Font(javafx.scene.text.Font) Icon(javax.swing.Icon) Collectors(java.util.stream.Collectors) FxPostInitialize(com.kyj.fx.voeditor.visual.framework.annotation.FxPostInitialize) MarginType(javafx.print.Printer.MarginType) List(java.util.List) Modifier(java.lang.reflect.Modifier) Scale(javafx.scene.transform.Scale) Optional(java.util.Optional) FontWeight(javafx.scene.text.FontWeight) AnimationUtils(jidefx.animation.AnimationUtils) Scene(javafx.scene.Scene) GargoyleBuilderFactory(com.kyj.fx.voeditor.visual.framework.builder.GargoyleBuilderFactory) WebEngine(javafx.scene.web.WebEngine) TextArea(javafx.scene.control.TextArea) MouseEvent(javafx.scene.input.MouseEvent) WebViewConsole(com.kyj.fx.voeditor.visual.component.console.WebViewConsole) Function(java.util.function.Function) TableColumn(javafx.scene.control.TableColumn) TableCell(javafx.scene.control.TableCell) Charset(java.nio.charset.Charset) State(javafx.concurrent.Worker.State) JavaTextView(com.kyj.fx.voeditor.visual.component.popup.JavaTextView) Callback(javafx.util.Callback) Tooltip(javafx.scene.control.Tooltip) GargoyleException(com.kyj.fx.voeditor.visual.exceptions.GargoyleException) FxMemory(com.kyj.fx.voeditor.visual.momory.FxMemory) PrinterJob(javafx.print.PrinterJob) OutputStream(java.io.OutputStream) KeyCode(javafx.scene.input.KeyCode) WebView(javafx.scene.web.WebView) Modality(javafx.stage.Modality) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) CloseableParent(com.kyj.fx.voeditor.visual.main.layout.CloseableParent) TablePosition(javafx.scene.control.TablePosition) WritableImage(javafx.scene.image.WritableImage) FileInputStream(java.io.FileInputStream) Consumer(java.util.function.Consumer) GargoyleSynchLoadBar(com.kyj.fx.voeditor.visual.component.bar.GargoyleSynchLoadBar) Stage(javafx.stage.Stage) Closeable(java.io.Closeable) SwingFXUtils(javafx.embed.swing.SwingFXUtils) Window(javafx.stage.Window) ChangeListener(javafx.beans.value.ChangeListener) InputStream(java.io.InputStream) SharedMemory(com.kyj.fx.voeditor.visual.momory.SharedMemory) WritableImage(javafx.scene.image.WritableImage) SnapshotResult(javafx.scene.SnapshotResult) PageLayout(javafx.print.PageLayout) Paper(javafx.print.Paper) Scale(javafx.scene.transform.Scale) ImageView(javafx.scene.image.ImageView) Printer(javafx.print.Printer) PrinterJob(javafx.print.PrinterJob)

Example 65 with ImageView

use of javafx.scene.image.ImageView in project bitsquare by bitsquare.

the class TakeOfferView method addAmountPriceGroup.

private void addAmountPriceGroup() {
    TitledGroupBg titledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 2, "Set amount and price", Layout.GROUP_DISTANCE);
    GridPane.setColumnSpan(titledGroupBg, 3);
    imageView = new ImageView();
    imageView.setPickOnBounds(true);
    directionLabel = new Label();
    directionLabel.setAlignment(Pos.CENTER);
    directionLabel.setPadding(new Insets(-5, 0, 0, 0));
    VBox imageVBox = new VBox();
    imageVBox.setAlignment(Pos.CENTER);
    imageVBox.setSpacing(6);
    imageVBox.getChildren().addAll(imageView, directionLabel);
    GridPane.setRowIndex(imageVBox, gridRow);
    GridPane.setRowSpan(imageVBox, 2);
    GridPane.setMargin(imageVBox, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE, 10, 10, 10));
    gridPane.getChildren().add(imageVBox);
    addAmountPriceFields();
    addSecondRow();
    HBox hBox = new HBox();
    hBox.setSpacing(10);
    nextButton = new Button(BSResources.get("takeOffer.amountPriceBox.next"));
    nextButton.setDefaultButton(true);
    nextButton.setOnAction(e -> onShowPayFundsScreen());
    //UserThread.runAfter(() -> nextButton.requestFocus(), 100, TimeUnit.MILLISECONDS);
    cancelButton1 = new Button(BSResources.get("shared.cancel"));
    cancelButton1.setDefaultButton(false);
    cancelButton1.setId("cancel-button");
    cancelButton1.setOnAction(e -> {
        model.dataModel.swapTradeToSavings();
        close();
    });
    offerAvailabilityBusyAnimation = new BusyAnimation();
    offerAvailabilityLabel = new Label(BSResources.get("takeOffer.fundsBox.isOfferAvailable"));
    hBox.setAlignment(Pos.CENTER_LEFT);
    hBox.getChildren().addAll(nextButton, cancelButton1, offerAvailabilityBusyAnimation, offerAvailabilityLabel);
    GridPane.setRowIndex(hBox, ++gridRow);
    GridPane.setColumnIndex(hBox, 1);
    GridPane.setMargin(hBox, new Insets(-30, 0, 0, 0));
    gridPane.getChildren().add(hBox);
}
Also used : ImageView(javafx.scene.image.ImageView)

Aggregations

ImageView (javafx.scene.image.ImageView)73 Image (javafx.scene.image.Image)33 Popup (io.bitsquare.gui.main.overlays.popups.Popup)13 Label (javafx.scene.control.Label)13 Insets (javafx.geometry.Insets)12 Callback (javafx.util.Callback)11 ChangeListener (javafx.beans.value.ChangeListener)10 File (java.io.File)9 IOException (java.io.IOException)9 Button (javafx.scene.control.Button)9 AnchorPane (javafx.scene.layout.AnchorPane)9 FxmlView (io.bitsquare.gui.common.view.FxmlView)8 FXML (javafx.fxml.FXML)8 Inject (javax.inject.Inject)8 ActivatableViewAndModel (io.bitsquare.gui.common.view.ActivatableViewAndModel)7 ObservableValue (javafx.beans.value.ObservableValue)7 javafx.scene.control (javafx.scene.control)7 GridPane (javafx.scene.layout.GridPane)7 VBox (javafx.scene.layout.VBox)7 UserThread (io.bitsquare.common.UserThread)6