Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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 @@
20190316185356
20190319211418
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 @@
20190316185356
20190319211418
Binary file modified sources/net.sf.j2s.java.core/dist/SwingJS-site.zip
Binary file not shown.
14 changes: 6 additions & 8 deletions sources/net.sf.j2s.java.core/src/java/awt/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -2385,17 +2385,15 @@ protected Dimension prefSizeComp() {
Dimension dim = prefSize;
if (dim == null || !(isPreferredSizeSet() || isValid())) {
// synchronized (getTreeLock()) {

// SwingJS TODO: it is not clear that we should deliver getMinimumSize here.
//
prefSize = // (
dim = (width != 0 || height != 0 ? null
: isDisplayable() ? //
// peer != null) ?
// peer.preferredSize() :
(width == 0 && height == 0 ? getMinimumSize() : new Dimension(width, height));
dim = prefSize;
peer.getPreferredSize() :
getMinimumSize());
prefSize = dim;
}
// }
return new Dimension(dim);
return (dim == null ? new Dimension(width, height) : new Dimension(dim));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ public interface ComponentPeer {

Point getLocationOnScreen();

// SwingJS -- never called by Java
Dimension getPreferredSize();
//

Dimension getMinimumSize();

ColorModel getColorModel();
Expand Down
3 changes: 0 additions & 3 deletions sources/net.sf.j2s.java.core/src/javax/swing/JTextArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import javax.swing.text.Element;
import javax.swing.text.JTextComponent;
import javax.swing.text.PlainDocument;

import swingjs.api.JSMinimalAbstractDocument;

/**
Expand Down Expand Up @@ -240,8 +239,6 @@ public String getUIClassID() {
* @return the default document model
*/
protected Document createDefaultModel() {
// SwingJS
// return JSToolkit.getPlainDocument(this);
return new PlainDocument();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2958,7 +2958,7 @@ public Insets getInsets() {

@Override
public void beginValidate() {
System.out.println("JSCUI beginValidate " + id);
//System.out.println("JSCUI beginValidate " + id);
}

@Override
Expand Down
87 changes: 52 additions & 35 deletions sources/net.sf.j2s.java.core/src/swingjs/plaf/JSFrameUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ public JSFrameUI() {
}


protected void selected() {
((JFrame) jc).toFront();
}

// public void notifyFrameMoved() {
// Toolkit.getEventQueue().postEvent(new ComponentEvent(frame,
// ComponentEvent.COMPONENT_MOVED));
Expand Down Expand Up @@ -119,36 +115,7 @@ public DOMNode updateDOMNode() {
DOMNode.setTopLeftAbsolute(modalNode, 0, 0);
DOMNode.setSize(modalNode, screen.width, screen.height);
}
// we have to wait until the frame is wrapped.
@SuppressWarnings("unused")
DOMNode fnode = frameNode;

JSFunction fGetFrameParent = null;
/**
* @j2sNative var me = this;
* fGetFrameParent = function(mode, x, y) {
* switch(arguments.length) {
* case 1:
* if (mode == 501)
* me.selected$();
* me.hideMenu$();
* return $(fnode).parent();
* case 3:
* if (mode == 506) {
* me.moveFrame$I$I(x, y);
* return null;
* }
* }
*
* return null;
* }
*/
{
hideMenu();
}


J2S.setDraggable(titleBarNode, fGetFrameParent);
setDraggableEvents();
titleBarNode.appendChild(titleNode);
titleBarNode.appendChild(closerWrap);
closerWrap.appendChild(closerNode);
Expand All @@ -173,7 +140,51 @@ public DOMNode updateDOMNode() {
return domNode;
}

@Override
protected void setDraggableEvents() {
@SuppressWarnings("unused")
DOMNode fnode = frameNode;
JSFunction fGetFrameParent = null;
/**
* @j2sNative var me = this;
* fGetFrameParent = function(mode, x, y) {
* switch(arguments.length) {
* case 1:
* if (mode == 501)
* me.selected$();
* me.hideMenu$();
* return $(fnode).parent();
* case 3:
* if (mode == 506) {
* me.moveFrame$I$I(x, y);
* return null;
* }
* }
*
* return null;
* }
*/
{
selected();
moveFrame(0,0);
hideMenu();
}

J2S.setDraggable(titleBarNode, fGetFrameParent);
}


/**
* Do not change this method name
* referenced by j2sNative, above
*/
protected void selected() {
// subclassed by JSInternalFrameUI
((JFrame) jc).toFront();
}

/**
* Do not change this method name
* referenced by j2sNative, above
*/
/*not private*/ void hideMenu() {
Expand All @@ -182,7 +193,13 @@ public DOMNode updateDOMNode() {



void moveFrame(int x, int y) {
/**
* Do not change this method name
* referenced by j2sNative, above
* @param x
* @param y
*/
/*not private*/ void moveFrame(int x, int y) {
if (!isInternalFrame) {
x = Math.max(30 - frame.getWidth(), x);
y = Math.max(0, y);
Expand Down
38 changes: 35 additions & 3 deletions sources/net.sf.j2s.java.core/src/swingjs/plaf/JSTextAreaUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
import java.beans.PropertyChangeEvent;

import javax.swing.JTextArea;
import javax.swing.text.Document;
import javax.swing.text.Element;
import javax.swing.text.JTextComponent;
import javax.swing.text.PlainView;
import javax.swing.text.View;
import javax.swing.text.WrappedPlainView;

import swingjs.JSToolkit;
import swingjs.api.js.DOMNode;
Expand Down Expand Up @@ -45,12 +51,20 @@ public DOMNode updateDOMNode() {
@Override
public void propertyChange(PropertyChangeEvent e) {
String prop = e.getPropertyName();
if (prop == "ancestor") {
// Object newValue = e.getNewValue();
// Object oldValue = e.getOldValue();
switch(prop) {
case "ancestor":
setJ2sMouseHandler();
}
break;
}
super.propertyChange(e);
}


protected void updateRootView() {
useRootView = true;
rootView.setView(create(editor.getDocument().getDefaultRootElement()));// does not take into account nested documents like HTML (I guess)
}
/**
* Get the real height and width of the text in a JavaScript textarea
* Used by JSScrollPaneUI
Expand Down Expand Up @@ -109,4 +123,22 @@ protected DOMNode setHTMLElement() {
"position", "absolute");
}

/**
* Creates the view for an element. Returns a WrappedPlainView or PlainView.
*
* @param elem the element
* @return the view
*/
@Override
public View create(Element elem) {
JTextArea area = (JTextArea) c;
View v;
if (area.getLineWrap()) {
v = new WrappedPlainView(elem, area.getWrapStyleWord());
} else {
v = new PlainView(elem);
}
return v;
}

}
Loading