Skip to content

Commit 51dda88

Browse files
author
soheil_h_y
committed
CTabFolder IE improvements
1 parent 69d2e5e commit 51dda88

File tree

4 files changed

+217
-156
lines changed

4 files changed

+217
-156
lines changed

sources/net.sf.j2s.lib/j2slib/j2s-swt-custom.z.js

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,12 @@ rect.y+=this.marginHeight;
432432
rect.width-=2*this.marginWidth;
433433
rect.height-=2*this.marginHeight;
434434
for(var i=0;i<children.length;i++){
435+
if(children[i]!=this.topControl){
436+
children[i].handle.style.display="none";
437+
}else{
435438
children[i].setBounds(rect);
436-
children[i].setVisible(children[i]==this.topControl);
437-
}
439+
children[i].handle.style.display="block";
440+
}}
438441
},"$wt.widgets.Composite,~B");
439442
$_M(c$,"getName",
440443
function(){
@@ -2158,12 +2161,14 @@ this.rightEl=d$.createElement("DIV");
21582161
this.rightEl.className=this.cssClassForRight();
21592162
this.handle.appendChild(this.rightEl);
21602163
this.configureRightEl();
2164+
this.parent.updateSelection(this.parent.getSelectionIndex());
21612165
}this.text=string;
21622166
},"~S");
21632167
$_M(c$,"configureRightEl",
21642168
function(){
21652169
System.out.println("Show close : "+this.showClose);
2166-
if(this.showClose)this.rightEl.onclick=$_Q((function(i$,v$){
2170+
if(this.showClose){
2171+
this.rightEl.onclick=$_Q((function(i$,v$){
21672172
if(!$_D("org.eclipse.swt.custom.CTabItem$4")){
21682173
$_H();
21692174
c$=$_C(function(){
@@ -2193,7 +2198,41 @@ c$=$_P();
21932198
}
21942199
return $_N($wt.custom.CTabItem$4,i$,v$);
21952200
})(this,null));
2201+
this.rightEl.onmouseover=$_Q((function(i$,v$){
2202+
if(!$_D("org.eclipse.swt.custom.CTabItem$5")){
2203+
$_H();
2204+
c$=$_C(function(){
2205+
$_B(this,arguments);
2206+
$_Z(this,arguments);
2207+
},$wt.custom,"CTabItem$5",$wt.internal.RunnableCompatibility);
2208+
$_V(c$,"run",
2209+
function(){
2210+
this.b$["$wt.custom.CTabItem"].prepareCloseBtn(true);
2211+
this.b$["$wt.custom.CTabItem"].rightEl.className=this.b$["$wt.custom.CTabItem"].rightEl.className.trim()+"-hover";
21962212
});
2213+
c$=$_P();
2214+
}
2215+
return $_N($wt.custom.CTabItem$5,i$,v$);
2216+
})(this,null));
2217+
this.rightEl.onmouseout=$_Q((function(i$,v$){
2218+
if(!$_D("org.eclipse.swt.custom.CTabItem$6")){
2219+
$_H();
2220+
c$=$_C(function(){
2221+
$_B(this,arguments);
2222+
$_Z(this,arguments);
2223+
},$wt.custom,"CTabItem$6",$wt.internal.RunnableCompatibility);
2224+
$_V(c$,"run",
2225+
function(){
2226+
this.b$["$wt.custom.CTabItem"].prepareCloseBtn(false);
2227+
var idx=this.b$["$wt.custom.CTabItem"].rightEl.className.indexOf("-hover");
2228+
if(idx>=0){
2229+
this.b$["$wt.custom.CTabItem"].rightEl.className=this.b$["$wt.custom.CTabItem"].rightEl.className.substring(0,idx);
2230+
}});
2231+
c$=$_P();
2232+
}
2233+
return $_N($wt.custom.CTabItem$6,i$,v$);
2234+
})(this,null));
2235+
}});
21972236
$_M(c$,"setToolTipText",
21982237
function(string){
21992238
this.toolTipText=string;
@@ -2227,14 +2266,14 @@ this.handle=null;
22272266
});
22282267
$_M(c$,"prepareCloseBtn",
22292268
function($in){
2230-
var key="ctab-item-attach-close-right";
2269+
var key=" ctab-item-attach-close-right";
22312270
if(this.isSelected||!this.parent.showClose){
22322271
return;
22332272
}var idx=this.rightEl.className.indexOf(key);
22342273
if(idx!=-1){
22352274
this.rightEl.className=this.rightEl.className.substring(0,idx)+this.rightEl.className.substring(idx+key.length);
22362275
}if($in){
2237-
this.rightEl.className+=" ctab-item-attach-close-right ";
2276+
this.rightEl.className+=" ctab-item-attach-close-right";
22382277
}this.handle.style.height=(O$.getContainerHeight(this.textEl)+1)+"px";
22392278
this.rightEl.style.height=(O$.getContainerHeight(this.textEl)+1)+"px";
22402279
},"~B");
@@ -3213,13 +3252,15 @@ this.setSelection(index,false);
32133252
$_M(c$,"setSelection",
32143253
function(index,notify){
32153254
var oldIndex=this.getSelectionIndex();
3255+
System.out.println("setselection called! at "+oldIndex+" at "+index);
32163256
if(oldIndex==index){
32173257
return;
32183258
}if(oldIndex!=-1){
32193259
var item=this.items[oldIndex];
32203260
var control=item.control;
32213261
if(control!=null&&!control.isDisposed()){
32223262
control.setVisible(false);
3263+
control.handle.style.display="none";
32233264
}}this.updateSelection(index);
32243265
var newIndex=index;
32253266
if(newIndex!=-1){
@@ -3229,6 +3270,7 @@ var control=item.control;
32293270
if(control!=null&&!control.isDisposed()){
32303271
control.setBounds(this.getClientArea());
32313272
control.setVisible(true);
3273+
control.handle.style.display="block";
32323274
}if(notify){
32333275
var event=new $wt.widgets.Event();
32343276
event.item=item;
@@ -3250,6 +3292,7 @@ var idx=cssName.indexOf(key);
32503292
if(idx!=-1){
32513293
this.items[i].handle.className=cssName.substring(0,idx)+cssName.substring(idx+key.length);
32523294
this.items[i].rightEl.className=this.items[i].cssClassForRight();
3295+
var el=this.buttonArea;
32533296
this.items[i].handle.style.height=(O$.getContainerHeight(this.buttonArea)-3)+"px";
32543297
this.items[i].isSelected=false;
32553298
if(i>index){
@@ -3271,14 +3314,13 @@ if(ww>0){
32713314
if(cssName==null)cssName="";
32723315
var idx=cssName.indexOf(key);
32733316
if(idx==-1){
3274-
var w=O$.getContainerWidth(this.items[index].rightEl)+O$.getContainerWidth(this.items[index].textEl);
32753317
this.items[index].handle.className+=" "+key;
32763318
this.items[index].rightEl.className=this.items[index].cssClassForRight();
32773319
this.items[index].handle.style.height=(O$.getContainerHeight(this.buttonArea)+3)+"px";
32783320
this.items[index].rightEl.style.height=this.items[index].handle.style.height;
32793321
this.items[index].isSelected=true;
3322+
var w=O$.getContainerWidth(this.items[index].rightEl)+O$.getContainerWidth(this.items[index].textEl);
32803323
if(!this.simple){
3281-
w+=24;
32823324
}var s=this.items[index].handle.style;
32833325
s.width=w+"px";
32843326
}this.items[index].handle.style.zIndex=(this.items.length+1)+"";

sources/net.sf.j2s.lib/j2slib/j2s-swt-more.z.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,9 +2473,12 @@ this.selected=selected;
24732473
var index=0;
24742474
if((this.parent.style&32)!=0){
24752475
index++;
2476-
}var element=this.handle.childNodes[0].childNodes[0].childNodes[index];
2476+
}if((this.parent.style&65536)!=0){
2477+
this.handle.className=selected?"table-item-selected":"table-item-default";
2478+
}else{
2479+
var element=this.handle.childNodes[0].childNodes[0].childNodes[index];
24772480
element.className=selected?"table-item-cell-text-selected":"table-item-cell-text-default";
2478-
},"~B");
2481+
}},"~B");
24792482
$_M(c$,"isSelected",
24802483
function(){
24812484
return this.selected;
@@ -3750,6 +3753,13 @@ $_Z(this,arguments);
37503753
$_V(c$,"run",
37513754
function(){
37523755
this.b$["$wt.widgets.TreeItem"].toggleExpandStatus();
3756+
var e=new $wt.widgets.Event();
3757+
e.display=this.b$["$wt.widgets.TreeItem"].display;
3758+
e.type=14;
3759+
e.detail=0;
3760+
e.item=this.b$["$wt.widgets.TreeItem"];
3761+
e.widget=this.b$["$wt.widgets.TreeItem"];
3762+
this.b$["$wt.widgets.TreeItem"].parent.sendEvent(e);
37533763
this.toReturn(false);
37543764
});
37553765
c$=$_P();

0 commit comments

Comments
 (0)