-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Everywhere: Remove usage of internal API UIAction.
- Loading branch information
Showing
4 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
core/src/main/java/com/github/weisj/darklaf/ui/UIAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.github.weisj.darklaf.ui; | ||
|
||
import javax.swing.Action; | ||
import java.beans.PropertyChangeListener; | ||
|
||
public abstract class UIAction implements Action { | ||
private final String name; | ||
|
||
public UIAction(String name) { | ||
this.name = name; | ||
} | ||
|
||
public final String getName() { | ||
return name; | ||
} | ||
|
||
public Object getValue(String key) { | ||
if (NAME.equals(key)) { | ||
return name; | ||
} | ||
return null; | ||
} | ||
|
||
// UIAction is not mutable, this does nothing. | ||
public void putValue(String key, Object value) {} | ||
|
||
// UIAction is not mutable, this does nothing. | ||
public void setEnabled(boolean b) {} | ||
|
||
/** | ||
* Cover method for <code>isEnabled(null)</code>. | ||
*/ | ||
public final boolean isEnabled() { | ||
return accept(null); | ||
} | ||
|
||
/** | ||
* Subclasses that need to conditionalize the enabled state should override this. Be aware that | ||
* <code>sender</code> may be null. | ||
* | ||
* @param sender Widget enabled state is being asked for, may be null. | ||
*/ | ||
@Override | ||
public boolean accept(Object sender) { | ||
return true; | ||
} | ||
|
||
// UIAction is not mutable, this does nothing. | ||
public void addPropertyChangeListener(PropertyChangeListener listener) {} | ||
|
||
// UIAction is not mutable, this does nothing. | ||
public void removePropertyChangeListener(PropertyChangeListener listener) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters