• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SortType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setSortOrder

import javafx.scene.control.TableColumn.SortType; //导入依赖的package包/类
/**
 * テーブルソート列の設定を行う
 * @param table テーブル
 * @param key テーブルのキー名
 */
public static <S> void setSortOrder(TableView<S> table, String key) {
    Map<String, String> setting = AppConfig.get()
            .getColumnSortOrderMap()
            .get(key);
    ObservableList<TableColumn<S, ?>> sortOrder = table.getSortOrder();
    if (setting != null) {
        // 初期設定
        Map<String, TableColumn<S, ?>> columnsMap = table.getColumns().stream()
                .collect(Collectors.toMap(c -> c.getText(), c -> c, (c1, c2) -> c1));
        setting.forEach((k, v) -> {
            Optional.ofNullable(columnsMap.get(k)).ifPresent(col -> {
                sortOrder.add(col);
                col.setSortType(SortType.valueOf(v));
            });
        });
    }
    // ソート列またはソートタイプが変更された時に設定を保存する
    sortOrder.addListener((ListChangeListener<TableColumn<S, ?>>) e -> storeSortOrder(table, key));
    table.getColumns().forEach(col -> {
        col.sortTypeProperty().addListener((ob, o, n) -> storeSortOrder(table, key));
    });
}
 
开发者ID:sanaehirotaka,项目名称:logbook-kai,代码行数:28,代码来源:Tools.java


示例2: createQueryDetail

import javafx.scene.control.TableColumn.SortType; //导入依赖的package包/类
public QueryDetail createQueryDetail() {
	QueryDetail q = new QueryDetail(0, 100);
	for (TableColumn<?,?> col : getTable().getSortOrder()) {
		SortType type = col.getSortType();
		q.addOrderByToken(col.getId(), type == SortType.ASCENDING);
	}
	if (q.getOrderBy().size() == 0) {
		q.addOrderByToken("id", false);			
	}
	return q;
}
 
开发者ID:salimvanak,项目名称:myWMS,代码行数:12,代码来源:BODTOTable.java


示例3: getReportPreferences

import javafx.scene.control.TableColumn.SortType; //导入依赖的package包/类
private ReportPreferences getReportPreferences()
{
	ColumnOrder columnOrder = new ColumnOrder();
	for(TableColumn<ReportItem, ?> currentColumn : tableView.getColumns())
	{
		ColumnType currentType = (ColumnType)currentColumn.getUserData();			
		if(columnFilter.containsColumn(currentType))
		{
			columnOrder.addColumn(currentType);
		}
	}
	
	ReportSorting reportSorting = new ReportSorting();
	ObservableList<TableColumn<ReportItem, ?>> sortOrder = tableView.getSortOrder();
	if(sortOrder.size() >  0)
	{
		reportSorting.setColumnType((ColumnType)sortOrder.get(0).getUserData());
		reportSorting.setSortType(sortOrder.get(0).getSortType());
	}
	else
	{
		reportSorting.setColumnType(ColumnType.DATE);
		reportSorting.setSortType(SortType.DESCENDING);
	}
	
	String reportFolderPath = null;
	if(reportPreferences != null)
	{
		reportFolderPath = reportPreferences.getReportFolderPath();
	}
	
	return new ReportPreferences(columnOrder, 
								checkBoxIncludeBudget.isSelected(),
								checkBoxSplitTable.isSelected(),
								checkBoxIncludeCategoryBudgets.isSelected(),
								reportSorting, 
								reportFolderPath);
}
 
开发者ID:deadlocker8,项目名称:BudgetMaster,代码行数:39,代码来源:ReportController.java


示例4: sort

import javafx.scene.control.TableColumn.SortType; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void sort(Comparator<? super IDataRow> pComparator)
{
	ObservableList<TableColumn<IDataRow, ?>> sortOrder = dataBookView.getSortOrder();
	
	try
	{
		if (sortOrder == null || sortOrder.isEmpty())
		{
			dataBook.setSort(null);
		}
		else
		{
			String[] sortColumns = new String[sortOrder.size()];
			boolean[] sortColumnsAscending = new boolean[sortColumns.length];
			
			for (int index = 0; index < sortOrder.size(); index++)
			{
				TableColumn<IDataRow, ?> column = sortOrder.get(index);
				String columnName = (String) column.getUserData();
				
				sortColumns[index] = columnName;
				sortColumnsAscending[index] = column.getSortType() == SortType.ASCENDING;
			}
			
			dataBook.setSort(new SortDefinition(sortColumns, sortColumnsAscending));
		}
		
		String currentColumn = dataBook.getSelectedColumn();
		
		fireChangedEvent(0, dataBook.getRowCount());
		
		dataBook.setSelectedColumn(currentColumn);
	}
	catch (ModelException e)
	{
		throw new RuntimeException(e);
	}
}
 
开发者ID:ivartanian,项目名称:JVx.javafx,代码行数:43,代码来源:DataBookViewList.java


示例5: updateProcessList

import javafx.scene.control.TableColumn.SortType; //导入依赖的package包/类
private void updateProcessList(final ArrayList<ProcInfo> processList) {
    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            ProcSort procSort = procSortProperty.get();
            if(procSort != null) {
                Comparator<ProcInfo> comparator = null;

                if("proc".equals(procSort.getSortField())) {
                    comparator = new Comparator<ProcInfo>() {
                        @Override
                        public int compare(ProcInfo o1, ProcInfo o2) {
                            return o1.getProcessName().compareTo(o2.getProcessName());
                        }};
                }
                else if("reduc".equals(procSort.getSortField())) {
                    comparator = new Comparator<ProcInfo>() {
                        @Override
                        public int compare(ProcInfo o1, ProcInfo o2) {
                            return Long.compare(o1.getReductions(), o2.getReductions());
                        }};
                }

                if(comparator != null) {
                    if(procSort.getSortType() == SortType.DESCENDING) {
                        comparator = Collections.reverseOrder(comparator);
                    }
                    Collections.sort(processList, comparator);
                }
            }
            processes.clear();
            processes.addAll(processList);
        }});
}
 
开发者ID:andytill,项目名称:erlyberly,代码行数:35,代码来源:ProcController.java


示例6: configureTable

import javafx.scene.control.TableColumn.SortType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void configureTable(StackPane root) {

	final ObservableList<MyDomain> data = FXCollections.observableArrayList(new MyDomain("Apple", "This is a fruit.", "Red"),
			new MyDomain("Orange", "This is also a fruit.", "Orange"), new MyDomain("Potato", "This is a vegetable.", "Brown"));

	final TableView<MyDomain> table = new TableView<MyDomain>();
	table.setManaged(true);
	TableColumn<MyDomain, String> titleColumn = new TableColumn<MyDomain, String>("Title");
	titleColumn.setPrefWidth(125);
	titleColumn.setCellValueFactory(new PropertyValueFactory<MyDomain, String>("name"));
	titleColumn.sortTypeProperty().addListener(new ChangeListener<SortType>() {
		@Override
		public void changed(ObservableValue<? extends SortType> arg0, SortType arg1, SortType arg2) {
			System.out.println(arg2);
		}
	});
	TableColumn<MyDomain, String> descCol = new TableColumn<MyDomain, String>("Description");
	descCol.setPrefWidth(200);
	descCol.setCellValueFactory(new PropertyValueFactory<MyDomain, String>("description"));

	TableColumn<MyDomain, String> colorCol = new TableColumn<MyDomain, String>("Color");
	colorCol.setPrefWidth(200);
	colorCol.setCellValueFactory(new PropertyValueFactory<MyDomain, String>("color"));

	table.getColumns().addAll(titleColumn, descCol, colorCol);
	table.itemsProperty().addListener(new ChangeListener<ObservableList<MyDomain>>() {
		@Override
		public void changed(ObservableValue<? extends ObservableList<MyDomain>> paramObservableValue, ObservableList<MyDomain> paramT1,
				ObservableList<MyDomain> paramT2) {
			table.setPrefHeight((table.getItems().size()*25) + 25);
		}});
	table.setItems(data);
	VBox vb = new VBox();
	vb.getChildren().addAll(StackPaneBuilder.create().prefHeight(100).style("-fx-background-color:red;").build(), table,
			StackPaneBuilder.create().prefHeight(100).style("-fx-background-color:blue;").build());
	root.getChildren().add(vb);

}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:40,代码来源:SimpleTableViewDemo.java


示例7: ReportSorting

import javafx.scene.control.TableColumn.SortType; //导入依赖的package包/类
public ReportSorting(ColumnType columnType, SortType sortType)
{
	this.columnType = columnType;
	this.sortType = sortType;
}
 
开发者ID:deadlocker8,项目名称:BudgetMaster,代码行数:6,代码来源:ReportSorting.java


示例8: getSortType

import javafx.scene.control.TableColumn.SortType; //导入依赖的package包/类
public SortType getSortType()
{
	return sortType;
}
 
开发者ID:deadlocker8,项目名称:BudgetMaster,代码行数:5,代码来源:ReportSorting.java


示例9: setSortType

import javafx.scene.control.TableColumn.SortType; //导入依赖的package包/类
public void setSortType(SortType sortType)
{
	this.sortType = sortType;
}
 
开发者ID:deadlocker8,项目名称:BudgetMaster,代码行数:5,代码来源:ReportSorting.java


示例10: BattleOfDecksResultView

import javafx.scene.control.TableColumn.SortType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public BattleOfDecksResultView() {
	FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/BattleOfDecksResultView.fxml"));
	fxmlLoader.setRoot(this);
	fxmlLoader.setController(this);

	try {
		fxmlLoader.load();
	} catch (IOException exception) {
		throw new RuntimeException(exception);
	}

	TableColumn<BattleDeckResult, String> nameColumn = new TableColumn<>("Deck name");
	nameColumn.setPrefWidth(200);
	TableColumn<BattleDeckResult, Double> winRateColumn = new TableColumn<>("Win rate");
	winRateColumn.setPrefWidth(150);

	nameColumn.setCellValueFactory(new PropertyValueFactory<BattleDeckResult, String>("deckName"));
	winRateColumn.setCellValueFactory(new PropertyValueFactory<BattleDeckResult, Double>("winRate"));

	winRateColumn.setCellFactory(new Callback<TableColumn<BattleDeckResult, Double>, TableCell<BattleDeckResult, Double>>() {
		public TableCell<BattleDeckResult, Double> call(TableColumn<BattleDeckResult, Double> p) {
			TableCell<BattleDeckResult, Double> cell = new TableCell<BattleDeckResult, Double>() {
				private final Label label = new Label();
				private final ProgressBar progressBar = new ProgressBar();
				private final StackPane stackPane = new StackPane();

				{
					label.getStyleClass().setAll("progress-text");
					stackPane.setAlignment(Pos.CENTER);
					stackPane.getChildren().setAll(progressBar, label);
					setGraphic(stackPane);
				}

				@Override
				protected void updateItem(Double winrate, boolean empty) {
					super.updateItem(winrate, empty);
					if (winrate == null || empty) {
						setGraphic(null);
						return;
					}
					progressBar.setProgress(winrate);
					label.setText(String.format("%.2f", winrate * 100) + "%");
					setGraphic(stackPane);
				}

			};
			return cell;
		}
	});

	rankingTable.getColumns().setAll(nameColumn, winRateColumn);
	rankingTable.getColumns().get(1).setSortType(SortType.DESCENDING);

	backButton.setOnAction(event -> NotificationProxy.sendNotification(GameNotification.MAIN_MENU));
}
 
开发者ID:demilich1,项目名称:metastone,代码行数:57,代码来源:BattleOfDecksResultView.java


示例11: ProcSort

import javafx.scene.control.TableColumn.SortType; //导入依赖的package包/类
public ProcSort(String sortField, SortType sortType) {
    this.sortField = sortField;
    this.sortType = sortType;
}
 
开发者ID:andytill,项目名称:erlyberly,代码行数:5,代码来源:ProcSort.java


示例12: getSortType

import javafx.scene.control.TableColumn.SortType; //导入依赖的package包/类
public SortType getSortType() {
    return sortType;
}
 
开发者ID:andytill,项目名称:erlyberly,代码行数:4,代码来源:ProcSort.java


示例13: configureTable

import javafx.scene.control.TableColumn.SortType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void configureTable(StackPane root) {

	final ObservableList<MyDomain> data = FXCollections.observableArrayList(
			new MyDomain("Apple","This is a fruit.","Red"),
			new MyDomain("Orange","This is also a fruit.","Orange"),
			new MyDomain("Potato","This is a vegetable.","Brown")
			);

	CustomTableView<MyDomain> table = new CustomTableView<MyDomain>();

	CustomTableColumn<MyDomain,String> titleColumn = new CustomTableColumn<MyDomain,String>("Title");
	titleColumn.setPercentWidth(25);
	titleColumn.setCellValueFactory(new PropertyValueFactory<MyDomain,String>("name"));
	titleColumn.sortTypeProperty().addListener(new ChangeListener<SortType>() {
		@Override
		public void changed(ObservableValue<? extends SortType> arg0,
				SortType arg1, SortType arg2) {
			System.out.println(arg2);
		}
	});
	CustomTableColumn<MyDomain,String> descCol = new CustomTableColumn<MyDomain,String>("Description");
	descCol.setPercentWidth(55);
	descCol.setCellValueFactory(new PropertyValueFactory<MyDomain,String>("description"));

	CustomTableColumn<MyDomain,String> colorCol = new CustomTableColumn<MyDomain,String>("Color");
	colorCol.setPercentWidth(20);
	colorCol.setCellValueFactory(new PropertyValueFactory<MyDomain,String>("color"));

	table.getTableView().getColumns().addAll(titleColumn,descCol,colorCol);
	table.getTableView().setItems(data);
	root.getChildren().add(table);
	
	table.getTableView().setOnMouseClicked(new EventHandler<MouseEvent>() {

		@Override
		public void handle(MouseEvent event) {
			System.out.println(event.getTarget());
		}
	});
	
	
	TableView<MyDomain> table2 = new TableView<MyDomain>();
	TableColumn<MyDomain,String> col1 = new TableColumn<MyDomain,String>();
	col1.setCellValueFactory(new PropertyValueFactory<MyDomain,String>("name"));
}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:47,代码来源:TableViewAutoSizeDemo.java


示例14: setupTable

import javafx.scene.control.TableColumn.SortType; //导入依赖的package包/类
private void setupTable() {
	table = new TableView<>();
	table.setBorder(Border.EMPTY);
	table.setPadding(Insets.EMPTY);

	liveCol = new TableColumn<>("Live");
	liveCol.setCellValueFactory(p -> p.getValue().onlineProperty());
	liveCol.setSortType(SortType.DESCENDING);
	liveCol.setCellFactory(p -> new LiveCell());

	nameCol = new TableColumn<>("Channel");
	nameCol.setCellValueFactory(p -> p.getValue().nameProperty());


	titleCol = new TableColumn<>("Status");
	titleCol.setCellValueFactory(p -> p.getValue().titleProperty());

	gameCol = new TableColumn<>("Game");
	gameCol.setCellValueFactory(p -> p.getValue().gameProperty());

	viewerCol = new TableColumn<>("Viewer");
	viewerCol.setCellValueFactory(p -> p.getValue().viewerProperty().asObject());
	viewerCol.setSortType(SortType.DESCENDING);
	viewerCol.setCellFactory(p -> new RightAlignedCell<>());

	uptimeCol = new TableColumn<>("Uptime");
	uptimeCol.setCellValueFactory(p -> p.getValue().uptimeProperty().asObject());
	uptimeCol.setCellFactory(p -> new UptimeCell());

	table.setPlaceholder(new Label("no channels added/matching the filters"));

	//table.getColumns().add(liveCol);
	table.getColumns().add(nameCol);
	table.getColumns().add(titleCol);
	table.getColumns().add(gameCol);
	table.getColumns().add(viewerCol);
	table.getColumns().add(uptimeCol);

	//table.getSortOrder().add(liveCol);
	table.getSortOrder().add(viewerCol);
	table.getSortOrder().add(nameCol);


	filteredChannelListTable = new FilteredList<>(channelStore.getChannels());
	final SortedList<Channel> sortedChannelListTable = new SortedList<>(filteredChannelListTable);
	sortedChannelListTable.comparatorProperty().bind(table.comparatorProperty());

	table.setItems(sortedChannelListTable);

	table.getSelectionModel().selectedItemProperty().addListener((obs, oldV, newV) -> {
		onSelection(newV);
		if ((newV == null) && splitPane.getItems().contains(detailPane)) {
			doDetailSlide(false);
		}
	});

	table.setOnMousePressed(event -> {
		if (table.getSelectionModel().getSelectedItem() == null) {
			return;
		}

		if (event.getButton() == MouseButton.MIDDLE) {
			openStream(table.getSelectionModel().getSelectedItem());

		} else if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() == 2) {
			openDetailPage(table.getSelectionModel().getSelectedItem());
		}
	});
}
 
开发者ID:JanStrauss,项目名称:skadi,代码行数:70,代码来源:MainWindow.java


示例15: ProcController

import javafx.scene.control.TableColumn.SortType; //导入依赖的package包/类
public ProcController() {
    polling = new SimpleBooleanProperty();

    procSortProperty = new SimpleObjectProperty<>(new ProcSort("reduc", SortType.DESCENDING));

    procPollerThread = new ProcPollerThread();

    waiter = new Object();

    Platform.runLater(() -> {
        ErlyBerly.nodeAPI().connectedProperty().addListener((o) -> { startPollingThread(); } );
    });

    filter.addListener((o, ov, nv) -> { updateProcFilter(nv); });
}
 
开发者ID:andytill,项目名称:erlyberly,代码行数:16,代码来源:ProcController.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FixedLocaleResolver类代码示例发布时间:2022-05-22
下一篇:
Java ThresholdFilter类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap