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


Java Change類代碼示例

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


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

示例1: changesTest

import org.reactfx.Change; //導入依賴的package包/類
@Test
public void changesTest() {
    IntegerProperty src = new SimpleIntegerProperty(0);
    Val<Number> val = Val.wrap(src);

    List<Change<Number>> changes = new ArrayList<>();
    val.changes().subscribe(changes::add);

    src.set(1);
    src.set(2);
    src.set(3);

    assertArrayEquals(Arrays.asList(0, 1, 2).toArray(),
        changes.stream().map(change -> change.getOldValue()).toArray());
    assertArrayEquals(Arrays.asList(1, 2, 3).toArray(),
        changes.stream().map(change -> change.getNewValue()).toArray());
}
 
開發者ID:TomasMikula,項目名稱:ReactFX,代碼行數:18,代碼來源:ValTest.java

示例2: initialize

import org.reactfx.Change; //導入依賴的package包/類
/**
 * Initializes the controller class.
 *
 * @param url
 * @param rb
 */
@Override
public void initialize(URL url, ResourceBundle rb) {

    //
    codeArea.textProperty().addListener(
            (ov, oldText, newText) -> {
                Matcher matcher = KEYWORD_PATTERN.matcher(newText);
                int lastKwEnd = 0;
                StyleSpansBuilder<Collection<String>> spansBuilder
                = new StyleSpansBuilder<>();
                while (matcher.find()) {
                    spansBuilder.add(Collections.emptyList(),
                            matcher.start() - lastKwEnd);
                    spansBuilder.add(Collections.singleton("keyword"),
                            matcher.end() - matcher.start());
                    lastKwEnd = matcher.end();
                }
                spansBuilder.add(Collections.emptyList(),
                        newText.length() - lastKwEnd);
                codeArea.setStyleSpans(0, spansBuilder.create());
            });

    EventStream<Change<String>> textEvents
            = EventStreams.changesOf(codeArea.textProperty());

    textEvents.reduceSuccessions((a, b) -> b, Duration.ofMillis(500)).
            subscribe(code -> {
                if (autoCompile) {
                    compile(code.getNewValue());
                }
            });

    codeArea.replaceText(
            "CSG cube = new Cube(2).toCSG()\n"
            + "CSG sphere = new Sphere(1.25).toCSG()\n"
            + "\n"
            + "cube.difference(sphere)");

    editorContainer.setContent(codeArea);

    subScene = new SubScene(viewGroup, 100, 100, true,
            SceneAntialiasing.BALANCED);

    subScene.widthProperty().bind(viewContainer.widthProperty());
    subScene.heightProperty().bind(viewContainer.heightProperty());

    PerspectiveCamera subSceneCamera = new PerspectiveCamera(false);
    subScene.setCamera(subSceneCamera);

    viewContainer.getChildren().add(subScene);
}
 
開發者ID:miho,項目名稱:PiOnWheels,代碼行數:58,代碼來源:MainController.java

示例3: ColorChange

import org.reactfx.Change; //導入依賴的package包/類
public ColorChange(Change<Paint> c) {
    this((Color) c.getOldValue(), (Color) c.getNewValue());
}
 
開發者ID:FXMisc,項目名稱:UndoFX,代碼行數:4,代碼來源:CircleProperties.java

示例4: RadiusChange

import org.reactfx.Change; //導入依賴的package包/類
public RadiusChange(Change<Number> c) {
    super(c.getOldValue().doubleValue(), c.getNewValue().doubleValue());
}
 
開發者ID:FXMisc,項目名稱:UndoFX,代碼行數:4,代碼來源:CircleProperties.java

示例5: CenterXChange

import org.reactfx.Change; //導入依賴的package包/類
public CenterXChange(Change<Number> c) {
    super(c.getOldValue().doubleValue(), c.getNewValue().doubleValue());
}
 
開發者ID:FXMisc,項目名稱:UndoFX,代碼行數:4,代碼來源:CircleProperties.java

示例6: CenterYChange

import org.reactfx.Change; //導入依賴的package包/類
public CenterYChange(Change<Number> c) {
    super(c.getOldValue().doubleValue(), c.getNewValue().doubleValue());
}
 
開發者ID:FXMisc,項目名稱:UndoFX,代碼行數:4,代碼來源:CircleProperties.java

示例7: changes

import org.reactfx.Change; //導入依賴的package包/類
/**
 * Returns a stream of changed values, which emits the changed value
 * (i.e. the old and the new value) on each change of this observable value.
 */
default EventStream<Change<T>> changes() {
    return EventStreams.changesOf(this);
}
 
開發者ID:TomasMikula,項目名稱:ReactFX,代碼行數:8,代碼來源:Val.java


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