Skip to content

Commit adc0092

Browse files
author
soheil_h_y
committed
1. Some changes to Tree to make it compatible with IE7 and Safari.
1 parent a0788cb commit adc0092

File tree

6 files changed

+47
-6
lines changed

6 files changed

+47
-6
lines changed

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/internal/xhtml/CSSStyle.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,5 @@ public class CSSStyle {
7777

7878
public String direction;
7979
public String cssText;
80+
public boolean hasLayout;
8081
}

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/internal/xhtml/Element.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ public class Element {
100100

101101
public int nodeType;
102102

103+
public boolean hasLayout;
104+
103105
//private String
104106

105107
public native void appendChild(Element child);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.eclipse.swt.internal.xhtml.Element;
3333
import org.eclipse.swt.internal.xhtml.document;
3434
import org.eclipse.swt.internal.xhtml.window;
35-
3635
/**
3736
* Instances of this class are responsible for managing the
3837
* connection between SWT and the underlying operating

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

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ thead .tree-head-text {
6363
.tree-grid-line .tree-row-first td {
6464
}
6565
.tree-full-selection tr.tree-item-selected td {
66+
background-color:ActiveCaption;
6667
color:highlighttext;
67-
background-color:highlight;
68+
min-height:1px;
6869
}
6970
.tree-blur .tree-full-selection tr.tree-item-selected td {
7071
background-color:gray;
@@ -125,19 +126,27 @@ thead .tree-head-text {
125126
min-height:16px;
126127
height:1.39em;
127128
line-height:1.39em;
128-
position:relative;
129129
margin-left:2px;
130130
left:-1px;
131131
_left:-3px;
132132
white-space:nowrap;
133133
float:left;
134134
padding-bottom:1px;
135135
}
136+
/*
137+
138+
position:relative;
136139
140+
*/
137141
.tree-text-rtl {
138142
float:right;
143+
margin-left:auto;
144+
margin-right:2px;
139145
}
146+
/*
147+
right:0px !important;
140148
149+
*/
141150
tree-image-icon {
142151
_padding-bottom:2px;
143152
_height:16px;
@@ -188,8 +197,10 @@ tree-image tree-image-icon {
188197
}
189198

190199
.tree-item-selected .tree-column-first .tree-text-inner {
191-
color:highlighttext;
192-
background-color:highlight;
200+
background:ActiveCaption;
201+
color:highlighttext;
202+
min-height:1px;
203+
193204
}
194205
.tree-blur .tree-item-selected .tree-column-first .tree-text-inner {
195206
background-color:gray;
@@ -228,6 +239,7 @@ tree-image tree-image-icon {
228239
float:left;
229240
top:0;
230241
left:0;
242+
right:0;
231243
margin-left:3px;
232244
width:16px;
233245
min-height:16px;
@@ -242,6 +254,8 @@ tree-image tree-image-icon {
242254

243255
.tree-anchor-rtl {
244256
float:right;
257+
left:auto;
258+
right:0px;
245259
}
246260

247261

@@ -260,10 +274,17 @@ tree-image tree-image-icon {
260274
/*border-left:0 none transparent;*/
261275
width:16px;
262276
left:0;
277+
right:0;
263278
background-repeat:repeat-y;
264279
background-position:center center;
265280
background-image:url('images/tree-packed.gif');
266281
}
282+
283+
.tree-anchor-rtl .tree-anchor-v{
284+
right:5px;
285+
left:auto;
286+
}
287+
267288
.tree-anchor-single .tree-anchor-v {
268289
background-image:none;
269290
}
@@ -277,6 +298,7 @@ tree-image tree-image-icon {
277298
.tree-anchor-h {
278299
position:absolute;
279300
left:0;
301+
right:0;
280302
top:50%;
281303
margin-top:-8px;
282304
width:15px;
@@ -285,6 +307,10 @@ tree-image tree-image-icon {
285307
height:16px;
286308
background-repeat:no-repeat;
287309
}
310+
.tree-anchor-rtl .tree-anchor-h{
311+
left:auto;
312+
right:0;
313+
}
288314
.tree-image .tree-anchor-h {
289315
width:16px;
290316
margin-right:0;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,9 @@ void createItem (TreeItem item, Object hParent, int index) {
905905
cssClass += " tree-anchor-single";
906906
}
907907
Element anchor = createCSSElement(lineWrapper, cssClass);
908+
if(OS.isIE && (style & SWT.RIGHT_TO_LEFT) != 0){
909+
anchor.style.position = "static";
910+
}
908911
createCSSElement(anchor, "tree-anchor-v");
909912
cssClass = "tree-anchor-h";
910913
if (i == 0) {

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1666,9 +1666,19 @@ void showSelection(boolean selected) {
16661666
if (OS.isIE) { // IE won't update selected background!
16671667
Element tmpDiv = document.createElement("DIV");
16681668
tmpDiv.style.width = "1px"; // hasLayout
1669-
Element innerEl = handle.childNodes[0].childNodes[0].childNodes[0];
1669+
tmpDiv.style.height = "1px";
1670+
Element tempElem = handle.childNodes[0].childNodes[0].childNodes[0];
1671+
Element innerEl = tempElem.childNodes[tempElem.childNodes.length-1].childNodes[0];
1672+
System.out.println(innerEl);
1673+
innerEl.style.hasLayout = true;
16701674
innerEl.appendChild(tmpDiv);
16711675
innerEl.removeChild(tmpDiv);
1676+
innerEl.style.display = "inline-block";
1677+
// handle.style.hasLayout = true;
1678+
if((style & SWT.RIGHT_TO_LEFT) != 0){
1679+
innerEl.style.left = "0px";
1680+
tempElem.childNodes[tempElem.childNodes.length-1].style.left = "0px";
1681+
}
16721682
}
16731683
}
16741684

0 commit comments

Comments
 (0)