我爲我的項目創建日期的小部件。SetDate在文本框?
n對對象的setProperty和getProperty使用相同的小部件。
public TextBox getTimeTxtbx() {
// TODO Auto-generated method stub
timebx =new TextBox();
timebx.setReadOnly(true);
final PopupPanel popupPanel=new PopupPanel(true);
final DatePicker datePicker=new DatePicker();
datePicker.addValueChangeHandler(new ValueChangeHandler<Date>() {
public void onValueChange(ValueChangeEvent<Date> event) {
// TODO Auto-generated method stub
Date date=event.getValue();
timebx.setText(DateTimeFormat.getFormat("EEE MMM dd HH:mm:ss z yyyy").format(date));
popupPanel.hide();
}
});
popupPanel.setWidget(datePicker);
timebx.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
// TODO Auto-generated method stub
String strDate = timebx.getText();
System.out.println(" strDate " +strDate);
DateTimeFormat format = DateTimeFormat.getFormat("[EEE MMM dd HH:mm:ss z yyyy]");
try {
Date selDate = (Date)format.parse(strDate);
datePicker.setValue(selDate, true);
} catch(Exception pe){
// setting current date
System.out.println("error" +pe);
datePicker.setValue(new Date(), true);
}
int x=timebx.getAbsoluteLeft();
int y=timebx.getAbsoluteTop();
popupPanel.setPopupPosition(x, y+20);
popupPanel.show();
}
});
return timebx;
}
public void setTimebx(String string) {
// TODO Auto-generated method stub
timebx.setText(string);
}
我在不同的GUI類
flexTable.setWidget(i, j,textBoxDisplay.getTimeTxtbx());
textBoxDisplay.setTimebx(customProperty.getValues().toString());
添加在flexTable此窗口小部件在flexTable,這上面的代碼是一個iterator
內和稱爲兩次。
Like in Image:testDate an received on。
當我testDate點擊收到的值被改變
編輯
public ListBox getBooleanBox() {
// TODO Auto-generated method stub
selectBoolean = new ListBox(false);
//selectBoolean.setName(title);
selectBoolean.setStyleName("cmis-Customproperties-TextBox");
selectBoolean.setSize("150px", "20px");
selectBoolean.addItem("True","True");
selectBoolean.addItem("False", "False");
return selectBoolean;
}
public void setBooleanBox(String value){
int itemCount = selectBoolean.getItemCount();
for(int i = 0 ;i < itemCount;i++){
if(selectBoolean.getItemText(i).equalsIgnoreCase(value)){
selectBoolean.setSelectedIndex(i);
}
}
}
將在flexTable
customPropertyTabel.setWidget(i, j,textBoxDisplay.getBooleanBox());
textBoxDisplay.setBooleanBox(removeSymbol(customProperty.getValues().toString()));
,這是工作完全正常。 我得到了正確的值。
你的問題是? – Keppil 2012-07-24 08:57:10
@Keppil當我點擊測試日期的文本框彈出在文本框的ReceivedOn螞蟻receivedOn文本框的值的變化 – NewCodeLearner 2012-07-24 09:21:02