Skip to content

Commit e50a0b3

Browse files
committed
various upgrades for JalviewJS
j2sClass -- unscoped C$ HTML5LookAndFeel tooltip defaults temporary JSDexktopiconUI, JSInternalFrameUI, JSTabbedPaneUI, JSToolTipUI PopupFactory fix -- mixed Lst, List
1 parent 032bbe3 commit e50a0b3

File tree

9 files changed

+333
-63
lines changed

9 files changed

+333
-63
lines changed
3.92 KB
Binary file not shown.

sources/net.sf.j2s.java.core/src/javax/swing/PopupFactory.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
import java.util.List;
3636
import java.util.Map;
3737

38-
import javajs.util.Lst;
39-
4038
import java.applet.Applet;
4139
import java.awt.BorderLayout;
4240
import java.awt.Component;
@@ -379,17 +377,17 @@ static Popup getHeavyWeightPopup(Component owner, Component contents,
379377
*/
380378
private static HeavyWeightPopup getRecycledHeavyWeightPopup(Window w) {
381379
synchronized (HeavyWeightPopup.class) {
382-
Lst cache;
380+
List cache;
383381
Map heavyPopupCache = getHeavyWeightPopupCache();
384382

385383
if (heavyPopupCache.containsKey(w)) {
386-
cache = (Lst)heavyPopupCache.get(w);
384+
cache = (List)heavyPopupCache.get(w);
387385
} else {
388386
return null;
389387
}
390388
if ((cache.size()) > 0) {
391389
HeavyWeightPopup r = (HeavyWeightPopup)cache.get(0);
392-
cache.removeItemAt(0);
390+
cache.remove(0);
393391
return r;
394392
}
395393
return null;
@@ -856,12 +854,12 @@ static Popup getMediumWeightPopup(Component owner, Component contents,
856854
/**
857855
* Returns the cache to use for medium weight popups.
858856
*/
859-
private static Lst getMediumWeightPopupCache() {
860-
Lst cache = (Lst)SwingUtilities.appContextGet(
857+
private static List getMediumWeightPopupCache() {
858+
List cache = (List)SwingUtilities.appContextGet(
861859
mediumWeightPopupCacheKey);
862860

863861
if (cache == null) {
864-
cache = new Lst();
862+
cache = new ArrayList();
865863
SwingUtilities.appContextPut(mediumWeightPopupCacheKey, cache);
866864
}
867865
return cache;
@@ -885,12 +883,12 @@ private static void recycleMediumWeightPopup(MediumWeightPopup popup) {
885883
*/
886884
private static MediumWeightPopup getRecycledMediumWeightPopup() {
887885
synchronized (MediumWeightPopup.class) {
888-
Lst mediumPopupCache =
886+
List mediumPopupCache =
889887
getMediumWeightPopupCache();
890888
if ((mediumPopupCache.size()) > 0) {
891889
MediumWeightPopup r = (MediumWeightPopup)mediumPopupCache.
892890
get(0);
893-
mediumPopupCache.removeItemAt(0);
891+
mediumPopupCache.remove(0);
894892
return r;
895893
}
896894
return null;

sources/net.sf.j2s.java.core/src/swingjs/plaf/HTML5LookAndFeel.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -568,9 +568,9 @@ protected void initComponentDefaults(UIDefaults table) {
568568
// "javax.swing.plaf.basic.BasicBorders",
569569
// "getInternalFrameBorder");
570570
//
571-
// Object blackLineBorder = new SwingLazyValue(
572-
// "javax.swing.plaf.BorderUIResource",
573-
// "getBlackLineBorderUIResource");
571+
Object blackLineBorder = new SwingLazyValue(
572+
"javax.swing.plaf.BorderUIResource",
573+
"getBlackLineBorderUIResource");
574574
// Object focusCellHighlightBorder = new SwingLazyValue(
575575
// "javax.swing.plaf.BorderUIResource$LineBorderUIResource",
576576
// null,
@@ -1927,10 +1927,10 @@ public Object createValue(UIDefaults table) {
19271927
// }),
19281928

19291929
// *** ToolTips
1930-
// "ToolTip.font", sansSerifPlain12,
1931-
// "ToolTip.background", table.get("info"),
1932-
// "ToolTip.foreground", table.get("infoText"),
1933-
// "ToolTip.border", blackLineBorder,
1930+
"ToolTip.font", sansSerifPlain12,
1931+
"ToolTip.background", table.get("info"),
1932+
"ToolTip.foreground", table.get("infoText"),
1933+
"ToolTip.border", blackLineBorder,
19341934
// ToolTips also support backgroundInactive, borderInactive,
19351935
// and foregroundInactive
19361936

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package swingjs.plaf;
2+
3+
4+
import java.awt.Dimension;
5+
6+
import javax.swing.JComponent;
7+
import javax.swing.JRootPane;
8+
import javax.swing.LookAndFeel;
9+
import swingjs.api.js.DOMNode;
10+
11+
public class JSDesktopIconUI extends JSPanelUI {
12+
13+
int frameZ = 10000;
14+
public JSDesktopIconUI() {
15+
isContainer = true;
16+
17+
18+
System.out.println("JSSDesktopIconUI SURRAGATE -- NOT IMPLEMENTED YET! ");
19+
20+
21+
22+
setDoc();
23+
}
24+
25+
@Override
26+
protected DOMNode updateDOMNode() {
27+
if (domNode == null) {
28+
JRootPane root = jc.getRootPane();
29+
isContentPane = (root != null && jc == root.getContentPane());
30+
domNode = newDOMObject("div", id);
31+
if (root != null && root.getGlassPane() == c)
32+
DOMNode.setVisible(domNode, false);
33+
}
34+
return domNode;
35+
}
36+
37+
@Override
38+
protected Dimension setHTMLSize(DOMNode obj, boolean addCSS) {
39+
// SwingJS for now: just designated container width/height
40+
return new Dimension(c.getWidth(), c.getHeight());
41+
}
42+
43+
44+
@Override
45+
public void installUI(JComponent jc) {
46+
LookAndFeel.installColorsAndFont(jc,
47+
"Panel.background",
48+
"Panel.foreground",
49+
"Panel.font");
50+
}
51+
52+
@Override
53+
public void uninstallUI(JComponent jc) {
54+
// TODO Auto-generated method stub
55+
56+
}
57+
58+
@Override
59+
public Dimension getPreferredSize() {
60+
return null;
61+
}
62+
63+
64+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package swingjs.plaf;
2+
3+
4+
import java.awt.Dimension;
5+
6+
import javax.swing.JComponent;
7+
import javax.swing.JRootPane;
8+
import javax.swing.LookAndFeel;
9+
import swingjs.api.js.DOMNode;
10+
11+
public class JSInternalFrameUI extends JSLightweightUI {
12+
13+
int frameZ = 10000;
14+
public JSInternalFrameUI() {
15+
isContainer = true;
16+
setDoc();
17+
}
18+
19+
@Override
20+
protected DOMNode updateDOMNode() {
21+
if (domNode == null) {
22+
JRootPane root = jc.getRootPane();
23+
isContentPane = (root != null && jc == root.getContentPane());
24+
domNode = newDOMObject("div", id);
25+
if (root != null && root.getGlassPane() == c)
26+
DOMNode.setVisible(domNode, false);
27+
}
28+
return domNode;
29+
}
30+
31+
@Override
32+
protected Dimension setHTMLSize(DOMNode obj, boolean addCSS) {
33+
// SwingJS for now: just designated container width/height
34+
return new Dimension(c.getWidth(), c.getHeight());
35+
}
36+
37+
38+
@Override
39+
public void installUI(JComponent jc) {
40+
LookAndFeel.installColorsAndFont(jc,
41+
"Panel.background",
42+
"Panel.foreground",
43+
"Panel.font");
44+
}
45+
46+
@Override
47+
public void uninstallUI(JComponent jc) {
48+
// TODO Auto-generated method stub
49+
50+
}
51+
52+
@Override
53+
public Dimension getPreferredSize() {
54+
return null;
55+
}
56+
57+
58+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package swingjs.plaf;
2+
3+
4+
import java.awt.Dimension;
5+
6+
import javax.swing.JComponent;
7+
import javax.swing.JRootPane;
8+
import javax.swing.LookAndFeel;
9+
import swingjs.api.js.DOMNode;
10+
11+
public class JSTabbedPaneUI extends JSPanelUI {
12+
13+
14+
int frameZ = 10000;
15+
public JSTabbedPaneUI() {
16+
isContainer = true;
17+
setDoc();
18+
19+
20+
System.out.println("JSTabbedPaneUI SURRAGATE -- NOT IMPLEMENTED YET! ");
21+
22+
}
23+
24+
@Override
25+
protected DOMNode updateDOMNode() {
26+
if (domNode == null) {
27+
JRootPane root = jc.getRootPane();
28+
isContentPane = (root != null && jc == root.getContentPane());
29+
domNode = newDOMObject("div", id);
30+
if (root != null && root.getGlassPane() == c)
31+
DOMNode.setVisible(domNode, false);
32+
}
33+
return domNode;
34+
}
35+
36+
@Override
37+
protected Dimension setHTMLSize(DOMNode obj, boolean addCSS) {
38+
// SwingJS for now: just designated container width/height
39+
return new Dimension(c.getWidth(), c.getHeight());
40+
}
41+
42+
43+
@Override
44+
public void installUI(JComponent jc) {
45+
LookAndFeel.installColorsAndFont(jc,
46+
"Panel.background",
47+
"Panel.foreground",
48+
"Panel.font");
49+
}
50+
51+
@Override
52+
public void uninstallUI(JComponent jc) {
53+
// TODO Auto-generated method stub
54+
55+
}
56+
57+
@Override
58+
public Dimension getPreferredSize() {
59+
return null;
60+
}
61+
62+
63+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package swingjs.plaf;
2+
3+
4+
import java.awt.Dimension;
5+
6+
import javax.swing.JComponent;
7+
import javax.swing.JRootPane;
8+
import javax.swing.LookAndFeel;
9+
import swingjs.api.js.DOMNode;
10+
11+
public class JSToolTipUI extends JSLightweightUI {
12+
13+
int frameZ = 10000;
14+
public JSToolTipUI() {
15+
isContainer = true;
16+
setDoc();
17+
}
18+
19+
@Override
20+
protected DOMNode updateDOMNode() {
21+
if (domNode == null) {
22+
JRootPane root = jc.getRootPane();
23+
//isContentPane = (root != null && jc == root.getContentPane());
24+
domNode = newDOMObject("div", id);
25+
DOMNode.setVisible(domNode, false);
26+
}
27+
return domNode;
28+
}
29+
30+
@Override
31+
protected Dimension setHTMLSize(DOMNode obj, boolean addCSS) {
32+
// SwingJS for now: just designated container width/height
33+
return new Dimension(c.getWidth(), c.getHeight());
34+
}
35+
36+
37+
@Override
38+
public void installUI(JComponent jc) {
39+
LookAndFeel.installColorsAndFont(jc,
40+
"Panel.background",
41+
"Panel.foreground",
42+
"Panel.font");
43+
}
44+
45+
@Override
46+
public void uninstallUI(JComponent jc) {
47+
// TODO Auto-generated method stub
48+
49+
}
50+
51+
@Override
52+
public Dimension getPreferredSize() {
53+
return null;
54+
}
55+
56+
57+
}

0 commit comments

Comments
 (0)