Beispiel #1
0
  /** {@inheritDoc} */
  @Override
  public void buildExportDialog(final ContactDetailsPresenter.ExportActionHandler handler) {

    final Window w = new Window();
    w.setPlain(true);
    w.setModal(true);
    w.setBlinkModal(true);
    w.setLayout(new FitLayout());
    w.setSize(400, 180);
    w.setHeadingHtml(I18N.CONSTANTS.exportData());

    final FormPanel panel = Forms.panel();

    final CheckBox synthesisBox = Forms.checkbox(I18N.CONSTANTS.caracteristics(), Boolean.TRUE);
    synthesisBox.setEnabled(false);
    final CheckBox allRelationsBox = Forms.checkbox(I18N.CONSTANTS.allRelations());
    final CheckBox frameworkRelationsBox = Forms.checkbox(I18N.CONSTANTS.frameworkRelations());
    final CheckBox relationsByElementBox = Forms.checkbox(I18N.CONSTANTS.relationsByElement());

    final CheckBoxGroup options =
        Forms.checkBoxGroup(
            I18N.CONSTANTS.exportOptions(),
            com.extjs.gxt.ui.client.Style.Orientation.VERTICAL,
            synthesisBox,
            allRelationsBox,
            frameworkRelationsBox,
            relationsByElementBox);

    panel.add(options);

    final Button export = Forms.button(I18N.CONSTANTS.export());
    panel.getButtonBar().add(export);
    export.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(final ButtonEvent ce) {
            if (handler != null) {
              handler.onExportContact(
                  synthesisBox.getValue(),
                  allRelationsBox.getValue(),
                  frameworkRelationsBox.getValue(),
                  relationsByElementBox.getValue());
            }
            w.hide();
          }
        });

    w.add(panel);
    w.show();
  }
 /** {@inheritDoc} */
 @Override
 public void onBrowserEvent(Event event) {
   super.onBrowserEvent(event);
   if ((event.getTypeInt() != Event.ONCLICK)
       && ((Element) event.getEventTarget().cast()).isOrHasChild(file.dom)) {
     button.onBrowserEvent(event);
   }
 }
  /** {@inheritDoc} */
  @Override
  protected void onRender(Element target, int index) {

    final El wrap = new El(DOM.createDiv());
    wrap.addStyleName("x-form-field-wrap");
    wrap.addStyleName("x-form-file-wrap");

    setElement(wrap.dom, target, index);

    createFileInput();

    button = Forms.button(buttonCaption != null ? buttonCaption : "...");
    button.addStyleName("x-form-file-btn");
    button.setIcon(buttonIcon);
    button.render(wrap.dom);

    super.onRender(target, index);
    super.setReadOnly(true);
  }
 /** {@inheritDoc} */
 @Override
 protected void onBlur(ComponentEvent ce) {
   final Rectangle rec = button.el().getBounds();
   if (rec.contains(BaseEventPreview.getLastXY())) {
     ce.stopEvent();
     return;
   }
   super.onBlur(ce);
   focusPreview.remove();
 }
 /** {@inheritDoc} */
 @Override
 public void setReadOnly(boolean readOnly) {
   this.readOnly = readOnly;
   if (button != null) {
     button.setEnabled(!readOnly);
   }
   if (file != null) {
     file.setEnabled(!readOnly);
   }
 }
 /** {@inheritDoc} */
 @Override
 protected void onResize(int width, int height) {
   super.onResize(width, height);
   el().setWidth(button.getWidth());
 }
 /** {@inheritDoc} */
 @Override
 public boolean isLoading() {
   return button.isLoading();
 }
 /** {@inheritDoc} */
 @Override
 public void setLoading(boolean loading) {
   button.setLoading(loading);
 }