Hi Torsten
This is currently not possible through the standard API. You could write an
extension to get information about the text that the user entered on the client,
however. The snippet below should give you an idea how you could implement
something like that.
I hope this helps.
Cheers
Rolf
import com.ulcjava.base.application.AbstractApplication;
import com.ulcjava.base.application.ULCFrame;
import com.ulcjava.base.application.ULCTextField;
import com.ulcjava.base.application.ULCButton;
import com.ulcjava.base.application.ULCBorderLayoutPane;
import com.ulcjava.base.application.event.IActionListener;
import com.ulcjava.base.application.event.ActionEvent;
import com.ulcjava.base.application.datatype.ULCDateDataType;
import com.ulcjava.base.development.DevelopmentRunner;
import com.ulcjava.base.client.UITextField;
import com.ulcjava.base.client.IDirtyDataOwner;
import com.ulcjava.base.server.IDispatcher;
public class DataTypeBadTextSnippet extends AbstractApplication {
public void start() {
ULCFrame frame = new ULCFrame();
final MyULCTextField textField = new MyULCTextField(40);
textField.setDataType(new ULCDateDataType("dd.MM.yyyy"));
ULCButton button = new ULCButton("Print");
button.addActionListener(new IActionListener() {
public void actionPerformed(ActionEvent event) {
System.out.println("textField.getValue() = " +
textField.getValue());
System.out.println("textField.getTextInput() = " +
textField.getTextInput());
}
});
frame.getContentPane().add(textField);
frame.getContentPane().add(button, ULCBorderLayoutPane.SOUTH);
frame.setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE);
frame.setVisible(true);
}
public static void main(String[] args) {
DevelopmentRunner.setApplicationClass(DataTypeBadTextSnippet.class);
DevelopmentRunner.main(args);
}
public static class MyULCTextField extends ULCTextField {
private String fTextInput = null;
public MyULCTextField(int columns) {
super(columns);
}
protected String typeString() {
return MyUITextField.class.getName();
}
public String getTextInput() {
return fTextInput;
}
protected IDispatcher createDispatcher() {
return new MyULCTextFieldDispatcher();
}
protected class MyULCTextFieldDispatcher extends ULCTextFieldDispatcher
{
public void updateTextInput(String textInput) {
fTextInput = textInput;
}
}
}
public static class MyUITextField extends UITextField {
private String fTextInput = null;
private IDirtyDataOwner fDirtyDataHandler = new DirtyDataHandler();
protected void updateToModel(boolean displayFormattedValue) {
fTextInput = getBasicTextComponent().getText();
getSession().addDirtyDataOwner(fDirtyDataHandler);
super.updateToModel(displayFormattedValue);
}
private class DirtyDataHandler implements IDirtyDataOwner {
public void flushDirtyData() {
updateStateULC("textInput", fTextInput);
}
}
}
}
**************************************
Rolf Pfenninger
Canoo Engineering AG
Kirschgartenstrasse 7
CH-4051 Basel
Tel +41 61 228 9444
Fax +41 61 228 9449
mailto:[EMAIL PROTECTED]
http://www.canoo.com
ULC - Rich Clients for J2EE
http://www.canoo.com/ulc
**************************************
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Hofmann,
> Torsten
> Sent: Montag, 18. Dezember 2006 16:33
> To: [email protected]
> Subject: [ULC-developer] ULCTextField
>
>
> Hello
>
> I am using a ULCTextField with a DataType. I want to set a value with
> the method setValue. The value i want to set does not fit to the
> Datatype. Is it possible to display/get the incorrect value?
>
> Regards
>
> Torsten Hofmann
> Dipl. - Informatiker (FH)
> IT Consultant Business Integration
>
> Würth Phoenix GmbH
> Drillberg 6
> D-97980 Bad Mergentheim
>
> Phone: +49 7931 91 6284
> Fax: +49 7931 91 7284
> E-Mail: [EMAIL PROTECTED]
> Website: www.wuerth-phoenix.de
>
> _______________________________________________
> ULC-developer mailing list
> [email protected]
> http://lists.canoo.com/mailman/listinfo/ulc-developer
_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer