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

Commitbdc37f2

Browse files
author
soheil_h_y
committed
1. Combo Enhancements.
1 parent7832ef4 commitbdc37f2

File tree

6 files changed

+348
-268
lines changed

6 files changed

+348
-268
lines changed

‎sources/net.sf.j2s.java.org.eclipse.swt/j2sswt/swt-default.css‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,17 +398,20 @@ input.text-border {
398398

399399
/* Combo */
400400
.combo-default{
401+
padding:0;
402+
border-style:none;
401403
overflow:visible;
402404
}
403405
.combo-button{
404-
width:11px;
405-
min-height:11px;
406+
//width:11px;
407+
height:100%;
406408
background-image:url('images/combo-button.gif');
407409
background-repeat:no-repeat;
408410
background-position:center center;
409411
}
410412

411413
.combo-input-box{
414+
border-style:none;
412415
}
413416

414417
.combo-select-box-invisible{
@@ -419,6 +422,10 @@ input.text-border {
419422
.combo-select-box-visible{
420423
display:block;
421424
}
425+
426+
.combo-select-box-notsimple{
427+
position:absolute;
428+
}
422429
/* End of Combo */
423430

424431

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,4 +423,21 @@ public static Point getStringStyledSize(String str, String className, String css
423423
Elementc =setupAsStyled(str,className,cssText, -1);
424424
returnnewPoint(getContainerWidth(c),getContainerHeight(c));
425425
}
426+
427+
staticpublicPointgetElementPositionInShell(Elementelem,ElementshellElem){
428+
ElementcurrentElem =elem;
429+
intleft =0;
430+
inttop =0;
431+
while (currentElem !=shellElem) {
432+
left +=currentElem.offsetLeft;
433+
top +=currentElem.offsetTop;
434+
currentElem =currentElem.offsetParent;
435+
}
436+
//System.out.println(getShell().she)
437+
if(isFirefox){
438+
left +=6;
439+
top +=2;
440+
}
441+
returnnewPoint(left,top +OS.getContainerHeight(elem));
442+
}
426443
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ public class Element {
1111
publicElementparentNode;
1212
publicElement[]childNodes;
1313
publicElementnextSibling;
14+
publicintoffsetLeft;
15+
publicintoffsetTop;
16+
publicElementoffsetParent;
1417

1518
publicCSSStylestyle;
1619
publicStringid;

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

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
importorg.eclipse.swt.internal.xhtml.Element;
2323
importorg.eclipse.swt.internal.xhtml.Option;
2424
importorg.eclipse.swt.internal.xhtml.document;
25+
importorg.eclipse.swt.internal.xhtml.window;
2526

2627
/**
2728
* Instances of this class are controls that allow the user
@@ -558,13 +559,26 @@ protected void createHandle () {
558559
selectInput.style.top =height +"px" ;
559560
selectInput.style.left =textInput.style.left;
560561
System.out.println("is Simple " +isSimple);
561-
selectInput.className ="combo-select-box-invisible";
562+
selectInput.className ="combo-select-box-invisible combo-select-box-notsimple";
562563
selectInput.size =visibleCount;
564+
System.out.println("ho combo1 " +textInput.scrollHeight);
565+
System.out.println("ho combo2 " +textInput.offsetHeight);
566+
System.out.println("ho combo3 " +textInput.clientHeight);
563567
//TODO: add the select to shell to be shown every where
564-
//getShell().handle.appendChild(selectInput);
565-
handle.appendChild(selectInput);
568+
569+
getShell().handle.appendChild(selectInput);
570+
//handle.appendChild(selectInput);
566571
}
567572

573+
textInput.ondblclick =newRunnableCompatibility() {
574+
publicvoidrun() {
575+
System.out.println("button clicked!");
576+
if(!isSimple)
577+
show();
578+
}
579+
};
580+
581+
568582
dropDownButton.onclick =newRunnableCompatibility() {
569583
publicvoidrun() {
570584
System.out.println("button clicked!");
@@ -608,20 +622,25 @@ void hide(){
608622
//}
609623

610624
this.selectShown =false;
611-
selectInput.className ="combo-select-box-invisible";
625+
selectInput.className ="combo-select-box-invisible" + (isSimple ?"" :" combo-select-box-notsimple");
612626
}
613627

614628
voidshow(){
615629

616630
//if(this.selectShown){
617631
//return;
618632
//}
633+
634+
Pointcoordinate =OS.getElementPositionInShell(textInput,getShell().handle);
619635
this.selectShown =true;
620636
selectInput.style.zIndex ="120";
621-
selectInput.className ="combo-select-box-visible";
637+
selectInput.className ="combo-select-box-visible" + (isSimple ?"" :" combo-select-box-notsimple");
638+
selectInput.style.top =coordinate.y +"px";
639+
selectInput.style.left =coordinate.x +"px";
622640
System.out.println("Z " +selectInput.style.zIndex);
623641
selectInput.focus();
624642
}
643+
625644
voidupdateSelection(){
626645
textInput.value =selectInput.options[getSelectionIndex()].value;
627646
}

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

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,19 @@ public class Table extends Composite {
5151
ImageListimageList;
5252
TableItemcurrentItem;
5353

54+
Elementtbody;
55+
5456
TableItemlastSelection;
5557
TableItem[]selection;
58+
59+
//String[] itemsStr;
60+
//String[] columnsStr;
61+
//String tableHeaderStr = "<TABLE>";
62+
//String tableFooterStr = "</TABLE>";
63+
//String theadHeaderStr = "<THEAD>";
64+
//String theadFooterStr = "</THEAD>";
65+
//String tbodyHeaderStr = "<TBODY>";
66+
//String tbodyFooterStr = "</TBODY>";
5667

5768
intlastIndexOf,lastWidth;
5869
booleancustomDraw,cancelMove,dragStarted,fixScrollWidth,tipRequested;
@@ -108,7 +119,9 @@ public Table (Composite parent, int style) {
108119
super (parent,checkStyle (style));
109120
selection =newTableItem[0];
110121
items =newTableItem[0];
111-
columns =newTableColumn[0];
122+
columns =newTableColumn[0];
123+
//itemsStr = new String[0];
124+
tbody =null;
112125
}
113126

114127
TableItem_getItem (intindex) {
@@ -840,7 +853,8 @@ void createItem (TableColumn column, int index) {
840853
}
841854
if (handle ==null) {
842855
return ;
843-
}
856+
}
857+
844858
Elementtable =handle.childNodes[0];
845859
Elementthead =null;
846860
for (inti =0;i <table.childNodes.length;i++) {
@@ -950,15 +964,20 @@ void createItem (TableItem item, int index) {
950964
items [index] = item;
951965
*/
952966
if (items ==null) {
953-
items =newTableItem[0];
954-
}
967+
items =newTableItem[0];
968+
//itemsStr = new String[0];
969+
}
970+
//if(itemsStr == null){
971+
//System.out.println("init itemStr");
972+
//}
955973
item.index =index;
956974
items[index] =item;
957975
if (handle ==null) {
958976
return ;
959977
}
960978
Elementtable =handle.childNodes[0];
961-
Elementtbody =null;
979+
//tbody = null;
980+
if(tbody ==null)
962981
for (inti =0;i <table.childNodes.length;i++) {
963982
if ("TBODY".equals(table.childNodes[i].nodeName)) {
964983
tbody =table.childNodes[i];
@@ -970,20 +989,27 @@ void createItem (TableItem item, int index) {
970989
table.appendChild(tbody);
971990
}
972991

973-
ElementtbodyTR =document.createElement("TR");
992+
ElementtbodyTR =document.createElement("TR");
993+
//String trStr = "<TR class=\"table-item-default\"></TR>";
974994
tbodyTR.className ="table-item-default";
975995
if (index <0 ||index >=tbody.childNodes.length) {//theadTD == null){
976996
tbody.appendChild(tbodyTR);
977-
items[index] =item;
997+
items[index] =item;
998+
//itemsStr[index] = trStr;
978999
}else {
9791000
System.out.println("existed");
9801001
tbody.insertBefore(tbodyTR,tbody.childNodes[index]);
9811002
for (inti =items.length;i >index;i--) {
9821003
items[i] =items[i -1];
983-
items[i].index =i;
1004+
items[i].index =i;
1005+
//itemsStr[i] = itemsStr[i - 1];
9841006
}
985-
items[index] =item;
986-
}
1007+
items[index] =item;
1008+
//itemsStr[index] = trStr;
1009+
}
1010+
//fillTbody();
1011+
//System.out.println(tbody.innerHTML);
1012+
//item.handle = tbody.childNodes[index];
9871013
item.handle =tbodyTR;
9881014
}
9891015

@@ -3634,6 +3660,14 @@ void updateMoveable () {
36343660
*/
36353661
}
36363662

3663+
///**
3664+
// * @j2sNative
3665+
// * this.tbody.innerHTML = this.itemsStr.join('');
3666+
// */
3667+
//void fillTbody() {
3668+
//
3669+
//}
3670+
36373671
/*
36383672
int widgetStyle () {
36393673
int bits = super.widgetStyle () | OS.LVS_SHAREIMAGELISTS;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp