javafx.beans.property.SimpleIntegerProperty Java Examples
The following examples show how to use
javafx.beans.property.SimpleIntegerProperty.
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: UndoManagerTest.java From UndoFX with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void testMergeResultingInNonIdentitySingleChangeStoresMergeAndPreventsNextMerge() { SimpleIntegerProperty lastAppliedValue = new SimpleIntegerProperty(0); EventSource<Integer> changes = new EventSource<>(); UndoManager<?> um = UndoManagerFactory.unlimitedHistorySingleChangeUM( changes, i -> -i, // invert i -> { lastAppliedValue.set(i); changes.push(i); }, // apply change and re-emit value so expected change is received (a, b) -> Optional.of(a + b), // merge adds two changes together i -> i == 0); // identity change = 0 changes.push(1); changes.push(2); assertTrue(um.isUndoAvailable()); um.undo(); assertFalse(um.isUndoAvailable()); assertEquals(-3, lastAppliedValue.get()); um.redo(); // redo to test whether merge occurs on next push changes.push(5); assertTrue(um.isUndoAvailable()); um.undo(); assertEquals(-5, lastAppliedValue.get()); }
Example #2
Source File: TransferAtoR.java From CPUSim with GNU General Public License v3.0 | 6 votes |
/** * Constructor * creates a new Test object with input values. * * @param name name of the microinstruction. * @param machine the machine that the microinstruction belongs to. * @param source the register whose value is to be tested. * @param srcStartBit an integer indicting the leftmost or rightmost bit to be tested. * @param dest the destination register. * @param destStartBit an integer indicting the leftmost or rightmost bit to be changed. * @param numBits a non-negative integer indicating the number of bits to be tested. */ public TransferAtoR(String name, Machine machine, RegisterArray source, Integer srcStartBit, Register dest, Integer destStartBit, Integer numBits, Register index, Integer indexStart, Integer indexNumBits){ super(name, machine); this.source = new SimpleObjectProperty<>(source); this.srcStartBit = new SimpleIntegerProperty(srcStartBit); this.dest = new SimpleObjectProperty<>(dest); this.destStartBit = new SimpleIntegerProperty(destStartBit); this.numBits = new SimpleIntegerProperty(numBits); this.index = new SimpleObjectProperty<>(index); this.indexStart = new SimpleIntegerProperty(indexStart); this.indexNumBits = new SimpleIntegerProperty(indexNumBits); }
Example #3
Source File: VehicleTableModel.java From RentLio with Apache License 2.0 | 6 votes |
public VehicleTableModel(SimpleStringProperty carNumber, SimpleStringProperty vehicleType, SimpleStringProperty brand, SimpleStringProperty model, SimpleStringProperty imageURL, SimpleStringProperty modelYear, SimpleStringProperty chasieNo, SimpleStringProperty fuel, SimpleDoubleProperty kmRs, SimpleStringProperty engineCapacity, SimpleStringProperty colour, SimpleIntegerProperty noOfDoors, SimpleStringProperty insurance, SimpleStringProperty comment, SimpleStringProperty status) { this.carNumber = carNumber; this.vehicleType = vehicleType; this.brand = brand; this.model = model; this.imageURL = imageURL; this.modelYear = modelYear; this.chasieNo = chasieNo; this.fuel = fuel; this.kmRs = kmRs; this.engineCapacity = engineCapacity; this.colour = colour; this.noOfDoors = noOfDoors; this.insurance = insurance; this.comment = comment; this.status = status; }
Example #4
Source File: UndoManagerTest.java From UndoFX with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void testPushedNonIdentitySingleChangeIsStored() { SimpleIntegerProperty lastAppliedValue = new SimpleIntegerProperty(0); EventSource<Integer> changes = new EventSource<>(); UndoManager<?> um = UndoManagerFactory.unlimitedHistorySingleChangeUM( changes, i -> -i, // invert i -> { lastAppliedValue.set(i); changes.push(i); }, // apply change and re-emit value so expected change is received (a, b) -> Optional.of(a + b), // merge adds two changes together i -> i == 0); // identity change = 0 changes.push(4); assertTrue(um.isUndoAvailable()); um.undo(); assertEquals(-4, lastAppliedValue.get()); assertFalse(um.isUndoAvailable()); }
Example #5
Source File: ListHelperTest.java From ReactFX with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void testAddInForEach() { ObjectProperty<ListHelper<Integer>> lh = new SimpleObjectProperty<>(null); IntegerProperty iterations = new SimpleIntegerProperty(0); lh.set(ListHelper.add(lh.get(), 0)); lh.set(ListHelper.add(lh.get(), 1)); lh.set(ListHelper.add(lh.get(), 2)); ListHelper.forEach(lh.get(), i -> { lh.set(ListHelper.add(lh.get(), 2-i)); iterations.set(iterations.get() + 1); }); assertEquals(3, iterations.get()); assertArrayEquals(new Integer[] { 0, 1, 2, 2, 1, 0 }, ListHelper.toArray(lh.get(), n -> new Integer[n])); }
Example #6
Source File: ValTest.java From ReactFX with BSD 2-Clause "Simplified" License | 6 votes |
@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()); }
Example #7
Source File: GoogleMap.java From GMapsFX with Apache License 2.0 | 6 votes |
protected void initialize(){ zoom = new SimpleIntegerProperty(internalGetZoom()); addStateEventHandler(MapStateEventType.zoom_changed, () -> { if (!userPromptedZoomChange) { mapPromptedZoomChange = true; zoom.set(internalGetZoom()); mapPromptedZoomChange = false; } }); zoom.addListener((ObservableValue<? extends Number> obs, Number o, Number n) -> { if (!mapPromptedZoomChange) { userPromptedZoomChange = true; internalSetZoom(n.intValue()); userPromptedZoomChange = false; } }); center = new ReadOnlyObjectWrapper<>(getCenter()); addStateEventHandler(MapStateEventType.center_changed, () -> { center.set(getCenter()); }); }
Example #8
Source File: MainSceneController.java From JavaFX-Tutorial-Codes with Apache License 2.0 | 6 votes |
@Override public void initialize(URL url, ResourceBundle rb) { SimpleIntegerProperty a = new SimpleIntegerProperty(5); SimpleIntegerProperty b = new SimpleIntegerProperty(10); NumberBinding sum = a.add(b); System.out.println(sum.getValue()); a.set(20); System.out.println(sum.getValue()); textField.textProperty().bind(stringProperty); MyTask myTask = new MyTask(); textField.setOnMouseClicked(event -> { Timer timer = new Timer(true); timer.scheduleAtFixedRate(myTask, 0, 1 * 1000); }); tf1.textProperty().bindBidirectional(tf2.textProperty()); }
Example #9
Source File: ClickAndDragTests.java From RichTextFX with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void single_clicking_outside_of_selected_text_does_not_trigger_new_selection_finished() throws InterruptedException, ExecutionException { // setup interact(() -> { area.replaceText(firstParagraph + "\n" + "this is the selected text"); area.selectRange(1, 0, 2, -1); }); SimpleIntegerProperty i = new SimpleIntegerProperty(0); area.setOnNewSelectionDragFinished(e -> i.set(1)); Bounds bounds = asyncFx( () -> area.getCharacterBoundsOnScreen(firstWord.length(), firstWord.length() + 1).get()) .get(); moveTo(bounds).clickOn(PRIMARY); assertEquals(0, i.get()); }
Example #10
Source File: Test.java From CPUSim with GNU General Public License v3.0 | 6 votes |
/** * Constructor * creates a new Test object with input values. * * @param name name of the microinstruction. * @param machine the machine that the microinstruction belongs to. * @param register the register whose value is to be tested. * @param start an integer indicating the leftmost or rightmost bit to be tested. * @param numBits a non-negative integer indicating the number of bits to be tested. * @param comparison the type of comparison be done. * @param value the integer to be compared with the part of the register. * @param omission an integer indicating the size of the relative jump. */ public Test(String name, Machine machine, Register register, Integer start, Integer numBits, String comparison, Long value, Integer omission){ super(name, machine); this.register = new SimpleObjectProperty<>(register); this.start = new SimpleIntegerProperty(start); this.numBits = new SimpleIntegerProperty(numBits); this.comparison = new SimpleStringProperty(comparison); this.value = new SimpleLongProperty(value); this.omission = new SimpleIntegerProperty(omission); }
Example #11
Source File: UndoManagerTests.java From RichTextFX with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void identity_change_works() { interact(() -> { area.replaceText("ttttt"); SimpleIntegerProperty richEmissions = new SimpleIntegerProperty(0); SimpleIntegerProperty plainEmissions = new SimpleIntegerProperty(0); area.multiRichChanges() .hook(list -> richEmissions.set(richEmissions.get() + 1)) .filter(list -> !list.stream().allMatch(TextChange::isIdentity)) .subscribe(list -> plainEmissions.set(plainEmissions.get() + 1)); int position = 0; area.createMultiChange(4) .replaceText(position, ++position, "t") .replaceText(position, ++position, "t") .replaceText(position, ++position, "t") .replaceText(position, ++position, "t") .commit(); assertEquals(1, richEmissions.get()); assertEquals(0, plainEmissions.get()); }); }
Example #12
Source File: DriverTableModel.java From RentLio with Apache License 2.0 | 5 votes |
public DriverTableModel(SimpleStringProperty driverId, SimpleStringProperty name, SimpleStringProperty address, SimpleStringProperty email, SimpleIntegerProperty tel, SimpleStringProperty nic, SimpleStringProperty status) { this.driverId = driverId; this.name = name; this.address = address; this.email = email; this.tel = tel; this.nic = nic; this.status = status; }
Example #13
Source File: AlignDistribCmd.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Override public void undo() { final IntegerProperty pos = new SimpleIntegerProperty(0); shape.getShapes().forEach(sh -> { // Reusing the old position. final Point pt = sh.getTopLeftPoint(); final Point oldPt = oldPositions.get(pos.get()); if(!pt.equals(oldPt)) { sh.translate(oldPt.getX() - pt.getX(), oldPt.getY() - pt.getY()); } pos.set(pos.get() + 1); }); shape.setModified(true); }
Example #14
Source File: MainSceneController.java From JavaFX-Tutorial-Codes with Apache License 2.0 | 5 votes |
private void sumObservable() { SimpleIntegerProperty a = new SimpleIntegerProperty(10); SimpleIntegerProperty b = new SimpleIntegerProperty(10); NumberBinding sum = a.add(b); System.out.println(sum.getValue()); a.set(20); System.out.println(sum.getValue()); }
Example #15
Source File: IssuedListController.java From Library-Assistant with Apache License 2.0 | 5 votes |
public IssueInfo(int id, String bookID, String bookName, String holderName, String dateOfIssue, Integer nDays, float fine) { this.id = new SimpleIntegerProperty(id); this.bookID = new SimpleStringProperty(bookID); this.bookName = new SimpleStringProperty(bookName); this.holderName = new SimpleStringProperty(holderName); this.dateOfIssue = new SimpleStringProperty(dateOfIssue); this.nDays = new SimpleIntegerProperty(nDays); this.fine = new SimpleFloatProperty(fine); System.out.println(this.nDays.get()); }
Example #16
Source File: BrokerConfigView.java From kafka-message-tool with MIT License | 5 votes |
private void initializeTopicDetailTableView() { TableUtils.installCopyPasteHandlerForSingleCell(topicsTableView); topicNameColumn.setCellValueFactory(param -> new SimpleStringProperty(param.getValue().getTopicName())); partitionCountColumn.setCellValueFactory(param -> new SimpleIntegerProperty(param.getValue().getPartitionsCount()).asObject()); activeAssignedConsumersColumn.setCellValueFactory(param -> new SimpleIntegerProperty(param.getValue().getConsumersCount()).asObject()); consumerGroupsCountColumn.setCellValueFactory(param -> new SimpleIntegerProperty(param.getValue().getConsumerGroupsCount()).asObject()); }
Example #17
Source File: Page.java From WorkbenchFX with Apache License 2.0 | 5 votes |
/** * Constructs a new {@link Tab}. * * @param workbench which created this {@link Tab} */ public Page(Workbench workbench) { this.workbench = workbench; pageIndex = new SimpleIntegerProperty(this, "pageIndex", INITIAL_PAGE_INDEX); modulesPerPage = workbench.modulesPerPageProperty(); modules = workbench.getModules(); tiles = FXCollections.observableArrayList(); setupChangeListeners(); updateTiles(); getStyleClass().add("page-control"); }
Example #18
Source File: ConvolutionKernel.java From MyBox with Apache License 2.0 | 5 votes |
public ConvolutionKernel() { name = new SimpleStringProperty(""); description = new SimpleStringProperty(""); modifyTime = new SimpleStringProperty(DateTools.datetimeToString(new Date())); createTime = new SimpleStringProperty(DateTools.datetimeToString(new Date())); width = new SimpleIntegerProperty(0); height = new SimpleIntegerProperty(0); type = new SimpleIntegerProperty(0); gray = new SimpleIntegerProperty(0); edge = new SimpleIntegerProperty(0); }
Example #19
Source File: ClickAndDragTests.java From RichTextFX with BSD 2-Clause "Simplified" License | 5 votes |
@Test public void releasing_the_mouse_after_drag_does_nothing() { assertEquals(0, area.getCaretPosition()); SimpleIntegerProperty i = new SimpleIntegerProperty(0); area.setOnNewSelectionDragFinished(e -> i.set(1)); moveTo(firstLineOfArea()) .press(PRIMARY) .dropBy(20, 0); assertEquals(0, area.getCaretPosition()); assertEquals(0, i.get()); }
Example #20
Source File: Scenario.java From mars-sim with GNU General Public License v3.0 | 5 votes |
public Scenario (String name, int sortOrder, String chapter, String fullClassName, String className, String description) { this.sortOrder = new SimpleIntegerProperty(sortOrder); this.name = new SimpleStringProperty(name); this.chapter = new SimpleStringProperty(chapter); this.fullClassName = new SimpleStringProperty(fullClassName); this.className = new SimpleStringProperty(className); this.description = new SimpleStringProperty(description); }
Example #21
Source File: PreferencesService.java From latexdraw with GNU General Public License v3.0 | 5 votes |
PreferencesService(final @NotNull String prefsPath) { super(); this.prefsPath = prefsPath; lang = new SimpleObjectProperty<>(readLang()); bundle = loadResourceBundle(lang.get()).orElseThrow( () -> new IllegalArgumentException("Cannot read any resource bundle in this lang: " + lang.get())); nbRecentFiles = new SimpleIntegerProperty(5); gridGap = new SimpleIntegerProperty(10); checkVersion = new SimpleBooleanProperty(true); gridStyle = new SimpleObjectProperty<>(GridStyle.NONE); unit = new SimpleObjectProperty<>(Unit.CM); magneticGrid = new SimpleBooleanProperty(false); pathExport = new SimpleStringProperty(""); pathOpen = new SimpleStringProperty(""); includes = new SimpleStringProperty(""); currentFile = Optional.empty(); currentFolder = Optional.empty(); recentFileNames = new SimpleListProperty<>(FXCollections.observableArrayList()); page = new SimpleObjectProperty<>(Page.USLETTER); nbRecentFiles.addListener((observable, oldValue, newValue) -> { while(newValue.intValue() > recentFileNames.size() && !recentFileNames.isEmpty()) { recentFileNames.remove(recentFileNames.size() - 1); } }); UndoCollector.getInstance().setBundle(bundle); }
Example #22
Source File: CpusimSet.java From CPUSim with GNU General Public License v3.0 | 5 votes |
/** * Constructor * creates a new Set object with input values. * * @param name name of the microinstruction. * @param register the register whose bits are to be set. * @param machine the machine that the microinstruction belongs to. * @param start the leftmost or rightmost bit of the register that is to be set. * @param numBits the number of consecutive bits in the register to be set. * @param value the base-10 value to which the bits are to be set. */ public CpusimSet(String name, Machine machine, Register register, Integer start, Integer numBits, Long value){ super(name, machine); this.register = new SimpleObjectProperty<>(register); this.start = new SimpleIntegerProperty(start); this.numBits = new SimpleIntegerProperty(numBits); this.value = new SimpleLongProperty(value); }
Example #23
Source File: BranchTableModel.java From RentLio with Apache License 2.0 | 5 votes |
public BranchTableModel(SimpleStringProperty branchId, SimpleStringProperty registerId, SimpleStringProperty address, SimpleStringProperty email, SimpleIntegerProperty tel, SimpleStringProperty postalCode) { this.branchId = branchId; this.registerId = registerId; this.address = address; this.email = email; this.tel = tel; this.postalCode = postalCode; }
Example #24
Source File: ReceptionTableModel.java From RentLio with Apache License 2.0 | 5 votes |
public ReceptionTableModel(SimpleStringProperty receptionId, SimpleStringProperty name, SimpleStringProperty branch, SimpleStringProperty address, SimpleStringProperty email, SimpleIntegerProperty tel, SimpleStringProperty nic) { this.receptionId = receptionId; this.name = name; this.branch = branch; this.address = address; this.email = email; this.tel = tel; this.nic = nic; }
Example #25
Source File: ClickAndDragTests.java From RichTextFX with BSD 2-Clause "Simplified" License | 5 votes |
@Test public void pressing_mouse_on_selection_and_dragging_and_releasing_does_not_trigger_new_selection_finished() throws InterruptedException, ExecutionException { // Linux passes; Mac/Windows uncertain // TODO: update test to see if it works on Mac & Windows run_only_on_linux(); // setup String twoSpaces = " "; interact(() -> { area.replaceText(firstParagraph + "\n" + twoSpaces + extraText); area.selectRange(0, firstWord.length()); }); SimpleIntegerProperty i = new SimpleIntegerProperty(0); area.setOnNewSelectionDragFinished(e -> i.set(1)); Bounds letterInFirstWord = asyncFx( () -> area.getCharacterBoundsOnScreen(1, 2).get()) .get(); final int insertionPosition = firstParagraph.length() + 2; Bounds insertionBounds = asyncFx( () -> area.getCharacterBoundsOnScreen(insertionPosition, insertionPosition + 1).get()) .get(); moveTo(letterInFirstWord) .press(PRIMARY) .dropTo(insertionBounds); assertEquals(0, i.get()); }
Example #26
Source File: MemoryInfoTableModel.java From Noexes with GNU General Public License v3.0 | 5 votes |
public MemoryInfoTableModel(String name, MemoryInfo info) { this.name = new SimpleStringProperty(name); this.addr = new SimpleLongProperty(info.getAddress()); this.size = new SimpleLongProperty(info.getSize()); this.end = Bindings.add(addr, size); this.type = new SimpleObjectProperty<>(info.getType()); this.access = new SimpleIntegerProperty(info.getPerm()); }
Example #27
Source File: App.java From java-ml-projects with Apache License 2.0 | 5 votes |
private void initVariables() { selectedModel = new SimpleObjectProperty<>(); outputReady = new SimpleBooleanProperty(); zoomValue = new SimpleIntegerProperty(5); showActivationGrid = new SimpleBooleanProperty(); showChannelGrid = new SimpleBooleanProperty(); showLayerListener = (b, o, n) -> showLayer(); showActivationGrid.addListener(showLayerListener); showChannelGrid.addListener(showLayerListener); }
Example #28
Source File: OfferBookViewModelTest.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
@Test public void testMaxCharactersForPriceDistance() { OfferBook offerBook = mock(OfferBook.class); OpenOfferManager openOfferManager = mock(OpenOfferManager.class); PriceFeedService priceFeedService = mock(PriceFeedService.class); final ObservableList<OfferBookListItem> offerBookListItems = FXCollections.observableArrayList(); final Maker<OfferBookListItem> item = btcBuyItem.but(with(useMarketBasedPrice, true)); when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); when(priceFeedService.getMarketPrice(anyString())).thenReturn(null); when(priceFeedService.updateCounterProperty()).thenReturn(new SimpleIntegerProperty()); final OfferBookListItem item1 = make(item); item1.getOffer().setPriceFeedService(priceFeedService); final OfferBookListItem item2 = make(item.but(with(marketPriceMargin, 0.0197))); item2.getOffer().setPriceFeedService(priceFeedService); final OfferBookListItem item3 = make(item.but(with(marketPriceMargin, 0.1))); item3.getOffer().setPriceFeedService(priceFeedService); final OfferBookListItem item4 = make(item.but(with(marketPriceMargin, -0.1))); item4.getOffer().setPriceFeedService(priceFeedService); offerBookListItems.addAll(item1, item2); final OfferBookViewModel model = new OfferBookViewModel(null, openOfferManager, offerBook, empty, null, priceFeedService, null, null, null, null, coinFormatter, new BsqFormatter()); model.activate(); assertEquals(8, model.maxPlacesForMarketPriceMargin.intValue()); //" (1.97%)" offerBookListItems.addAll(item3); assertEquals(9, model.maxPlacesForMarketPriceMargin.intValue()); //" (10.00%)" offerBookListItems.addAll(item4); assertEquals(10, model.maxPlacesForMarketPriceMargin.intValue()); //" (-10.00%)" }
Example #29
Source File: Rubik.java From gluon-samples with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void doSequence(String list){ onScrambling.set(true); sequence = Utils.unifyNotation(list); /* This is the way to perform several rotations from a list, waiting till each of them ends properly. A listener is added to onRotation, so only when the last rotation finishes a new rotation is performed. The end of the list is used to stop the listener, by adding a new listener to the index property. Note the size+1, to allow for the last rotation to end. */ IntegerProperty index = new SimpleIntegerProperty(1); ChangeListener<Boolean> lis = (ov, b, b1) -> { if (!b1) { if (index.get()<sequence.size()) { rotateFace(sequence.get(index.get())); } else { // save transforms for (Map.Entry<String, MeshView> entry : mapMeshes.entrySet()) { mapTransformsScramble.put(entry.getKey(), entry.getValue().getTransforms().get(0)); } orderScramble = new ArrayList<>(); for (Integer i : reorder) { orderScramble.add(i); } } index.set(index.get()+1); } }; index.addListener((ov, v, v1) -> { if (v1.intValue() == sequence.size()+1) { onScrambling.set(false); onRotation.removeListener(lis); count.set(-1); } }); onRotation.addListener(lis); rotateFace(sequence.get(0)); }
Example #30
Source File: TransferRtoR.java From CPUSim with GNU General Public License v3.0 | 5 votes |
/** * Constructor * creates a new Test object with input values. * * @param name name of the microinstruction. * @param machine the machine that the microinstruction belongs to. * @param source the register whose value is to be tested. * @param srcStartBit an integer indicting the leftmost or rightmost bit to be tested. * @param dest the destination register. * @param destStartBit an integer indicting the leftmost or rightmost bit to be changed. * @param numBits a non-negative integer indicating the number of bits to be tested. */ public TransferRtoR(String name, Machine machine, Register source, Integer srcStartBit, Register dest, Integer destStartBit, Integer numBits){ super(name, machine); this.source = new SimpleObjectProperty<>(source); this.srcStartBit = new SimpleIntegerProperty(srcStartBit); this.dest = new SimpleObjectProperty<>(dest); this.destStartBit = new SimpleIntegerProperty(destStartBit); this.numBits = new SimpleIntegerProperty(numBits); }