javafx.beans.binding.StringExpression Java Examples

The following examples show how to use javafx.beans.binding.StringExpression. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DetachableDisplayBehaviour.java    From kafka-message-tool with MIT License 6 votes vote down vote up
public DetachableDisplayBehaviour(AnchorPane parentPane,
                                  StringExpression windowTitleProperty,
                                  Pane childNode,
                                  BooleanProperty isDetachedProperty,
                                  ModelConfigObject trackedModeObject,
                                  ModelConfigObjectsGuiInformer guiInformer) {
    this.parentPane = parentPane;
    this.windowTitleProperty = windowTitleProperty;
    this.childNode = childNode;
    this.isDetachedProperty = isDetachedProperty;
    this.trackedModeObject = trackedModeObject;
    this.guiInformer = guiInformer;

    setStageAppearance();
    setDetachPropertyListener();
    setStageOnCloseEvent();
    setSizeChangedListeners();
    setPositionChangedListeners();
    setLastElementRemovedListener();
    detachedPaneContent = new DetachedPaneContent(this::reattachPaneCallback);

}
 
Example #2
Source File: TopicConfigView.java    From kafka-message-tool with MIT License 5 votes vote down vote up
public TopicConfigView(KafkaTopicConfig config,
                       AnchorPane parentPane,
                       ModelConfigObjectsGuiInformer guiInformer,
                       Runnable refreshCallback,
                       ObservableList<KafkaBrokerConfig> brokerConfigs,
                       ClusterStatusChecker statusChecker,
                       KafkaClusterProxies kafkaClusterProxies) throws IOException {
    this.statusChecker = statusChecker;
    this.kafkaClusterProxies = kafkaClusterProxies;

    CustomFxWidgetsLoader.loadAnchorPane(this, FXML_FILE);

    this.refreshCallback = refreshCallback;
    this.config = config;

    StringExpression windowTitle = composeBrokerConfigWindowTitle();
    displayBehaviour = new DetachableDisplayBehaviour(parentPane,
            windowTitle,
            this,
            detachPaneButton.selectedProperty(),
            config,
            guiInformer);

    configureComboBox(brokerConfigs);
    GuiUtils.configureComboBoxToClearSelectedValueIfItsPreviousValueWasRemoved(kafkaBrokerComboBox);
    comboBoxConfigurator = new TopicConfigComboBoxConfigurator<>(kafkaBrokerComboBox, config);
    comboBoxConfigurator.configure();
    configureTopicConfigNameField();
    configureTopicNameField();
    configureConnectionCheckButton();

    setCallbackToUpdateTopicNameAppearanceWhenTopicNameChanges();
    setCallbackForBrokerConfigChanges();
    resetBrokerConfigToFireUpAllCallbacksForTheFirstTimeToSetupControls();

}
 
Example #3
Source File: TopicConfigView.java    From kafka-message-tool with MIT License 5 votes vote down vote up
private StringExpression composeBrokerConfigWindowTitle() {
    return new ReadOnlyStringWrapper("Topic configuration")
            .concat(" '").concat(config.nameProperty()).concat("' (")
            .concat("topic:")
            .concat(config.topicNameProperty())
            .concat(")");
}
 
Example #4
Source File: BrokerConfigView.java    From kafka-message-tool with MIT License 5 votes vote down vote up
public BrokerConfigView(KafkaBrokerConfig config,
                        AnchorPane parentPane,
                        ModelConfigObjectsGuiInformer guiInformer,
                        Window parentWindow,
                        Runnable refeshCallback,
                        UserInteractor guiInteractor,
                        ClusterStatusChecker statusChecker,
                        KafkaClusterProxies kafkaClusterProxies) throws IOException {

    this.statusChecker = statusChecker;
    this.kafkaClusterProxies = kafkaClusterProxies;
    CustomFxWidgetsLoader.loadAnchorPane(this, FXML_FILE);

    this.config = config;
    this.parentWindow = parentWindow;
    this.rerfeshCallback = refeshCallback;
    this.userInteractor = guiInteractor;

    final StringExpression windowTitle = composeConfigWindowTitle();

    displayBehaviour = new DetachableDisplayBehaviour(parentPane,
                                                      windowTitle,
                                                      this,
                                                      detachPaneButton.selectedProperty(),
                                                      config,
                                                      guiInformer);
    GuiUtils.expandNodeToAnchorPaneBorders(this);

    configureGuiControls();

    startObservingNewKafkaBrokerProxyForNewHostInfo();
    setCallbackToStartListeningOnNewKafkaProxyChangesWhenHostnameOrPortPropertyChanges();

    resetKafkaBrokerPropertyToFireUpCallbacksForTheFirstTime();
}
 
Example #5
Source File: BrokerConfigView.java    From kafka-message-tool with MIT License 5 votes vote down vote up
private StringExpression composeConfigWindowTitle() {
    return new ReadOnlyStringWrapper("Broker configuration")
        .concat(" '").concat(config.nameProperty()).concat("' (")
        .concat(config.hostNameProperty())
        .concat(":")
        .concat(config.portProperty())
        .concat(")");
}
 
Example #6
Source File: SenderConfigView.java    From kafka-message-tool with MIT License 4 votes vote down vote up
public SenderConfigView(KafkaSenderConfig config,
                        AnchorPane parentPane,
                        ModelConfigObjectsGuiInformer guiInformer,
                        Runnable refreshCallback,
                        ObservableList<KafkaTopicConfig> topicConfigs,
                        MessageTemplateSender msgTemplateSender,
                        VirtualizedScrollPane<StyleClassedTextArea> beforeAllMessagesSharedScriptScrollPane,
                        VirtualizedScrollPane<StyleClassedTextArea> beforeAllMessagesScriptScrollPane,
                        VirtualizedScrollPane<StyleClassedTextArea> beforeEachMessageScriptScrollPane,
                        VirtualizedScrollPane<StyleClassedTextArea> messageContentScrollPane,
                        KafkaClusterProxies kafkaClusterProxies,
                        ApplicationSettings applicationSettings) throws IOException {
    this.msgTemplateSender = msgTemplateSender;

    this.beforeAllMessagesSharedScriptScrollPane = beforeAllMessagesSharedScriptScrollPane;
    this.beforeAllMessagesScriptScrollPane = beforeAllMessagesScriptScrollPane;
    this.beforeEachMessageScriptScrollPane = beforeEachMessageScriptScrollPane;

    this.kafkaClusterProxies = kafkaClusterProxies;
    this.applicationSettings = applicationSettings;

    beforeAllmessagesSharedScriptCodeArea = this.beforeAllMessagesSharedScriptScrollPane.getContent();
    beforeAllMessagesScriptCodeArea = this.beforeAllMessagesScriptScrollPane.getContent();
    beforeEachMessagesScriptCodeArea = this.beforeEachMessageScriptScrollPane.getContent();


    this.messageContentScrollPane = messageContentScrollPane;
    messageContentTextArea = this.messageContentScrollPane.getContent();


    CustomFxWidgetsLoader.loadAnchorPane(this, FXML_FILE);

    this.config = config;
    this.refreshCallback = refreshCallback;
    this.topicConfigs = topicConfigs;

    final StringExpression windowTitle = new ReadOnlyStringWrapper("Message sender configuration");
    displayBehaviour = new DetachableDisplayBehaviour(parentPane,
                                                      windowTitle,
                                                      this,
                                                      detachPaneButton.selectedProperty(),
                                                      config,
                                                      guiInformer);

    configureMessageNameTextField();
    configureMessageContentTextArea();
    configureTopicComboBox();
    configureRepeatCountSpinner();
    configureMessageKeyCheckbox();
    configureScriptsTextAreas();
    configureMessageKeyTextField();
    configureSimulationSendingCheckBox();
    createProgressNotifier();
    GuiUtils.configureComboBoxToClearSelectedValueIfItsPreviousValueWasRemoved(topicConfigComboBox);
    comboBoxConfigurator = new TopicConfigComboBoxConfigurator<>(topicConfigComboBox, config);
    comboBoxConfigurator.configure();
    taskExecutor = new MessageSenderTaskExecutor(sendMsgPushButton.disableProperty(),
                                                 stopSendingButton.disableProperty());
}
 
Example #7
Source File: ListenerConfigView.java    From kafka-message-tool with MIT License 4 votes vote down vote up
public ListenerConfigView(KafkaListenerConfig config,
                          AnchorPane parentPane,
                          ModelConfigObjectsGuiInformer guiInformer,
                          Listeners activeConsumers,
                          Runnable refreshCallback,
                          ObservableList<KafkaTopicConfig> topicConfigs,
                          ToFileSaver toFileSaver,
                          FixedNumberRecordsCountLogger fixedRecordsLogger) throws IOException {
    this.parentPane = parentPane;
    this.guiInformer = guiInformer;
    this.toFileSaver = toFileSaver;
    this.fixedRecordsLogger = fixedRecordsLogger;
    partitionAssignmentHandler = new PartitionAssignmentChangeHandler(
        new FXNodeBlinker(Color.BLACK), config);

    CustomFxWidgetsLoader.loadAnchorPane(this, FXML_FILE);

    this.config = config;
    this.activeConsumers = activeConsumers;
    this.refreshCallback = refreshCallback;
    this.topicConfigs = topicConfigs;

    final StringExpression windowTitle = new ReadOnlyStringWrapper("Kafka listener configuration");
    displayBehaviour = new DetachableDisplayBehaviour(parentPane,
                                                      windowTitle,
                                                      this,
                                                      detachPaneButton.selectedProperty(),
                                                      config,
                                                      guiInformer);
    configureTopicConfigComboBox();
    configureOffsetResetComboBox();
    configureMessageNameTextField();
    configureConsumerGroupField();
    configureFetchTimeoutField();
    configureReceiveMsgLimitControls();
    setKafkaListenerBinding();

    configureGuiControlDisableStateBasedOnStartButtonState();
    GuiUtils.configureComboBoxToClearSelectedValueIfItsPreviousValueWasRemoved(topicConfigComboBox);

    comboBoxConfigurator = new TopicConfigComboBoxConfigurator<>(topicConfigComboBox, config);
    comboBoxConfigurator.configure();

}
 
Example #8
Source File: TooltipUtils.java    From jstackfx with Apache License 2.0 4 votes vote down vote up
public static Tooltip createNumberedTooltip(final StringProperty label, final DoubleProperty value) {
    final StringExpression text = label.concat(": ").concat(value.asString("%.0f"));
    final Tooltip tooltip = new Tooltip();
    tooltip.textProperty().bind(text);
    return tooltip;
}
 
Example #9
Source File: ProgressController.java    From VocabHunter with Apache License 2.0 4 votes vote down vote up
private void bindValueLabel(final Label valueLabel, final ObservableNumberValue property) {
    StringExpression binding = i18nManager.textBinding(PROGRESS_WORD_COUNT, property);

    valueLabel.textProperty().bind(binding);
}
 
Example #10
Source File: I18nManagerImpl.java    From VocabHunter with Apache License 2.0 4 votes vote down vote up
@Override
public StringExpression textBinding(final I18nKey key, final ObservableValue<?>... arguments) {
    return Bindings.createStringBinding(() -> text(key, toArgs(arguments)), arguments);
}
 
Example #11
Source File: I18nManagerTest.java    From VocabHunter with Apache License 2.0 3 votes vote down vote up
private void validatePercentage(final String expected, final double value) {
    SimpleDoubleProperty property = new SimpleDoubleProperty(value);

    StringExpression result = target.textBinding(STATUS_MARKED_PERCENTAGE, property);

    assertEquals(expected, result.getValue());
}
 
Example #12
Source File: I18nManager.java    From VocabHunter with Apache License 2.0 votes vote down vote up
StringExpression textBinding(I18nKey key, ObservableValue<?>... arguments);