当前位置: 首页>>代码示例>>Java>>正文


Java SortedList类代码示例

本文整理汇总了Java中javafx.collections.transformation.SortedList的典型用法代码示例。如果您正苦于以下问题:Java SortedList类的具体用法?Java SortedList怎么用?Java SortedList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SortedList类属于javafx.collections.transformation包,在下文中一共展示了SortedList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: FxMediaTags

import javafx.collections.transformation.SortedList; //导入依赖的package包/类
public FxMediaTags() {
	getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);
	getDialogPane().setContent(createForm());
	getDialogPane().setPrefWidth(RESOLUTION.getWidth() / 4);
	getDialogPane().setPrefHeight(RESOLUTION.getHeight());
	setResultConverter(createResultConverter());
	//
	titleProperty().bind(MODEL.dialogTitleProperty());
	//
	TAGS_TABLE.setItems(new SortedList<>(MODEL.tagsProperty(), (a,b) -> a.compareTo(b)));
	TAGS_TABLE.setContextMenu(createContextMenu());
	TAGS_TABLE.setOnMousePressed(event -> {
		if (event.isPrimaryButtonDown() && event.getClickCount() == 2) {
			final Button okButton = ((Button)getDialogPane().lookupButton(ButtonType.OK));
			if (null != okButton) {
				okButton.fire();
			}
		}
	});
}
 
开发者ID:mikelaud,项目名称:fx-media-tags,代码行数:21,代码来源:FxMediaTags.java

示例2: CollatedTreeItem

import javafx.collections.transformation.SortedList; //导入依赖的package包/类
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());
            }
        }
    });
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:CollatedTreeItem.java

示例3: createTableFilter

import javafx.collections.transformation.SortedList; //导入依赖的package包/类
public static SortedList<Ticket> createTableFilter(TextField textSearch, ListView listView){

        if(isPrepared)
            return new SortedList<>(filteredTickets);

        textSearch.setOnKeyPressed((KeyEvent ke) ->{
            if(ke.getCode().equals(KeyCode.ENTER)){
                text = textSearch.getText().toLowerCase();
                filterTickets();
            }
        });

        //Listview
        listView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
            @Override
            public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
                categoryText = newValue.split(" ")[0];
                if(categoryText.equals("DownloadPlayChild"))
                    categoryText = "DLP";
                filterTickets();
            }
        });

        isPrepared = true;
        return new SortedList<>(filteredTickets);
    }
 
开发者ID:Ptrk25,项目名称:CDN-FX-2.2,代码行数:27,代码来源:TDATableFilter.java

示例4: createTableFilter

import javafx.collections.transformation.SortedList; //导入依赖的package包/类
public static SortedList<Ticket> createTableFilter(TextField textSearch, ListView listView){

        if(isPrepared)
            return new SortedList<>(filteredTickets);

        textSearch.setOnKeyPressed((KeyEvent ke) ->{
            if(ke.getCode().equals(KeyCode.ENTER)){
                text = textSearch.getText();
                filterTickets();
            }
        });

        //Listview
        listView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
            @Override
            public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
                categoryText = newValue.split(" ")[0];
                if(categoryText.equals("DownloadPlayChild"))
                    categoryText = "DLP";
                filterTickets();
            }
        });

        isPrepared = true;
        return new SortedList<>(filteredTickets);
    }
 
开发者ID:Ptrk25,项目名称:CDN-FX-2.2,代码行数:27,代码来源:TMTableFilter.java

示例5: setupSorting

import javafx.collections.transformation.SortedList; //导入依赖的package包/类
private void setupSorting() {
	FilteredList<Item> filteredData = new FilteredList<>(itemList, p -> true);

	filterField.textProperty().addListener((observable, oldValue, newValue) -> {
		filteredData.setPredicate(item -> {
			if(newValue == null || newValue.isEmpty() )
				return true;

			if(item.getName().toLowerCase().contains(newValue.toLowerCase())){
				return true;
			} else {
				return false;
			}

		});
	});

	SortedList<Item> sortedData = new SortedList<>(filteredData);

	sortedData.comparatorProperty().bind(itemTable.comparatorProperty());

	itemTable.setItems(sortedData);

}
 
开发者ID:landonreams,项目名称:osrs-equipment-builder,代码行数:25,代码来源:ItemSelectorController.java

示例6: buildUI

import javafx.collections.transformation.SortedList; //导入依赖的package包/类
@Override
public void buildUI() {
    albumSongsList = FXCollections.observableArrayList();
    songDataSortedList = new SortedList<>(albumSongsList, new SongDataComparator());
    songListTable.getStylesheets().clear();
    songListTable.getStylesheets().add(Constants.getCssMainFilePath());

    songListTableTitle.setCellValueFactory(cellData -> cellData.getValue().titleProperty());
    songListTableArtist.setCellValueFactory(cellData -> cellData.getValue().artistProperty());
    songListTableAlbum.setCellValueFactory(cellData -> cellData.getValue().albumTitleProperty());
    songListTableYear.setCellValueFactory(cellData -> cellData.getValue().yearProperty());
    songListTableGenre.setCellValueFactory(cellData -> cellData.getValue().gerneProperty());
    songListTableLength.setCellValueFactory(cellData -> cellData.getValue().lengthStrProperty());
    songListTableLength.setStyle("-fx-alignment: CENTER-RIGHT;");
    songListTable.setItems(songDataSortedList);
    songListTable.setOnMouseClicked(event -> {
        if (event.getClickCount() == 2) {
            mainPlayerController.playSong(songListTable.getSelectionModel().getSelectedItem());
            mainPlayerController.setViewId(Constants.VIEWS_ID.ALBUMS);
            buildPlaylist();
        }
    });

    songListTable.setFixedCellSize(48.0);
}
 
开发者ID:daothanhduy305,项目名称:MusicHub,代码行数:26,代码来源:AlbumsViewSpecificController.java

示例7: createCommandTable

import javafx.collections.transformation.SortedList; //导入依赖的package包/类
static TableView<CommandEntry> createCommandTable(final ObservableList<CommandEntry> commands) {
	TableView<CommandEntry> table = new TableView<>();
	SortedList<CommandEntry> items = new SortedList<>(commands);
	items.comparatorProperty().bind(table.comparatorProperty());
	table.setItems(items);
	
	TableColumn<CommandEntry, String> col1 = new TableColumn<>("Command");
	col1.setCellValueFactory(new PropertyValueFactory<>("text"));
	TableColumn<CommandEntry, String> col2 = new TableColumn<>("Menu Path");
	col2.setCellValueFactory(new PropertyValueFactory<>("menuPath"));
	table.getColumns().add(col1);
	table.getColumns().add(col2);
	table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
	table.setFocusTraversable(false);
	return table;
}
 
开发者ID:qupath,项目名称:qupath,代码行数:17,代码来源:CommandFinderTools.java

示例8: testListPermutation

import javafx.collections.transformation.SortedList; //导入依赖的package包/类
@Test
public void testListPermutation() {
    SortedList<String> sortedList = FXCollections.observableArrayList(Arrays.asList("3", "7", "1", "5"))
            .sorted(Comparator.naturalOrder());
    AdhocList<String> mappedList = new AdhocList<>(sortedList, "0");

    assertEquals(5, mappedList.size());
    assertEquals("0", mappedList.get(0));
    assertEquals("1", mappedList.get(1));
    assertEquals("3", mappedList.get(2));
    assertEquals("5", mappedList.get(3));
    assertEquals("7", mappedList.get(4));

    sortedList.comparatorProperty().set(Comparator.comparing(String::valueOf).reversed());

    assertEquals(5, mappedList.size());
    assertEquals("0", mappedList.get(0));
    assertEquals("7", mappedList.get(1));
    assertEquals("5", mappedList.get(2));
    assertEquals("3", mappedList.get(3));
    assertEquals("1", mappedList.get(4));
}
 
开发者ID:PhoenicisOrg,项目名称:POL-POM-5,代码行数:23,代码来源:AdhocListTest.java

示例9: testListPermutation

import javafx.collections.transformation.SortedList; //导入依赖的package包/类
@Test
public void testListPermutation() {
    SortedList<Integer> sortedList = FXCollections.observableList(Arrays.asList(1, 2, 4, 3))
            .sorted(Comparator.naturalOrder());
    PhoenicisFilteredList<Integer> filteredList = new PhoenicisFilteredList<>(sortedList, i -> i % 2 == 0);

    assertEquals(2, filteredList.size());
    assertEquals(2, (int) filteredList.get(0));
    assertEquals(4, (int) filteredList.get(1));

    sortedList.comparatorProperty().set(Comparator.comparing(String::valueOf).reversed());

    assertEquals(2, filteredList.size());
    assertEquals(4, (int) filteredList.get(0));
    assertEquals(2, (int) filteredList.get(1));
}
 
开发者ID:PhoenicisOrg,项目名称:POL-POM-5,代码行数:17,代码来源:PhoenicisFilteredListTest.java

示例10: testListPermutation

import javafx.collections.transformation.SortedList; //导入依赖的package包/类
@Test
public void testListPermutation() {
    SortedList<Integer> sortedList = FXCollections.observableList(Arrays.asList(3, 7, 1, 5))
            .sorted(Comparator.naturalOrder());
    MappedList<String, Integer> mappedList = new MappedList<>(sortedList, i -> String.valueOf(i));

    assertEquals(4, mappedList.size());
    assertEquals("1", mappedList.get(0));
    assertEquals("3", mappedList.get(1));
    assertEquals("5", mappedList.get(2));
    assertEquals("7", mappedList.get(3));

    sortedList.comparatorProperty().set(Comparator.comparing(String::valueOf).reversed());

    assertEquals(4, mappedList.size());
    assertEquals("7", mappedList.get(0));
    assertEquals("5", mappedList.get(1));
    assertEquals("3", mappedList.get(2));
    assertEquals("1", mappedList.get(3));
}
 
开发者ID:PhoenicisOrg,项目名称:POL-POM-5,代码行数:21,代码来源:MappedListTest.java

示例11: loadItems

import javafx.collections.transformation.SortedList; //导入依赖的package包/类
/**
 * Wires the list view with the items source and configures filtering and sorting of the items.
 */
private void loadItems() {
	// filtering -- default show all
	FilteredList<ActivityItem> filteredItems = new FilteredList<>(activityLogger.getActivityItems(), p -> true);
	txtFilter.textProperty().addListener(new ChangeListener<String>() {
		@Override
		public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
			// filter on predicate
			filteredItems.setPredicate(new ActivityItemFilterPredicate(newValue));
		}
	});

	// sorting
	SortedList<ActivityItem> sortedItems = new SortedList<>(filteredItems, new ActivityItemTimeComparator());

	// set item source
	lstActivityLog.setItems(sortedItems);
	lstActivityLog
			.setCellFactory(new Callback<ListView<ActivityItem>, ListCell<ActivityItem>>() {
				@Override
				public ListCell<ActivityItem> call(ListView<ActivityItem> param) {
					return new ActivityItemCell();
				}
			});
}
 
开发者ID:PeerWasp,项目名称:PeerWasp,代码行数:28,代码来源:ActivityController.java

示例12: updateFilters

import javafx.collections.transformation.SortedList; //导入依赖的package包/类
private void updateFilters() {
	LOG.trace("updateFilters()");
	if (tableViewData == null) return;
	SortedList<DesignVariable> sortedList = getSortedFilteredDesignVariables(tableViewData);
	tableView.setItems(sortedList);
	sortedList.comparatorProperty().bind(tableView.comparatorProperty());
	updateLabel();
}
 
开发者ID:nasa,项目名称:OpenVSP3Plugin,代码行数:9,代码来源:JavaFXUI.java

示例13: getSortedFilteredDesignVariables

import javafx.collections.transformation.SortedList; //导入依赖的package包/类
private SortedList<DesignVariable> getSortedFilteredDesignVariables(ObservableList<DesignVariable> designVariables) {
	LOG.trace("getSortedFilteredDesignVariables(designVariables)");
	Pattern pattern;
	try {
		pattern = Pattern.compile(filterTextField.getText());
	} catch(Exception ex) {
		pattern = emptyPattern;
	}
	Pattern finalPattern = pattern; // make lambda happy
	return new SortedList<>(designVariables.filtered((DesignVariable dv) -> {
		boolean filter = ((selectedOnlyButton.isSelected() && !dv.isChecked()) ||
				(!filterTextField.getText().isEmpty() && !finalPattern.matcher(dv.getFullName()).find()));
		return !filter;
	}));
}
 
开发者ID:nasa,项目名称:OpenVSP3Plugin,代码行数:16,代码来源:JavaFXUI.java

示例14: desFileSort

import javafx.collections.transformation.SortedList; //导入依赖的package包/类
private SortedList<DesignVariable> desFileSort(ObservableList<DesignVariable> list) {
	return list.sorted((DesignVariable dv1, DesignVariable dv2) -> {
		int value;
		if (dv1.getContainer().equals(dv2.getContainer())) {
			if (dv1.getGroup().equals(dv2.getGroup())) {
				value = dv1.getName().compareTo(dv2.getName());
			} else {
				value = dv2.getGroup().replace("_", " ").compareTo(dv1.getGroup().replace("_", " "));
			}
		} else {
			value = dv1.getContainer().compareTo(dv2.getContainer());
		}
		return value;
	});
}
 
开发者ID:nasa,项目名称:OpenVSP3Plugin,代码行数:16,代码来源:PluginState.java

示例15: LogPane

import javafx.collections.transformation.SortedList; //导入依赖的package包/类
public LogPane() {
    super();
    table = new TableView<>();

    TableColumn<LogItem, StatusType> statusColumn = new TableColumn<>("Status");
    statusColumn.setCellValueFactory(new PropertyValueFactory<>("status"));
    statusColumn.prefWidthProperty().bind(Bindings.multiply(0.1, table.widthProperty()));
    statusColumn.setCellFactory(col -> new StatusTypeCell());

    TableColumn<LogItem, ActionType> actionColumn = new TableColumn<>("Action");
    actionColumn.setCellValueFactory(new PropertyValueFactory<>("action"));
    actionColumn.prefWidthProperty().bind(Bindings.multiply(0.1, table.widthProperty()));
    actionColumn.setCellFactory(col -> new ActionTypeCell());

    TableColumn<LogItem, LocalDateTime> timeColumn = new TableColumn<>("Time");
    timeColumn.setCellValueFactory(new PropertyValueFactory<>("time"));
    timeColumn.prefWidthProperty().bind(Bindings.multiply(0.2, table.widthProperty()));
    timeColumn.setCellFactory(col -> new TimeCell());

    TableColumn<LogItem, String> calendarColumn = new TableColumn<>("Calendar");
    calendarColumn.setCellValueFactory(new PropertyValueFactory<>("calendar"));
    calendarColumn.prefWidthProperty().bind(Bindings.multiply(0.2, table.widthProperty()));

    TableColumn<LogItem, String> descriptionColumn = new TableColumn<>("Description");
    descriptionColumn.setCellValueFactory(new PropertyValueFactory<>("description"));
    descriptionColumn.prefWidthProperty().bind(Bindings.multiply(0.4, table.widthProperty()));

    filteredData = new FilteredList<>(items);
    SortedList<LogItem> sortedData = new SortedList<>(filteredData);
    sortedData.comparatorProperty().bind(table.comparatorProperty());

    table.getColumns().add(statusColumn);
    table.getColumns().add(actionColumn);
    table.getColumns().add(timeColumn);
    table.getColumns().add(calendarColumn);
    table.getColumns().add(descriptionColumn);
    table.setTableMenuButtonVisible(true);
    table.setItems(sortedData);
    table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:41,代码来源:LogPane.java


注:本文中的javafx.collections.transformation.SortedList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。