Skip to content

Commit faf9b58

Browse files
author
soheil_h_y
committed
1. Right to left for Tree widget done. But there are some line figures that should be fixed.
1 parent aff1bef commit faf9b58

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,12 @@ thead .tree-head-text {
124124
margin-left:2px;
125125
white-space:nowrap;
126126
float:left;
127-
}
127+
}
128+
129+
.tree-text-rtl {
130+
float:right;
131+
}
132+
128133
tree-image-icon {
129134
_padding-bottom:2px;
130135
_height:16px;
@@ -193,6 +198,7 @@ tree-image tree-image-icon {
193198
z-index:100;
194199
float:right;
195200
}
201+
196202

197203
.tree-item-focus {
198204
background-color:#E8F2FE;
@@ -209,10 +215,17 @@ tree-image tree-image-icon {
209215
height:1.39em;
210216
line-height:1.39em;
211217
overflow:hidden;
212-
}
218+
}
219+
213220
* html .tree-anchor {
214221
margin-left:1px;
215-
}
222+
}
223+
224+
.tree-anchor-rtl {
225+
float:right;
226+
}
227+
228+
216229
.tree-anchor-v {
217230
position:absolute;
218231
top:0;

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,9 @@ void createItem (TreeItem item, Object hParent, int index) {
859859
for (int i = chains.length - 1; i >= 0; i--) {
860860
TreeItem currentItem = chains[i];
861861
String cssClass = "tree-anchor";
862+
if((style & SWT.RIGHT_TO_LEFT) != 0){
863+
cssClass += " tree-anchor-rtl";
864+
}
862865
TreeItem[] listItems = (lastItem == null ? directChildrens : lastItem.items);
863866
if (listItems.length > 1) {
864867
int j = 0;
@@ -907,6 +910,8 @@ void createItem (TreeItem item, Object hParent, int index) {
907910
}
908911

909912
Element textEl = createCSSElement(lineWrapper, "tree-text");
913+
if((style & SWT.RIGHT_TO_LEFT) != 0)
914+
textEl.className += " tree-text-rtl";
910915
if ((style & SWT.CHECK) != 0) {
911916
Element input = document.createElement("INPUT");
912917
input.type = "checkbox";
@@ -952,6 +957,9 @@ void createItem (TreeItem item, Object hParent, int index) {
952957
TreeItem ti = items[k];
953958
Element anchor = ti.handle.childNodes[0].childNodes[0].childNodes[0].childNodes[elIndex];
954959
String cssClass = "tree-anchor";
960+
if((style & SWT.RIGHT_TO_LEFT) != 0){
961+
cssClass += " tree-anchor-rtl";
962+
}
955963
if (ti.parentItem == item.parentItem) {
956964
int i = 0;
957965
for (i = 0; i < itemList.length; i++) {

0 commit comments

Comments
 (0)