Search in sources :

Example 1 with ReadOnlyBooleanProperty

use of javafx.beans.property.ReadOnlyBooleanProperty in project VocabHunter by VocabHunter.

the class SettingsController method initialiseField.

private void initialiseField(final TextField field, final Supplier<Object> settingGetter) {
    StringProperty textProperty = field.textProperty();
    ReadOnlyBooleanProperty focusedProperty = field.focusedProperty();
    field.setText(settingGetter.get().toString());
    textProperty.addListener((o, oldValue, newValue) -> cleanNonNegativeInteger(field::setText, newValue, oldValue));
    focusedProperty.addListener((o, old, isFocused) -> applyDefaultIfEmpty(field::setText, field::getText, settingGetter));
}
Also used : ReadOnlyBooleanProperty(javafx.beans.property.ReadOnlyBooleanProperty) StringProperty(javafx.beans.property.StringProperty)

Example 2 with ReadOnlyBooleanProperty

use of javafx.beans.property.ReadOnlyBooleanProperty in project bitsquare by bitsquare.

the class TraderDisputeView method getStateColumn.

private TableColumn<Dispute, Dispute> getStateColumn() {
    TableColumn<Dispute, Dispute> column = new TableColumn<Dispute, Dispute>("State") {

        {
            setMinWidth(50);
        }
    };
    column.setCellValueFactory((dispute) -> new ReadOnlyObjectWrapper<>(dispute.getValue()));
    column.setCellFactory(new Callback<TableColumn<Dispute, Dispute>, TableCell<Dispute, Dispute>>() {

        @Override
        public TableCell<Dispute, Dispute> call(TableColumn<Dispute, Dispute> column) {
            return new TableCell<Dispute, Dispute>() {

                public ReadOnlyBooleanProperty closedProperty;

                public ChangeListener<Boolean> listener;

                @Override
                public void updateItem(final Dispute item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        listener = (observable, oldValue, newValue) -> {
                            setText(newValue ? "Closed" : "Open");
                            getTableRow().setOpacity(newValue ? 0.4 : 1);
                        };
                        closedProperty = item.isClosedProperty();
                        closedProperty.addListener(listener);
                        boolean isClosed = item.isClosed();
                        setText(isClosed ? "Closed" : "Open");
                        getTableRow().setOpacity(isClosed ? 0.4 : 1);
                    } else {
                        if (closedProperty != null) {
                            closedProperty.removeListener(listener);
                            closedProperty = null;
                        }
                        setText("");
                    }
                }
            };
        }
    });
    return column;
}
Also used : EventHandler(javafx.event.EventHandler) PubKeyRing(io.bitsquare.common.crypto.PubKeyRing) Popup(io.bitsquare.gui.main.overlays.popups.Popup) javafx.scene.layout(javafx.scene.layout) javafx.scene.control(javafx.scene.control) URL(java.net.URL) ReadOnlyBooleanProperty(javafx.beans.property.ReadOnlyBooleanProperty) DisputeManager(io.bitsquare.arbitration.DisputeManager) Trade(io.bitsquare.trade.Trade) ActivatableView(io.bitsquare.gui.common.view.ActivatableView) DisputeCommunicationMessage(io.bitsquare.arbitration.messages.DisputeCommunicationMessage) GUIUtil(io.bitsquare.gui.util.GUIUtil) KeyCombination(javafx.scene.input.KeyCombination) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) ListChangeListener(javafx.collections.ListChangeListener) KeyRing(io.bitsquare.common.crypto.KeyRing) DisputeSummaryWindow(io.bitsquare.gui.main.overlays.windows.DisputeSummaryWindow) ParseException(java.text.ParseException) DateFormat(java.text.DateFormat) SortedList(javafx.collections.transformation.SortedList) TableGroupHeadline(io.bitsquare.gui.components.TableGroupHeadline) Contract(io.bitsquare.trade.Contract) FilteredList(javafx.collections.transformation.FilteredList) KeyEvent(javafx.scene.input.KeyEvent) Subscription(org.fxmisc.easybind.Subscription) PrivateNotificationManager(io.bitsquare.alert.PrivateNotificationManager) Attachment(io.bitsquare.arbitration.payload.Attachment) Paint(javafx.scene.paint.Paint) ByteStreams(com.google.common.io.ByteStreams) Dispute(io.bitsquare.arbitration.Dispute) ObservableList(javafx.collections.ObservableList) AwesomeIcon(de.jensd.fx.fontawesome.AwesomeIcon) Version(io.bitsquare.app.Version) Scene(javafx.scene.Scene) java.util(java.util) P2PService(io.bitsquare.p2p.P2PService) SimpleDateFormat(java.text.SimpleDateFormat) Connection(io.bitsquare.p2p.network.Connection) Timer(io.bitsquare.common.Timer) Inject(javax.inject.Inject) TradeManager(io.bitsquare.trade.TradeManager) Lists(com.google.common.collect.Lists) Insets(javafx.geometry.Insets) TradeDetailsWindow(io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow) TextAlignment(javafx.scene.text.TextAlignment) Callback(javafx.util.Callback) Nullable(javax.annotation.Nullable) BSFormatter(io.bitsquare.gui.util.BSFormatter) KeyCode(javafx.scene.input.KeyCode) InputTextField(io.bitsquare.gui.components.InputTextField) Utilities(io.bitsquare.common.util.Utilities) ContractWindow(io.bitsquare.gui.main.overlays.windows.ContractWindow) MalformedURLException(java.net.MalformedURLException) UserThread(io.bitsquare.common.UserThread) AwesomeDude(de.jensd.fx.fontawesome.AwesomeDude) NodeAddress(io.bitsquare.p2p.NodeAddress) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) File(java.io.File) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) TimeUnit(java.util.concurrent.TimeUnit) FileChooser(javafx.stage.FileChooser) HyperlinkWithIcon(io.bitsquare.gui.components.HyperlinkWithIcon) Stage(javafx.stage.Stage) EasyBind(org.fxmisc.easybind.EasyBind) ImageView(javafx.scene.image.ImageView) BusyAnimation(io.bitsquare.gui.components.BusyAnimation) SendPrivateNotificationWindow(io.bitsquare.gui.main.overlays.windows.SendPrivateNotificationWindow) FxmlView(io.bitsquare.gui.common.view.FxmlView) ChangeListener(javafx.beans.value.ChangeListener) InputStream(java.io.InputStream) ReadOnlyBooleanProperty(javafx.beans.property.ReadOnlyBooleanProperty) Dispute(io.bitsquare.arbitration.Dispute)

Example 3 with ReadOnlyBooleanProperty

use of javafx.beans.property.ReadOnlyBooleanProperty in project bisq-desktop by bisq-network.

the class TraderDisputeView method getStateColumn.

private TableColumn<Dispute, Dispute> getStateColumn() {
    TableColumn<Dispute, Dispute> column = new AutoTooltipTableColumn<Dispute, Dispute>(Res.get("support.state")) {

        {
            setMinWidth(50);
        }
    };
    column.setCellValueFactory((dispute) -> new ReadOnlyObjectWrapper<>(dispute.getValue()));
    column.setCellFactory(new Callback<TableColumn<Dispute, Dispute>, TableCell<Dispute, Dispute>>() {

        @Override
        public TableCell<Dispute, Dispute> call(TableColumn<Dispute, Dispute> column) {
            return new TableCell<Dispute, Dispute>() {

                public ReadOnlyBooleanProperty closedProperty;

                public ChangeListener<Boolean> listener;

                @Override
                public void updateItem(final Dispute item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        listener = (observable, oldValue, newValue) -> {
                            setText(newValue ? Res.get("support.closed") : Res.get("support.open"));
                            getTableRow().setOpacity(newValue ? 0.4 : 1);
                        };
                        closedProperty = item.isClosedProperty();
                        closedProperty.addListener(listener);
                        boolean isClosed = item.isClosed();
                        setText(isClosed ? Res.get("support.closed") : Res.get("support.open"));
                        getTableRow().setOpacity(isClosed ? 0.4 : 1);
                    } else {
                        if (closedProperty != null) {
                            closedProperty.removeListener(listener);
                            closedProperty = null;
                        }
                        setText("");
                    }
                }
            };
        }
    });
    return column;
}
Also used : Button(javafx.scene.control.Button) EventHandler(javafx.event.EventHandler) PubKeyRing(bisq.common.crypto.PubKeyRing) BusyAnimation(bisq.desktop.components.BusyAnimation) Utilities(bisq.common.util.Utilities) HyperlinkWithIcon(bisq.desktop.components.HyperlinkWithIcon) ListCell(javafx.scene.control.ListCell) URL(java.net.URL) Date(java.util.Date) ReadOnlyBooleanProperty(javafx.beans.property.ReadOnlyBooleanProperty) DisputeManager(bisq.core.arbitration.DisputeManager) VBox(javafx.scene.layout.VBox) BSFormatter(bisq.desktop.util.BSFormatter) Contract(bisq.core.trade.Contract) InputTextField(bisq.desktop.components.InputTextField) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) ListChangeListener(javafx.collections.ListChangeListener) Res(bisq.core.locale.Res) Map(java.util.Map) TableView(javafx.scene.control.TableView) ParseException(java.text.ParseException) DateFormat(java.text.DateFormat) Pane(javafx.scene.layout.Pane) SortedList(javafx.collections.transformation.SortedList) HBox(javafx.scene.layout.HBox) Popup(bisq.desktop.main.overlays.popups.Popup) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) P2PService(bisq.network.p2p.P2PService) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) FilteredList(javafx.collections.transformation.FilteredList) KeyEvent(javafx.scene.input.KeyEvent) Subscription(org.fxmisc.easybind.Subscription) SendPrivateNotificationWindow(bisq.desktop.main.overlays.windows.SendPrivateNotificationWindow) Priority(javafx.scene.layout.Priority) List(java.util.List) TradeManager(bisq.core.trade.TradeManager) AnchorPane(javafx.scene.layout.AnchorPane) Paint(javafx.scene.paint.Paint) NodeAddress(bisq.network.p2p.NodeAddress) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) AppOptionKeys(bisq.core.app.AppOptionKeys) UserThread(bisq.common.UserThread) ByteStreams(com.google.common.io.ByteStreams) Optional(java.util.Optional) Attachment(bisq.core.arbitration.Attachment) ObservableList(javafx.collections.ObservableList) AwesomeIcon(de.jensd.fx.fontawesome.AwesomeIcon) TableGroupHeadline(bisq.desktop.components.TableGroupHeadline) GUIUtil(bisq.desktop.util.GUIUtil) Scene(javafx.scene.Scene) ActivatableView(bisq.desktop.common.view.ActivatableView) ListView(javafx.scene.control.ListView) DisputeSummaryWindow(bisq.desktop.main.overlays.windows.DisputeSummaryWindow) TextArea(javafx.scene.control.TextArea) SimpleDateFormat(java.text.SimpleDateFormat) Timer(bisq.common.Timer) HashMap(java.util.HashMap) Dispute(bisq.core.arbitration.Dispute) ContractWindow(bisq.desktop.main.overlays.windows.ContractWindow) FxmlView(bisq.desktop.common.view.FxmlView) TableColumn(javafx.scene.control.TableColumn) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) TableCell(javafx.scene.control.TableCell) Lists(com.google.common.collect.Lists) Insets(javafx.geometry.Insets) Connection(bisq.network.p2p.network.Connection) TextAlignment(javafx.scene.text.TextAlignment) Callback(javafx.util.Callback) Tooltip(javafx.scene.control.Tooltip) PrivateNotificationManager(bisq.core.alert.PrivateNotificationManager) Nullable(javax.annotation.Nullable) KeyCode(javafx.scene.input.KeyCode) Version(bisq.common.app.Version) Label(javafx.scene.control.Label) TradeDetailsWindow(bisq.desktop.main.overlays.windows.TradeDetailsWindow) MalformedURLException(java.net.MalformedURLException) Trade(bisq.core.trade.Trade) AwesomeDude(de.jensd.fx.fontawesome.AwesomeDude) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) File(java.io.File) TimeUnit(java.util.concurrent.TimeUnit) FileChooser(javafx.stage.FileChooser) DisputeCommunicationMessage(bisq.core.arbitration.messages.DisputeCommunicationMessage) Stage(javafx.stage.Stage) EasyBind(org.fxmisc.easybind.EasyBind) ImageView(javafx.scene.image.ImageView) ArbitratorDisputeView(bisq.desktop.main.disputes.arbitrator.ArbitratorDisputeView) Named(com.google.inject.name.Named) KeyRing(bisq.common.crypto.KeyRing) ChangeListener(javafx.beans.value.ChangeListener) InputStream(java.io.InputStream) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) TableColumn(javafx.scene.control.TableColumn) TableCell(javafx.scene.control.TableCell) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) ReadOnlyBooleanProperty(javafx.beans.property.ReadOnlyBooleanProperty) Dispute(bisq.core.arbitration.Dispute)

Aggregations

ReadOnlyBooleanProperty (javafx.beans.property.ReadOnlyBooleanProperty)3 Lists (com.google.common.collect.Lists)2 ByteStreams (com.google.common.io.ByteStreams)2 AwesomeDude (de.jensd.fx.fontawesome.AwesomeDude)2 AwesomeIcon (de.jensd.fx.fontawesome.AwesomeIcon)2 File (java.io.File)2 FileOutputStream (java.io.FileOutputStream)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 MalformedURLException (java.net.MalformedURLException)2 URL (java.net.URL)2 DateFormat (java.text.DateFormat)2 ParseException (java.text.ParseException)2 SimpleDateFormat (java.text.SimpleDateFormat)2 TimeUnit (java.util.concurrent.TimeUnit)2 ReadOnlyObjectWrapper (javafx.beans.property.ReadOnlyObjectWrapper)2 ChangeListener (javafx.beans.value.ChangeListener)2 ListChangeListener (javafx.collections.ListChangeListener)2 ObservableList (javafx.collections.ObservableList)2 FilteredList (javafx.collections.transformation.FilteredList)2