Example usage for javafx.beans.value WeakChangeListener WeakChangeListener

List of usage examples for javafx.beans.value WeakChangeListener WeakChangeListener

Introduction

In this page you can find the example usage for javafx.beans.value WeakChangeListener WeakChangeListener.

Prototype

public WeakChangeListener(@NamedArg("listener") ChangeListener<T> listener) 

Source Link

Document

The constructor of WeakChangeListener .

Usage

From source file:org.pdfsam.ui.info.SummaryTab.java

@EventListener
void requestShow(ShowPdfDescriptorRequest event) {
    if (current != event.getDescriptor()) {
        current = event.getDescriptor();
        current.loadedProperty().addListener(new WeakChangeListener<>(this));
    }//from   www. ja  v  a2 s. co  m
    setFileProperties(current.getFile());
    setPdfProperties(current);
}

From source file:org.pdfsam.ui.selection.single.SingleSelectionPane.java

public SingleSelectionPane(String ownerModule) {
    super(5);/*from  w ww  .  j a  v a  2s. c om*/
    this.ownerModule = defaultString(ownerModule);
    field.enforceValidation(true, false);
    field.getTextField().setPromptText(
            DefaultI18nContext.getInstance().i18n("Select or drag and drop the PDF you want to split"));
    encryptionIndicator = new LoadingStatusIndicator(this, this.ownerModule);
    field.setGraphic(encryptionIndicator);
    HBox.setMargin(encryptionIndicator, new Insets(0, 0, 0, 2));
    HBox topRow = new HBox(5, field);
    HBox.setHgrow(field, Priority.ALWAYS);
    topRow.setAlignment(Pos.CENTER_LEFT);
    getChildren().addAll(topRow, pages);
    field.getTextField().setEditable(false);
    field.getTextField().validProperty().addListener((o, oldVal, newVal) -> {
        if (newVal == ValidationState.VALID) {
            if (descriptor != null) {
                descriptor.invalidate();
            }
            PdfLoadRequestEvent loadEvent = new PdfLoadRequestEvent(getOwnerModule());
            descriptor = PdfDocumentDescriptor
                    .newDescriptorNoPassword(new File(field.getTextField().getText()));
            descriptor.loadedProperty().addListener(new WeakChangeListener<>(onDescriptorLoaded));
            field.getTextField().getContextMenu().getItems().forEach(i -> i.setDisable(false));
            loadEvent.add(descriptor);
            eventStudio().broadcast(loadEvent);
        }
    });
    initContextMenu();
}

From source file:org.shiftedit.gui.preview.html.RemoteHTMLPreviewController.java

@Override
public void initialize(URL url, ResourceBundle rb) {
    super.initialize(url, rb);

    if (started) {
        displayInfoDialog(getResourceBundle().getString("builtin.plugin.preview.remote_html.title"),
                getResourceBundle().getString("builtin.plugin.preview.remote_html.already_running.text"));
        Platform.runLater(() -> {//from   www .  j  a  v a 2 s.  c  om
            close();
        });

    } else {

        // Start server
        startServer();

        // URL click
        urlLinkActionEventHandler = (ActionEvent t) -> {
            ApplicationContext.getHostServices().showDocument(urlLink.getText());
        };
        urlLink.setOnAction(new WeakEventHandler<>(urlLinkActionEventHandler));

        // Table view setup
        this.setupConnectionTable();

        // Bind tracking button state
        trackActiveFileChangeListener = (ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) -> {
            setActiveDocumentTrackingEnabled(t1);
        };
        trackActiveFileToggleButton.selectedProperty()
                .addListener(new WeakChangeListener<>(trackActiveFileChangeListener));
        trackActiveFileToggleButton.setSelected(true);
    }

    // Later ...
    Platform.runLater(() -> {
        getStage().setTitle(getResourceBundle().getString("builtin.plugin.preview.remote_html.title"));
    });
}