Browse Source

Everywhere: Remove usage of internal API UIAction.

pull/245/head
weisj 4 years ago
parent
commit
9ee79f4329
No known key found for this signature in database
GPG Key ID: 31124CB75461DA2A
  1. 53
      core/src/main/java/com/github/weisj/darklaf/ui/UIAction.java
  2. 2
      core/src/main/java/com/github/weisj/darklaf/ui/list/DarkListUIBridge.java
  3. 2
      core/src/main/java/com/github/weisj/darklaf/ui/menu/DarkMenuItemUIBase.java
  4. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneUIBridge.java

53
core/src/main/java/com/github/weisj/darklaf/ui/UIAction.java

@ -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) {}
}

2
core/src/main/java/com/github/weisj/darklaf/ui/list/DarkListUIBridge.java

@ -37,7 +37,7 @@ import javax.swing.plaf.basic.BasicListUI;
import javax.swing.text.Position; import javax.swing.text.Position;
import sun.swing.DefaultLookup; import sun.swing.DefaultLookup;
import sun.swing.UIAction; import com.github.weisj.darklaf.ui.UIAction;
import com.github.weisj.darklaf.ui.BasicTransferable; import com.github.weisj.darklaf.ui.BasicTransferable;
import com.github.weisj.darklaf.ui.DragRecognitionSupport; import com.github.weisj.darklaf.ui.DragRecognitionSupport;

2
core/src/main/java/com/github/weisj/darklaf/ui/menu/DarkMenuItemUIBase.java

@ -29,7 +29,7 @@ import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicMenuItemUI; import javax.swing.plaf.basic.BasicMenuItemUI;
import sun.swing.MenuItemLayoutHelper; import sun.swing.MenuItemLayoutHelper;
import sun.swing.UIAction; import com.github.weisj.darklaf.ui.UIAction;
import com.github.weisj.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.LazyActionMap; import com.github.weisj.darklaf.util.LazyActionMap;

2
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneUIBridge.java

@ -40,7 +40,7 @@ import javax.swing.plaf.basic.BasicHTML;
import javax.swing.text.View; import javax.swing.text.View;
import sun.swing.DefaultLookup; import sun.swing.DefaultLookup;
import sun.swing.UIAction; import com.github.weisj.darklaf.ui.UIAction;
import com.github.weisj.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.LazyActionMap; import com.github.weisj.darklaf.util.LazyActionMap;

Loading…
Cancel
Save