Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit181eda3

Browse files
author
zhourenjian
committed
Add scrollbars support for desktop HTML
Add configuration support of window["swt.notification.corner.autohide"]=true; window["swt.quick.launch.autohide"]=true; and window["swt.task.bar.autohide"]=true; for automatically hidingFixed bug that IE does not correspond to window resize events.
1 parent52d28c2 commit181eda3

File tree

10 files changed

+231
-59
lines changed

10 files changed

+231
-59
lines changed

‎sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/internal/ResizeSystem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
if (document.addEventListener) {
3535
window.addEventListener('resize', $browserLayoutResize, true);
3636
} else if (document.attachEvent) {
37-
document.attachEvent('onresize', $browserLayoutResize);
37+
window.attachEvent('onresize', $browserLayoutResize);
3838
}
3939
*/
4040
publicclassResizeSystem {

‎sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/internal/browser/OS.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,9 +833,12 @@ public static int getFixedBodyClientWidth() {
833833
intpcWidth =p.clientWidth;
834834
if (OS.isIE) {// && !OS.isOpera
835835
return (pcWidth ==0) ?bcWidth :pcWidth;
836-
}elseif (OS.isFirefox ||OS.isSafari) {
836+
}elseif (OS.isFirefox ||OS.isSafari ||OS.isOpera) {
837+
returnpcWidth;
838+
/*
837839
return (pcWidth == p.offsetWidth
838840
&& pcWidth == p.scrollWidth) ? bcWidth : pcWidth;
841+
*/
839842
}
840843
returnbcWidth;
841844
}

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

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -596,20 +596,22 @@ protected static void createResizeHandles(Element handle) {
596596
}
597597
}
598598

599-
protectedstaticvoidcreateShadowHandles(Elementhandle) {
599+
protectedstaticvoidappendShadowHandles(Elementhandle,booleantop,booleanright,booleanbottom,booleanleft) {
600600
String[]handles =newString[] {
601-
"shadow-left-top",
602-
"shadow-right-top",
603-
"shadow-center-top",
604-
"shadow-left-middle",
605-
"shadow-right-middle",
601+
left &&top ?"shadow-left-top" :null,
602+
right &&top ?"shadow-right-top" :null,
603+
top ?"shadow-center-top" :null,
604+
left ?"shadow-left-middle" :null,
605+
right ?"shadow-right-middle" :null,
606606
"shadow-center-middle",
607-
"shadow-left-bottom",
608-
"shadow-right-bottom",
609-
"shadow-center-bottom"
607+
left &&bottom ?"shadow-left-bottom" :null,
608+
right &&bottom ?"shadow-right-bottom" :null,
609+
bottom ?"shadow-center-bottom" :null
610610
};
611611
for (inti =0;i <handles.length;i++) {
612-
createCSSDiv(handle,handles[i]);
612+
if (handles[i] !=null) {
613+
createCSSDiv(handle,handles[i]);
614+
}
613615
}
614616
if (OS.isChrome) {
615617
handle.style.opacity ="1";
@@ -619,6 +621,10 @@ protected static void createShadowHandles(Element handle) {
619621
}
620622
}
621623

624+
protectedstaticvoidcreateShadowHandles(Elementhandle) {
625+
appendShadowHandles(handle,true,true,true,true);
626+
}
627+
622628
protectedstaticvoidcreateNarrowShadowHandles(Elementhandle) {
623629
String[]handles =newString[] {
624630
"shadow-narrow-left-top",

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

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2507,6 +2507,57 @@ void initializeDekstop() {
25072507
shortcutBar.initialize();
25082508
trayCorner.initialize();
25092509

2510+
/**
2511+
* @j2sNative
2512+
* var autoHide = window["swt.notification.corner.autohide"];
2513+
* if (autoHide != null && (autoHide == true || autoHide == "true")) {
2514+
* this.trayCorner.toggleAutoHide(); // by default, it is being shown normally.
2515+
* }
2516+
* autoHide = window["swt.quick.launch.autohide"];
2517+
* if (autoHide != null && (autoHide == true || autoHide == "true")) {
2518+
* this.shortcutBar.toggleAutoHide(); // by default, it is being shown normally.
2519+
* }
2520+
* autoHide = window["swt.task.bar.autohide"];
2521+
* if (autoHide != null && (autoHide == false || autoHide == "false")) {
2522+
* this.taskBar.toggleAutoHide(); // by default, it is being hide automatically.
2523+
* }
2524+
*/ {}
2525+
2526+
Elementpanel =document.getElementById("swt-desktop-panel");
2527+
if (panel !=null) {
2528+
intheight =OS.getFixedBodyClientHeight();
2529+
intwidth =OS.getFixedBodyClientWidth();
2530+
panel.style.position ="absolute";
2531+
panel.style.backgroundColor ="white";
2532+
/**
2533+
* @j2sNative
2534+
* var vsb = window["swt.desktop.vscrollbar"];
2535+
* if (vsb != null && (vsb == true || vsb == "true" || vsb == "enable")) {
2536+
* panel.style.overflowY = "auto";
2537+
* }
2538+
* var hsb = window["swt.desktop.hscrollbar"];
2539+
* if (hsb != null && (hsb == true || hsb == "true" || hsb == "enable")) {
2540+
* panel.style.overflowX = "auto";
2541+
* }
2542+
*/ {}
2543+
panel.style.paddingBottom ="80px";
2544+
if (!OS.isIE) {
2545+
Elementdiv =document.createElement("DIV");
2546+
/**
2547+
* @j2sNative
2548+
* div.style.cssFloat = "left";
2549+
*/ {}
2550+
div.style.height ="80px";
2551+
div.style.width ="1px";
2552+
div.style.marginLeft ="-1px";
2553+
panel.appendChild(div);
2554+
}
2555+
panel.style.left ="0";
2556+
panel.style.top ="0";
2557+
panel.style.width =width +"px";
2558+
panel.style.height = (height -80) +"px";
2559+
}
2560+
25102561
mouseMoveListener =newRunnableCompatibility(){
25112562

25122563
publicvoidrun() {
@@ -4685,6 +4736,13 @@ public void updateLayout() {
46854736
topBar.updateLayout();
46864737
shortcutBar.updateLayout();
46874738
trayCorner.updateLayout();
4739+
Elementpanel =document.getElementById("swt-desktop-panel");
4740+
if (panel !=null) {
4741+
intheight =OS.getFixedBodyClientHeight();
4742+
intwidth =OS.getFixedBodyClientWidth();
4743+
panel.style.width =width +"px";
4744+
panel.style.height = (height -80) +"px";
4745+
}
46884746
}
46894747
}
46904748

@@ -4808,6 +4866,10 @@ public void run() {
48084866
HTMLEventWrapperevt =newHTMLEventWrapper(this.getEvent());
48094867
Elementsrc =evt.target;
48104868
while (src !=null) {
4869+
StringclassName =src.className;
4870+
if (className !=null &&className.indexOf("shadow-") != -1) {
4871+
return;
4872+
}
48114873
if (OS.existedCSSClass(src,"shell-default")) {
48124874
Display[]displs =Displays;
48134875
if (displs !=null) {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ public void initialize() {
9292
* supportShadow = window["swt.disable.shadow"] != true;
9393
*/ {}
9494
if (supportShadow) {
95-
Decorations.createShadowHandles(handle);
95+
//Decorations.createShadowHandles(handle);
96+
Decorations.appendShadowHandles(handle,false,true,true,true);
9697
}
9798

9899
Elementtb =document.createElement("DIV");

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

Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,29 @@ public NotificationCorner(Display display) {
3232

3333
publicvoidinitialize() {
3434
booleanexisted =false;
35-
Element[]divs =document.body.childNodes;
36-
for (inti =0;i <divs.length;i++) {
37-
if (divs[i].className =="powered") {
38-
document.body.removeChild(divs[i]);
39-
existed =true;
40-
/**
41-
* @j2sNative
42-
* if (window["swt.notification.corner.float"] == null) {
43-
* window["swt.notification.corner.float"] = true;
44-
* }
45-
*/ {}
35+
Element[]containers =newElement[2];
36+
containers[0] =document.body;
37+
containers[1] =document.getElementById("swt-desktop-panel");
38+
for (intk =0;k <containers.length;k++) {
39+
Elementcontainer =containers[k];
40+
if (containers[k] ==null) {
41+
continue;
42+
}
43+
Element[]divs =container.childNodes;
44+
for (inti =0;i <divs.length;i++) {
45+
if (divs[i].className =="powered") {
46+
container.removeChild(divs[i]);
47+
existed =true;
48+
/**
49+
* @j2sNative
50+
* if (window["swt.notification.corner.float"] == null) {
51+
* window["swt.notification.corner.float"] = true;
52+
* }
53+
*/ {}
54+
break;
55+
}
56+
}
57+
if (existed) {
4658
break;
4759
}
4860
}
@@ -164,14 +176,7 @@ public void run() {
164176
mouseDoubleClick =newRunnableCompatibility() {
165177

166178
publicvoidrun() {
167-
isAutoHide = !isAutoHide;
168-
minimizedEl.title =isAutoHide ?"Doubleclick to set notification area always-visible"
169-
:"Doubleclick to set notification area auto-hide";
170-
setMinimized(isAutoHide);
171-
if (isJustUpdated) {
172-
return;
173-
}
174-
bringToTop(-1);
179+
toggleAutoHide();
175180
}
176181

177182
};
@@ -312,21 +317,32 @@ public boolean setMinimized(boolean minimized) {
312317
}
313318
minimizedEl.style.display = !minimized ?"none" :"block";
314319
for (inti =0;i <tray.allCells.length;i++) {
315-
tray.allCells[i].style.display =minimized ?"none" :"block";
320+
Elementcell =tray.allCells[i];
321+
if (cell !=null) {
322+
cell.style.display =minimized ?"none" :"block";
323+
}
316324
}
317325
for (inti =0;i <tray.allFloats.length;i++) {
318-
tray.allFloats[i].style.display =minimized ?"none" :"block";
326+
ElementdivFloat =tray.allFloats[i];
327+
if (divFloat !=null) {
328+
divFloat.style.display =minimized ?"none" :"block";
329+
}
319330
}
320331
for (inti =0;i <tray.allItems.length;i++) {
321-
tray.allItems[i].style.display =minimized ?"none" :"block";
332+
Elementitem =tray.allItems[i];
333+
if (item !=null) {
334+
item.style.display =minimized ?"none" :"block";
335+
}
322336
}
323337
if (tray.supportShadow) {
324338
for (inti =0;i <tray.outerShadows.length;i++) {
325339
Elementcell =tray.outerShadows[i];
326-
if (minimized) {
327-
cell.style.left = (-i *36 -21) +"px";
328-
}else {
329-
cell.style.left = ((tray.cellLines -i -1) *36 -1) +"px";
340+
if (cell !=null) {
341+
if (minimized) {
342+
cell.style.left = (-i *36 -21) +"px";
343+
}else {
344+
cell.style.left = ((tray.cellLines -i -1) *36 -1) +"px";
345+
}
330346
}
331347
}
332348
}
@@ -378,4 +394,15 @@ public void releaseWidget() {
378394
}
379395
}
380396

397+
voidtoggleAutoHide() {
398+
isAutoHide = !isAutoHide;
399+
minimizedEl.title =isAutoHide ?"Doubleclick to set notification area always-visible"
400+
:"Doubleclick to set notification area auto-hide";
401+
setMinimized(isAutoHide);
402+
if (isJustUpdated) {
403+
return;
404+
}
405+
bringToTop(-1);
406+
}
407+
381408
}

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

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,7 @@ public void run() {
104104
this.handle.ondblclick =newRunnableCompatibility(){
105105

106106
publicvoidrun() {
107-
isAutoHide = !isAutoHide;
108-
handle.title =isAutoHide ?"Doubleclick to set quicklaunch always-visible"
109-
:"Doubleclick to set quicklaunch auto-hide";
110-
setMinimized(isAutoHide);
111-
if (isJustUpdated) {
112-
return;
113-
}
114-
bringToTop(-1);
107+
toggleAutoHide();
115108
}
116109

117110
};
@@ -122,14 +115,23 @@ public void run() {
122115
* supportShadow = window["swt.disable.shadow"] != true;
123116
*/ {}
124117
if (supportShadow) {
125-
Decorations.createShadowHandles(handle);
118+
//Decorations.createShadowHandles(handle);
119+
Decorations.appendShadowHandles(handle,true,true,false,true);
126120
}
127121

128122
Element[]childNodes =document.body.childNodes;
129123
Element[]children =newElement[childNodes.length];
130124
for (inti =0;i <childNodes.length;i++) {
131125
children[i] =childNodes[i];
132126
}
127+
Elementpanel =document.getElementById("swt-desktop-panel");
128+
if (panel !=null) {
129+
intoffset =children.length;
130+
childNodes =panel.childNodes;
131+
for (inti =0;i <childNodes.length;i++) {
132+
children[offset +i] =childNodes[i];
133+
}
134+
}
133135
ElementqlContainer =document.getElementById("quick-launch");
134136
if (qlContainer !=null) {
135137
childNodes =qlContainer.childNodes;
@@ -393,5 +395,15 @@ public void releaseWidget() {
393395
shortcutCount =0;
394396
}
395397
}
398+
voidtoggleAutoHide() {
399+
isAutoHide = !isAutoHide;
400+
handle.title =isAutoHide ?"Doubleclick to set quicklaunch always-visible"
401+
:"Doubleclick to set quicklaunch auto-hide";
402+
setMinimized(isAutoHide);
403+
if (isJustUpdated) {
404+
return;
405+
}
406+
bringToTop(-1);
407+
}
396408

397409
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp