private TableColumn processChoiceBoxColumnName(String name, JsonArray items){
TableColumn column = new TableColumn(name);
column.setCellValueFactory( p -> ((TableColumn.CellDataFeatures<Item, Object>)p).getValue().getStringProperty(name));
ObservableList list = FXCollections.observableArrayList();
if(items!=null) list.addAll(items.getList());
column.setCellFactory(ChoiceBoxTableCell.forTableColumn(list));
column.setOnEditCommit( t -> {
int index = ((TableColumn.CellEditEvent<Item, Object>) t).getTablePosition().getRow();
Item item = ((TableColumn.CellEditEvent<Item, Object>) t).getTableView().getItems().get(index);
item.setProperty(name,((TableColumn.CellEditEvent<Item, Object>) t).getNewValue());
});
columnMap.put(name, column);
return column;
}
java类javafx.collections.FXCollections的实例源码
TableView.java 文件源码
项目:xbrowser
阅读 33
收藏 0
点赞 0
评论 0
ShikoKonsumatoret.java 文件源码
项目:Automekanik
阅读 23
收藏 0
点赞 0
评论 0
public void mbushTabelen(){
Thread t = new Thread(new Runnable() {
public void run() {
try {
Connection conn = DriverManager.getConnection(CON_STR, "test", "test");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select * from Konsumatori");
ObservableList<TabelaKonsumatori> data = FXCollections.observableArrayList();
while (rs.next()){
data.add(new TabelaKonsumatori(rs.getInt("id"), rs.getString("emri"), rs.getString("mbiemri"),
rs.getString("makina"), rs.getString("komuna"), rs.getString("pershkrimi")));
}
table.setItems(data);
conn.close();
}catch (Exception ex){ex.printStackTrace();}
}
});
t.start();
}
MainWindowController.java 文件源码
项目:qiniu
阅读 29
收藏 0
点赞 0
评论 0
/**
* 搜索资源文件,忽略大小写
*/
public void searchFile(KeyEvent event) {
ArrayList<FileInfo> files = new ArrayList<FileInfo>();
String search = Checker.checkNull(searchTextField.getText());
logger.info("search file: " + search);
QiniuApplication.totalLength = 0;
QiniuApplication.totalSize = 0;
try {
// 正则匹配查询
Pattern pattern = Pattern.compile(search, Pattern.CASE_INSENSITIVE);
for (FileInfo file : QiniuApplication.data) {
if (pattern.matcher(file.getName()).find()) {
files.add(file);
QiniuApplication.totalLength++;
QiniuApplication.totalSize += Formatter.sizeToLong(file.getSize());
}
}
} catch (Exception e) {
logger.warn("pattern '" + search + "' compile error, message: " + e.getMessage());
}
setBucketCount();
resTable.setItems(FXCollections.observableArrayList(files));
}
BubbleChartSample.java 文件源码
项目:marathonv5
阅读 20
收藏 0
点赞 0
评论 0
public BubbleChartSample() {
NumberAxis xAxis = new NumberAxis("X", 0d, 150d, 20d);
NumberAxis yAxis = new NumberAxis("Y", 0d, 150d, 20d);
ObservableList<BubbleChart.Series> bubbleChartData = FXCollections.observableArrayList(
new BubbleChart.Series("Series 1", FXCollections.observableArrayList(
new XYChart.Data(30d, 40d, 10d),
new XYChart.Data(60d, 20d, 13d),
new XYChart.Data(10d, 90d, 7d),
new XYChart.Data(100d, 40d, 10d),
new XYChart.Data(50d, 23d, 5d)))
,
new BubbleChart.Series("Series 2", FXCollections.observableArrayList(
new XYChart.Data(13d, 100d, 7d),
new XYChart.Data(20d, 80d, 13d),
new XYChart.Data(100d, 60d, 10d),
new XYChart.Data(30d, 40d, 6d),
new XYChart.Data(50d, 20d, 12d)
))
);
BubbleChart chart = new BubbleChart(xAxis, yAxis, bubbleChartData);
getChildren().add(chart);
}
SearchController.java 文件源码
项目:IP1
阅读 29
收藏 0
点赞 0
评论 0
private void displayData() {
ObservableList<BookEntity> data = book.getAllBooksList();
title.setCellValueFactory(new PropertyValueFactory<>("title"));
category.setCellValueFactory(new PropertyValueFactory<>("category"));
author.setCellValueFactory(new PropertyValueFactory<>("author"));
isbn.setCellValueFactory(new PropertyValueFactory<>("isbn"));
publisher.setCellValueFactory(new PropertyValueFactory<>("publisher"));
date.setCellValueFactory(new PropertyValueFactory<>("date"));
pages.setCellValueFactory(new PropertyValueFactory<>("pages"));
quantity.setCellValueFactory(new PropertyValueFactory<>("quantity"));
table.setItems(data);
ObservableList<String> options = FXCollections.observableArrayList("Title", "Category", "Author", "Publisher");
search_combo.setItems(options);
search_combo.getSelectionModel().selectFirst();
}
PackageInfoController.java 文件源码
项目:aem-epic-tool
阅读 20
收藏 0
点赞 0
评论 0
private void showPackageContents(PackageContents packageContents) {
packageConfirmPanel.setVisible(false);
downloadingPane.setVisible(false);
analysisPane.setVisible(true);
pkgContents = packageContents;
downloadFileLabel.setText(packageContents.getFile().getPath());
fileCountLabel.setText(String.valueOf(packageContents.getFileCount()));
folderCountLabel.setText(String.valueOf(packageContents.getFolderCount()));
rootSummaryTable.setItems(FXCollections.observableArrayList(packageContents.getBaseCounts().entrySet()));
typeSummaryTable.setItems(FXCollections.observableArrayList(packageContents.getFilesByType().entrySet()));
downloadFileLabel.setOnMouseClicked(evt -> {
if (evt.getButton() == MouseButton.PRIMARY && evt.getClickCount() == 2) {
String path;
if (evt.isShiftDown() || evt.isControlDown()) {
path = packageContents.getFile().getParent();
} else {
path = packageContents.getFile().getPath();
}
HostServices services = ApplicationState.getInstance().getApplication().getHostServices();
services.showDocument(path);
}
});
}
MainWindowController.java 文件源码
项目:dialog-tool
阅读 23
收藏 0
点赞 0
评论 0
protected void refreshListView () {
this.questionList.getItems().clear();
//create list with all questions
ObservableList<String> questions = FXCollections.observableArrayList();
//iterate through all questions
for (Map.Entry<String,QuestionEntry> entry : this.questionMap.entrySet()) {
//add question name to list
questions.add(entry.getKey());
}
Collections.sort(questions);
if (questions.size() <= 0) {
//hide delete button
this.deleteButton.setVisible(false);
} else {
//show delete button
this.deleteButton.setVisible(true);
}
this.questionList.setItems(questions);
}
SpotManagerController.java 文件源码
项目:Squid
阅读 26
收藏 0
点赞 0
评论 0
private void setUpPrawnFile() {
shrimpRuns = FXCollections.observableArrayList(squidProject.getPrawnFileRuns());
setUpShrimpFractionList();
saveSpotNameButton.setDisable(false);
setFilteredSpotsAsRefMatButton.setDisable(false);
setFilteredSpotsAsConcRefMatButton.setDisable(false);
// filter runs to populate ref mat list
filterRuns(squidProject.getFilterForRefMatSpotNames());
updateReferenceMaterialsList(false);
// filter runs to populate concentration ref mat list
filterRuns(squidProject.getFilterForConcRefMatSpotNames());
updateConcReferenceMaterialsList(false);
// restore spot list to full population
filterRuns("");
}
ManutencaoSoftware.java 文件源码
项目:AlphaLab
阅读 24
收藏 0
点赞 0
评论 0
@Override
public void initialize(URL location, ResourceBundle resources) {
software = new SoftwareEntity();
negocio = new Software(DAOFactory.getDAOFactory().getSoftwareDAO());
tbcDescricao.setCellValueFactory(new PropertyValueFactory<>("descricao"));
tbcLink.setCellValueFactory(new PropertyValueFactory<>("link"));
tbcId.setCellValueFactory(new PropertyValueFactory<>("id"));
tbcObservacao.setCellValueFactory(new PropertyValueFactory<>("observacaoInstalacao"));
tbcTipo.setCellValueFactory(new PropertyValueFactory<>("tipo"));
tbcVersao.setCellValueFactory(new PropertyValueFactory<>("versao"));
cbxManutencaoTipoSoftware.getItems().addAll(TipoSoftwareEnum.values());
cbxManutencaoTipoSoftware.getSelectionModel().selectFirst();
cbxSoftwareTipo.getItems().addAll(TipoSoftwareEnum.values());
listaSoftwares = FXCollections.observableArrayList();
listaSoftwares.addAll(negocio.buscarTodosSoftwares());
tblManutencaoSoftware.setItems(listaSoftwares);
tbpGerenciaSoftware.getSelectionModel().selectLast();
}
NotificationBarPane.java 文件源码
项目:legendary-guide
阅读 30
收藏 0
点赞 0
评论 0
public NotificationBarPane(Node content) {
super(content);
progressBar = new ProgressBar();
label = new Label("infobar!");
bar = new HBox(label);
bar.setMinHeight(0.0);
bar.getStyleClass().add("info-bar");
bar.setFillHeight(true);
setBottom(bar);
// Figure out the height of the bar based on the CSS. Must wait until after we've been added to the parent node.
sceneProperty().addListener(o -> {
if (getParent() == null) return;
getParent().applyCss();
getParent().layout();
barHeight = bar.getHeight();
bar.setPrefHeight(0.0);
});
items = FXCollections.observableArrayList();
items.addListener((ListChangeListener<? super Item>) change -> {
config();
showOrHide();
});
}
SimpleBookmarkStore.java 文件源码
项目:hygene
阅读 21
收藏 0
点赞 0
评论 0
/**
* Create an instance of a {@link SimpleBookmarkStore}.
* <p>
* If it observed that the {@link org.dnacronym.hygene.parser.GfaFile} in {@link GraphStore} has changed, it will
* clear all current {@link SimpleBookmark}s and load the {@link Bookmark}s associated with the new
* {@link org.dnacronym.hygene.parser.GfaFile}.
* <p>
* It uses the {@link GraphDimensionsCalculator} as a reference for each internal {@link SimpleBookmark}.
*
* @param graphStore the {@link GraphStore} to be observed by this class
* @param graphVisualizer the {@link GraphVisualizer} to be used by this class
* @param graphDimensionsCalculator the {@link GraphDimensionsCalculator} to be used by this class
* @param sequenceVisualizer the {@link SequenceVisualizer} to be used by this class
* @see SimpleBookmark
*/
@Inject
public SimpleBookmarkStore(final GraphStore graphStore, final GraphVisualizer graphVisualizer,
final GraphDimensionsCalculator graphDimensionsCalculator,
final SequenceVisualizer sequenceVisualizer) {
this.graphDimensionsCalculator = graphDimensionsCalculator;
this.graphVisualizer = graphVisualizer;
this.sequenceVisualizer = sequenceVisualizer;
simpleBookmarks = new ArrayList<>();
observableSimpleBookmarks = FXCollections.observableList(simpleBookmarks);
observableSimpleBookmarks.addListener((ListChangeListener<SimpleBookmark>) listener -> graphVisualizer.draw());
graphStore.getGfaFileProperty().addListener((observable, oldValue, newValue) -> {
try {
fileBookmarks = new FileBookmarks(new FileDatabase(newValue.getFileName()));
simpleBookmarks.clear();
addBookmarks(fileBookmarks.getAll());
} catch (final SQLException | IOException e) {
LOGGER.error("Unable to load bookmarks from file.", e);
}
});
}
AppController.java 文件源码
项目:Steam-trader-tools
阅读 30
收藏 0
点赞 0
评论 0
@FXML
void searchApp(KeyEvent event)
{
ArrayList<AbstractSteamAppWithKey> searchResult = new ArrayList<>();
String search = searchText.getText();
if (!search.isEmpty())
searchGraphic.setImage(new Image("/com/matthieu42/steamtradertools/bundles/images/close.png"));
else
searchGraphic.setImage(new Image("/com/matthieu42/steamtradertools/bundles/images/magnify.png"));
search = search.toLowerCase();
for (AbstractSteamAppWithKey curVal : currentAppList)
{
if (curVal.getName().toLowerCase().contains(search))
{
searchResult.add(curVal);
}
}
appList.setItems(FXCollections.observableArrayList(searchResult));
}
SetAction.java 文件源码
项目:MythRedisClient
阅读 18
收藏 0
点赞 0
评论 0
/**
* 装载面板数据.
*
* @param key 数据库中的键
*/
@Override
public void setValue(String key) {
ObservableList<TableEntity> values = FXCollections.observableArrayList();
Set<String> sets = redisSet.getMembersSet(key);
int i = 0;
for (String set : sets) {
TableEntity value = new TableEntity("" + i, key, set);
values.add(value);
i++;
}
this.dataTable.setItems(values);
this.rowColumn.setCellValueFactory(cellData -> cellData.getValue().rowProperty());
this.keyColumn.setCellValueFactory(cellData -> cellData.getValue().keyProperty());
this.valueColumn.setCellValueFactory(cellData -> cellData.getValue().valueProperty());
}
ChartLine.java 文件源码
项目:incubator-netbeans
阅读 25
收藏 0
点赞 0
评论 0
private void init(Stage primaryStage) {
Group root = new Group();
primaryStage.setScene(new Scene(root));
NumberAxis xAxis = new NumberAxis("Values for X-Axis", 0, 3, 1);
NumberAxis yAxis = new NumberAxis("Values for Y-Axis", 0, 3, 1);
ObservableList<XYChart.Series<Double,Double>> lineChartData = FXCollections.observableArrayList(
new LineChart.Series<Double,Double>("Series 1", FXCollections.observableArrayList(
new XYChart.Data<Double,Double>(0.0, 1.0),
new XYChart.Data<Double,Double>(1.2, 1.4),
new XYChart.Data<Double,Double>(2.2, 1.9),
new XYChart.Data<Double,Double>(2.7, 2.3),
new XYChart.Data<Double,Double>(2.9, 0.5)
)),
new LineChart.Series<Double,Double>("Series 2", FXCollections.observableArrayList(
new XYChart.Data<Double,Double>(0.0, 1.6),
new XYChart.Data<Double,Double>(0.8, 0.4),
new XYChart.Data<Double,Double>(1.4, 2.9),
new XYChart.Data<Double,Double>(2.1, 1.3),
new XYChart.Data<Double,Double>(2.6, 0.9)
))
);
LineChart chart = new LineChart(xAxis, yAxis, lineChartData);
root.getChildren().add(chart);
}
MainDisplay.java 文件源码
项目:SnapDup
阅读 29
收藏 0
点赞 0
评论 0
@FXML
private void btnMapDevicesAction()
{
try
{
FXMLLoader loader = new FXMLLoader(MainDisplay.class.getResource("/fxml/MapDevicesDialog.fxml"));
Parent root = loader.load();
Scene scene = new Scene(root);
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
stage.initStyle(StageStyle.UNDECORATED);
stage.setScene(scene);
stage.show();
Node node = scene.lookup("#tblMapDevice");
if(node instanceof TableView)
{
TableView<Pair<String, String>> table = (TableView)node;
ArrayList<Pair<String, String>> pairList = new ArrayList<>();
dataContainer.getDeviceMap().entrySet().forEach(entry -> pairList.add(new Pair<String, String>(entry.getKey(), entry.getValue())));
ObservableList<Pair<String, String>> tableModel = FXCollections.<Pair<String, String>> observableArrayList(pairList);
table.setItems(tableModel);
}
}
catch(IOException e)
{
e.printStackTrace();
}
}
ShikoPunetoret.java 文件源码
项目:Automekanik
阅读 23
收藏 0
点赞 0
评论 0
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();}
}
CollatedTreeItem.java 文件源码
项目:marathonv5
阅读 20
收藏 0
点赞 0
评论 0
public CollatedTreeItem() {
children = FXCollections.observableArrayList();
filteredChildren = new FilteredList<>(children, new Predicate<TreeItem<T>>() {
@Override public boolean test(TreeItem<T> t) {
return filter.test(t.getValue());
}
});
sortedChildren = new SortedList<>(filteredChildren);
ObservableList<TreeItem<T>> original = super.getChildren();
sortedChildren.addListener(new ListChangeListener<TreeItem<T>>() {
@Override public void onChanged(javafx.collections.ListChangeListener.Change<? extends TreeItem<T>> c) {
while (c.next()) {
original.removeAll(c.getRemoved());
original.addAll(c.getFrom(), c.getAddedSubList());
}
}
});
}
SimpleListViewScrollSample.java 文件源码
项目:marathonv5
阅读 22
收藏 0
点赞 0
评论 0
@Override public void start(Stage primaryStage) throws Exception {
final ListView<String> listView = new ListView<String>();
listView.setItems(FXCollections.observableArrayList("Row 1", "Row 2", "Long Row 3", "Row 4", "Row 5", "Row 6", "Row 7",
"Row 8", "Row 9", "Row 10", "Row 11", "Row 12", "Row 13", "Row 14", "Row 15", "Row 16", "Row 17", "Row 18",
"Row 19", "Row 20", "Row 21", "Row 22", "Row 23", "Row 24", "Row 25"));
listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
Button button = new Button("Debug");
button.setOnAction((e) -> {
ObservableList<Integer> selectedIndices = listView.getSelectionModel().getSelectedIndices();
for (Integer index : selectedIndices) {
ListCell cellAt = getCellAt(listView, index);
System.out.println("SimpleListViewScrollSample.SimpleListViewScrollSampleApp.start(" + cellAt + ")");
}
});
VBox root = new VBox(listView, button);
primaryStage.setScene(new Scene(root, 300, 400));
primaryStage.show();
}
GerenciarInstalacaoSoftware.java 文件源码
项目:AlphaLab
阅读 15
收藏 0
点赞 0
评论 0
@Override
public void initialize(URL location, ResourceBundle resources) {
negocio=new SolicitacaoSoftware(DAOFactory.getDAOFactory().getSolicitacaoSoftwareDAO());
tbcSituacao.setCellValueFactory(new PropertyValueFactory<>("situacaoInstalacao"));
tbcProfessor.setCellValueFactory(new PropertyValueFactory<>("solicitante"));
tbcSoftware.setCellValueFactory(new PropertyValueFactory<>("descricao"));
tbcObservacaoInstalacao.setCellValueFactory(new PropertyValueFactory<>("observacaoInstalacao"));
tbcLaboratorio.setCellValueFactory(new PropertyValueFactory<>("laboratorio"));
tbcId.setCellValueFactory(new PropertyValueFactory<>("idSolicitacao"));
tbcTipo.setCellValueFactory(new PropertyValueFactory<>("tipo"));
tbcDataSolicitacao.setCellValueFactory(new PropertyValueFactory<>("dataSolicitacao"));
tbcInstalado.setCellValueFactory(new PropertyValueFactory<>("instalado"));
//tbcInstalado.setCellFactory();
listaSolicitacao=FXCollections.observableArrayList((new SolicitacaoSoftwareView()).setSolicitacao(negocio.buscarTodas()).getList());
tblSolicitacao.setItems(listaSolicitacao);
/*Deve ser substituido pelo carregamento a partir da classe de negócio, porém esta não estava disponível até o momento da criação*/
cbxLaboratorio.setItems(FXCollections.observableArrayList(MockLaboratorioDAO.getInstance().buscarTodos()));
cbxSituacao.setItems(FXCollections.observableArrayList(SituacaoSolicitacaoEnum.values()));
}
GenerateExamsCtrl.java 文件源码
项目:Luna-Exam-Builder
阅读 19
收藏 0
点赞 0
评论 0
@Override
public void initialize(URL location, ResourceBundle resources) {
//Set fields
titleField.setText(MainApp.currentExam.title);
authorField.setText(MainApp.currentExam.author);
//Set format selection box
formatBox.setItems(FXCollections.observableArrayList(FORMATS));
formatBox.getSelectionModel().select(3);
//set max export label
System.out.println(MainApp.questionObservableList.size());
int max = factorial(MainApp.questionObservableList.size());
maxExportLabel.setText("You can generate up to "+ NumberFormat.getIntegerInstance().format(max) + " different exams");
//make the tree
TreeItem root = new TreeItem<>("Exam");
root.setExpanded(true);
questionTreeView.setRoot(root);
//add each question
for (Question question: MainApp.questionObservableList) {
TreeItem<String> q = new TreeItem<>(question.getTitle());
for (String option: question.options) {
TreeItem<String> o = new TreeItem<>(option);
q.getChildren().add(o);
}
q.setExpanded(true);
root.getChildren().add(q);
}
questionTreeView.setShowRoot(false);
}
GroupMemberView.java 文件源码
项目:Lernkartei_2017
阅读 23
收藏 0
点赞 0
评论 0
@Override
public Parent constructContainer()
{
bp.setId("loginviewbg");
list = new ListView<String>();
items = FXCollections.observableArrayList("Philippe Kr�ttli","Irina Deck","Javier Martinez Alvarez","Frithjof Hoppe");
list.setItems(items);
AllFields = new VBox(50);
AllFields.setAlignment(Pos.CENTER);
AllFields.setMaxWidth(300);
AllFields.setPadding(new Insets(20));
GroupName = new HBox(50);
Option = new HBox(50);
name = new Label("Name:");
groupname = new Label("{Gruppenname}");
btnAdd = new AppButton("Hinzuf�gen");
btnRemove = new AppButton("Entfernen");
back = new BackButton(getFXController(),"Zur�ck");
GroupName.getChildren().addAll(name,groupname);
Option.getChildren().addAll(back,btnAdd,btnRemove);
AllFields.getChildren().addAll(GroupName,Option,list);
bp.setCenter(AllFields);
back.setOnAction(e -> getFXController().showView("groupview"));
btnAdd.setOnAction(e -> getFXController().showView("userlistview"));
btnRemove.setOnAction(e -> {
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Mitglied l�schen");
alert.setHeaderText("Sie sind gerade dabei ein Mitglied aus der Gruppe zu entfernen.");
alert.setContentText("Sind Sie sich sicher, dass sie das tun wollen?");
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK){
// ... user chose OK
} else {
Alert noDeletion = new Alert(AlertType.INFORMATION);
noDeletion.setTitle("L�schvorgang abgebrochen");
noDeletion.setHeaderText("Mitglied nicht gel�scht");
noDeletion.setContentText("Der L�schvorgang wurde abgebrochen.");
noDeletion.showAndWait();
alert.close();
}});
return bp;
}
TreeNode.java 文件源码
项目:charts
阅读 27
收藏 0
点赞 0
评论 0
public TreeNode(final T ITEM, final TreeNode PARENT) {
item = ITEM;
parent = PARENT;
depth = -1;
children = FXCollections.observableArrayList();
listeners = new CopyOnWriteArrayList<>();
init();
}
NineAnimeController.java 文件源码
项目:Anime-Downloader
阅读 27
收藏 0
点赞 0
评论 0
@Override
public void initialize(URL location, ResourceBundle resources) {
// TODO Auto-generated method stub
name.setCellValueFactory(new PropertyValueFactory<Anime,String>("name"));
status.setCellValueFactory(new PropertyValueFactory<Anime,String>("status"));
table.setItems(list);
errormsg.setTextFill(Paint.valueOf("red"));
choicebox.setItems(FXCollections.observableArrayList("Provide Anime Name",
"Provide URL to a particular episode"));
}
MarathonModuleStage.java 文件源码
项目:marathonv5
阅读 18
收藏 0
点赞 0
评论 0
private void initComponents() {
moduleNameField.setPrefColumnCount(20);
moduleNameField.textProperty().addListener((observable, oldValue, newValue) -> validateModuleName());
descriptionArea.setPrefColumnCount(20);
descriptionArea.setPrefRowCount(4);
if (moduleInfo.isNeedModuleFile()) {
moduleDirComboBox.setItems(FXCollections.observableArrayList(moduleInfo.getModuleDirElements()));
moduleDirComboBox.getSelectionModel().selectedItemProperty().addListener((e) -> {
moduleInfo.populateFiles(moduleDirComboBox.getSelectionModel().getSelectedItem());
});
if (moduleDirComboBox.getItems().size() > 0) {
moduleDirComboBox.getSelectionModel().select(0);
}
moduleFileComboBox.setItems(moduleInfo.getModuleFileElements());
moduleFileComboBox.setEditable(true);
TextField editor = moduleFileComboBox.getEditor();
editor.textProperty().addListener((observable, oldValue, newValue) -> validateModuleName());
}
errorMessageLabel.setGraphic(FXUIUtils.getIcon("error"));
errorMessageLabel.setVisible(false);
buttonBar.setId("ModuleButtonBar");
okButton.setOnAction((e) -> onOK());
okButton.setDisable(true);
cancelButton.setOnAction((e) -> onCancel());
buttonBar.getButtons().addAll(okButton, cancelButton);
}
FXMLDocumentController.java 文件源码
项目:joanne
阅读 50
收藏 0
点赞 0
评论 0
private void setFavoritesToList(){
image_list.refresh();
ObservableList<String> l = FXCollections.observableArrayList(images);
if(l.size() > 0){
image_list.setItems(l);
image_list.setCellFactory(new CallbackImpl());
}else{
System.out.print("List length is 0");
}
System.gc();
}
VisitorsReports.java 文件源码
项目:gatepass
阅读 18
收藏 0
点赞 0
评论 0
private void initFilter() {
txtsearch = TextFields.createSearchField();
txtsearch.setStyle("-fx-background-radius:10;");
txtsearch.setPromptText("Search The Records");
txtsearch.setMaxWidth(90);
txtsearch.textProperty().addListener(new InvalidationListener() {
@Override
public void invalidated(Observable o) {
if(txtsearch.textProperty().get().isEmpty()) {
tableView.setItems(att);
return;
}
ObservableList<Reports> tableItems = FXCollections.observableArrayList();
ObservableList<TableColumn<Reports, ?>> cols = tableView.getColumns();
for(int i=0; i<att.size(); i++) {
for(int j=0; j<cols.size(); j++) {
TableColumn<Reports, ?> col = cols.get(j);
String cellValue = col.getCellData(att.get(i)).toString();
cellValue = cellValue.toLowerCase();
if(cellValue.contains(txtsearch.textProperty().get().toLowerCase())) {
tableItems.add(att.get(i));
break;
}
}
}
tableView.setItems(tableItems);
}
});
}
AuthorshipData.java 文件源码
项目:GameAuthoringEnvironment
阅读 19
收藏 0
点赞 0
评论 0
/**
* Just for show and picking. Will not edit the overall lists!
*
* @return all the created sprites
*/
public ObservableList<SpriteDefinition> getAllCreatedSpritesAsList () {
List<SpriteDefinition> sprites = new ArrayList<>();
getMyCreatedSpritesMap().values().stream().forEach(col -> sprites.addAll(col.getItems()));
return FXCollections.observableArrayList(sprites);
}
Office_Entry.java 文件源码
项目:gatepass
阅读 25
收藏 0
点赞 0
评论 0
@SuppressWarnings("unchecked")
private void configureBox(HBox root) {
StackPane container = new StackPane();
//container.setPrefHeight(700);
container.setPrefSize(boxBounds.getWidth(), boxBounds.getHeight());
container.setStyle("-fx-border-width:1px;-fx-border-style:solid;-fx-border-color:#999999;");
table= new TableView<OfficeClass>();
Label lview= new Label();
lview.setText("View Records");
lview.setId("lview");
bottomPane= new VBox();
tclock= new Text();
tclock.setId("lview");
//tclock.setFont(Font.font("Calibri", 20));
final Timeline timeline = new Timeline(new KeyFrame(Duration.seconds(1), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
tclock.setText(DateFormat.getDateTimeInstance().format(new Date()));
}
}));
timeline.setCycleCount(Animation.INDEFINITE);
timeline.play();
bottomPane.getChildren().addAll(tclock, lview);
bottomPane.setAlignment(Pos.CENTER);
nocol= new TableColumn<>("no");
nocol.setMinWidth(130);
nocol.setCellValueFactory(new PropertyValueFactory<>("no"));
namecol= new TableColumn<>("First Name");
namecol.setMinWidth(170);
namecol.setCellValueFactory(new PropertyValueFactory<>("name"));
admcol= new TableColumn<>("Admission Number");
admcol.setMinWidth(180);
admcol.setCellValueFactory(new PropertyValueFactory<>("adm"));
timecol= new TableColumn<>("Signin");
timecol.setMinWidth(140);
timecol.setCellValueFactory(new PropertyValueFactory<>("timein"));
datecol= new TableColumn<>("Date");
datecol.setMinWidth(180);
datecol.setCellValueFactory(new PropertyValueFactory<>("date"));
table.getColumns().addAll(nocol,namecol, admcol, timecol, datecol);
table.setItems(getAtt());
att= getAtt();
table.setItems(FXCollections.observableArrayList(att));
table.setMinHeight(500);
btnrefresh = new Button("Refresh");
btnrefresh.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent t) {
table.setItems(getAtt());
}
});
laytable= new VBox(10);
laytable.getChildren().addAll(table, btnrefresh);
laytable.setAlignment(Pos.TOP_LEFT);
container.getChildren().addAll(bottomPane,laytable);
setAnimation();
sc.setContent(container);
root.setStyle("-fx-background-color: linear-gradient(#E4EAA2, #9CD672)");
root.getChildren().addAll(getActionPane(),sc);
//service.start();
}
GuestRegistryScreenController.java 文件源码
项目:git-rekt
阅读 23
收藏 0
点赞 0
评论 0
/**
* Initializes the FXML controller class.
*
* Called by JavaFX.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// Prepare to display the data
bookings = FXCollections.observableArrayList();
registryTable.setItems(bookings);
guestNameColumn.setCellValueFactory(
(param) -> {
return new SimpleStringProperty(
String.valueOf(param.getValue().getGuest().getLastName() + " , "
+ param.getValue().getGuest().getFirstName())
);
}
);
checkedInColumn.setCellValueFactory((param) -> {
return new SimpleBooleanProperty(param.getValue().isCheckedIn());
});
// Use a check box to display booleans rather than a string
checkedInColumn.setCellFactory(
(param) -> {
return new CheckBoxTableCell<>();
}
);
bookingNumberColumn.setCellValueFactory(
(param) -> {
return new SimpleLongProperty(
param.getValue().getId()
).asObject();
}
);
// Load the registry data from the database
BookingService bookingService = new BookingService();
bookings.addAll(bookingService.getDailyRegistry());
}
ModelWrapper.java 文件源码
项目:easyMvvmFx
阅读 23
收藏 0
点赞 0
评论 0
public FxListPropertyField(ListPropertyAccessor<M, E> accessor, Supplier<ListProperty<E>> propertySupplier, List<E> defaultValue) {
this.accessor = accessor;
this.defaultValue = defaultValue;
this.targetProperty = propertySupplier.get();
this.targetProperty.setValue(FXCollections.observableArrayList());
this.targetProperty.addListener((ListChangeListener<E>) change -> ModelWrapper.this.propertyWasChanged());
}