javafx.collections.FXCollections Java Examples

The following examples show how to use javafx.collections.FXCollections. 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: Main.java    From quantumjava with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public static Chart plotFunction(List<Function<Double, Double>> functions, Number xStart, Number xEnd) {
    int div = 500;
    double x0 = xStart.doubleValue();
    double x1 = xEnd.doubleValue();
    double step = 1./div* (x1-x0);
    Axis<Number> xAxis = new NumberAxis(x0, x1, .1* (x1-x0));
    Axis<Number> yAxis = new NumberAxis();
    ObservableList<XYChart.Series<Number, Number>> series = FXCollections.observableArrayList();
    LineChart<Number,Number> chart = new LineChart(xAxis, yAxis, series);
    chart.setCreateSymbols(false);
    for (Function<Double, Double> f: functions) {
        XYChart.Series<Number, Number> mainSeries = new XYChart.Series();
        series.add(mainSeries);
        ObservableList<XYChart.Data<Number, Number>> data = FXCollections.observableArrayList();
        mainSeries.setData(data);
        for (double x = x0; x < x1; x= x +step) {
            final Number y = f.apply(x);
            data.add(new XYChart.Data<>(x,y));
        }
    }
    return chart;

}
 
Example #2
Source File: ThemeUtils.java    From Quelea with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Get a list of themes currently in use on this window.
 * <p/>
 * @return the list of themes displayed.
 */
public static ObservableList<ThemeDTO> getThemes() {
    List<ThemeDTO> themesList = new ArrayList<>();
    File themeDir = new File(QueleaProperties.get().getQueleaUserHome(), "themes");
    if (!themeDir.exists()) {
        themeDir.mkdir();
    }
    for (File file : themeDir.listFiles()) {
        if (file.getName().endsWith(".th")) {
            String fileText = Utils.getTextFromFile(file.getAbsolutePath(), "");
            if (fileText.trim().isEmpty()) {
                continue;
            }
            final ThemeDTO theme = ThemeDTO.fromString(fileText);
            if (theme == ThemeDTO.DEFAULT_THEME) {
                LOGGER.log(Level.WARNING, "Error parsing theme file: {0}", fileText);
                continue;  //error
            }
            theme.setFile(file);
            themesList.add(theme);
        }
    }
    return FXCollections.observableArrayList(themesList);
}
 
Example #3
Source File: PropertySheet.java    From JetUML with GNU General Public License v3.0 6 votes vote down vote up
private Control createEnumEditor(Property pProperty)
{
	Enum<?> value = (Enum<?>)pProperty.get();
	try 
	{
		Enum<?>[] enumValues = (Enum<?>[])value.getClass().getMethod("values").invoke(null);
		final ComboBox<Enum<?>> comboBox = new ComboBox<>(FXCollections.observableArrayList(enumValues));
		
		comboBox.getSelectionModel().select(value);
		comboBox.valueProperty().addListener((pObservable, pOldValue, pNewValue) -> 
		{
			pProperty.set(pNewValue.toString());
			aListener.propertyChanged();
		});
	
		return comboBox;
	}
	catch(NoSuchMethodException | InvocationTargetException | IllegalAccessException e) 
	{ 
		return null; 
	}
}
 
Example #4
Source File: RecordingListController.java    From archivo with GNU General Public License v3.0 6 votes vote down vote up
public RecordingListController(Archivo mainApp) {
    recordingSelection = new RecordingSelection();
    tivoIsBusy = new SimpleBooleanProperty(false);
    alreadyDefaultSorted = false;
    fadeTransition = new FadeTransition(javafx.util.Duration.millis(FADE_DURATION));
    this.mainApp = mainApp;
    tivos = FXCollections.synchronizedObservableList(FXCollections.observableArrayList());
    tablePlaceholderMessage = new Label("No recordings are available");
    tivoSelectedListener = (tivoList, oldTivo, curTivo) -> {
        logger.info("New TiVo selected: {}", curTivo);
        if (curTivo != null) {
            mainApp.setLastDevice(curTivo);
            fetchRecordingsFrom(curTivo);
        }
    };
}
 
Example #5
Source File: SingleModuleWorkbenchTest.java    From WorkbenchFX with Apache License 2.0 6 votes vote down vote up
@Test
void tabBarVisibilityChanges(){
  HBox bottomBox = robot.lookup("#bottom-box").queryAs(HBox.class);

  WorkbenchModule anotherModule = createMockModule(
          new Label(), null, true, "Module 2", workbench,
          FXCollections.observableArrayList(), FXCollections.observableArrayList());


  robot.interact(() -> {
    // add a second module to the workbench, the bottom-box should be visible now
    workbench.getModules().add(anotherModule);
    assertTrue(bottomBox.isVisible());

    workbench.getModules().remove(anotherModule);
    assertFalse(bottomBox.isVisible());
  });
}
 
Example #6
Source File: DialogTestModule.java    From WorkbenchFX with Apache License 2.0 6 votes vote down vote up
private void initDialogParts() {
  // create the data to show in the CheckListView
  final ObservableList<String> libraries = FXCollections.observableArrayList();
  libraries.addAll("WorkbenchFX", "PreferencesFX", "CalendarFX", "FlexGanttFX", "FormsFX");

  // Create the CheckListView with the data
  checkListView = new CheckListView<>(libraries);

  // initialize map for dialog
  mapView = new GoogleMapView();
  mapView.addMapInializedListener(this);

  // initialize favorites dialog separately
  favoriteLibrariesDialog =
      WorkbenchDialog.builder("Select your favorite libraries", checkListView, Type.INPUT)
          .onResult(buttonType -> {
            if (ButtonType.CANCEL.equals(buttonType)) {
              System.err.println("Dialog was cancelled!");
            } else {
              System.err.println("Chosen favorite libraries: " +
                  checkListView.getCheckModel().getCheckedItems().stream().collect(
                      Collectors.joining(", ")));
            }
          }).build();
}
 
Example #7
Source File: TableScrollSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public TableScrollSample() {
    final ObservableList<Person> data = FXCollections.observableArrayList(
            new Person("Jacob", "Smith", "[email protected]"),
            new Person("Isabella", "Johnson", "[email protected]"),
            new Person("Ethan", "Williams", "[email protected]"),
            new Person("Emma", "Jones", "[email protected]"), new Person("Michael", "Brown", "[email protected]"));
    TableColumn firstNameCol = new TableColumn();
    firstNameCol.setText("First");
    firstNameCol.setCellValueFactory(new PropertyValueFactory("firstName"));
    TableColumn lastNameCol = new TableColumn();
    lastNameCol.setText("Last");
    lastNameCol.setCellValueFactory(new PropertyValueFactory("lastName"));
    TableColumn emailCol = new TableColumn();
    emailCol.setText("Email");
    emailCol.setMinWidth(200);
    emailCol.setCellValueFactory(new PropertyValueFactory("email"));
    TableView tableView = new TableView();
    tableView.setItems(data);
    ObservableList items = tableView.getItems();
    for (int i = 0; i < 10; i++)
        items.add(new Person("Name" + i, "Last" + i, "Email " + i));
    tableView.getColumns().addAll(firstNameCol, lastNameCol, emailCol);
    getChildren().add(tableView);
}
 
Example #8
Source File: SetSqlController.java    From Spring-generator with MIT License 6 votes vote down vote up
@Override
public void initialize(URL location, ResourceBundle resources) {
	tblProperty.setEditable(true);
	tblProperty.setStyle("-fx-font-size:14px");
	StringProperty property = Main.LANGUAGE.get(LanguageKey.SET_TBL_TIPS);
	String title = property == null ? "可以在右边自定义添加属性..." : property.get();
	tblProperty.setPlaceholder(new Label(title));
	tblPropertyValues = FXCollections.observableArrayList();
	// 设置列的大小自适应
	tblProperty.setColumnResizePolicy(resize -> {
		double width = resize.getTable().getWidth();
		tdKey.setPrefWidth(width / 3);
		tdValue.setPrefWidth(width / 3);
		tdDescribe.setPrefWidth(width / 3);
		return true;
	});
	btnConfirm.widthProperty().addListener(w -> {
		double x = btnConfirm.getLayoutX() + btnConfirm.getWidth() + 10;
		btnCancel.setLayoutX(x);
	});
}
 
Example #9
Source File: ApplicationSidebarSkin.java    From phoenicis with GNU Lesser General Public License v3.0 6 votes vote down vote up
private SidebarGroup<CheckBox> createFilterGroup() {
    final CheckBox testingCheck = createCheckBox(tr("Testing"));
    getControl().containTestingApplicationsProperty().bind(testingCheck.selectedProperty());

    final CheckBox requiresPatchCheck = createCheckBox(tr("Patch required"));
    getControl().containRequiresPatchApplicationsProperty().bind(requiresPatchCheck.selectedProperty());

    final CheckBox commercialCheck = createCheckBox(tr("Commercial"));
    commercialCheck.setSelected(true);
    getControl().containCommercialApplicationsProperty().bind(commercialCheck.selectedProperty());

    final CheckBox operatingSystemCheck = createCheckBox(tr("All Operating Systems"));
    getControl().containAllOSCompatibleApplicationsProperty().bind(operatingSystemCheck.selectedProperty());

    return new SidebarGroup<>(tr("Filters"), FXCollections.observableArrayList(
            testingCheck, requiresPatchCheck, commercialCheck, operatingSystemCheck));
}
 
Example #10
Source File: ListReductionTest.java    From ReactFX with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Test
public void testWhenBound() {
    ObservableList<Integer> list = FXCollections.observableArrayList(1, 1, 1, 1, 1);
    Val<Integer> sum = LiveList.reduce(list, (a, b) -> a + b);
    Var<Integer> lastObserved = Var.newSimpleVar(sum.getValue());

    assertEquals(5, lastObserved.getValue().intValue());

    sum.addListener((obs, oldVal, newVal) -> {
        assertEquals(lastObserved.getValue(), oldVal);
        lastObserved.setValue(newVal);
    });

    list.addAll(2, Arrays.asList(2, 2));
    assertEquals(9, lastObserved.getValue().intValue());

    list.subList(3, 6).clear();
    assertEquals(5, lastObserved.getValue().intValue());
}
 
Example #11
Source File: ShikoPunetPunetoret.java    From Automekanik with GNU General Public License v3.0 6 votes vote down vote up
public void mbushNgaStatusi(String emri){
    try {
        String sql = "select * from Punet where punetori = '" + emri + "' order by id asc";
        Connection conn = DriverManager.getConnection(CON_STR, "test", "test");
        Statement stmt = conn.createStatement();
        ResultSet rs = stmt.executeQuery(sql);
        ObservableList<TabelaTeDhenatPunetore> data = FXCollections.observableArrayList();
        Format format = new SimpleDateFormat("dd/MM/yyyy");
        String s = "";
        while (rs.next()) {
            s = format.format(rs.getDate("data"));
            data.add(new TabelaTeDhenatPunetore(rs.getInt("id"), rs.getString("lloji"), s,
                    rs.getFloat("qmimi"), rs.getString("konsumatori"), rs.getString("pershkrimi"), rs.getString("kryer"), rs.getString("makina")));
        }

        rs.close();
        stmt.close();
        conn.close();
        table.setItems(data);
    }catch (Exception ex){ex.printStackTrace();}
}
 
Example #12
Source File: ListViewCellFactorySample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public ListViewCellFactorySample() {
    final ListView<Number> listView = new ListView<Number>();
    listView.setItems(FXCollections.<Number>observableArrayList(
            100.00, -12.34, 33.01, 71.00, 23000.00, -6.00, 0, 42223.00, -12.05, 500.00,
            430000.00, 1.00, -4.00, 1922.01, -90.00, 11111.00, 3901349.00, 12.00, -1.00, -2.00,
            15.00, 47.50, 12.11

    ));
    
    listView.setCellFactory(new Callback<ListView<java.lang.Number>, ListCell<java.lang.Number>>() {
        @Override public ListCell<Number> call(ListView<java.lang.Number> list) {
            return new MoneyFormatCell();
        }
    });        
    
    listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    getChildren().add(listView);
}
 
Example #13
Source File: SearchController.java    From tutorials with MIT License 6 votes vote down vote up
private void loadData() {

        String searchText = searchField.getText();

        Task<ObservableList<Person>> task = new Task<ObservableList<Person>>() {
            @Override
            protected ObservableList<Person> call() throws Exception {
                updateMessage("Loading data");
                return FXCollections.observableArrayList(masterData
                        .stream()
                        .filter(value -> value.getName().toLowerCase().contains(searchText))
                        .collect(Collectors.toList()));
            }
        };

        task.setOnSucceeded(event -> {
            masterData = task.getValue();
            pagination.setVisible(true);
            pagination.setPageCount(masterData.size() / PAGE_ITEMS_COUNT);
        });

        Thread th = new Thread(task);
        th.setDaemon(true);
        th.start();
    }
 
Example #14
Source File: ShortcutInformationPanelSkin.java    From phoenicis with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Constructor
 *
 * @param control The control belonging to the skin
 */
public ShortcutInformationPanelSkin(ShortcutInformationPanel control) {
    super(control);

    this.description = StringBindings.map(getControl().shortcutProperty(),
            shortcut -> shortcut.getInfo().getDescription());

    this.shortcutProperties = CollectionBindings.mapToMap(getControl().shortcutProperty(), shortcut -> {
        try {
            return getControl().getObjectMapper()
                    .readValue(shortcut.getScript(), new TypeReference<Map<String, Object>>() {
                        // nothing
                    });
        } catch (IOException e) {
            LOGGER.error("An error occurred during a shortcut update", e);

            return Map.of();
        }
    });

    this.environmentAttributes = FXCollections.observableHashMap();
}
 
Example #15
Source File: ShikoPunetoret.java    From Automekanik with GNU General Public License v3.0 6 votes vote down vote up
public void mbushPunetoret(){
    try {
        String sql = "select * from Punetoret";
        Connection conn = DriverManager.getConnection(CON_STR, "test", "test");
        Statement stmt = conn.createStatement();
        ResultSet rs = stmt.executeQuery(sql);
        ObservableList<TabelaPunetoret> data = FXCollections.observableArrayList();
        Format format = new SimpleDateFormat("dd/MM/yyyy");
        while (rs.next()){
            String s = format.format(rs.getDate("regjistrimi"));
            data.add(new TabelaPunetoret(rs.getInt("id"), rs.getString("emri"),
                    rs.getString("mbiemri"), rs.getString("komuna"), rs.getString("pozita"),
                    s, rs.getFloat("paga")));
        }

        table.setItems(data);
        conn.close();
    }catch (Exception ex){ex.printStackTrace();}
}
 
Example #16
Source File: RoleSelectionTest.java    From triplea with GNU General Public License v3.0 6 votes vote down vote up
@ParameterizedTest
@ValueSource(booleans = {true, false})
void canToggleResourceModifiers(final boolean checked) {
  final CheckBox checkBox = mock(CheckBox.class);
  when(checkBox.isSelected()).thenReturn(checked);

  final Node node1 = mock(Node.class);
  final Node node2 = mockNodeInGridPane(0, 2);
  final Node node3 = mockNodeInGridPane(0, 3);
  final Node node4 = mockNodeInGridPane(1, 2);
  final Node node5 = mockNodeInGridPane(1, 3);

  final GridPane factionGrid = mock(GridPane.class);
  when(factionGrid.getChildren())
      .thenReturn(FXCollections.observableArrayList(node1, node2, node3, node4, node5));
  roleSelection.setFactionGrid(factionGrid);
  roleSelection.setResourceModifierCheckbox(checkBox);

  roleSelection.toggleResourceModifiers();

  verify(node1, never()).setDisable(anyBoolean());
  verify(node2, never()).setDisable(anyBoolean());
  verify(node3, never()).setDisable(anyBoolean());
  verify(node4, never()).setDisable(anyBoolean());
  verify(node5).setDisable(!checked);
}
 
Example #17
Source File: SettingsView.java    From phoenicis with GNU Lesser General Public License v3.0 6 votes vote down vote up
private RepositoriesPanel createRepositoriesPanel() {
    ObservableList<RepositoryLocation<? extends Repository>> repositoryLocations = FXCollections
            .observableArrayList(settingsManager.loadRepositoryLocations());

    final RepositoriesPanel repositoriesPanel = new RepositoriesPanel(repositoryLocations);

    // set the initial values
    repositoriesPanel.setOnRepositoryRefresh(repositoryManager::triggerRepositoryChange);

    repositoriesPanel.setRepositoryLocationLoader(repositoryLocationLoader);

    // react to changes
    repositoriesPanel.getRepositoryLocations()
            .addListener((ListChangeListener.Change<? extends RepositoryLocation<? extends Repository>> change) -> {
                repositoryManager.updateRepositories(repositoryLocations);

                settingsManager.saveRepositories(repositoryLocations);
            });

    return repositoriesPanel;
}
 
Example #18
Source File: ListViewCellFactorySample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public ListViewCellFactorySample() {
    final ListView<Number> listView = new ListView<Number>();
    listView.setItems(FXCollections.<Number>observableArrayList(
            100.00, -12.34, 33.01, 71.00, 23000.00, -6.00, 0, 42223.00, -12.05, 500.00,
            430000.00, 1.00, -4.00, 1922.01, -90.00, 11111.00, 3901349.00, 12.00, -1.00, -2.00,
            15.00, 47.50, 12.11

    ));
    
    listView.setCellFactory(new Callback<ListView<java.lang.Number>, ListCell<java.lang.Number>>() {
        @Override public ListCell<Number> call(ListView<java.lang.Number> list) {
            return new MoneyFormatCell();
        }
    });        
    
    listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    getChildren().add(listView);
}
 
Example #19
Source File: DrilldownPieChartSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public DrilldownPieChartSample() {
    String drilldownCss = DrilldownPieChartSample.class.getResource("DrilldownChart.css").toExternalForm();

    PieChart pie = new PieChart(
            FXCollections.observableArrayList(
            A = new PieChart.Data("A", 20),
            B = new PieChart.Data("B", 30),
            C = new PieChart.Data("C", 10),
            D = new PieChart.Data("D", 40)));
    ((Parent) pie).getStylesheets().add(drilldownCss);

    setDrilldownData(pie, A, "a");
    setDrilldownData(pie, B, "b");
    setDrilldownData(pie, C, "c");
    setDrilldownData(pie, D, "d");
    getChildren().add(pie);
}
 
Example #20
Source File: ChartAdvancedPie.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected PieChart createChart() {
    final PieChart pc = new PieChart(FXCollections.observableArrayList(
        new PieChart.Data("Sun", 20),
        new PieChart.Data("IBM", 12),
        new PieChart.Data("HP", 25),
        new PieChart.Data("Dell", 22),
        new PieChart.Data("Apple", 30)
    ));
    // setup chart
    pc.setId("BasicPie");
    pc.setTitle("Pie Chart Example");
    return pc;
}
 
Example #21
Source File: DataSetSelector.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
public DataSetSelector(final ParameterMeasurements plugin, final int requiredNumberOfDataSets) {
    super();
    if (plugin == null) {
        throw new IllegalArgumentException("plugin must not be null");
    }

    // wrap observable Array List, to prevent resetting the selection model whenever getAllDatasets() is called
    // somewhere in the code.
    allDataSets = plugin.getChart() != null ? FXCollections.observableArrayList(plugin.getChart().getAllDatasets()) : FXCollections.emptyObservableList();

    final Label label = new Label("Selected Dataset: ");
    GridPane.setConstraints(label, 0, 0);
    dataSetListView = new ListView<>(allDataSets);
    GridPane.setConstraints(dataSetListView, 1, 0);
    dataSetListView.setOrientation(Orientation.VERTICAL);
    dataSetListView.setPrefSize(-1, DEFAULT_SELECTOR_HEIGHT);
    dataSetListView.setCellFactory(list -> new DataSetLabel());
    dataSetListView.setPrefHeight(Math.max(2, allDataSets.size()) * ROW_HEIGHT + 2.0);
    MultipleSelectionModel<DataSet> selModel = dataSetListView.getSelectionModel();
    if (requiredNumberOfDataSets == 1) {
        selModel.setSelectionMode(SelectionMode.SINGLE);
    } else if (requiredNumberOfDataSets >= 2) {
        selModel.setSelectionMode(SelectionMode.MULTIPLE);
    }

    // add default initially selected DataSets
    if (selModel.getSelectedIndices().isEmpty() && allDataSets.size() >= requiredNumberOfDataSets) {
        for (int i = 0; i < requiredNumberOfDataSets; i++) {
            selModel.select(i);
        }
    }

    if (requiredNumberOfDataSets >= 1) {
        getChildren().addAll(label, dataSetListView);
    }
}
 
Example #22
Source File: StatisticsPane.java    From logbook-kai with MIT License 5 votes vote down vote up
/**
 * 経験値比率
 * @param ships 対象艦
 */
private void setRatio(List<Ship> ships) {
    Map<TypeGroup, Long> collect = ships.stream()
            .collect(Collectors.groupingBy(TypeGroup::toTypeGroup, TreeMap::new,
                    Collectors.summingLong(this::getExp)));

    ObservableList<PieChart.Data> value = FXCollections.observableArrayList();
    for (Entry<TypeGroup, Long> data : collect.entrySet()) {
        if (data.getKey() != null)
            value.add(new PieChart.Data(data.getKey().name(), data.getValue()));
    }
    this.ratio.setData(value);
}
 
Example #23
Source File: ConsumerGroupView.java    From kafka-message-tool with MIT License 5 votes vote down vote up
public void refresh(KafkaClusterProxy proxy) {
    this.proxy = proxy;
    final List<ConsumerGroupName> names = proxy.getConsumerGroupDetails().stream()
        .map(ConsumerGroupDetailRecord::getConsumerGroupId).distinct().map(ConsumerGroupName::new)
        .collect(Collectors.toList());
    consumerGroupNameTable.setItems(FXCollections.observableList(names));

}
 
Example #24
Source File: BidirectionalListBinderTest.java    From dolphin-platform with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldRemoveSingleElementAtBeginningOfDolphinList() {
    // given:
    final javafx.collections.ObservableList<String> javaFXList = FXCollections.observableArrayList();
    final ObservableList<Integer> dolphinList = new ObservableArrayList<>();
    FXBinder.bind(javaFXList).bidirectionalTo(dolphinList, Object::toString, Integer::parseInt);
    dolphinList.addAll(1, 2, 3);

    // when:
    javaFXList.remove("1");

    // then:
    assertThat(dolphinList, contains(2, 3));
}
 
Example #25
Source File: TrainingConfigView.java    From metastone with GNU General Public License v2.0 5 votes vote down vote up
public void injectDecks(List<Deck> decks) {
	List<Deck> filteredDecks = FXCollections.observableArrayList();
	for (Deck deck : decks) {
		if (deck.getHeroClass() != HeroClass.DECK_COLLECTION) {
			filteredDecks.add(deck);
		}
	}
	selectedDecksListView.getItems().clear();
	availableDecksListView.getItems().setAll(filteredDecks);
	deckBox.getItems().setAll(filteredDecks);
	deckBox.getSelectionModel().selectFirst();
}
 
Example #26
Source File: ToolsController.java    From Noexes with GNU General Public License v3.0 5 votes vote down vote up
@FXML
public void initialize() {
    memoryInfoList = FXCollections.observableArrayList();

    for (TableColumn c : memInfoTable.getColumns()) {
        c.setReorderable(false);
    }
    memInfoTable.setItems(new SortedList<>(memoryInfoList, (info1, info2) -> {
        long addr1 = info1.getAddr();
        long addr2 = info2.getAddr();
        if (addr1 < addr2) {
            return -1;
        }
        if (addr1 > addr2) {
            return 1;
        }
        return 0;
    }));

    memInfoName.setCellValueFactory(param -> param.getValue().nameProperty());
    memInfoAddr.setCellValueFactory(param -> param.getValue().addrProperty());
    memInfoSize.setCellValueFactory(param -> param.getValue().sizeProperty());
    memInfoType.setCellValueFactory(param -> param.getValue().typeProperty());
    memInfoPerm.setCellValueFactory(param -> param.getValue().accessProperty());

    memInfoAddr.setCellFactory(param -> new FormattedTableCell<>(addr -> HexUtils.formatAddress(addr.longValue())));
    memInfoSize.setCellFactory(param -> new FormattedTableCell<>(size -> HexUtils.formatSize(size.longValue())));
    memInfoPerm.setCellFactory(param -> new FormattedTableCell<>(access -> HexUtils.formatAccess(access.intValue())));

    pidList.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue == null) {
            return;
        }
        displayTitleId(mc.getDebugger().getTitleId(newValue));
    });

    MemoryInfoContextMenu cm = new MemoryInfoContextMenu(() -> mc, memInfoTable);
    memInfoTable.contextMenuProperty().setValue(cm);
}
 
Example #27
Source File: ReportsController.java    From HealthPlus with Apache License 2.0 5 votes vote down vote up
public void fillPieChart(int months)
{
    ArrayList<ArrayList<String>> data = admin.lastMonthsReports(months);
    String[] test = {   
                        "Blood Grouping & Rh","Lipid Profile Test","LFT","RFT",
                        "HIV","CPK","Pathalogy Test",
                        "Complete Blood Count"
                    };
    ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList(); 
    pieChartData.clear();
    int tmpSize = test.length;
    for(int i = 0; i < tmpSize; i++)
    {
        pieChartData.add(new PieChart.Data(test[i], Integer.parseInt(data.get(1).get(i))));
    }    
    
    pieChartData.forEach(data1 ->
            data1.nameProperty().bind(
                    Bindings.concat(
                            data1.getName(), " (", data1.pieValueProperty(), ")"
                    )
            )
    );
    
    labReportPieChart.setData(pieChartData);
    
    ArrayList<Integer> month = new ArrayList<Integer>();
    for (int i = 1; i < 13; i++)
    {
        month.add(i);
    }    
    //reportsCombo.getItems().clear();
    //reportsCombo.getItems().addAll(month);
    //reportsCombo.setValue(12);
    
}
 
Example #28
Source File: WarDetailsController.java    From VickyWarAnalyzer with MIT License 5 votes vote down vote up
public void init(MainController mainController, ModelService modelService,
				 Tab tab) {
	main = mainController;
	this.tab = tab;
	this.modelService = modelService;
	setColumnValues();
	attackerBoxController.init(modelService, "Attacker");
	defenderBoxController.init(modelService, "Defender");
	battleTableContent = FXCollections.observableArrayList();

	/* Listening to selections in battleTable */
	ObservableList<Battle> battleTableSelection = battleTable
			.getSelectionModel().getSelectedItems();
	battleTableSelection.addListener(battleTableSelectionChanged);
}
 
Example #29
Source File: BidirectionalListBinderTest.java    From dolphin-platform with Apache License 2.0 5 votes vote down vote up
@Test (enabled = false)
public void shouldRemoveMultipleElementsAtBeginningOfJavaFXList() {
    // given:
    final javafx.collections.ObservableList<String> javaFXList = FXCollections.observableArrayList();
    final ObservableList<Integer> dolphinList = new ObservableArrayList<>();
    FXBinder.bind(javaFXList).bidirectionalTo(dolphinList, Object::toString, Integer::parseInt);
    javaFXList.addAll("1", "2", "3", "4", "5");

    // when:
    dolphinList.subList(0, 3).clear();

    // then:
    assertThat(javaFXList, contains(4, 5));
}
 
Example #30
Source File: FailureDetailView.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private void initStackTrace() {
    traces = FXCollections.observableArrayList();
    stackTrace = new ListView<>(traces);
    stackTrace.setOnMousePressed((event) -> {
        if (event.getClickCount() > 1) {
            Object selectedItem = stackTrace.getSelectionModel().getSelectedItem();
            if (selectedItem instanceof StackElement) {
                resultPaneSelectionListener.resultSelected(((StackElement) selectedItem).sourceLine);
            }
        }
    });
}