|
|
|
Re: Simple db application with Scout and Oracle Database 11g Express edition [message #1391138 is a reply to message #1390944] |
Mon, 30 June 2014 13:55 |
Matthias Nick Messages: 197 Registered: August 2013 |
Senior Member |
|
|
Hi Davor,
basically I would create a new Service, e.g. "MyService" using the SDK:
Afterwards, I would add a Service method to the new Service. Here you can use the SDK as well:
This means, your Service has now a method "getVersion()" which shall return the version from the Server:
public interface IMyService extends IService {
/**
* @return
* @throws org.eclipse.scout.commons.exception.ProcessingException
*/
String getVersion() throws ProcessingException;
}
Now, you have to write the implementation of this method:
public class MyService extends AbstractService implements IMyService {
@Override
public String getVersion() throws ProcessingException {
String version = "This String will be sent to the Client! Calculate the String from the SQL Service!";
return version;
}
}
This simply returns a hard-coded string. Here you need to use your SQLService instead.
On the client, when I press the update Button I can update the textField now:
@Order(20.0)
public class UpdateButton extends AbstractButton {
@Override
protected String getConfiguredLabel() {
return TEXTS.get("Update");
}
@Override
protected void execClickAction() throws ProcessingException {
String dbVersion = SERVICES.getService(IMyService.class).getVersion();
getVersionField().setValue(dbVersion);
}
}
}
And this is how it looks like on my side:
Do not hesitate to contact me in case you have questions.
Best regards,
Matthias
-
Attachment: MyService.png
(Size: 25.75KB, Downloaded 428 times) -
Attachment: new_method.png
(Size: 26.55KB, Downloaded 444 times) -
Attachment: result.png
(Size: 7.08KB, Downloaded 444 times)
|
|
|
Powered by
FUDForum. Page generated in 0.02859 seconds