本文整理汇总了Java中javax.swing.Action.removePropertyChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java Action.removePropertyChangeListener方法的具体用法?Java Action.removePropertyChangeListener怎么用?Java Action.removePropertyChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.Action
的用法示例。
在下文中一共展示了Action.removePropertyChangeListener方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: attach
import javax.swing.Action; //导入方法依赖的package包/类
public void attach(Action action) {
Reference<Action> d = delegate;
if ((d == null) || (d.get() == action)) {
return;
}
Action prev = d.get();
// reattaches to different action
if (prev != null) {
prev.removePropertyChangeListener(this);
}
this.delegate = new WeakReference<Action>(action);
action.addPropertyChangeListener(this);
}
示例2: isEnabled
import javax.swing.Action; //导入方法依赖的package包/类
public boolean isEnabled() {
Action a = findAction();
if (a == null) {
a = delegate;
}
// 40915 - hold last action weakly
Action last = lastRef == null ? null : lastRef.get();
if (a != last) {
if (last != null) {
last.removePropertyChangeListener(weakL);
}
lastRef = new WeakReference<Action>(a);
a.addPropertyChangeListener(weakL);
}
return a.isEnabled();
}
示例3: editorDeactivated
import javax.swing.Action; //导入方法依赖的package包/类
public void editorDeactivated() {
Action ea = getEditorAction();
Action sa = getSystemAction();
if (ea != null && sa != null) {
/* if (sa instanceof CallbackSystemAction) {
CallbackSystemAction csa = (CallbackSystemAction)sa;
if (csa.getActionPerformer() == this) {
csa.setActionPerformer(null);
}
}
*/
if (syncEnabling && enabledPropertySyncL != null) {
ea.removePropertyChangeListener(enabledPropertySyncL);
}
}
}
示例4: clear
import javax.swing.Action; //导入方法依赖的package包/类
public void clear() {
Action a;
Reference<Action> d = delegate;
a = d == null ? null : d.get();
if (a == null) {
return;
}
delegate = null;
a.removePropertyChangeListener(this);
}
示例5: finalize
import javax.swing.Action; //导入方法依赖的package包/类
protected void finalize() {
Action last = lastRef == null ? null : lastRef.get();
if (last != null) {
last.removePropertyChangeListener(weakL);
}
}
示例6: updateState
import javax.swing.Action; //导入方法依赖的package包/类
void updateState(ActionMap prev, ActionMap now, boolean fire) {
if (key == null) {
return;
}
boolean prevEnabled = false;
if (prev != null) {
Action prevAction = prev.get(key);
if (prevAction != null) {
prevEnabled = fire && prevAction.isEnabled();
prevAction.removePropertyChangeListener(weakL);
}
}
if (now != null) {
Action nowAction = now.get(key);
boolean nowEnabled;
if (nowAction != null) {
nowAction.addPropertyChangeListener(weakL);
nowEnabled = nowAction.isEnabled();
} else {
nowEnabled = fallback != null && fallback.isEnabled();
}
PropertyChangeSupport sup = fire ? support : null;
if (sup != null && nowEnabled != prevEnabled) {
sup.firePropertyChange("enabled", prevEnabled, !prevEnabled); // NOI18N
}
}
}
示例7: removeNotify
import javax.swing.Action; //导入方法依赖的package包/类
@Override
protected synchronized void removeNotify() {
for (Action a : actions) {
a.removePropertyChangeListener(this);
}
setDelegateAction(null);
}
示例8: testStackOverFlow
import javax.swing.Action; //导入方法依赖的package包/类
public void testStackOverFlow() throws IOException {
InstanceContent ic = new InstanceContent();
Lookup context = new AbstractLookup(ic);
boolean clone = false;
Action instance;
if (clone) {
Action a = create(Lookup.EMPTY);
instance = ((ContextAwareAction)a).createContextAwareInstance(context);
} else {
instance = create(context);
}
FileObject pfo = TestSupport.createTestProject(FileUtil.createMemoryFileSystem().getRoot(), "yaya");
FileObject pf2 = TestSupport.createTestProject(FileUtil.createMemoryFileSystem().getRoot(), "blabla");
MockServices.setServices(TestSupport.TestProjectFactory.class);
Project p = ProjectManager.getDefault().findProject(pfo);
Project p2 = ProjectManager.getDefault().findProject(pf2);
if (p instanceof TestSupport.TestProject) {
enhanceProject((TestSupport.TestProject)p);
}
if (p2 instanceof TestSupport.TestProject) {
enhanceProject((TestSupport.TestProject)p2);
}
assertNotNull("Project found", p);
assertNotNull("Project2 found", p2);
OpenProjects.getDefault().open(new Project[] { p }, false);
assertFalse("Disabled1", instance.isEnabled());
instance.addPropertyChangeListener(this);
ic.add(p);
assertTrue("Enabled", instance.isEnabled());
assertEquals("One change", 1, change);
class Q implements PropertyChangeListener {
Action i;
int cnt;
@Override
public void propertyChange(PropertyChangeEvent evt) {
if ("enabled".equals(evt.getPropertyName())) {
cnt++;
/* What is this for? Often fails during unit tests (but tests pass).
assertTrue("enabled in listener", i.isEnabled());
*/
}
}
}
Q q = new Q();
q.i = instance;
ic.remove(p);
instance.removePropertyChangeListener(this);
ic.add(p);
instance.addPropertyChangeListener(q);
assertTrue("Enabled", instance.isEnabled());
assertEquals("One call", 1, q.cnt);
}