當前位置: 首頁>>代碼示例>>Java>>正文


Java SortOrder.UNSORTED屬性代碼示例

本文整理匯總了Java中javax.swing.SortOrder.UNSORTED屬性的典型用法代碼示例。如果您正苦於以下問題:Java SortOrder.UNSORTED屬性的具體用法?Java SortOrder.UNSORTED怎麽用?Java SortOrder.UNSORTED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javax.swing.SortOrder的用法示例。


在下文中一共展示了SortOrder.UNSORTED屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: assertControlsSorterPropertiesFalse

/**
 * RowSorter properties not touched if getControlsSorterProperties false.
 */
private void assertControlsSorterPropertiesFalse(boolean setSorter) {
    table.setAutoCreateRowSorter(false);
    SortOrder[] cycle = new SortOrder[] {SortOrder.DESCENDING, SortOrder.UNSORTED};
    table.setSortOrderCycle(cycle);
    table.setSortsOnUpdates(!table.getSortsOnUpdates());
    table.setSortable(!table.isSortable());
    if (setSorter) {
        table.setRowSorter(new TableSortController<TableModel>(table.getModel()));
        assertFalse("StringValueProvider propagated to controller", 
                table.getStringValueRegistry().equals(getSortController(table).getStringValueProvider()));
    }
    assertEquals("sortsOnUpdates propagated to controller", 
            !table.getSortsOnUpdates(), getSortController(table).getSortsOnUpdates());
    assertEquals("sortable propagated to controller",
            !table.isSortable(), getSortController(table).isSortable());
    assertFalse("sortOrderCycle propagated to controller",
            Arrays.equals(table.getSortOrderCycle(), 
                    getSortController(table).getSortOrderCycle()));
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:22,代碼來源:JXTableUnitTest.java

示例2: assertControlsSorterPropertiesTrue

/**
 * RowSorter properties updated on getControlsSorterProperties true.
 */
private void assertControlsSorterPropertiesTrue(boolean setSorter) {
    SortOrder[] cycle = new SortOrder[] {SortOrder.DESCENDING, SortOrder.UNSORTED};
    table.setSortOrderCycle(cycle);
    table.setSortsOnUpdates(!table.getSortsOnUpdates());
    table.setSortable(!table.isSortable());
    if (setSorter) {
        table.setRowSorter(new TableSortController<TableModel>(table.getModel()));
    }
    assertEquals("sortsOnUpdates propagated to controller", 
            table.getSortsOnUpdates(), getSortController(table).getSortsOnUpdates());
    assertEquals("sortable propagated to controller",
            table.isSortable(), getSortController(table).isSortable());
    assertTrue("sortOrderCycle propagated to controller",
            Arrays.equals(table.getSortOrderCycle(), 
                    getSortController(table).getSortOrderCycle()));
    assertEquals("StringValueProvider propagated to controller", 
            table.getStringValueRegistry(), getSortController(table).getStringValueProvider());
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:21,代碼來源:JXTableUnitTest.java

示例3: setColumnSortOrder

protected final void setColumnSortOrder(final int modelColumnIndex, final SortOrder sortOrder)
{
	sortIndexes2Direction.remove(modelColumnIndex);
	if (sortOrder == SortOrder.ASCENDING)
	{
		sortIndexes2Direction.put(modelColumnIndex, true);
	}
	else if (sortOrder == SortOrder.DESCENDING)
	{
		sortIndexes2Direction.put(modelColumnIndex, false);
	}
	else if (sortOrder == SortOrder.UNSORTED)
	{
		// just removed it's fine
	}
	else
	{
		// shall not happen
	}
}
 
開發者ID:metasfresh,項目名稱:metasfresh,代碼行數:20,代碼來源:CTableModelRowSorter.java

示例4: getSortAscendingFlagOfSortOrder

private static final Boolean getSortAscendingFlagOfSortOrder(final SortOrder sortOrder)
{
	if (sortOrder == null)
	{
		return null;
	}
	else if (sortOrder == SortOrder.ASCENDING)
	{
		return true;
	}
	else if (sortOrder == SortOrder.DESCENDING)
	{
		return false;
	}
	else if (sortOrder == SortOrder.UNSORTED)
	{
		return null;
	}
	else
	{
		throw new IllegalArgumentException("Unknown sortOrder: " + sortOrder);
	}
}
 
開發者ID:metasfresh,項目名稱:metasfresh,代碼行數:23,代碼來源:CTableModelRowSorter.java

示例5: getIcon

@Override
public Icon getIcon() {
	int modelCol = header.getTable().convertColumnIndexToModel(curCol);
	TableModel model = header.getTable().getModel();
	if (model instanceof ExtendedJTableSorterModel) {
		ExtendedJTableSorterModel sortModel = (ExtendedJTableSorterModel) model;
		switch (sortModel.getSortingStatus(modelCol)) {
			case ExtendedJTableSorterModel.ASCENDING:
				return UIManager.getIcon("Table.ascendingSortIcon");
			case ExtendedJTableSorterModel.DESCENDING:
				return UIManager.getIcon("Table.descendingSortIcon");
			case ExtendedJTableSorterModel.NOT_SORTED:
			default:
				return null;
		}
	} else {
		SortKey sortKey = getSortKey(header.getTable().getRowSorter(), modelCol);
		SortOrder sortOrder = sortKey != null ? sortKey.getSortOrder() : SortOrder.UNSORTED;
		switch (sortOrder) {
			case ASCENDING:
				return UIManager.getIcon("Table.ascendingSortIcon");
			case DESCENDING:
				return UIManager.getIcon("Table.descendingSortIcon");
			case UNSORTED:
			default:
				return null;
		}
	}
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:29,代碼來源:TableHeaderUI.java

示例6: toggle

private SortKey toggle(final SortKey key) {
  switch (key.getSortOrder()) {
    case ASCENDING: {
      return new SortKey(key.getColumn(), SortOrder.DESCENDING);
    }
    case DESCENDING: {
      return new SortKey(key.getColumn(), SortOrder.UNSORTED);
    }
    case UNSORTED: {
      return new SortKey(key.getColumn(), SortOrder.ASCENDING);
    }
  }
  throw new UnreachableCodeReachedException();
}
 
開發者ID:AndreasWBartels,項目名稱:libraries,代碼行數:14,代碼來源:ObjectTableRowSorter.java

示例7: rowSorterChanged

private void
rowSorterChanged() {
	List<? extends SortKey> list = getRowSorter().getSortKeys();
	if(list.isEmpty()) return;
	SortKey k = list.get(0);
	int i = k.getColumn() + 1;
	if(k.getSortOrder() == SortOrder.UNSORTED) return;
	if(k.getSortOrder() == SortOrder.DESCENDING) i *= -1;
	preferences().setIntProperty(tablePrefix + "sortOrder", i);
}
 
開發者ID:lxlxlo,項目名稱:LS-jsampler,代碼行數:10,代碼來源:AbstractInstrumentsDbTable.java

示例8: testSortOrderCycle

/**
 * Setting table's sortable property updates controller.
 */
@Test
public void testSortOrderCycle() {
    JXList list = new JXList(true);
    SortOrder[] cycle = new SortOrder[] {SortOrder.DESCENDING, SortOrder.UNSORTED};
    PropertyChangeReport report = new PropertyChangeReport(list);
    list.setSortOrderCycle(cycle);
    TestUtils.assertPropertyChangeEvent(report, "sortOrderCycle", 
                DefaultSortController.getDefaultSortOrderCycle(), list.getSortOrderCycle());
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:12,代碼來源:JXListTest.java

示例9: testSortOrderCycleNotification

/**
 * Setting table's sortable property updates controller.
 */
@Test
public void testSortOrderCycleNotification() {
    SortOrder[] cycle = new SortOrder[] {SortOrder.DESCENDING, SortOrder.UNSORTED};
    PropertyChangeReport report = new PropertyChangeReport(table);
    table.setSortOrderCycle(cycle);
    TestUtils.assertPropertyChangeEvent(report, "sortOrderCycle", 
                DefaultSortController.getDefaultSortOrderCycle(), table.getSortOrderCycle());
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:11,代碼來源:JXTableUnitTest.java

示例10: setComparator

public void setComparator(Comparator<?> comparator) {
    // <snip> JXList sorting
    //  configure the comparator to use in sorting
    list.setComparator(comparator);
    if (list.getSortOrder() != SortOrder.UNSORTED) {
        // PENDING missing refresh api?
        ((DefaultSortController<?>) list.getRowSorter()).sort();
    }
    // </snip>
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:10,代碼來源:XListDemo.java

示例11: getSortOrder

public final SortOrder getSortOrder(final int modelColumnIndex)
{
	final List<? extends SortKey> sortKeys = getSortKeys();
	for (final SortKey sortKey : sortKeys)
	{
		if (sortKey.getColumn() == modelColumnIndex)
		{
			return sortKey.getSortOrder();
		}
	}
	return SortOrder.UNSORTED;
}
 
開發者ID:metasfresh,項目名稱:metasfresh,代碼行數:12,代碼來源:CTableViewRowSorter.java

示例12: getSortOrderOfBooleanAscendingFlag

private static final SortOrder getSortOrderOfBooleanAscendingFlag(final Boolean isSortAscending)
{
	if (isSortAscending == null)
	{
		return SortOrder.UNSORTED;
	}
	else if (isSortAscending)
	{
		return SortOrder.ASCENDING;
	}
	else
	{
		return SortOrder.DESCENDING;
	}
}
 
開發者ID:metasfresh,項目名稱:metasfresh,代碼行數:15,代碼來源:CTableModelRowSorter.java

示例13: getSortOrder

SortOrder getSortOrder() {
    RowSorter.SortKey key = getSortKey();
    return key == null ? SortOrder.UNSORTED : key.getSortOrder();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:ProfilerRowSorter.java

示例14: isUnsorted

private boolean isUnsorted() {
    List<? extends SortKey> keys = getSortKeys();
    int keySize = keys.size();
    return (keySize == 0 || keys.get(0).getSortOrder() ==
            SortOrder.UNSORTED);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:6,代碼來源:DefaultRowSorter.java

示例15: compare

@SuppressWarnings("unchecked")
private int compare(int model1, int model2) {
    int column;
    SortOrder sortOrder;
    Object v1, v2;
    int result;

    for (int counter = 0; counter < cachedSortKeys.length; counter++) {
        column = cachedSortKeys[counter].getColumn();
        sortOrder = cachedSortKeys[counter].getSortOrder();
        if (sortOrder == SortOrder.UNSORTED) {
            result = model1 - model2;
        } else {
            // v1 != null && v2 != null
            if (useToString[column]) {
                v1 = getModelWrapper().getStringValueAt(model1, column);
                v2 = getModelWrapper().getStringValueAt(model2, column);
            } else {
                v1 = getModelWrapper().getValueAt(model1, column);
                v2 = getModelWrapper().getValueAt(model2, column);
            }
            // Treat nulls as < then non-null
            if (v1 == null) {
                if (v2 == null) {
                    result = 0;
                } else {
                    result = -1;
                }
            } else if (v2 == null) {
                result = 1;
            } else {
                result = sortComparators[counter].compare(v1, v2);
            }
            if (sortOrder == SortOrder.DESCENDING) {
                result *= -1;
            }
        }
        if (result != 0) {
            return result;
        }
    }
    // If we get here, they're equal. Fallback to model order.
    return model1 - model2;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:44,代碼來源:DefaultRowSorter.java


注:本文中的javax.swing.SortOrder.UNSORTED屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。