本文整理汇总了Java中javax.swing.tree.RowMapper类的典型用法代码示例。如果您正苦于以下问题:Java RowMapper类的具体用法?Java RowMapper怎么用?Java RowMapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RowMapper类属于javax.swing.tree包,在下文中一共展示了RowMapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clearSelectionCache
import javax.swing.tree.RowMapper; //导入依赖的package包/类
private static void clearSelectionCache(RowMapper rm) {
if (rm instanceof FixedHeightLayoutCache) {
try {
Field infoField = rm.getClass().getDeclaredField("info");
infoField.setAccessible(true);
Object searchInfo = infoField.get(rm);
if (searchInfo != null) {
Field nodeField = searchInfo.getClass().getDeclaredField("node");
nodeField.setAccessible(true);
nodeField.set(searchInfo, null);
}
} catch (Exception ex) {}
}
}
示例2: SynchronizedListSelectionModel
import javax.swing.tree.RowMapper; //导入依赖的package包/类
public SynchronizedListSelectionModel(RowMapper mapper,
TreeSelectionModel treeSelectionModel)
{
super();
setRowMapper(mapper);
setTreeSelectionModel(treeSelectionModel);
}
示例3: getSingleColumnRowMapper
import javax.swing.tree.RowMapper; //导入依赖的package包/类
/**
* A {@link RowMapper} that returns the object contained in the first field.
*/
public <T> RowMapper<T> getSingleColumnRowMapper(Class<T> requiredType){
return new RowMapper<T>() {
@Override
public T map(ResultSet rs) throws SQLException {
return (T) rs.getObject(1);
}
};
}
示例4: query
import javax.swing.tree.RowMapper; //导入依赖的package包/类
/**
* Return a list of objects obtained applying the given {@link RowMapper} to each record.
* @return A not null empty list when the result set is empty.
* @throws SQLException
*/
public <T> List<T> query(String sql, RowMapper<T> rowMapper) throws SQLException{
if (logger.isDebugEnabled()) {
logger.debug("Executing SQL statement [" + sql + "]");
}
Connection connection = null;
Statement stm = null;
ResultSet rs = null;
ArrayList<T> result = new ArrayList<T>();
try{
connection = ds.getConnection();
stm = connection.createStatement();
rs = stm.executeQuery(sql);
while(rs.next()){
result.add( rowMapper.map(rs) );
}
} catch (SQLException e) {
throw e;
}finally{
if(rs!=null) rs.close();
if(stm!=null) stm.close();
if(connection!=null) connection.close();
}
return result;
}
示例5: isSelectionModeBroken
import javax.swing.tree.RowMapper; //导入依赖的package包/类
/** Check if selection of the nodes could break the selection mode set in TreeSelectionModel.
* @param nodes the nodes for selection
* @return true if the selection mode is broken */
private boolean isSelectionModeBroken(Node[] nodes) {
// if nodes are empty or single the everthing is ok
// or if discontiguous selection then everthing ok
if ((nodes.length <= 1) || (getSelectionMode() == TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION)) {
return false;
}
// if many nodes
// brakes single selection mode
if (getSelectionMode() == TreeSelectionModel.SINGLE_TREE_SELECTION) {
return true;
}
// check the contiguous selection mode
TreePath[] paths = new TreePath[nodes.length];
RowMapper rowMapper = tree.getSelectionModel().getRowMapper();
// if rowMapper is null then tree bahaves as discontiguous selection mode is set
if (rowMapper == null) {
return false;
}
ArrayList<Node> toBeExpaned = new ArrayList<Node>(3);
for (int i = 0; i < nodes.length; i++) {
toBeExpaned.clear();
Node n = nodes[i];
while (n.getParentNode() != null) {
if (!isExpanded(n)) {
toBeExpaned.add(n);
}
n = n.getParentNode();
}
for (int j = toBeExpaned.size() - 1; j >= 0; j--) {
expandNode(toBeExpaned.get(j));
}
paths[i] = getTreePath(nodes[i]);
}
int[] rows = rowMapper.getRowsForPaths(paths);
// check selection's rows
Arrays.sort(rows);
for (int i = 1; i < rows.length; i++) {
if (rows[i] != (rows[i - 1] + 1)) {
return true;
}
}
// all is ok
return false;
}
示例6: getRowMapper
import javax.swing.tree.RowMapper; //导入依赖的package包/类
public RowMapper getRowMapper()
{
return rowMapper;
}
示例7: setRowMapper
import javax.swing.tree.RowMapper; //导入依赖的package包/类
public synchronized void setRowMapper(RowMapper mapper)
{
rowMapper = mapper;
}
示例8: initializeLocalVars
import javax.swing.tree.RowMapper; //导入依赖的package包/类
protected void initializeLocalVars()
{
super.initializeLocalVars();
Enumeration<TableColumn> e = getColumnModel().getColumns();
while(e.hasMoreElements()) {
TableColumn column = e.nextElement();
setHeaderRenderer(column);
}
//setHeaderRenderer(getHeaderColumn());
AlignerTree alignerTree = getAlignerTree();
if(alignerTree != null) {
List<NameTree> trees= getAlignableTrees();
Aligner aligner = alignerTree.getAligner();
for (NameTree tree : trees) {
alignerTree.addTree(tree);
tree.setAligner(aligner);
}
// or...
//setAlignerTree(alignerTree);
alignerTree.addTreeSelectionListener(this);
}
/*
setAligner(aligner);
TableModel rowMapper = getModel();
if(rowMapper != null &&
rowMapper instanceof RowMapper) {
SynchronizedListSelectionModel selector =
(SynchronizedListSelectionModel)getSelectionModel();
selector.setRowMapper((RowMapper)rowMapper);
selector.setTree(aligner);
selector.addListSelectionListener(this);
}
setSelectAndScroll(true);
*/
/*
Aligner aligner = ((AlignerTree)((TreeHeaderRenderer)a.getHeaderRenderer()).getTree()).getAligner();
*/
TableModel rowMapper = getModel();
if(rowMapper != null &&
rowMapper instanceof RowMapper) {
SynchronizedListSelectionModel selector =
(SynchronizedListSelectionModel)getSelectionModel();
selector.setRowMapper((RowMapper)rowMapper);
selector.setTree(alignerTree);
selector.setTable(this);
SynchronizedTreeSelectionModel treeSelector =
(SynchronizedTreeSelectionModel)alignerTree.getSelectionModel();
treeSelector.addTreeSelectionListener(selector);
treeSelector.setTable(this);
selector.setTreeSelectionModel(treeSelector);
}
setSelectAndScroll(true);
preferredHeight = -1;
}
示例9: getRowMapper
import javax.swing.tree.RowMapper; //导入依赖的package包/类
@Override
public RowMapper getRowMapper() {
return rowMapper;
}
示例10: setRowMapper
import javax.swing.tree.RowMapper; //导入依赖的package包/类
@Override
public void setRowMapper(RowMapper newMapper) {
rowMapper = newMapper;
}
示例11: setRowMapper
import javax.swing.tree.RowMapper; //导入依赖的package包/类
@Override
public void setRowMapper(RowMapper newMapper)
{
}
示例12: getRowMapper
import javax.swing.tree.RowMapper; //导入依赖的package包/类
@Override
public RowMapper getRowMapper()
{
return null;
}
示例13: getRowMapper
import javax.swing.tree.RowMapper; //导入依赖的package包/类
@Override
public RowMapper getRowMapper() {
throw new UnsupportedOperationException("Not implemented.");
}
示例14: setRowMapper
import javax.swing.tree.RowMapper; //导入依赖的package包/类
@Override
public void setRowMapper(RowMapper newMapper) {
throw new UnsupportedOperationException("Not implemented.");
}
示例15: queryForObject
import javax.swing.tree.RowMapper; //导入依赖的package包/类
/**
* Execute a query that return a single result obtained allowing the current row to be mapped through
* the provided {@link RowMapper}.
* @throws SQLException
*/
public <T> T queryForObject(String sql, RowMapper<T> rowMapper) throws SQLException {
return (T) query(sql, rowMapper);
}