63 setImage(Images.getImage(
"handshake"));
65 onClick =
new EventListener() {
67 public void onEvent(Event event)
throws Exception {
69 if(handshake !=
null) {
70 ElephantResponse er = HandshakeUtil.checkStatus(contract);
71 if(ElephantResponse.isCorrect(er)) {
72 HandshakeStatus status = HandshakeStatus.getStatus(er);
73 Clients.showNotification(er.message +
": " + er.code);
76 Clients.showNotification(
"Handshake server not found");
78 Events.postEvent(
new Event(Events.ON_CHANGE, HandshakeControl.this));
80 InputDialog.getInput(getPage(),
"Handshake",
"Remote server",
"",
null, 0,
83 public Object execute(Context context) {
84 String remoteUrl = (String) context.get(
"value");
85 remoteUrl = URLUtil.checkAppServer(remoteUrl,
true);
86 if(!Strings.isBlank(remoteUrl)) {
87 ElephantResponse er = HandshakeUtil.sendPetition(contract, remoteUrl);
88 if(ElephantResponse.isCorrect(er)) {
89 ContractHandshake handshake =
new ContractHandshake();
90 handshake.setContract(contract);
91 handshake.setRemoteServer(remoteUrl);
93 HandshakeStatus status = HandshakeStatus.getStatus(er);
94 Clients.showNotification(I_.get(
"Save before continue") +
"<br/>" + er.message +
": " + er.code);
98 Clients.showNotification(
"Handshake server not found");
102 Events.postEvent(
new Event(Events.ON_CHANGE, HandshakeControl.this));
109 addEventListener(Events.ON_CLICK, onClick);
112 setImage(Images.getImage(
"handshake"));
113 if(onClick ==
null) {
114 onClick =
new EventListener() {
116 public void onEvent(Event event)
throws Exception {
118 if(handshake !=
null) {
119 ElephantResponse er = HandshakeUtil.checkStatus(contract);
120 if(ElephantResponse.isCorrect(er)) {
121 HandshakeStatus status = HandshakeStatus.getStatus(er);
122 Clients.showNotification(er.message +
": " + er.code);
125 Clients.showNotification(
"Handshake server not found");
128 updateImage(HandshakeStatus.HS_NO_HANDSHAKE);
130 Events.postEvent(
new Event(Events.ON_CHANGE, HandshakeControl.this));
133 addEventListener(Events.ON_CLICK, onClick);
ContractHandshake getContractHandshake()
ContractDefinition getContractDefinition()
void setContractHandshake(ContractHandshake contractHandshake)