本文整理匯總了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);
}