19 package org.turro.financials.handshake;
21 import org.turro.string.Strings;
22 import org.turro.command.Command;
23 import org.turro.command.Context;
24 import org.turro.elephant.util.Images;
25 import org.turro.financials.entity.Contract;
26 import org.turro.financials.entity.ContractHandshake;
27 import org.turro.http.ElephantResponse;
28 import org.turro.http.URLUtil;
29 import org.turro.i18n.I_;
30 import org.turro.zkoss.dialog.InputDialog;
31 import org.zkoss.zk.ui.event.Event;
32 import org.zkoss.zk.ui.event.EventListener;
33 import org.zkoss.zk.ui.event.Events;
34 import org.zkoss.zk.ui.ext.AfterCompose;
35 import org.zkoss.zk.ui.util.Clients;
36 import org.zkoss.zul.Toolbarbutton;
45 private EventListener onClick;
46 private boolean mustSave =
false;
49 this.contract = contract;
65 onClick =
new EventListener() {
67 public void onEvent(Event event)
throws Exception {
69 if(handshake !=
null) {
73 Clients.showNotification(er.
message +
": " + er.
code);
76 Clients.showNotification(
"Handshake server not found");
83 public Object execute(Context context) {
84 String remoteUrl = (String) context.get(
"value");
86 if(!Strings.isBlank(remoteUrl)) {
94 Clients.showNotification(
I_.
get(
"Save before continue") +
"<br/>" + er.
message +
": " + er.
code);
98 Clients.showNotification(
"Handshake server not found");
109 addEventListener(Events.ON_CLICK, onClick);
113 if(onClick ==
null) {
114 onClick =
new EventListener() {
116 public void onEvent(Event event)
throws Exception {
118 if(handshake !=
null) {
122 Clients.showNotification(er.
message +
": " + er.
code);
125 Clients.showNotification(
"Handshake server not found");
133 addEventListener(Events.ON_CLICK, onClick);
148 case HS_NO_HANDSHAKE:
static String getImage(String image)
void setContract(Contract contract)
void setRemoteServer(String remoteServer)
ContractHandshake getContractHandshake()
ContractDefinition getContractDefinition()
void setContractHandshake(ContractHandshake contractHandshake)
void setContract(Contract contract)
static ElephantResponse sendPetition(Contract contract, String remoteUrl)
static ElephantResponse checkStatus(Contract contract)
static boolean isCorrect(ElephantResponse er)
static String checkAppServer(String server, boolean secured)
static String get(String msg)
static HandshakeStatus getStatus(ElephantResponse er)