Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
08223f2
Fix for BufferedImage rotation
Oct 23, 2018
700bc4e
Moving a2s.A2SEvent to java.awt
Oct 23, 2018
c1a13c8
dev-noA2S -- moving a2s/ to swingjs/a2s
Oct 23, 2018
e399cd9
swingjs/a2s/_README.txt
Oct 24, 2018
3bcc855
JAXB marshaller/unmarshaller for List<Object>, Map<Object,Object>
Oct 25, 2018
377f1ad
JAXB enum marshalling/unmarshalling
Oct 27, 2018
a563e73
adds @XmlTransient
Oct 27, 2018
b6a5eec
checkbox group fix
Oct 30, 2018
3759232
JAXB tested for XmlAccessorTypes FIELD, NONE
Oct 30, 2018
5f764b5
JAXB test files
Oct 30, 2018
7483d51
updated swingjs/ files
Oct 30, 2018
6384bdf
adds org.json
Oct 30, 2018
6489372
JAXB marshaller fix
Oct 30, 2018
2f66d4a
adds URL.getResponseCode()
Oct 30, 2018
fe33526
update for swingjs/
Oct 30, 2018
1b6d50b
update for swingjs/
Oct 30, 2018
5e2b900
swingjs/ update
Oct 30, 2018
245caa7
swingjs/ upgrade fixes HTTPConnection.getResponseCode()
Oct 30, 2018
4ea97a1
working on JAXB
Oct 31, 2018
b74819f
Utilizing package-info.java for package-level marshalling information
Nov 1, 2018
519d437
Adds package-info support for namespace
Nov 1, 2018
aec06c1
uses ObjectFactory (hack) to get QNAME
Nov 1, 2018
d809361
streamlined marshaller, XmlEnum support
Nov 1, 2018
7720a45
JAXB update complete
Nov 2, 2018
338ae6d
JAXB XMLEnumValue for attributes
Nov 2, 2018
fe8c7c3
JAXB for attribute enums
Nov 2, 2018
8b6f1f0
additional JAXB work
Nov 4, 2018
3dde6e2
Java2Script/SwingJS 3.2.4.02 further support for JAXB
Nov 4, 2018
5e03b04
JAXB marshalling by JavaScript successfully unmarshalled in Java
Nov 6, 2018
7faba8a
JAXB unmarshalling succesful for Jalview session
Nov 7, 2018
a50eb59
eclipse note; j2s config TODO note
Nov 7, 2018
8cd9407
JAXB unmarshaller fix for field.unmarshallingClassName bug
Nov 7, 2018
928951b
DOMNode.getAttr fix for returning "" not null
Nov 9, 2018
beedf11
JAXB fix for unmarshalling objects
Nov 9, 2018
fd513eb
fix for TableUI with null cell value
Nov 9, 2018
8db24ee
JAXB, more
Nov 9, 2018
de1e8e5
SwingJS-site.zip update
Nov 9, 2018
6ec873b
fixes missing border ui for table
Nov 11, 2018
e517bce
removes debug comment
Nov 11, 2018
7b030af
JAXB fixes; adds @XmlElements
Nov 11, 2018
c2119ab
JTable performance improvements
Nov 11, 2018
99d60d1
JSplitPane implemented; frame jump fixed
Nov 11, 2018
9983931
JInternalFrames closing but not being removed from Desktop
Nov 11, 2018
58cbac6
// fixes String.CASE_INSENSITIVE_ORDER.compare$S$S
Nov 11, 2018
30cac34
JSJAXBUnmarshaller not clearing statics
Nov 11, 2018
2e408ac
JAXB, JInternalFrame, JTable, String fixes
Nov 11, 2018
2287fa2
removing 0.5-pixel antialias default shift; just does not work for
Nov 11, 2018
9037548
Merge branch 'hanson1' of https://github.com/BobHanson/java2script.git
Nov 12, 2018
5a28d57
0-length zip
Nov 12, 2018
5ad524c
corrects missing hashCode()
Nov 14, 2018
4f44662
tests for right-alignment
Nov 14, 2018
b70e70e
removes unnecessary synthetic reference for inner class ref
Nov 14, 2018
7ab5c49
adds overflow:hidden to JFrame title bar
Nov 14, 2018
45e2943
smooths tooltip presentation when it is rapidly changing
Nov 14, 2018
b2eb313
update of SwingJS-site.zip and net.sf.j2s.core.jar
Nov 14, 2018
c3dc92a
tooltip debug message removed
Nov 15, 2018
c76b982
JMenu select/deselect enabled
Nov 15, 2018
9a1d657
JMenu select/deselect enabled
Nov 15, 2018
3d3558b
Merge branch 'hanson1' of https://github.com/BobHanson/java2script.gi…
Nov 15, 2018
c7c7761
JSFrame and JSDialog need parameter aliasing as Frame, Dialog
Nov 15, 2018
b5e7018
Adds J2S.getCachedJavaFile(); update for Frame/Dialog
Nov 15, 2018
07aa0b9
disallowing tooltip for modal-blocked dialog
Nov 16, 2018
d38d2a9
fixing menu dynamic add/remove
Nov 16, 2018
289d9a6
fixing modal block z-index
Nov 16, 2018
1af085f
fixing panel should be overflow:hidden
Nov 16, 2018
617ec32
fixing JSComboBox not disabling
Nov 16, 2018
4fdeb89
fixing TypeError does not have getLocaleMessage
Nov 16, 2018
4569409
SwingJS-site.zip update
Nov 16, 2018
2439f08
fix for validate not running when w or h == 0
Nov 16, 2018
1fecfbb
menus
Nov 17, 2018
dbbd5df
menus - SwingJS-site.zip
Nov 17, 2018
df97f3c
Merge branch 'hanson1' of https://github.com/BobHanson/java2script.gi…
Nov 17, 2018
20e3002
menu opener triangle spacing 10ex and \u23F5 not \u25B8
Nov 17, 2018
d9c3b03
Merge branch 'hanson1' of https://github.com/BobHanson/java2script.gi…
Nov 17, 2018
f9ca11b
menu fonts/padding correction
Nov 17, 2018
3012176
menu fonts/padding correction
Nov 17, 2018
053bc55
Merge branch 'hanson1' of https://github.com/BobHanson/java2script.git
Nov 17, 2018
0dc5aea
Menu font line spacing fix
Nov 17, 2018
3e004f5
fixes menu fix
Nov 17, 2018
4824978
fix for applications accessing file "./"
Nov 17, 2018
53772b2
adds move for fdrag, giving splitpane cursor
Nov 17, 2018
5665196
misc fixes
Nov 18, 2018
462750b
resetting default width/height to 500
Nov 18, 2018
ec61093
JTable drag of columns and rows
Nov 18, 2018
940d5be
JScrollbar/JSlider fix for UI/class notification infinite loop
Nov 19, 2018
8a1af7e
menu, scrollbar fixes
Nov 21, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
misc fixes
adds move cursor for JSplitPane
corrects EventDispatchThread miscoding
adds dummy frame consideration for SwingUtilities.SharedOwnerFrame
sets mouse click for multiple click from jqevent.originalEvent
adds JSplitPane drag cursor on mouse move
fixes JComboBox not being disabled
fixes early setCursor before peer is created
  • Loading branch information
hansonr authored and hansonr committed Nov 18, 2018
commit 566519639825d2fce249c091a7d2ee8df348f076
Binary file modified sources/net.sf.j2s.core/dist/swingjs/SwingJS-site.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20181117145755
20181117231441
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/SwingJS-site.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20181117145755
20181117231441
Binary file modified sources/net.sf.j2s.java.core/dist/SwingJS-site.zip
Binary file not shown.
3 changes: 2 additions & 1 deletion sources/net.sf.j2s.java.core/src/java/awt/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -2884,7 +2884,8 @@ final void updateCursorImmediately() {
// cPeer.updateCursorImmediately();
// }
// } else if (peer != null) {
peer.updateCursorImmediately();
if (peer != null)
peer.updateCursorImmediately();
// }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ public void run() {
}
};
JSThread me = this;
JSFunction f = /** @j2sNative function() {r.run$();me.run1$I(mode)} || */ null;
int mode = LOOP;
JSFunction f = /** @j2sNative function() {r.run$();me.run1$I(mode)} || */ null;
JSToolkit.dispatch(f, 0, 0);
// handling sleepAndReturn myself
// and once through only
Expand Down
5 changes: 5 additions & 0 deletions sources/net.sf.j2s.java.core/src/javax/swing/JFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,11 @@ public JFrame(String title, GraphicsConfiguration gc, String uiid) {
rootPane.addNotify(); // builds a peer for the root pane
}

public JFrame(Object object, Object object2, Object object3, Object object4) {
uiClassID = "FrameUI";

}

private static int frameCount;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1765,7 +1765,7 @@ public static ActionMap getUIActionMap(JComponent component) {
static class SharedOwnerFrame extends JFrame implements WindowListener {

SharedOwnerFrame() {
super(); // required by SwingJS
super(null, null, null, null); // required by SwingJS
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions sources/net.sf.j2s.java.core/src/swingjs/JSMouse.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ private void clicked(long time, int x, int y, int modifiers, int clickCount) {
// clearKeyBuffer();
// clickedCount is not reliable on some platforms
// so we will just deal with it ourselves
mouseAction(MouseEvent.MOUSE_CLICKED, time, x, y, 1, modifiers, 0);
mouseAction(MouseEvent.MOUSE_CLICKED, time, x, y, clickCount, modifiers, 0);
}

private boolean isCtrlShiftMouseDown; // Macintosh may not recognize CTRL-SHIFT-LEFT as
Expand Down Expand Up @@ -278,7 +278,7 @@ private void mouseAction(int id, long time, int x, int y, int xcount,
extended == InputEvent.META_DOWN_MASK ||
JSToolkit.isMac && extended == (InputEvent.CTRL_DOWN_MASK | InputEvent.BUTTON1_DOWN_MASK));
int button = getButton(modifiers);
int count = updateClickCount(id, time, x, y);
int count = (xcount > 1 && id == MouseEvent.MOUSE_CLICKED ? xcount : updateClickCount(id, time, x, y));

Component source = viewer.getTopComponent(); // may be a JFrame
MouseEvent e;
Expand Down
4 changes: 2 additions & 2 deletions sources/net.sf.j2s.java.core/src/swingjs/JSToolkit.java
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,8 @@ private static void invokeAndWait(JSFunction f, int id) {
* var id0 = SwingJS.eventID || 0;
* SwingJS.eventID = id;
* java.lang.Thread.thisThread = thread;
* if (f.run)
* f.run();
* if (f.run$)
* f.run$();
* else
* f();
* SwingJS.eventID = id0;
Expand Down
26 changes: 17 additions & 9 deletions sources/net.sf.j2s.java.core/src/swingjs/plaf/JSComboBoxUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import javajs.util.PT;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.LookAndFeel;
Expand All @@ -23,7 +21,7 @@
*
*/

public class JSComboBoxUI extends JSLightweightUI implements PropertyChangeListener, ItemListener, ListDataListener {
public class JSComboBoxUI extends JSLightweightUI implements ItemListener, ListDataListener {

private JComboBox comboBox;

Expand All @@ -43,11 +41,21 @@ public DOMNode updateDOMNode() {
addJQueryFocusCallbacks();
}
populateList();
checkEnabled();
return domNode;
}

private void checkEnabled() {
if (comboBox.isEnabled())
domNode.removeAttribute("disabled");
else
DOMNode.setAttr(domNode, "disabled", "true");
return domNode;
}


@Override
public void setEnabled(boolean b) {
checkEnabled();
}

@Override
Expand Down Expand Up @@ -149,11 +157,11 @@ protected void uninstallListeners() {



@Override
public void propertyChange(PropertyChangeEvent evt) {
if (debugging)
System.out.println("JSComboBoxUI propertychange " + evt);
}
// @Override
// public void propertyChange(PropertyChangeEvent evt) {
// if (debugging)
// System.out.println("JSComboBoxUI propertychange " + evt);
// }

@Override
public boolean contains(JComponent c, int x, int y) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ public void setDraggable(JSFunction f) {
// */
// private boolean zeroWidth;

protected boolean isDummyFrame;

/**
* indicates that in a toolbar, this component should use its preferred size for
* min and max
Expand Down Expand Up @@ -1190,6 +1192,10 @@ protected DOMNode setHTMLElementCUI() {
if (!isTainted)
return outerNode;

if (isDummyFrame) {
isTainted = false;
return (outerNode = DOMNode.createElement("div", "dummyFrame"));
}
updateDOMNode();
checkTransparent(domNode);
Component[] children = getChildren();
Expand Down
14 changes: 10 additions & 4 deletions sources/net.sf.j2s.java.core/src/swingjs/plaf/JSFrameUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public JSFrameUI() {
frameZ += 1000;
z = frameZ;
isContainer = true;
defaultHeight = 500;
defaultWidth = 500;
defaultHeight = 0;
defaultWidth = 0;
setDoc();
}

Expand All @@ -76,6 +76,8 @@ public DOMNode updateDOMNode() {
// page too much.
// a Windows applet has a sort of fuzzy shadowy border
domNode = frameNode = newDOMObject("div", id + "_frame");
if (isDummyFrame)
return domNode;
DOMNode.setStyles(frameNode, "box-shadow", "0px 0px 10px gray", "box-sizing", "content-box");
setWindowClass();
int w = c.getWidth();
Expand Down Expand Up @@ -227,7 +229,9 @@ protected void setInnerComponentBounds(int width, int height) {
public void installUI(JComponent jc) {
super.installUI(jc);
// jc is really JFrame, even though JFrame is not a JComponent
frame = (JFrame) c;
frame = (JFrame) c;
isDummyFrame = frame.getClass().getName().equals("javax.swing.SwingUtilities$SharedOwnerFrame");

LookAndFeel.installColors(jc,
"Frame.background",
"Frame.foreground");
Expand Down Expand Up @@ -294,7 +298,7 @@ public Rectangle getBoundsPrivate() {

@Override
public Insets getInsets() {
return jc.getFrameViewer().getInsets();
return (isDummyFrame ? null : jc.getFrameViewer().getInsets());
}

@Override
Expand All @@ -311,6 +315,8 @@ public void propertyChange(PropertyChangeEvent e) {

@Override
public void setVisible(boolean b) {
if (isDummyFrame)
b = false;
super.setVisible(b);
if (isModal) {
if (b) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ static void loadActionMap(LazyActionMap map) {

@Override
public void paint(Graphics g, JComponent c) {
checkTextAreaHeight();
// unnecessary updateScrollBarExtents();
Border vpBorder = scrollpane.getViewportBorder();
if (vpBorder != null) {
Rectangle r = scrollpane.getViewportBorderBounds();
vpBorder.paintBorder(scrollpane, g, r.x, r.y, r.width, r.height);
}
// checkTextAreaHeight();
//// unnecessary updateScrollBarExtents();
// Border vpBorder = scrollpane.getViewportBorder();
// if (vpBorder != null) {
// Rectangle r = scrollpane.getViewportBorderBounds();
// vpBorder.paintBorder(scrollpane, g, r.x, r.y, r.width, r.height);
// }
}

// private void updateScrollBarExtents() {
Expand Down
68 changes: 39 additions & 29 deletions sources/net.sf.j2s.java.core/src/swingjs/plaf/JSSplitPaneUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@

package swingjs.plaf;

//import java.awt.Canvas;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;

import javajs.api.JSFunction;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
Expand All @@ -46,13 +41,18 @@
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
//import java.awt.Canvas;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JSplitPane;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;

import javajs.api.JSFunction;
import swingjs.api.js.DOMNode;

/**
Expand Down Expand Up @@ -187,7 +187,7 @@ public Dimension getPreferredSize() {

private Cursor cursor;

private Object xyev;
Object xyev;

private int pressedLocation;

Expand Down Expand Up @@ -217,6 +217,7 @@ public Dimension getPreferredSize() {
@Override
public void installUI(JComponent jc) {
splitPane = (JSplitPane) jc;
isHorizontal = (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT);
dividerLocationIsSet = false;
dividerKeyboardResize = false;
keepHidden = false;
Expand All @@ -227,33 +228,35 @@ public void installUI(JComponent jc) {
}

protected void fHandleDrag(Object xyev, int type) {
isHorizontal = (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT);
getCursor();
switch (type) {
case MouseEvent.MOUSE_MOVED:
divider.setCursor(cursor);
break;
case MouseEvent.MOUSE_PRESSED:
this.xyev = xyev;
this.pressedLocation = splitPane.getDividerLocation();
divider.setCursor(cursor);
DOMNode.setCursor(getCursorName(cursor), null);
break;
case MouseEvent.MOUSE_DRAGGED:
int d = this.pressedLocation + /** @j2sNative (this.isHorizontal ? xyev.dx : xyev.dy) || */ 0;
int max = getMaximumDividerLocation(splitPane);
int min = getMinimumDividerLocation(splitPane);
d = Math.max(min, Math.min(max, d));
splitPane.setDividerLocation(d);
break;
case MouseEvent.MOUSE_RELEASED:
DOMNode.setCursor(null, null);
divider.setCursor(null);
break;
}
if (splitPane.isEnabled())
switch (type) {
case MouseEvent.MOUSE_MOVED:
divider.setCursor(cursor);
return;
case MouseEvent.MOUSE_PRESSED:
this.xyev = xyev;
this.pressedLocation = splitPane.getDividerLocation();
divider.setCursor(cursor);
DOMNode.setCursor(getCursorName(cursor), null);
return;
case MouseEvent.MOUSE_DRAGGED:
int d = this.pressedLocation + /** @j2sNative (this.isHorizontal ? xyev.dx : xyev.dy) || */
0;
int max = getMaximumDividerLocation(splitPane);
int min = getMinimumDividerLocation(splitPane);
d = Math.max(min, Math.min(max, d));
splitPane.setDividerLocation(d);
return;
case MouseEvent.MOUSE_RELEASED:
break;
}
DOMNode.setCursor(null, null);
divider.setCursor(null);
}

private Cursor getCursor() {
isHorizontal = (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT);
if (cursor == null) {
cursor = Toolkit.getDefaultToolkit().createCustomCursor(null, null, isHorizontal ? "col-resize" : "row-resize");
}
Expand All @@ -263,6 +266,7 @@ private Cursor getCursor() {
private void setupDivider() {
divider = new SplitPaneDivider(this);
JSFunction fDrag = null;
@SuppressWarnings("unused")
JSSplitPaneUI me = this;

/**
Expand Down Expand Up @@ -2192,4 +2196,10 @@ public void focusLost(FocusEvent ev) {
// return new KeyboardResizeToggleHandler();
// }

@Override
public void setEnabled(boolean b) {
super.setEnabled(b);
splitPane.setCursor(b ? getCursor() : null);
}

}
10 changes: 10 additions & 0 deletions sources/net.sf.j2s.java.core/src/test/Test_Applet_2.java
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,9 @@ class Test_2Controls extends JPanel implements ItemListener {
private ButtonGroup bg;

public Test_2Controls(Test_2Canvas canvas) {

setBackground(Color.white);

setLayout(new FlowLayout());
// default for JPanel, but
// being explicit allows debugging.
Expand All @@ -757,6 +760,7 @@ public Test_2Controls(Test_2Canvas canvas) {
.getClassLoader()
.getResource("test/test2.png"), "test");
JLabel l = new JLabel(text, icon, SwingConstants.LEFT);

add(l);
JCheckBox c = new JCheckBox("test");
c.addItemListener(this);
Expand All @@ -777,6 +781,10 @@ public Test_2Controls(Test_2Canvas canvas) {
@Override
public void actionPerformed(ActionEvent e) {
enableButtons(enableBtn.getText().equals("Enable"));

bg0.setOpaque(false);
bg0.setBackground(Color.green);

}

private void enableButtons(boolean isEnable) {
Expand All @@ -795,6 +803,8 @@ private JComponent addButton(ButtonGroup bg, String text, boolean b) {
bg.add(c = new JRadioButton(text, b));
c.setName(text);
add(c);
c.setBackground(Color.blue);
System.out.println("radio is opaque " + c.isOpaque());
c.setEnabled(false);
c.addItemListener(this);
c.setFont(new Font("Arial", Font.PLAIN & Font.BOLD, 10));
Expand Down
Loading