Search in sources :

Example 1 with ModalHideEvent

use of org.gwtbootstrap3.client.shared.event.ModalHideEvent in project kura by eclipse.

the class NatTabUi method initEditButton.

private void initEditButton() {
    this.edit.setText(MSGS.editButton());
    this.edit.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            GwtFirewallNatEntry selection = NatTabUi.this.selectionModel.getSelectedObject();
            if (selection != null) {
                showModal(selection);
            }
        }
    });
    this.natForm.addHideHandler(new ModalHideHandler() {

        @Override
        public void onHide(ModalHideEvent evt) {
            if (NatTabUi.this.editNatEntry != null) {
                GwtFirewallNatEntry oldEntry = NatTabUi.this.selectionModel.getSelectedObject();
                NatTabUi.this.natDataProvider.getList().remove(oldEntry);
                if (!duplicateEntry(NatTabUi.this.editNatEntry)) {
                    NatTabUi.this.natDataProvider.getList().add(NatTabUi.this.editNatEntry);
                    NatTabUi.this.natDataProvider.flush();
                    NatTabUi.this.apply.setEnabled(true);
                    NatTabUi.this.editNatEntry = null;
                } else {
                    // end duplicate
                    NatTabUi.this.natDataProvider.getList().add(oldEntry);
                    NatTabUi.this.natDataProvider.flush();
                }
            }
        }
    });
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) GwtFirewallNatEntry(org.eclipse.kura.web.shared.model.GwtFirewallNatEntry) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ModalHideHandler(org.gwtbootstrap3.client.shared.event.ModalHideHandler) ModalHideEvent(org.gwtbootstrap3.client.shared.event.ModalHideEvent)

Example 2 with ModalHideEvent

use of org.gwtbootstrap3.client.shared.event.ModalHideEvent in project kura by eclipse.

the class OpenPortsTabUi method initCreateButton.

private void initCreateButton() {
    this.create.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            showModal(null);
        }
    });
    // TODO add warnings for port 80 and 22
    this.openPortsForm.addHideHandler(new ModalHideHandler() {

        @Override
        public void onHide(ModalHideEvent evt) {
            if (OpenPortsTabUi.this.newOpenPortEntry != null) {
                if (!duplicateEntry(OpenPortsTabUi.this.newOpenPortEntry)) {
                    OpenPortsTabUi.this.openPortsDataProvider.getList().add(OpenPortsTabUi.this.newOpenPortEntry);
                    refreshTable();
                    setVisibility();
                    OpenPortsTabUi.this.apply.setEnabled(true);
                } else {
                // Growl.growl(MSGS.firewallOpenPortFormError()
                // + ": ",
                // MSGS.firewallOpenPortFormDuplicate());
                }
            }
        }
    });
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ModalHideHandler(org.gwtbootstrap3.client.shared.event.ModalHideHandler) ModalHideEvent(org.gwtbootstrap3.client.shared.event.ModalHideEvent)

Example 3 with ModalHideEvent

use of org.gwtbootstrap3.client.shared.event.ModalHideEvent in project kura by eclipse.

the class PortForwardingTabUi method initEditButton.

private void initEditButton() {
    this.edit.setText(MSGS.editButton());
    this.edit.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            GwtFirewallPortForwardEntry selection = PortForwardingTabUi.this.selectionModel.getSelectedObject();
            if (selection != null) {
                showModal(selection);
            }
        }
    });
    this.portForwardingForm.addHideHandler(new ModalHideHandler() {

        @Override
        public void onHide(ModalHideEvent evt) {
            if (PortForwardingTabUi.this.editPortForwardEntry != null) {
                GwtFirewallPortForwardEntry oldEntry = PortForwardingTabUi.this.selectionModel.getSelectedObject();
                PortForwardingTabUi.this.portForwardDataProvider.getList().remove(oldEntry);
                if (!duplicateEntry(PortForwardingTabUi.this.editPortForwardEntry)) {
                    PortForwardingTabUi.this.portForwardDataProvider.getList().add(PortForwardingTabUi.this.editPortForwardEntry);
                    PortForwardingTabUi.this.portForwardDataProvider.flush();
                    PortForwardingTabUi.this.apply.setEnabled(true);
                    PortForwardingTabUi.this.editPortForwardEntry = null;
                } else {
                    // end duplicate
                    PortForwardingTabUi.this.portForwardDataProvider.getList().add(oldEntry);
                    PortForwardingTabUi.this.portForwardDataProvider.flush();
                }
            }
        }
    });
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) GwtFirewallPortForwardEntry(org.eclipse.kura.web.shared.model.GwtFirewallPortForwardEntry) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ModalHideHandler(org.gwtbootstrap3.client.shared.event.ModalHideHandler) ModalHideEvent(org.gwtbootstrap3.client.shared.event.ModalHideEvent)

Example 4 with ModalHideEvent

use of org.gwtbootstrap3.client.shared.event.ModalHideEvent in project kura by eclipse.

the class NatTabUi method initCreateButton.

private void initCreateButton() {
    this.create.setText(MSGS.newButton());
    this.create.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            showModal(null);
        }
    });
    this.natForm.addHideHandler(new ModalHideHandler() {

        @Override
        public void onHide(ModalHideEvent evt) {
            if (NatTabUi.this.newNatEntry != null && !duplicateEntry(NatTabUi.this.newNatEntry)) {
                NatTabUi.this.natDataProvider.getList().add(NatTabUi.this.newNatEntry);
                refreshTable();
                NatTabUi.this.apply.setEnabled(true);
                NatTabUi.this.newNatEntry = null;
            }
        }
    });
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ModalHideHandler(org.gwtbootstrap3.client.shared.event.ModalHideHandler) ModalHideEvent(org.gwtbootstrap3.client.shared.event.ModalHideEvent)

Example 5 with ModalHideEvent

use of org.gwtbootstrap3.client.shared.event.ModalHideEvent in project kura by eclipse.

the class OpenPortsTabUi method initEditButton.

private void initEditButton() {
    this.edit.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            GwtFirewallOpenPortEntry selection = OpenPortsTabUi.this.selectionModel.getSelectedObject();
            if (selection != null) {
                if (selection.getPortRange().equals("22")) {
                    // show warning
                    OpenPortsTabUi.this.alertBody.setText(MSGS.firewallOpenPorts22());
                    OpenPortsTabUi.this.yes.setText(MSGS.yesButton());
                    OpenPortsTabUi.this.no.setText(MSGS.noButton());
                    OpenPortsTabUi.this.no.addClickHandler(new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent event) {
                            OpenPortsTabUi.this.alert.hide();
                        }
                    });
                    OpenPortsTabUi.this.yes.addClickHandler(new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent event) {
                            showModal(OpenPortsTabUi.this.selectionModel.getSelectedObject());
                            OpenPortsTabUi.this.alert.hide();
                        }
                    });
                    OpenPortsTabUi.this.alert.show();
                } else if (selection.getPortRange().equals("80")) {
                    // show warning
                    OpenPortsTabUi.this.alertBody.setText(MSGS.firewallOpenPorts80());
                    OpenPortsTabUi.this.yes.setText(MSGS.yesButton());
                    OpenPortsTabUi.this.no.setText(MSGS.noButton());
                    OpenPortsTabUi.this.no.addClickHandler(new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent event) {
                            OpenPortsTabUi.this.alert.hide();
                        }
                    });
                    OpenPortsTabUi.this.yes.addClickHandler(new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent event) {
                            showModal(OpenPortsTabUi.this.selectionModel.getSelectedObject());
                            OpenPortsTabUi.this.alert.hide();
                        }
                    });
                    OpenPortsTabUi.this.alert.show();
                } else {
                    showModal(selection);
                }
            }
        }
    });
    this.openPortsForm.addHideHandler(new ModalHideHandler() {

        @Override
        public void onHide(ModalHideEvent evt) {
            if (OpenPortsTabUi.this.editOpenPortEntry != null) {
                GwtFirewallOpenPortEntry oldEntry = OpenPortsTabUi.this.selectionModel.getSelectedObject();
                OpenPortsTabUi.this.openPortsDataProvider.getList().remove(OpenPortsTabUi.this.selectionModel.getSelectedObject());
                refreshTable();
                if (!duplicateEntry(OpenPortsTabUi.this.editOpenPortEntry)) {
                    OpenPortsTabUi.this.openPortsDataProvider.getList().add(OpenPortsTabUi.this.editOpenPortEntry);
                    OpenPortsTabUi.this.openPortsDataProvider.flush();
                    OpenPortsTabUi.this.apply.setEnabled(true);
                    OpenPortsTabUi.this.editOpenPortEntry = null;
                    setVisibility();
                } else {
                    // end duplicate
                    OpenPortsTabUi.this.openPortsDataProvider.getList().add(oldEntry);
                    OpenPortsTabUi.this.openPortsDataProvider.flush();
                }
                refreshTable();
            }
        // end !=null
        }
    });
}
Also used : GwtFirewallOpenPortEntry(org.eclipse.kura.web.shared.model.GwtFirewallOpenPortEntry) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ModalHideHandler(org.gwtbootstrap3.client.shared.event.ModalHideHandler) ModalHideEvent(org.gwtbootstrap3.client.shared.event.ModalHideEvent)

Aggregations

ClickEvent (com.google.gwt.event.dom.client.ClickEvent)6 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)6 ModalHideEvent (org.gwtbootstrap3.client.shared.event.ModalHideEvent)6 ModalHideHandler (org.gwtbootstrap3.client.shared.event.ModalHideHandler)6 GwtFirewallNatEntry (org.eclipse.kura.web.shared.model.GwtFirewallNatEntry)1 GwtFirewallOpenPortEntry (org.eclipse.kura.web.shared.model.GwtFirewallOpenPortEntry)1 GwtFirewallPortForwardEntry (org.eclipse.kura.web.shared.model.GwtFirewallPortForwardEntry)1