當前位置: 首頁>>代碼示例>>Java>>正文


Java InvalidationListener類代碼示例

本文整理匯總了Java中javafx.beans.InvalidationListener的典型用法代碼示例。如果您正苦於以下問題:Java InvalidationListener類的具體用法?Java InvalidationListener怎麽用?Java InvalidationListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


InvalidationListener類屬於javafx.beans包,在下文中一共展示了InvalidationListener類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createRadioButton

import javafx.beans.InvalidationListener; //導入依賴的package包/類
private RadioButton createRadioButton(final Node rect, String name, final boolean toFront, ToggleGroup tg) {
    final RadioButton radioButton = new RadioButton(name);
    radioButton.setToggleGroup(tg);
    radioButton.selectedProperty().addListener(new InvalidationListener() {
        public void invalidated(Observable ov) {
            if (radioButton.isSelected()) {
                if (toFront) {
                    rect.toFront();
                } else {
                    rect.toBack();
                }
            }
        }
    });

    return radioButton;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:18,代碼來源:NodePropertiesSample.java

示例2: WeekFieldsViewSkin

import javafx.beans.InvalidationListener; //導入依賴的package包/類
public WeekFieldsViewSkin(final WeekFieldsView view) {
    super(view);

    dayOfWeekComboBox = new ComboBox<>();
    dayOfWeekComboBox.getItems().addAll(DayOfWeek.values());
    dayOfWeekComboBox.setValue(view.getFirstDayOfWeek());

    minimalDaysInFirstWeekComboBox = new ComboBox<>();
    minimalDaysInFirstWeekComboBox.getItems().addAll(1, 2, 3, 4, 5, 6, 7);
    minimalDaysInFirstWeekComboBox.setValue(view.getMinimalDaysInFirstWeek());

    GridPane pane = new GridPane();
    pane.getStyleClass().add("content");
    pane.add(new Label("First day:"), 0, 0);
    pane.add(new Label("Minimum days:"), 0, 1);
    pane.add(dayOfWeekComboBox, 1, 0);
    pane.add(minimalDaysInFirstWeekComboBox, 1, 1);

    getChildren().add(pane);

    // listeners

    InvalidationListener updateListener = it -> updateValues();
    dayOfWeekComboBox.valueProperty().addListener(updateListener);
    minimalDaysInFirstWeekComboBox.valueProperty().addListener(updateListener);

    view.weekFieldsProperty().addListener(it -> {
        WeekFields fields = view.getWeekFields();
        dayOfWeekComboBox.setValue(fields.getFirstDayOfWeek());
        minimalDaysInFirstWeekComboBox.setValue(fields.getMinimalDaysInFirstWeek());
    });
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:33,代碼來源:WeekFieldsViewSkin.java

示例3: setOnLabelChangeListener

import javafx.beans.InvalidationListener; //導入依賴的package包/類
/**
 * set listener on the ComboBox to update the database when the
 * selected index changes
 *
 * @param tree TreeView which the LabelCell is in, needed for updating
 *             the database
 * @param day LocalDate which we need for updating the database
 */
private void setOnLabelChangeListener(TreeView<HomeworkTask> tree,
                              LocalDate day) {
    
    InvalidationListener invalidationListener = observable -> {
        controller.updateDatabase(day, controller
                .convertTreeToArrayList(tree));
        // We do not need to cleanup here, as no tasks
        // were added or deleted.
    };
    
    // Pass the invalidationlistener on to the custom listener
    labelChangeListener = new InvalidationListenerWithBlocker(invalidationListener);
    
    // update label in database when selecting a different one
    comboBox.getSelectionModel().selectedIndexProperty()
            .addListener(labelChangeListener);
    
}
 
開發者ID:deltadak,項目名稱:plep,代碼行數:27,代碼來源:CustomTreeCell.java

示例4: Room

import javafx.beans.InvalidationListener; //導入依賴的package包/類
Room(ApiLayer api, Repository<User> userRepository, String id) {
	this.api = api;
	this.userRepository = userRepository;
	this.id = id;

	// update the alias list
	aliasLists.addListener((InvalidationListener) (invalidated) -> {
		// get all aliases
		java.util.List<String> list = new ArrayList<>();
		for (ObservableList<String> a:aliasLists.values()){
			list.addAll(a);
		}

		// set aliases
		aliases.setAll(list);
	});
}
 
開發者ID:Gurgy,項目名稱:Cypher,代碼行數:18,代碼來源:Room.java

示例5: addListener

import javafx.beans.InvalidationListener; //導入依賴的package包/類
@Override
public void addListener(InvalidationListener invalidationListener) {
	synchronized (this) {
		// If first listener start listening to inner value
		if (invalidationListeners.isEmpty()) {
			invalidationListenerObject = (observable) -> {
				Platform.runLater(() -> {
					synchronized (this) {
						for (InvalidationListener listener : invalidationListeners) {
							listener.invalidated(this);
						}
					}
				});
			};
			inner.addListener(invalidationListenerObject);
		}
		invalidationListeners.add(invalidationListener);
	}
}
 
開發者ID:Gurgy,項目名稱:Cypher,代碼行數:20,代碼來源:FXThreadedObservableValueWrapper.java

示例6: WeekView

import javafx.beans.InvalidationListener; //導入依賴的package包/類
public WeekView(ObjectProperty<LocalDate> dateBegin, int numberOfDays, LocalTime dayStartTime, LocalTime dayEndTime, WeekViewRenderer renderer, AbstractAppointmentFactory appointmentFactory, Calendar... calendar) {
    this.getStylesheets().add(WeekView.class.getClassLoader().getResource("css/WeekView.css").toString());
    this.dateProperty = dateBegin;
    this.numberOfDays = numberOfDays;
    this.dayStartTime = dayStartTime;
    this.dayEndTime = dayEndTime;
    this.renderer = renderer;
    this.appointmentFactory = appointmentFactory;
    for (int i = 0; i < calendar.length; i++) {
        this.getCalendars().add(calendar[i]);
    }

    setLayout();
    setContent();

    getDate().addListener(observable -> {
        setContent();
    });

    getCalendars().addListener((InvalidationListener) observable -> {
        setContent();
    });
}
 
開發者ID:Jibbow,項目名稱:FastisFX,代碼行數:24,代碼來源:WeekView.java

示例7: bind

import javafx.beans.InvalidationListener; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public void bind(final ObjectProperty<?> property, final String propertyName, Class<?> type) {
    String value = props.getProperty(propertyName);
    if (value != null) {
        if (type.getName().equals(Color.class.getName())) {
            ((ObjectProperty<Color>) property).set(Color.valueOf(value));
        } else if (type.getName().equals(String.class.getName())) {
            ((ObjectProperty<String>) property).set(value);
        } else {
            ((ObjectProperty<Object>) property).set(value);
        }
    }
    property.addListener(new InvalidationListener() {

        @Override
        public void invalidated(Observable o) {
            props.setProperty(propertyName, property.getValue().toString());
        }
    });
}
 
開發者ID:comtel2000,項目名稱:mokka7,代碼行數:21,代碼來源:SessionManager.java

示例8: DayViewBaseSkin

import javafx.beans.InvalidationListener; //導入依賴的package包/類
public DayViewBaseSkin(T view) {
    super(view);

    InvalidationListener layoutListener = it -> {
        getSkinnable().autosize();
        getSkinnable().requestLayout();
    };

    view.timeProperty().addListener(layoutListener);
    view.hourHeightProperty().addListener(layoutListener);
    view.hourHeightCompressedProperty().addListener(layoutListener);
    view.visibleHoursProperty().addListener(layoutListener);
    view.earlyLateHoursStrategyProperty().addListener(layoutListener);
    view.hoursLayoutStrategyProperty().addListener(layoutListener);
    view.startTimeProperty().addListener(layoutListener);
    view.endTimeProperty().addListener(layoutListener);
    view.getCalendars().addListener(layoutListener);
    view.enableCurrentTimeMarkerProperty().addListener(layoutListener);
    view.entryWidthPercentageProperty().addListener(layoutListener);
    view.showTodayProperty().addListener(layoutListener);
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:22,代碼來源:DayViewBaseSkin.java

示例9: WeekDayHeaderViewSkin

import javafx.beans.InvalidationListener; //導入依賴的package包/類
public WeekDayHeaderViewSkin(WeekDayHeaderView view) {
    super(view);

    pane = new GridPane();
    pane.getStyleClass().add("container");

    getChildren().add(pane);

    final InvalidationListener updateListener = it -> updateControl();

    view.numberOfDaysProperty().addListener(updateListener);
    view.showTodayProperty().addListener(updateListener);
    view.weekFieldsProperty().addListener(updateListener);
    view.enableHyperlinksProperty().addListener(updateListener);
    view.adjustToFirstDayOfWeekProperty().addListener(updateListener);

    updateControl();
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:19,代碼來源:WeekDayHeaderViewSkin.java

示例10: WeekViewSkin

import javafx.beans.InvalidationListener; //導入依賴的package包/類
public WeekViewSkin(WeekView view) {
    super(view);

    final InvalidationListener rebuildListener = it -> buildDays();
    view.numberOfDaysProperty().addListener(rebuildListener);
    view.adjustToFirstDayOfWeekProperty().addListener(rebuildListener);
    view.weekDayViewFactoryProperty().addListener(rebuildListener);

    buildDays();

    Rectangle clip = new Rectangle();
    clip.widthProperty().bind(view.widthProperty());
    clip.heightProperty().bind(view.heightProperty());
    view.setClip(clip);

    new DayViewEditController(view);

    getChildren().add(dayGridPane);
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:20,代碼來源:WeekViewSkin.java

示例11: crossfadeTimeListener

import javafx.beans.InvalidationListener; //導入依賴的package包/類
private InvalidationListener crossfadeTimeListener() {
	return new InvalidationListener() {
		private boolean run = false;

		@Override
		public void invalidated(final javafx.beans.Observable observable) {
			// Run once when less than 3 seconds away from the end of the song
			if (currentPlayer == null) return;

			if (currentPlayer.getCurrentTime()
					.greaterThan(currentPlayer.getMedia().getDuration()
							.subtract(Duration.seconds(CROSSFADE_DURATION)))
					&& !run && crossfadeMode.get()) {
				run = true;
				currentPlayer.setOnEndOfMedia(() -> {
					// clear out the normal behaviour for the end of a song
					// playCrossfade will start the next song a little early
					// so there's no need to do anything once the current song ends
				});
				lastPlayed.addFirst(playQueue.get(currentIndex));
				playCrossfade(playQueue, nextIndex());
			}
		}
	};
}
 
開發者ID:jakemanning,項目名稱:boomer-tuner,代碼行數:26,代碼來源:Player.java

示例12: main

import javafx.beans.InvalidationListener; //導入依賴的package包/類
/**
 *
 * @param args
 */
public static void main(String[] args) {
    Logger log = LoggerFactory.getLogger(AppDemo.class);
    Initializer.getToolBox()
            .getEventBus()
            .toObserverable()
            .subscribe(e -> log.debug(e.toString()));
    App.main(args);

    ObservableList<Annotation> annotations = Initializer.getToolBox()
            .getData()
            .getAnnotations();

    annotations.addListener((InvalidationListener) observable ->
            log.debug("Annotation count: " + annotations.size()));
}
 
開發者ID:mbari-media-management,項目名稱:vars-annotation,代碼行數:20,代碼來源:AppDemo.java

示例13: addServerUpdateListener

import javafx.beans.InvalidationListener; //導入依賴的package包/類
private void addServerUpdateListener() {
	serverTable.getSelectionModel().getSelectedCells().addListener((InvalidationListener) changed -> {
		if (serverTable.getSelectionModel().getSelectedIndices().size() == 1) {
			final SampServer selectedServer = serverTable.getSelectionModel().getSelectedItem();
			if (Objects.nonNull(selectedServer)) {
				updateServerInfo(selectedServer);
			}
		} else {
			playerTable.getItems().clear();
			playerTable.setPlaceholder(new Label());
			serverAddress.setText("");
			serverLagcomp.setText("");
			serverPing.setText("");
			serverPassword.setText("");

			killServerLookupThreads();
		}
	});
}
 
開發者ID:Bios-Marcel,項目名稱:ServerBrowser,代碼行數:20,代碼來源:ServerListController.java

示例14: testClearColumnListenerSelection

import javafx.beans.InvalidationListener; //導入依賴的package包/類
@Test
public void testClearColumnListenerSelection() {
  BooleanProperty wasCalled = new SimpleBooleanProperty(false);
  Selection selection = new Selection("fgrfg", 4);
  InvalidationListener listener = i -> wasCalled.set(true);
  selection.columnProperty().addListener(listener);
  selection.columnProperty().set(null);
  assertTrue(wasCalled.get());
  assertTrue(selection.columnProperty().isNull().get());

  wasCalled.set(false);
  selection.columnProperty().removeListener(listener);
  selection.setColumn("Test");
  assertFalse(wasCalled.get());
  assertEquals("Test", selection.getColumn().get());
}
 
開發者ID:VerifAPS,項目名稱:stvs,代碼行數:17,代碼來源:SelectionTest.java

示例15: FocusTraversalNode

import javafx.beans.InvalidationListener; //導入依賴的package包/類
public FocusTraversalNode(FocusTraversal<?> parent,
                          MultipleCellSelection<JsonNode, C> selectionModel,
                          Bias bias) {
    this.bias = bias;
    this.parent = parent;
    this.selectionModel = selectionModel;
    Node node = getNode();
    node.focusedProperty()
        .addListener((InvalidationListener) property -> {
            if (node.isFocused()) {
                if (parent != null) {
                    parent.setCurrent();
                }
            }
        });
}
 
開發者ID:ChiralBehaviors,項目名稱:Kramer,代碼行數:17,代碼來源:FocusTraversalNode.java


注:本文中的javafx.beans.InvalidationListener類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。