Browse Source

Removed overriding of shared dummy ui.

pull/173/head
weisj 5 years ago
parent
commit
5a7bd22a79
  1. 15
      core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextPaneUI.java
  2. 16
      core/src/main/java/com/github/weisj/darklaf/ui/text/bridge/DarkEditorPaneUIBridge.java
  3. 49
      core/src/main/java/com/github/weisj/darklaf/ui/text/bridge/DarkTextPaneUIBridge.java

15
core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextPaneUI.java

@ -24,26 +24,25 @@
*/ */
package com.github.weisj.darklaf.ui.text; package com.github.weisj.darklaf.ui.text;
import java.awt.*;
import javax.swing.*; import javax.swing.*;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import com.github.weisj.darklaf.ui.text.dummy.DummyTextPaneUI; import com.github.weisj.darklaf.ui.text.bridge.DarkTextPaneUIBridge;
/** /**
* @author Jannis Weis * @author Jannis Weis
*/ */
public class DarkTextPaneUI extends DarkEditorPaneUI { public class DarkTextPaneUI extends DarkTextPaneUIBridge {
static {
basicEditorPaneUI = new DummyTextPaneUI();
}
public static ComponentUI createUI(final JComponent c) { public static ComponentUI createUI(final JComponent c) {
return new DarkTextPaneUI(); return new DarkTextPaneUI();
} }
@Override
protected DarkCaret.CaretStyle getDefaultCaretStyle() {
return DarkCaret.CaretStyle.THICK_VERTICAL_LINE_STYLE;
}
@Override @Override
protected String getPropertyPrefix() { protected String getPropertyPrefix() {
return "TextPane"; return "TextPane";

16
core/src/main/java/com/github/weisj/darklaf/ui/text/bridge/DarkEditorPaneUIBridge.java

@ -42,19 +42,31 @@ import com.github.weisj.darklaf.util.PropertyKey;
*/ */
public abstract class DarkEditorPaneUIBridge extends DarkTextUI { public abstract class DarkEditorPaneUIBridge extends DarkTextUI {
private static final DummyEditorPane editorPane = new DummyEditorPane(); private static final DummyEditorPane shareDummyEditorPane = new DummyEditorPane();
protected static DummyTextUIMethods basicEditorPaneUI = new DummyEditorPaneUI(); private static final DummyTextUIMethods sharedDummyUI = new DummyEditorPaneUI();
private DummyEditorPane editorPane;
private DummyTextUIMethods basicEditorPaneUI;
private PropertyChangeListener propertyChangeListener; private PropertyChangeListener propertyChangeListener;
@Override @Override
public void installUI(final JComponent c) { public void installUI(final JComponent c) {
editorPane = createDummyEditorPane();
basicEditorPaneUI = createDummyUI();
editorPane.setEditorPane((JEditorPane) c); editorPane.setEditorPane((JEditorPane) c);
basicEditorPaneUI.installUI(editorPane); basicEditorPaneUI.installUI(editorPane);
super.installUI(c); super.installUI(c);
updateDisplayProperties(); updateDisplayProperties();
} }
protected DummyTextUIMethods createDummyUI() {
return sharedDummyUI;
}
protected DummyEditorPane createDummyEditorPane() {
return shareDummyEditorPane;
}
@Override @Override
protected void installListeners() { protected void installListeners() {
propertyChangeListener = editorPane.getPropertyChangeListener(); propertyChangeListener = editorPane.getPropertyChangeListener();

49
core/src/main/java/com/github/weisj/darklaf/ui/text/bridge/DarkTextPaneUIBridge.java

@ -0,0 +1,49 @@
/*
* MIT License
*
* Copyright (c) 2020 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
package com.github.weisj.darklaf.ui.text.bridge;
import javax.swing.*;
import com.github.weisj.darklaf.ui.text.DarkEditorPaneUI;
import com.github.weisj.darklaf.ui.text.dummy.DummyEditorPane;
import com.github.weisj.darklaf.ui.text.dummy.DummyTextPaneUI;
import com.github.weisj.darklaf.ui.text.dummy.DummyTextUIMethods;
/**
* @author Jannis Weis
*/
public abstract class DarkTextPaneUIBridge extends DarkEditorPaneUI {
private static final DummyEditorPane sharedDummyTextPane = new DummyEditorPane();
private static final DummyTextUIMethods sharedDummyUI = new DummyTextPaneUI();
protected DummyTextUIMethods createDummyUI() {
return sharedDummyUI;
}
protected DummyEditorPane createDummyEditorPane() {
return sharedDummyTextPane;
}
}
Loading…
Cancel
Save