本文整理汇总了Java中org.fxmisc.easybind.EasyBind.subscribe方法的典型用法代码示例。如果您正苦于以下问题:Java EasyBind.subscribe方法的具体用法?Java EasyBind.subscribe怎么用?Java EasyBind.subscribe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.fxmisc.easybind.EasyBind
的用法示例。
在下文中一共展示了EasyBind.subscribe方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: StyledTableCell
import org.fxmisc.easybind.EasyBind; //导入方法依赖的package包/类
public StyledTableCell(TableColumn<LogEntry, String> column, Search search) {
text = new SearchableLabel(search);
text.fontProperty().bind(fontProperty());
setGraphic(text);
setText(null);
// this is usually called only once (when this cell is attached to a row)
EasyBind.subscribe(tableRowProperty(), row -> {
if (row == null) {
return;
}
// bind the text for the foreground
//noinspection unchecked
Binding<Style> colorizedLogStyle = getOrCreateStyleBinding(row, colorizer);
text.normalStyleProperty().bind(colorizedLogStyle);
// apply the style to the cell for the background
EasyBind.subscribe(colorizedLogStyle, s -> s.bindNode(this));
});
}
示例2: SearchableLabel
import org.fxmisc.easybind.EasyBind; //导入方法依赖的package包/类
public SearchableLabel(Search search) {
this.search = search;
// reuse the same initial text when not searching
initialText = new Label();
initialText.textProperty().bind(text);
initialText.fontProperty().bind(font);
initialText.setMinWidth(USE_COMPUTED_SIZE);
EasyBind.subscribe(normalStyle, style -> style.bindNodes(initialText));
text.addListener((obs, old, val) -> refreshSearch());
search.textProperty().addListener((obs, old, val) -> refreshSearch());
search.activeProperty().addListener((obs, old, val) -> refreshSearch());
search.matchCaseProperty().addListener((obs, old, val) -> refreshSearch());
search.regexModeProperty().addListener((obs, old, val) -> refreshSearch());
// initialize the content
refreshSearch();
}
示例3: activate
import org.fxmisc.easybind.EasyBind; //导入方法依赖的package包/类
public void activate() {
if (txIdTextField != null) {
if (txIdSubscription != null)
txIdSubscription.unsubscribe();
txIdSubscription = EasyBind.subscribe(model.dataModel.txId, id -> {
if (!id.isEmpty())
txIdTextField.setup(id);
else
txIdTextField.cleanup();
});
}
trade.errorMessageProperty().addListener(errorMessageListener);
disputeStateSubscription = EasyBind.subscribe(trade.disputeStateProperty(), newValue -> {
if (newValue != null)
updateDisputeState(newValue);
});
tradePeriodStateSubscription = EasyBind.subscribe(trade.tradePeriodStateProperty(), newValue -> {
if (newValue != null)
updateTradePeriodState(newValue);
});
model.clock.addListener(clockListener);
}
示例4: getJavaFXTask
import org.fxmisc.easybind.EasyBind; //导入方法依赖的package包/类
private <V> Task<V> getJavaFXTask(BackgroundTask<V> task) {
Task<V> javaTask = new Task<V>() {
{
EasyBind.subscribe(task.progressProperty(), progress -> updateProgress(progress.getWorkDone(), progress.getMax()));
}
@Override
public V call() throws Exception {
return task.call();
}
};
Runnable onRunning = task.getOnRunning();
if (onRunning != null) {
javaTask.setOnRunning(event -> onRunning.run());
}
Consumer<V> onSuccess = task.getOnSuccess();
if (onSuccess != null) {
javaTask.setOnSucceeded(event -> onSuccess.accept(javaTask.getValue()));
}
Consumer<Exception> onException = task.getOnException();
if (onException != null) {
javaTask.setOnFailed(event -> onException.accept(convertToException(javaTask.getException())));
}
return javaTask;
}
示例5: activate
import org.fxmisc.easybind.EasyBind; //导入方法依赖的package包/类
@Override
protected void activate() {
tableView.getSelectionModel().selectedItemProperty().addListener(tableViewSelectionListener);
sortedList.comparatorProperty().bind(tableView.comparatorProperty());
updateList();
walletService.addBalanceListener(balanceListener);
amountTextFieldSubscription = EasyBind.subscribe(amountTextField.textProperty(), t -> {
addressTextField.setAmountAsCoin(formatter.parseToCoin(t));
updateQRCode();
});
if (tableView.getSelectionModel().getSelectedItem() == null && !sortedList.isEmpty())
tableView.getSelectionModel().select(0);
}
示例6: EntryEditor
import org.fxmisc.easybind.EasyBind; //导入方法依赖的package包/类
public EntryEditor(BasePanel panel) {
this.panel = panel;
this.bibDatabaseContext = panel.getBibDatabaseContext();
this.undoManager = panel.getUndoManager();
ControlHelper.loadFXMLForControl(this);
getStylesheets().add(EntryEditor.class.getResource("EntryEditor.css").toExternalForm());
setStyle("-fx-font-size: " + Globals.prefs.getFontSizeFX() + "pt;");
EasyBind.subscribe(tabbed.getSelectionModel().selectedItemProperty(), tab -> {
EntryEditorTab activeTab = (EntryEditorTab) tab;
if (activeTab != null) {
activeTab.notifyAboutFocus(entry);
}
});
setupKeyBindings();
tabs = createTabs();
}
示例7: createNonMatchingText
import org.fxmisc.easybind.EasyBind; //导入方法依赖的package包/类
private Text createNonMatchingText(String str) {
Text text = new Text(str);
text.fontProperty().bind(font);
EasyBind.subscribe(normalStyle, style -> style.bindNodes(text));
return text;
}
示例8: createMatchingTextPane
import org.fxmisc.easybind.EasyBind; //导入方法依赖的package包/类
private StackPane createMatchingTextPane(String str) {
Text text = new Text(str);
text.fontProperty().bind(font);
StackPane pane = new StackPane();
pane.getChildren().add(text);
EasyBind.subscribe(searchMatchStyle, style -> style.bindNodes(text, pane));
return pane;
}
示例9: bindStyle
import org.fxmisc.easybind.EasyBind; //导入方法依赖的package包/类
private void bindStyle(Label label, boolean matchesSearch) {
@SuppressWarnings("unchecked")
Consumer<Style> styleListener = (Consumer<Style>)label.getProperties().get("styleListener");
// remove previous style subscription
Subscription subscription = (Subscription)label.getProperties().get("subscription");
if (subscription != null) {
subscription.unsubscribe();
}
// subscribe to new style
subscription = EasyBind.subscribe(matchesSearch ? searchMatchStyle : normalStyle, styleListener);
label.getProperties().put("subscription", subscription);
}
示例10: configureLogsTable
import org.fxmisc.easybind.EasyBind; //导入方法依赖的package包/类
/**
* Binds the logs table to the current colorizer, columnizer, and filtered logs list.
*/
private void configureLogsTable() {
logsTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
EasyBind.subscribe(columnizer, c -> {
logsTable.getColumns().clear();
if (c != null) {
logsTable.getColumns().addAll(getConfiguredColumns(c));
}
});
logsTable.setItems(filteredLogs);
}
示例11: onSelectedItemChanged
import org.fxmisc.easybind.EasyBind; //导入方法依赖的package包/类
public void onSelectedItemChanged(PendingTradesListItem selectedItem) {
if (tradeStateSubscription != null) {
tradeStateSubscription.unsubscribe();
sellerState.set(SellerState.UNDEFINED);
buyerState.set(BuyerState.UNDEFINED);
}
if (selectedItem != null) {
this.trade = selectedItem.getTrade();
tradeStateSubscription = EasyBind.subscribe(trade.stateProperty(), this::onTradeStateChanged);
}
}
示例12: activate
import org.fxmisc.easybind.EasyBind; //导入方法依赖的package包/类
@Override
protected void activate() {
sortedList.comparatorProperty().bind(tableView.comparatorProperty());
selectedCompensationRequestSubscription = EasyBind.subscribe(tableView.getSelectionModel().selectedItemProperty(), this::onSelectCompensationRequest);
phaseSubscription = EasyBind.subscribe(daoPeriodService.getPhaseProperty(), phase -> {
if (!phase.equals(this.currentPhase)) {
this.currentPhase = phase;
onSelectCompensationRequest(selectedCompensationRequest);
}
phaseBarsItems.stream().forEach(item -> {
if (item.getPhase() == phase) {
item.setActive();
} else {
item.setInActive();
}
});
});
bsqWalletService.getChainHeightProperty().addListener(chainHeightChangeListener);
bsqBlockChainChangeDispatcher.addBsqBlockChainListener(this);
compensationRequestManger.getAllRequests().addListener(compensationRequestListChangeListener);
daoPeriodService.getPhaseProperty().addListener(phaseChangeListener);
onChainHeightChanged(bsqWalletService.getChainHeightProperty().get());
}
示例13: addListenersOnSelectDispute
import org.fxmisc.easybind.EasyBind; //导入方法依赖的package包/类
private void addListenersOnSelectDispute() {
if (tableGroupHeadline != null) {
tableGroupHeadline.prefWidthProperty().bind(root.widthProperty());
messageListView.prefWidthProperty().bind(root.widthProperty());
messagesAnchorPane.prefWidthProperty().bind(root.widthProperty());
disputeCommunicationMessages.addListener(disputeDirectMessageListListener);
if (selectedDispute != null)
selectedDispute.isClosedProperty().addListener(selectedDisputeClosedPropertyListener);
inputTextAreaTextSubscription = EasyBind.subscribe(inputTextArea.textProperty(), t -> sendButton.setDisable(t.isEmpty()));
}
}
示例14: P2pNetworkListItem
import org.fxmisc.easybind.EasyBind; //导入方法依赖的package包/类
public P2pNetworkListItem(Connection connection, Clock clock, BSFormatter formatter) {
this.connection = connection;
this.clock = clock;
this.formatter = formatter;
this.statistic = connection.getStatistic();
sentBytesSubscription = EasyBind.subscribe(statistic.sentBytesProperty(),
e -> sentBytes.set(formatter.formatBytes((long) e)));
receivedBytesSubscription = EasyBind.subscribe(statistic.receivedBytesProperty(),
e -> receivedBytes.set(formatter.formatBytes((long) e)));
onionAddressSubscription = EasyBind.subscribe(connection.peersNodeAddressProperty(),
nodeAddress -> onionAddress.set(nodeAddress != null ? nodeAddress.getFullAddress() : Res.get("settings.net.notKnownYet")));
roundTripTimeSubscription = EasyBind.subscribe(statistic.roundTripTimeProperty(),
roundTripTime -> this.roundTripTime.set((int) roundTripTime == 0 ? "-" : roundTripTime + " ms"));
listener = new Clock.Listener() {
@Override
public void onSecondTick() {
onLastActivityChanged(statistic.getLastActivityTimestamp());
updatePeerType();
updateConnectionType();
}
@Override
public void onMinuteTick() {
}
@Override
public void onMissedSecondTick(long missed) {
}
};
clock.addListener(listener);
onLastActivityChanged(statistic.getLastActivityTimestamp());
updatePeerType();
updateConnectionType();
}
示例15: addSubscriptions
import org.fxmisc.easybind.EasyBind; //导入方法依赖的package包/类
private void addSubscriptions() {
isWaitingForFundsSubscription = EasyBind.subscribe(model.isWaitingForFunds, isWaitingForFunds -> {
waitingForFundsBusyAnimation.setIsRunning(isWaitingForFunds);
waitingForFundsLabel.setVisible(isWaitingForFunds);
waitingForFundsLabel.setManaged(isWaitingForFunds);
});
cancelButton2StyleSubscription = EasyBind.subscribe(placeOfferButton.visibleProperty(),
isVisible -> cancelButton2.setId(isVisible ? "cancel-button" : null));
balanceSubscription = EasyBind.subscribe(model.dataModel.getBalance(), balanceTextField::setBalance);
}