X Tutup
Skip to content

Commit 8c99799

Browse files
author
soheil_h_y
committed
1 parent eccff93 commit 8c99799

File tree

18 files changed

+100
-71
lines changed

18 files changed

+100
-71
lines changed

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/custom/CTabFolder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ public Rectangle computeTrim (int x, int y, int width, int height) {
568568
lineHeight--;
569569
}
570570
}
571-
System.err.println("]" + lineHeight);
571+
// System.err.println("]" + lineHeight);
572572
x -= 4;
573573
y -= 4 + lineHeight;
574574
width += 8;

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/custom/CTabItem.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ public void setControl (Control control) {
446446
if (control.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
447447
if (control.parent != parent) error (SWT.ERROR_INVALID_PARENT);
448448
}
449-
System.out.println("Ctab setControl " + control + " " + control.parent + " " + parent);
449+
// System.out.println("Ctab setControl " + control + " " + control.parent + " " + parent);
450450
if (this.control != null && this.control.isDisposed ()) {
451451
this.control = null;
452452
}
@@ -460,7 +460,7 @@ public void setControl (Control control) {
460460
if (newControl != null) {
461461
Rectangle clientArea = parent.getClientArea ();
462462
if (clientArea.height <= 0 || clientArea.width <= 0) {
463-
System.out.println("client area has trouble");
463+
// System.out.println("client area has trouble");
464464
} else {
465465
if(this.isSelected){
466466
newControl.setBounds (clientArea);

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/internal/struct/MESSAGE.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class MESSAGE {
2424
public static final int CONTROL_RESIZE = 1;
2525
public static final int CONTROL_LAYOUT = 2;
2626

27-
27+
public boolean defer;
2828
public Control control;
2929
public int type;
3030
public Object data;

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Combo.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
470470
}
471471
}
472472
*/
473-
System.out.println("Combo : " + width + " " + height + " hints " + wHint + " " + hHint);
473+
// System.out.println("Combo : " + width + " " + height + " hints " + wHint + " " + hHint);
474474
return new Point (width, height);
475475
}
476476

@@ -554,19 +554,19 @@ protected void createHandle () {
554554
if(isSimple){
555555
selectInput.style.top = height + "px";
556556
selectInput.style.left = textInput.style.left;
557-
System.out.println("is Simple " + isSimple);
557+
// System.out.println("is Simple " + isSimple);
558558
selectInput.className = "combo-select-box-visible";
559559
selectInput.size = visibleCount;
560560
handle.appendChild(selectInput);
561561
}else{
562562
selectInput.style.top = height + "px" ;
563563
selectInput.style.left = textInput.style.left;
564-
System.out.println("is Simple " + isSimple);
564+
// System.out.println("is Simple " + isSimple);
565565
selectInput.className = "combo-select-box-invisible combo-select-box-notsimple";
566566
selectInput.size = visibleCount;
567-
System.out.println("ho combo1 " + textInput.scrollHeight);
568-
System.out.println("ho combo2 " + textInput.offsetHeight);
569-
System.out.println("ho combo3 " + textInput.clientHeight);
567+
// System.out.println("ho combo1 " + textInput.scrollHeight);
568+
// System.out.println("ho combo2 " + textInput.offsetHeight);
569+
// System.out.println("ho combo3 " + textInput.clientHeight);
570570
//TODO: add the select to shell to be shown every where
571571

572572
getShell().handle.appendChild(selectInput);
@@ -575,7 +575,7 @@ protected void createHandle () {
575575

576576
textInput.ondblclick = new RunnableCompatibility() {
577577
public void run() {
578-
System.out.println("button clicked!");
578+
// System.out.println("button clicked!");
579579
if(!isSimple)
580580
show();
581581
}
@@ -584,15 +584,15 @@ public void run() {
584584

585585
dropDownButton.onclick = new RunnableCompatibility() {
586586
public void run() {
587-
System.out.println("button clicked!");
587+
// System.out.println("button clicked!");
588588
if(!isSimple)
589589
show();
590590
}
591591
};
592592

593593
selectInput.onchange = new RunnableCompatibility() {
594594
public void run() {
595-
System.out.println("select changed!" + selectInput.selectedIndex);
595+
// System.out.println("select changed!" + selectInput.selectedIndex);
596596
noSelection = false;
597597
updateSelection();
598598
if(!isSimple)
@@ -602,7 +602,7 @@ public void run() {
602602

603603
selectInput.onblur = new RunnableCompatibility() {
604604
public void run() {
605-
System.out.println("handle blurred!");
605+
// System.out.println("handle blurred!");
606606
// updateSelection();
607607
if(!isSimple)
608608
hide();
@@ -640,7 +640,7 @@ void show(){
640640
selectInput.className = "combo-select-box-visible" + (isSimple ? "" : " combo-select-box-notsimple");
641641
selectInput.style.top = coordinate.y + "px";
642642
selectInput.style.left = coordinate.x + "px";
643-
System.out.println("Z " + selectInput.style.zIndex);
643+
// System.out.println("Z " + selectInput.style.zIndex);
644644
selectInput.focus();
645645
}
646646

@@ -903,7 +903,7 @@ public int getSelectionIndex () {
903903
checkWidget ();
904904
if (noSelection) return -1;
905905
//return OS.SendMessage (handle, OS.CB_GETCURSEL, 0, 0);
906-
System.out.println("combo selected Index " + selectInput.selectedIndex);
906+
// System.out.println("combo selected Index " + selectInput.selectedIndex);
907907
return selectInput.selectedIndex;
908908
}
909909

@@ -1570,7 +1570,7 @@ void setBounds (int x, int y, int width, int height, int flags) {
15701570
}
15711571
selectInput.style.width = width + "px";
15721572

1573-
System.out.println("combo left " + this.left + " " + this.top + " textInput " +dropDownButton.style.width + " " + dropDownButton.style.height);
1573+
// System.out.println("combo left " + this.left + " " + this.top + " textInput " +dropDownButton.style.width + " " + dropDownButton.style.height);
15741574
}
15751575

15761576
/*

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Composite.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public class Composite extends Scrollable {
5252
int layoutCount = 0;
5353
// Control [] children = new Control[0];
5454
Control [] children;
55+
boolean waitingForLayoutWithResize;
5556

5657
/**
5758
* Prevents uninitialized instances from being created outside the package.
@@ -595,7 +596,7 @@ public void layout (boolean changed, boolean all) {
595596
*/
596597
public void layout (Control [] changed) {
597598
checkWidget ();
598-
System.out.print("control");
599+
// System.out.print("control");
599600
if (changed == null) error (SWT.ERROR_INVALID_ARGUMENT);
600601
Date d = new Date();
601602
int length = changed.length;
@@ -612,7 +613,7 @@ public void layout (Control [] changed) {
612613
}
613614
if (!ancestor) error (SWT.ERROR_INVALID_PARENT);
614615
}
615-
System.out.println(":::" + (new Date().getTime() - d.getTime()));
616+
// System.out.println(":::" + (new Date().getTime() - d.getTime()));
616617
d = new Date();
617618
int updateCount = 0;
618619
Composite [] update = new Composite [16];
@@ -635,12 +636,12 @@ public void layout (Control [] changed) {
635636
composite = child.parent;
636637
}
637638
}
638-
System.out.println(":::" + (new Date().getTime() - d.getTime()));
639+
// System.out.println(":::" + (new Date().getTime() - d.getTime()));
639640
d = new Date();
640641
for (int i=updateCount-1; i>=0; i--) {
641642
update [i].updateLayout (true, false);
642643
}
643-
System.out.println(":::" + (new Date().getTime() - d.getTime()));
644+
// System.out.println(":::" + (new Date().getTime() - d.getTime()));
644645
d = new Date();
645646
}
646647

@@ -1007,11 +1008,12 @@ void updateLayout (boolean resize, boolean all) {
10071008
if ((state & LAYOUT_NEEDED) != 0) {
10081009
boolean changed = (state & LAYOUT_CHANGED) != 0;
10091010
state &= ~(LAYOUT_NEEDED | LAYOUT_CHANGED);
1010-
if (resize) setResizeChildren (false);
1011+
// if (resize) setResizeChildren (false);
10111012
// layout.layout (this, changed);
1012-
this.waintingForLayout = true;
1013+
this.waitingForLayout = true;
1014+
this.waitingForLayoutWithResize = resize;
10131015
display.sendMessage(new MESSAGE(this, MESSAGE.CONTROL_LAYOUT, new boolean[] {resize, all}));
1014-
if (resize) setResizeChildren (true);
1016+
// if (resize) setResizeChildren (true);
10151017
}
10161018

10171019

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Control.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,7 @@ public void pack () {
15901590
public void pack (boolean changed) {
15911591
checkWidget ();
15921592
Point computeSize = computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
1593-
System.out.println(computeSize);
1593+
// System.out.println(computeSize);
15941594
setSize (computeSize);
15951595
}
15961596

@@ -2592,7 +2592,7 @@ public void setSize (int width, int height) {
25922592
public void setSize (Point size) {
25932593
checkWidget ();
25942594
if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
2595-
System.err.println(size);
2595+
// System.err.println(size);
25962596
setSize (size.x, size.y);
25972597
}
25982598

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Decorations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ public Rectangle computeTrim (int x, int y, int width, int height) {
360360
y -= 2;
361361
}
362362
}
363-
System.err.println( new Rectangle (x, y, width, height));
363+
// System.err.println( new Rectangle (x, y, width, height));
364364
return new Rectangle (x, y, width, height);
365365
/*
366366
/* Get the size of the trimmings *-/

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Display.java

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2933,67 +2933,89 @@ public void run() {
29332933
// List layoutQueue = new ArrayList();
29342934
MESSAGE[] msgs = Display.this.msgs;
29352935
if (msgs.length != 0) {
2936-
System.out.println("msgs.legnth" + msgs.length);
2936+
// System.out.println("msgs.legnth" + msgs.length);
2937+
MESSAGE[] defered = new MESSAGE[0];
2938+
2939+
int defsize = 0;
29372940
for (int i = msgs.length - 1; i >= 0; i--) {
29382941
MESSAGE m1 = msgs[i];
29392942
if (m1 == null) {
29402943
continue;
29412944
}
2942-
2945+
m1.defer = false;
29432946
for (int j = i - 1; j >= 0; j--) {
29442947
MESSAGE m2 = msgs[j];
29452948
if (m2 != null && m2.control == m1.control
29462949
&& m2.type == m1.type) {
29472950
msgs[j] = null;
2948-
2949-
// break;
29502951
}
29512952
}
29522953

29532954
if(m1.type == MESSAGE.CONTROL_LAYOUT){
2954-
if(m1.control.parent != null && m1.control.parent.waintingForLayout){
2955-
msgs[i] = null;
2955+
if(m1.control.parent != null && m1.control.parent.waitingForLayout){
2956+
// System.out.println(m1.control.getName()+ " is waiting for parent " +
2957+
// m1.control.parent.getName());
2958+
m1.defer = true;
2959+
defered[defsize++] = m1;
29562960
}
29572961
}
29582962

29592963
}
29602964
long time = 0;
29612965

2966+
29622967
for (int i = 0; i < msgs.length; i++) {
29632968
// for (int i = msgs.length - 1; i >= 0; i--) {
29642969
MESSAGE m = msgs[i];
2970+
2971+
if(m != null && m.defer){
2972+
// System.out.println("deffer " + m.control.getName());
2973+
continue;
2974+
}
29652975
msgs[i] = null;
29662976
if (m != null && m.type == MESSAGE.CONTROL_LAYOUT) {
2967-
m.control.waintingForLayout = false;
2977+
m.control.waitingForLayout = false;
29682978
if (!m.control.isVisible()) { continue; }
29692979
Date d = new Date();
29702980
Composite c = (Composite) m.control;
2981+
if(c.waitingForLayoutWithResize){
2982+
c.setResizeChildren (false);
2983+
}
29712984
if(c.layout != null){
29722985
c.layout.layout (c, (c.state & Composite.LAYOUT_CHANGED) != 0);
29732986
}
2987+
if(c.waitingForLayoutWithResize){
2988+
c.setResizeChildren (true);
2989+
c.waitingForLayoutWithResize = false;
2990+
}
2991+
29742992
if (m.data != null) {
29752993
boolean[] bs = (boolean[]) m.data;
29762994
c.updateLayout(bs[0], bs[1]);
29772995
} else {
29782996
c.layout();
29792997
}
29802998
time += new Date().getTime() - d.getTime();
2981-
System.err.println(c.getName() + " cost " + (time));
2999+
// System.err.println(c.getName() + " cost " + (time));
29823000
if (time > 200) {
2983-
System.out.println("before deferring:" + msgs.length);
3001+
// System.out.println("before deferring:" + msgs.length);
29843002
for (int j = i + 1; j < msgs.length; j++) {
29853003
msgs[j - i - 1] = msgs[j];
29863004
}
2987-
for (int j = 0; j < i; j++) {
2988-
msgs[msgs.length - 1 - j] = null;
3005+
// for (int j = 0; j < i; j++) {
3006+
// msgs[msgs.length - 1 - j] = null;
3007+
// }
3008+
int length = msgs.length - i - 1;
3009+
for(int j = 0; j < defsize; j++){
3010+
msgs[length + j] = defered[j];
29893011
}
29903012
/**
29913013
* @j2sNativeSrc
29923014
* msgs.length -= i + 1;
29933015
* @j2sNative
29943016
* a.length -= d + 1;
29953017
*/ {}
2996-
System.out.println("after deferring:" + msgs.length);
3018+
// System.out.println("after deferring:" + msgs.length);
29973019
return ;
29983020
}
29993021
}
@@ -3004,6 +3026,10 @@ public void run() {
30043026
* @j2sNative
30053027
* a.length = 0;
30063028
*/ {}
3029+
Display.this.msgs = defered;
3030+
// for(int j = 0; j < defsize; j++){
3031+
// msgs[j] = defered[j];
3032+
// }
30073033
}
30083034
}
30093035
}, 100);

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/ScrollBar.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ public void setValues (int selection, int minimum, int maximum, int thumb, int i
850850
*/
851851
public void setVisible (boolean visible) {
852852
checkWidget();
853-
System.out.println("setvisible of scrollbar called : " + visible + " parent : " + parent);
853+
// System.out.println("setvisible of scrollbar called : " + visible + " parent : " + parent);
854854
boolean isVisible = (state & HIDDEN) == 0;
855855
if (isVisible == visible) return;
856856
if(visible) {
@@ -868,14 +868,14 @@ public void setVisible (boolean visible) {
868868
}
869869
String className = this.parent.handle.className;
870870
int idx = this.parent.handle.className.indexOf(scrollClass);
871-
System.out.println("parent scroll class name is " + className + " " + idx + " " + visible);
871+
// System.out.println("parent scroll class name is " + className + " " + idx + " " + visible);
872872
if(!visible && idx != -1){
873873
className = className.substring(0, idx) + className.substring(idx + scrollClass.length());
874874
}
875875
else if(visible && idx == -1){
876876
className += " " + scrollClass;
877877
}
878-
System.out.println("setting parent scrollable to " + className);
878+
// System.out.println("setting parent scrollable to " + className);
879879
this.parent.handle.className = className;
880880
/*
881881
/*

0 commit comments

Comments
 (0)
X Tutup