Example usage for com.google.gwt.event.logical.shared CloseHandler CloseHandler

List of usage examples for com.google.gwt.event.logical.shared CloseHandler CloseHandler

Introduction

In this page you can find the example usage for com.google.gwt.event.logical.shared CloseHandler CloseHandler.

Prototype

CloseHandler

Source Link

Usage

From source file:at.ait.dme.yuma.client.Application.java

License:EUPL

/**
 * show the annotation composite/*  w  w  w. ja v  a2 s .co m*/
 */
private void showAnnotations() {
    // Create a floating window
    final WindowPanel window = MinMaxWindowPanel.createMinMaxWindowPanel(500, 50, 430, 600);
    window.show();
    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
            // we do not allow to close this window
            window.show();
        }
    });

    // Parent tab panel 
    TabLayoutPanel tabPanel = new DecoratedTabLayoutPanel();
    tabPanel.setPadding(0);
    showAnnotationsTab(tabPanel);
    if (Application.isInTileMode()) {
        showGeoReferencingTab(tabPanel);
        showExplorationTab(tabPanel);
        tabPanel.addSelectionHandler(new SelectionHandler<Integer>() {

            TiledImageComposite tic = (TiledImageComposite) imageComposite;

            @Override
            public void onSelection(SelectionEvent<Integer> event) {
                if (event.getSelectedItem().intValue() == 0) {
                    // Annotations tab
                    tic.showAnnotationLayer();
                } else if (event.getSelectedItem().intValue() == 1) {
                    // Georeferencing tab
                    tic.showControlPointLayer();
                } else if (event.getSelectedItem().intValue() == 2) {
                    // Exploration tab
                }
            }
        });
    }
    window.setWidget(tabPanel);
}

From source file:at.ait.dme.yuma.suite.apps.image.client.YumaImageClient.java

License:EUPL

private void showAnnotations() {
    // Create a floating window
    final WindowPanel window = MinMaxWindowPanel.createMinMaxWindowPanel(500, 50, 430, 500);
    window.show();/*from ww  w  .jav a2s. c o m*/
    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
            // we do not allow to close this window
            window.show();
        }
    });

    // Parent tab panel 
    TabLayoutPanel tabPanel = new DecoratedTabLayoutPanel();
    tabPanel.setPadding(0);
    showAnnotationsTab(tabPanel);
    window.setWidget(tabPanel);
}

From source file:at.ait.dme.yuma.suite.apps.map.client.YumaMapClient.java

License:EUPL

private void showAnnotations() {
    // Create a floating window
    final WindowPanel window = MinMaxWindowPanel.createMinMaxWindowPanel(500, 50, 430, 500);
    window.show();//from  ww  w  . j a  v a  2s .co m
    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
            // we do not allow to close this window
            window.show();
        }
    });

    TabLayoutPanel tabPanel = new DecoratedTabLayoutPanel();
    tabPanel.setPadding(0);
    showAnnotationsTab(tabPanel);

    showGeoReferencingTab(tabPanel);
    showExplorationTab(tabPanel);
    tabPanel.addSelectionHandler(new SelectionHandler<Integer>() {

        TileBasedImageViewer tic = (TileBasedImageViewer) mapViewer;

        @Override
        public void onSelection(SelectionEvent<Integer> event) {
            if (event.getSelectedItem().intValue() == 0) {
                // Annotations tab
                tic.showAnnotationLayer();
            } else if (event.getSelectedItem().intValue() == 1) {
                // Georeferencing tab
                tic.showControlPointLayer();
            } else if (event.getSelectedItem().intValue() == 2) {
                // Exploration tab
            }
        }

    });

    window.setWidget(tabPanel);
}

From source file:cc.alcina.framework.gwt.client.cell.PropertyDateCell.java

License:Apache License

/**
 * Constructs a new DatePickerCell that uses the given date/time format and
 * {@link SafeHtmlRenderer}.//from   w w w .jav  a2 s.  co m
 *
 * @param format
 *            a {@link DateTimeFormat} instance
 * @param renderer
 *            a {@link SafeHtmlRenderer SafeHtmlRenderer<String>} instance
 */
public PropertyDateCell(DateTimeFormat format, SafeHtmlRenderer<String> renderer) {
    super(CLICK, KEYDOWN);
    if (format == null) {
        throw new IllegalArgumentException("format == null");
    }
    if (renderer == null) {
        throw new IllegalArgumentException("renderer == null");
    }
    this.format = format;
    this.renderer = renderer;
    this.datePicker = new DatePicker();
    this.panel = new PopupPanel(true, true) {
        @Override
        protected void onPreviewNativeEvent(NativePreviewEvent event) {
            if (Event.ONKEYUP == event.getTypeInt()) {
                if (event.getNativeEvent().getKeyCode() == ESCAPE) {
                    // Dismiss when escape is pressed
                    panel.hide();
                }
            }
        }
    };
    panel.addCloseHandler(new CloseHandler<PopupPanel>() {
        public void onClose(CloseEvent<PopupPanel> event) {
            lastKey = null;
            lastValue = null;
            lastIndex = -1;
            lastColumn = -1;
            if (lastParent != null && !event.isAutoClosed()) {
                // Refocus on the containing cell after the user selects a
                // value, but
                // not if the popup is auto closed.
                lastParent.focus();
            }
            lastParent = null;
        }
    });
    panel.add(datePicker);
    // Hide the panel and call valueUpdater.update when a date is selected
    datePicker.addValueChangeHandler(new ValueChangeHandler<Date>() {
        public void onValueChange(ValueChangeEvent<Date> event) {
            // Remember the values before hiding the popup.
            Element cellParent = lastParent;
            Date oldValue = lastValue;
            Object key = lastKey;
            int index = lastIndex;
            int column = lastColumn;
            panel.hide();
            // Update the cell and value updater.
            Date date = event.getValue();
            setViewData(key, date);
            setValue(new Context(index, column, key), cellParent, oldValue);
            if (valueUpdater != null) {
                valueUpdater.update(date);
            }
        }
    });
}

From source file:cc.alcina.framework.gwt.client.cell.PropertyDomainSuggestCell.java

License:Apache License

public PropertyDomainSuggestCell(Function<T, String> toStringMapper, BoundSuggestBox suggestor) {
    super(CLICK, KEYDOWN);
    this.toStringMapper = toStringMapper;
    this.suggestor = suggestor;
    this.renderer = SimpleSafeHtmlRenderer.getInstance();
    this.panel = new PopupPanel(true, true) {
        @Override// w w w  . jav a  2s.c o  m
        protected void onPreviewNativeEvent(NativePreviewEvent event) {
            if (Event.ONKEYUP == event.getTypeInt()) {
                if (event.getNativeEvent().getKeyCode() == ESCAPE) {
                    // Dismiss when escape is pressed
                    panel.hide();
                }
            }
        }
    };
    panel.addStyleName("property-selector");
    panel.addCloseHandler(new CloseHandler<PopupPanel>() {
        public void onClose(CloseEvent<PopupPanel> event) {
            lastKey = null;
            lastValue = null;
            lastIndex = -1;
            lastColumn = -1;
            if (lastParent != null && !event.isAutoClosed()) {
                // Refocus on the containing cell after the user selects a
                // value, but
                // not if the popup is auto closed.
                lastParent.focus();
            }
            lastParent = null;
        }
    });
    panel.add(suggestor);
    // Hide the panel and call valueUpdater.update when a value is selected
    suggestor.addPropertyChangeListener("value", event -> {
        // Remember the values before hiding the popup.
        Element cellParent = lastParent;
        T oldValue = lastValue;
        Object key = lastKey;
        int index = lastIndex;
        int column = lastColumn;
        panel.hide();
        // Update the cell and value updater.
        T value = (T) event.getNewValue();
        setViewData(key, value);
        setValue(new Context(index, column, key), cellParent, oldValue);
        if (valueUpdater != null) {
            valueUpdater.update(value);
        }
        lastFilterText = suggestor.getLastFilterText();
    });
}

From source file:cc.alcina.framework.gwt.client.cell.PropertySelectorCell.java

License:Apache License

private PopupPanel ensurePopup() {
    this.panel = new PopupPanel(true, true) {
        @Override/*from ww w.j a  va2  s .c o m*/
        protected void onPreviewNativeEvent(NativePreviewEvent event) {
            if (Event.ONKEYUP == event.getTypeInt()) {
                if (event.getNativeEvent().getKeyCode() == ESCAPE) {
                    // Dismiss when escape is pressed
                    panel.hide();
                }
            }
        }
    };
    panel.addStyleName("property-selector");
    panel.addCloseHandler(new CloseHandler<PopupPanel>() {
        public void onClose(CloseEvent<PopupPanel> event) {
            lastKey = null;
            lastValue = null;
            lastIndex = -1;
            lastColumn = -1;
            if (lastParent != null && !event.isAutoClosed()) {
                // Refocus on the containing cell after the user selects a
                // value, but
                // not if the popup is auto closed.
                lastParent.focus();
            }
            lastParent = null;
        }
    });
    panel.add(selector);
    return panel;
}

From source file:cc.alcina.framework.gwt.client.cell.PropertySingleSelectorCell.java

License:Apache License

public PropertySingleSelectorCell(Class<T> selectionObjectClass, Function<T, String> toStringMapper,
        FlatSearchSelector selector) {/* w w  w  .ja  v  a  2 s . c  o  m*/
    super(CLICK, KEYDOWN);
    this.toStringMapper = toStringMapper;
    this.selector = selector;
    this.renderer = SimpleSafeHtmlRenderer.getInstance();
    this.panel = new PopupPanel(true, true) {
        @Override
        protected void onPreviewNativeEvent(NativePreviewEvent event) {
            if (Event.ONKEYUP == event.getTypeInt()) {
                if (event.getNativeEvent().getKeyCode() == ESCAPE) {
                    // Dismiss when escape is pressed
                    panel.hide();
                }
            }
        }
    };
    panel.addStyleName("property-selector");
    panel.addCloseHandler(new CloseHandler<PopupPanel>() {
        public void onClose(CloseEvent<PopupPanel> event) {
            lastKey = null;
            lastValue = null;
            lastIndex = -1;
            lastColumn = -1;
            if (lastParent != null && !event.isAutoClosed()) {
                // Refocus on the containing cell after the user selects a
                // value, but
                // not if the popup is auto closed.
                lastParent.focus();
            }
            lastParent = null;
        }
    });
    panel.add(selector);
    // Hide the panel and call valueUpdater.update when a value is selected
    selector.addPropertyChangeListener("value", event -> {
        // Remember the values before hiding the popup.
        Element cellParent = lastParent;
        T oldValue = lastValue;
        Object key = lastKey;
        int index = lastIndex;
        int column = lastColumn;
        panel.hide();
        // Update the cell and value updater.
        T value = (T) event.getNewValue();
        setViewData(key, value);
        setValue(new Context(index, column, key), cellParent, oldValue);
        if (valueUpdater != null) {
            valueUpdater.update(value);
        }
        lastFilterText = selector.getLastFilterText();
    });
}

From source file:cc.kune.bootstrap.client.actions.ui.PopupBSMenuGui.java

License:GNU Affero Public License

/**
 * Creates the popup that includes the menu.
 *
 * @return the popup panel//from  ww  w .  j  a  v  a2s. co m
 */
private PopupPanel createPopup() {
    popup = new PopupPanel(true);
    popup.setStyleName("oc-menu");
    popup.add(popupContent);
    SmartMenuUtils.init(popup.getElement());
    popup.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(final CloseEvent<PopupPanel> event) {
            descriptor.putValue(MenuDescriptor.MENU_ONHIDE, popup);
        }
    });
    return popup;
}

From source file:cc.kune.common.client.actions.gwtui.AbstractGwtMenuGui.java

License:GNU Affero Public License

/**
 * Creates the popup.//from  w ww.  ja  va2  s  . co  m
 *
 * @return the popup panel
 */
private PopupPanel createPopup() {
    popup = new PopupPanel(true);
    popup.setStyleName("oc-menu");
    popup.add(menu);
    popup.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(final CloseEvent<PopupPanel> event) {
            descriptor.putValue(MenuDescriptor.MENU_ONHIDE, popup);
        }
    });
    return popup;
}

From source file:cc.kune.common.client.ui.dialogs.wizard.WizardDialog.java

License:GNU Affero Public License

/**
 * Instantiates a new wizard dialog./* www .  j a  v a2  s  .  c o m*/
 *
 * @param dialogId
 *          the dialog id
 * @param header
 *          the header
 * @param modal
 *          the modal
 * @param minimizable
 *          the minimizable
 * @param width
 *          the width
 * @param height
 *          the height
 * @param backId
 *          the back id
 * @param nextId
 *          the next id
 * @param finishId
 *          the finish id
 * @param cancelId
 *          the cancel id
 * @param closeId
 *          the close id
 * @param i18n
 *          the i18n
 * @param maskWidget
 *          the mask widget
 * @param listener
 *          the listener
 */
public WizardDialog(final String dialogId, final String header, final boolean modal, final boolean minimizable,
        final String width, final String height, final String backId, final String nextId,
        final String finishId, final String cancelId, final String closeId, final I18nTranslationService i18n,
        final MaskWidgetView maskWidget, final WizardListener listener) {
    this.maskWidget = maskWidget;
    this.listener = listener;
    this.i18n = i18n;
    final Builder dialogBuilder = new BasicTopDialog.Builder(dialogId, false, modal, i18n.getDirection())
            .width(width).height(height).firstButtonId(cancelId).sndButtonId(finishId).title(header);
    dialog = dialogBuilder.build();
    dialog.setFirstBtnText(i18n.tWithNT("Cancel", "used in button"));
    dialog.getFirstBtn().addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            WizardDialog.this.listener.onCancel();
        }
    });

    nextButton = new CustomButton(i18n.tWithNT("Next ", "used in button"), new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            WizardDialog.this.listener.onNext();
        }
    });
    nextButton.ensureDebugId(nextId);
    nextButton.addStyleName("btn-group");
    nextButton.addStyleName("kune-Margin-Medium-l");
    dialog.getBtnPanel().addStyleName("btn-group");
    dialog.addCloseHandler(new CloseHandler<BSBasicDialog>() {

        @Override
        public void onClose(final CloseEvent<BSBasicDialog> event) {
            WizardDialog.this.listener.onClose();
        }
    });

    backButton = new CustomButton(i18n.tWithNT(" Back", "used in button"), new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            WizardDialog.this.listener.onBack();
        }
    });
    backButton.ensureDebugId(backId);
    backButton.addStyleName("btn-group");
    backButton.addStyleName("kune-Margin-Medium-l");
    dialog.getBtnPanel().add(backButton);
    dialog.getBtnPanel().add(nextButton);

    dialog.setSecondBtnId(finishId);
    dialog.setSecondBtnText(i18n.tWithNT("Finish", "used in button"));
    dialog.getSecondBtn().addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            WizardDialog.this.listener.onFinish();
        }
    });

    deck = new DeckPanel();
}