本文整理汇总了Java中net.coderazzi.filters.gui.TableFilterHeader类的典型用法代码示例。如果您正苦于以下问题:Java TableFilterHeader类的具体用法?Java TableFilterHeader怎么用?Java TableFilterHeader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TableFilterHeader类属于net.coderazzi.filters.gui包,在下文中一共展示了TableFilterHeader类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tableFilterUpdated
import net.coderazzi.filters.gui.TableFilterHeader; //导入依赖的package包/类
public void tableFilterUpdated(TableFilterHeader header, final IFilterEditor editor, TableColumn tableColumn) {
Object content = editor.getContent();
Field field = fields.get(tableColumn.getModelIndex());
FilterFactory factory = filterManager.getFilterFactory(context, query.getEntityType(), field, true);
if(AnyChoice.choose.equals(content)) {
// restore the previous editor value (we record it on every change)
// this prevents double-popup that started to appear after instant filtering was turned off
editor.setContent(lastValues.get(field.getName()));
String value = query.getValue(field.getName());
FilterChooser popup = factory.createChooser(value);
popup.show();
if(query.setValue(field.getName(), popup.getSelectedValue())) {
fireChangeEvent();
}
setContent(factory, query.getEntityType(), field.getName(), popup.getSelectedValue(), editor);
} else {
if(!content.toString().isEmpty() && factory != null && factory.getCustomChoices() == null) {
// ignore, it's the callback from resolver that resolved the filter display value
} else {
if(query.setValue(field.getName(), content.toString())) {
fireChangeEvent();
}
}
}
}
示例2: tableFilterEditorCreated
import net.coderazzi.filters.gui.TableFilterHeader; //导入依赖的package包/类
public void tableFilterEditorCreated(TableFilterHeader header, IFilterEditor editor, TableColumn tableColumn) {
Field field = fields.get(tableColumn.getModelIndex());
if(field == null || !field.isCanFilter()) {
editor.setEditable(false);
editor.setUserInteractionEnabled(false);
} else {
boolean chooser = false;
FilterFactory filterFactory = filterManager.getFilterFactory(context, query.getEntityType(), field, true);
if(filterFactory != null) {
List<String> customChoices = filterFactory.getCustomChoices();
if(customChoices != null) {
setCustomChoices(editor, customChoices);
} else {
chooser = true;
}
} else {
updateCustomChoices(query.getEntityType(), field, editor);
}
if(chooser) {
editor.setEditable(false);
HashSet<CustomChoice> set = new HashSet<CustomChoice>();
set.add(AnyChoice.choose);
editor.setCustomChoices(set);
}
setContent(filterFactory, query.getEntityType(), field.getName(), query.getValue(field.getName()), editor);
}
}
示例3: createFilterTable
import net.coderazzi.filters.gui.TableFilterHeader; //导入依赖的package包/类
protected JPanel createFilterTable(final E query, final Metadata metadata) {
final EntityFilterTableModel<E> model = new EntityFilterTableModel<E>(project, metadata, query, hiddenFields);
JBTable table = new JBTable() {
public TableCellEditor getCellEditor(int row, int col) {
int modelRow = convertRowIndexToModel(row);
Field field = model.getFields().get(modelRow);
FilterFactory factory = fieldManager.getFilterFactory(new Context<E>(query), entityType, field, true);
if(factory != null) {
if(factory.getCustomChoices() == null) {
return new ReferenceCellEditor(factory, model);
} else {
return new LookupCellEditor(factory.getCustomChoices(), false);
}
} else if(field.getListId() != null) {
List<String> list = project.getComponent(ProjectListService.class).getProjectList(entityType, field);
return new LookupCellEditor(list, true);
} else {
return super.getCellEditor(row, col);
}
}
};
table.setRowSelectionAllowed(false);
table.setCellSelectionEnabled(true);
table.setModel(model);
TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(model);
table.setRowSorter(sorter);
new TableFilterHeader(table);
model.addTableModelListener(new TableModelListener() {
public void tableChanged(TableModelEvent tableModelEvent) {
queryModel.fireFilterUpdated(true);
}
});
sorter.setSortKeys(Arrays.asList(new RowSorter.SortKey(0, SortOrder.ASCENDING)));
JPanel panel = new JPanel(new BorderLayout());
panel.add(new JBScrollPane(table), BorderLayout.CENTER);
return panel;
}
示例4: tableFilterUpdated
import net.coderazzi.filters.gui.TableFilterHeader; //导入依赖的package包/类
@Override
public void tableFilterUpdated(TableFilterHeader tableFilterHeader, IFilterEditor iFilterEditor, TableColumn tableColumn) {
String filter = iFilterEditor.getContent().toString();
if(!filter.isEmpty() && !filter.endsWith("*")) {
// enforce prefix semantics to remain compatible with instant search that is used when all items fit into the first (filter-less) request
iFilterEditor.setContent(filter + "*");
} else {
load(false, filter);
}
}
示例5: requestPropertyFilterFocus
import net.coderazzi.filters.gui.TableFilterHeader; //导入依赖的package包/类
private void requestPropertyFilterFocus(TableFilterHeader header) {
IFilterEditor editor = header.getFilterEditor(model.getColumnCount() - 1);
if(editor instanceof JComponent) {
if(((JComponent) editor).getComponentCount() == 2) {
((JComponent) editor).getComponent(1).requestFocus();
}
}
}
示例6: tableFilterUpdated
import net.coderazzi.filters.gui.TableFilterHeader; //导入依赖的package包/类
@Override
public void tableFilterUpdated(TableFilterHeader tableFilterHeader, IFilterEditor iFilterEditor, TableColumn tableColumn) {
String filter = iFilterEditor.getContent().toString();
if(!filter.endsWith("*")) {
// enforce prefix semantics to remain compatible with instant search that is used when all items fit into the first (filter-less) request
iFilterEditor.setContent(filter + "*");
} else {
executeQuery(false, filter);
}
}
示例7: init
import net.coderazzi.filters.gui.TableFilterHeader; //导入依赖的package包/类
private void init()
{
setLayout(new MigLayout("insets 0 0 0 0",
"[grow,fill]",
"[grow,fill]"));
//System Configuration View and Editor
mAliasTable = new JTable(mAliasModel);
mAliasTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
mAliasTable.getSelectionModel().addListSelectionListener(this);
mAliasTable.setAutoCreateRowSorter(true);
mAliasTable.getColumnModel().getColumn(AliasModel.COLUMN_COLOR)
.setCellRenderer(new ColorCellRenderer());
mAliasTable.getColumnModel().getColumn(AliasModel.COLUMN_ICON)
.setCellRenderer(mIconCellRenderer);
mTableFilterHeader = new TableFilterHeader(mAliasTable, AutoChoices.ENABLED);
mTableFilterHeader.setFilterOnUpdates(true);
JScrollPane tableScroller = new JScrollPane(mAliasTable);
JPanel buttonsPanel = new JPanel();
buttonsPanel.setLayout(
new MigLayout("insets 0 0 0 0", "[grow,fill][grow,fill][grow,fill]", "[]"));
mNewButton.addActionListener(this);
mNewButton.setToolTipText("Adds a new alias");
buttonsPanel.add(mNewButton);
mCopyButton.addActionListener(this);
mCopyButton.setEnabled(false);
mCopyButton.setToolTipText("Creates a copy of the currently selected alias and adds it");
buttonsPanel.add(mCopyButton);
mDeleteButton.addActionListener(this);
mDeleteButton.setEnabled(false);
mDeleteButton.setToolTipText("Deletes the currently selected alias");
buttonsPanel.add(mDeleteButton);
JPanel listAndButtonsPanel = new JPanel();
listAndButtonsPanel.setLayout(
new MigLayout("insets 0 0 0 0", "[grow,fill]", "[grow,fill][]"));
listAndButtonsPanel.add(tableScroller, "wrap");
listAndButtonsPanel.add(buttonsPanel);
mSplitPane = new JideSplitPane(JideSplitPane.HORIZONTAL_SPLIT);
mSplitPane.setDividerSize(5);
mSplitPane.setShowGripper(true);
mSplitPane.add(listAndButtonsPanel);
mSplitPane.add(mAliasEditor);
add(mSplitPane);
}
示例8: init
import net.coderazzi.filters.gui.TableFilterHeader; //导入依赖的package包/类
private void init()
{
setLayout( new MigLayout( "", "[grow,fill]", "[grow,fill]") );
//System Configuration View and Editor
mChannelTable = new JTable( mChannelModel );
mChannelTable.setDefaultRenderer( String.class, new ChannelTableCellRenderer() );
mChannelTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
mChannelTable.getSelectionModel().addListSelectionListener( this );
mChannelTable.setAutoCreateRowSorter( true );
mTableFilterHeader = new TableFilterHeader( mChannelTable, AutoChoices.ENABLED );
mTableFilterHeader.setFilterOnUpdates( true );
JScrollPane channelScroller = new JScrollPane( mChannelTable );
JPanel buttonsPanel = new JPanel();
buttonsPanel.setLayout(
new MigLayout( "insets 0 0 0 0", "[grow,fill][grow,fill][grow,fill]", "[]") );
mNewChannelButton.addActionListener( this );
mNewChannelButton.setToolTipText( "Create a new channel configuration" );
buttonsPanel.add( mNewChannelButton );
mCopyChannelButton.addActionListener( this );
mCopyChannelButton.setEnabled( false );
mCopyChannelButton.setToolTipText( "Create a copy of the currently selected channel configuration" );
buttonsPanel.add( mCopyChannelButton );
mDeleteChannelButton.addActionListener( this );
mDeleteChannelButton.setEnabled( false );
mDeleteChannelButton.setToolTipText( "Delete the currently selected channel configuration" );
buttonsPanel.add( mDeleteChannelButton );
JPanel listAndButtonsPanel = new JPanel();
listAndButtonsPanel.setLayout(
new MigLayout( "insets 0 0 0 0", "[grow,fill]", "[grow,fill][]") );
listAndButtonsPanel.add( channelScroller, "wrap" );
listAndButtonsPanel.add( buttonsPanel );
JideSplitPane splitPane = new JideSplitPane( JideSplitPane.VERTICAL_SPLIT );
splitPane.setDividerSize( 5 );
splitPane.setShowGripper( true );
//Shrink this guy so that he'll eventually be expanded to the scroller preferred size
listAndButtonsPanel.setPreferredSize( new Dimension( 10, 10 ) );
//Attempt to get a 60:40 vertical sizing preference
JScrollPane listScroller = new JScrollPane( listAndButtonsPanel );
listScroller.setPreferredSize( new Dimension( 800, 58 ) );
JScrollPane editorScroller = new JScrollPane( mEditor );
editorScroller.setPreferredSize( new Dimension( 800, 42 ) );
splitPane.add( listScroller );
splitPane.add( editorScroller );
add( splitPane );
}
示例9: tableFilterEditorExcluded
import net.coderazzi.filters.gui.TableFilterHeader; //导入依赖的package包/类
public void tableFilterEditorExcluded(TableFilterHeader header, IFilterEditor editor, TableColumn tableColumn) {
}
示例10: tableFilterEditorCreated
import net.coderazzi.filters.gui.TableFilterHeader; //导入依赖的package包/类
@Override
public void tableFilterEditorCreated(TableFilterHeader tableFilterHeader, IFilterEditor iFilterEditor, TableColumn tableColumn) {
}
示例11: tableFilterEditorExcluded
import net.coderazzi.filters.gui.TableFilterHeader; //导入依赖的package包/类
@Override
public void tableFilterEditorExcluded(TableFilterHeader tableFilterHeader, IFilterEditor iFilterEditor, TableColumn tableColumn) {
}