當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。