本文整理汇总了Java中ca.sqlpower.object.SPListener类的典型用法代码示例。如果您正苦于以下问题:Java SPListener类的具体用法?Java SPListener怎么用?Java SPListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SPListener类属于ca.sqlpower.object包,在下文中一共展示了SPListener类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listenToHierarchy
import ca.sqlpower.object.SPListener; //导入依赖的package包/类
/**
* Adds the given listeners to the hierarchy of {@link SPObject}s rooted at
* <code>root</code>.
*
* @param root
* The object at the top of the subtree to listen to. Must not be
* null.
* @param spcl
* The SQL Power child listener to add to root and all its
* SPObject descendants. If you do not want {@link SPChildEvent}s,
* you can provide null for this parameter.
*/
public static void listenToHierarchy(SPObject root, SPListener spcl) {
root.addSPListener(spcl);
if (root.allowsChildren()) {
List<? extends SPObject> children;
if (root instanceof SQLObject) {
children = ((SQLObject) root).getChildrenWithoutPopulating();
} else {
children = root.getChildren();
}
for (SPObject wob : children) {
listenToHierarchy(wob, spcl);
}
}
}
示例2: listenToShallowHierarchy
import ca.sqlpower.object.SPListener; //导入依赖的package包/类
/**
* This method is similar to listenToHierarchy but only listens to the
* first two levels in the tree, i.e. the listener is not added to the
* grand children of the root. See
* {@link #lisenToHierachy(MatchMakerListener listener, MatchMakerObject root)}
*/
public static void listenToShallowHierarchy(SPListener listener, SPObject root) {
root.addSPListener(listener);
logger.debug("listenToShallowHierarchy: \"" + root.getName() + "\" (" +
root.getClass().getName() + ") children: " + root.getChildren());
for (SPObject spo : root.getChildren()) {
spo.addSPListener(listener);
}
}
示例3: unlistenToHierarchy
import ca.sqlpower.object.SPListener; //导入依赖的package包/类
/**
* Removes the given listeners from the hierarchy of {@link SPObject}s
* rooted at <code>root</code>.
*
* @param root
* The object at the top of the subtree to unlisten to. Must not
* be null.
* @param spcl
* The SQL Power child listener to remove from root and all its
* SPObject descendants. If you do not want to unlisten to
* {@link SPChildEvent}s, you can provide null for this
* parameter.
*/
public static void unlistenToHierarchy(SPObject root, SPListener spcl) {
root.removeSPListener(spcl);
if (root.allowsChildren()) {
List<? extends SPObject> children;
if (root instanceof SQLObject) {
children = ((SQLObject) root).getChildrenWithoutPopulating();
} else {
children = root.getChildren();
}
for (SPObject wob : children) {
unlistenToHierarchy(wob, spcl);
}
}
}
示例4: commitObjects
import ca.sqlpower.object.SPListener; //导入依赖的package包/类
/**
* Commits the persisted {@link WabitObject}s
*
* @throws SPPersistenceException
*/
private void commitObjects() throws SPPersistenceException {
List<PersistedSPObject> orderedPersistedObjects = new ArrayList<PersistedSPObject>(persistedObjects.size());
orderedPersistedObjects.addAll(persistedObjects.values());
Collections.sort(orderedPersistedObjects, persistedObjectComparator);
for (PersistedSPObject pwo : orderedPersistedObjects) {
if (pwo.isLoaded())
continue;
SPObject parent = SQLPowerUtils.findByUuid(root, pwo
.getParentUUID(), SPObject.class);
SPObject spo = loadWabitObject(pwo);
if (spo != null) {
SPListener removeChildOnAddListener = new AbstractSPListener() {
public void childRemoved(SPChildEvent e) {
objectsToRemoveRollbackList.add(
new RemovedObjectEntry(e.getSource().getUUID(), e.getChild(), e.getIndex()));
}
};
parent.addSPListener(removeChildOnAddListener);
// FIXME Terrible hack, see bug 2326
parent.addChild(spo, Math.min(pwo.getIndex(), parent.getChildren(spo.getClass()).size()));
parent.removeSPListener(removeChildOnAddListener);
this.persistedObjectsRollbackList.add(
new PersistedObjectEntry(
parent.getUUID(),
spo.getUUID()));
}
}
persistedObjects.clear();
}
示例5: getSPListeners
import ca.sqlpower.object.SPListener; //导入依赖的package包/类
@NonProperty
public List<SPListener> getSPListeners() {
return listeners;
}
示例6: hasListener
import ca.sqlpower.object.SPListener; //导入依赖的package包/类
public boolean hasListener(SPListener listener) {
return listeners.contains(listener);
}
示例7: removeWabitListener
import ca.sqlpower.object.SPListener; //导入依赖的package包/类
public void removeWabitListener(SPListener l) {
// no-op
}
示例8: addSPListener
import ca.sqlpower.object.SPListener; //导入依赖的package包/类
@Override
public void addSPListener(SPListener l) {
}
示例9: removeSPListener
import ca.sqlpower.object.SPListener; //导入依赖的package包/类
@Override
public void removeSPListener(SPListener l) {
}
示例10: addSPListener
import ca.sqlpower.object.SPListener; //导入依赖的package包/类
public void addSPListener(SPListener l) {
// TODO Auto-generated method stub
}
示例11: removeSPListener
import ca.sqlpower.object.SPListener; //导入依赖的package包/类
public void removeSPListener(SPListener l) {
// TODO Auto-generated method stub
}