Пример #1
0
 @Override
 protected void onDeleteSubmit(AjaxRequestTarget target, Form<?> form) {
   Application.getBean(FieldLanguagesValuesDao.class)
       .delete(getModelObject(), WebSession.getUserId());
   target.add(panel.listContainer);
   target.appendJavaScript("labelsInit();");
 }
Пример #2
0
    private static void replace(AjaxRequestTarget target, Component component) {
      component.add(new DisplayNoneBehavior());

      target.prependJavaScript(
          "notify|jQuery('#" + component.getMarkupId() + "').slideUp(1000, notify);");
      target.add(component);
      target.appendJavaScript("jQuery('#" + component.getMarkupId() + "').slideDown(1000);");
    }
Пример #3
0
 public void iniciar(AjaxRequestTarget target) {
   String url = getCallbackUrl().toString();
   if (antiCache) {
     url = url + (url.contains("?") ? "&" : "?");
     url = url + "antiCache=" + System.currentTimeMillis();
   }
   target.appendJavaScript("setTimeout(\"window.location.href='" + url + "'\", 100);");
 }
Пример #4
0
 @Override
 protected void onNewSubmit(AjaxRequestTarget target, Form<?> f) {
   Fieldlanguagesvalues flv = new Fieldlanguagesvalues();
   flv.setLanguage_id(panel.language.getLanguage_id());
   this.setModelObject(flv);
   target.add(this);
   target.appendJavaScript("labelsInit();");
 }
Пример #5
0
 public void cancelEditing(AjaxRequestTarget target) {
   target.appendJavaScript(
       jsClosure(
           "var sw = $('#"
               + getMarkupId()
               + "').swidget(\""
               + getWidgetType()
               + "\"); if (sw) { sw.cancelEditing(); }"));
 }
  /**
   * Sets the dialog's title dynamically
   *
   * @param target the {@link AjaxRequestTarget}
   * @param title the dialog's title
   */
  public void setTitle(AjaxRequestTarget target, IModel<String> title) {
    this.setTitle(title);

    target.appendJavaScript(
        this.widgetBehavior.$(
            Options.asString("option"),
            Options.asString("title"),
            Options.asString(title.getObject())));
  }
Пример #7
0
 public void clearSelection(AjaxRequestTarget target) {
   target.appendJavaScript(
       jsClosure(
           "var sw = $('#"
               + getMarkupId()
               + "').swidget(\""
               + getWidgetType()
               + "\"); if (sw) { sw.clearSelection(); }"));
 }
Пример #8
0
 public void saveChanges(AjaxRequestTarget target) {
   target.appendJavaScript(
       jsClosure(
           "var sw = $('#"
               + getMarkupId()
               + "').swidget(\""
               + getWidgetType()
               + "\"); if (sw) { sw.saveChanges(); }"));
 }
Пример #9
0
 public void pageSize(AjaxRequestTarget target, Integer pageSize) {
   target.appendJavaScript(
       jsClosure(
           "var sw = $('#"
               + getMarkupId()
               + "').swidget(\""
               + getWidgetType()
               + "\"); if (sw) { sw.pageSize("
               + pageSize
               + "); }"));
 }
Пример #10
0
 public void filter(AjaxRequestTarget target, DataSourceOptions.FilterOption filter) {
   target.appendJavaScript(
       jsClosure(
           "var sw = $('#"
               + getMarkupId()
               + "').swidget(\""
               + getWidgetType()
               + "\"); if (sw) { sw.filter("
               + hashToJson(filter.toHashMap())
               + "); }"));
 }
Пример #11
0
 public void setEnabled(AjaxRequestTarget target, Boolean enabled) {
   target.appendJavaScript(
       jsClosure(
           "var sw = $('#"
               + getMarkupId()
               + "').swidget(\""
               + getWidgetType()
               + "\"); if (sw) { sw.enabled("
               + (enabled ? "true" : "false")
               + "); }"));
 }
Пример #12
0
 public void addRow(AjaxRequestTarget target, HashMap<String, Object> item) {
   target.appendJavaScript(
       jsClosure(
           "var sw = $('#"
               + getMarkupId()
               + "').swidget(\""
               + getWidgetType()
               + "\"); if (sw) { sw.addRow("
               + hashToJson(item)
               + "); }"));
 }
Пример #13
0
 public void collapseRow(AjaxRequestTarget target, JsonFunction row) {
   target.appendJavaScript(
       jsClosure(
           "var sw = $('#"
               + getMarkupId()
               + "').swidget(\""
               + getWidgetType()
               + "\"); if (sw) { sw.collapseRow("
               + row
               + "); }"));
 }
Пример #14
0
 public void select(AjaxRequestTarget target, String selector) {
   target.appendJavaScript(
       jsClosure(
           "var sw = $('#"
               + getMarkupId()
               + "').swidget(\""
               + getWidgetType()
               + "\"); if (sw) { sw.select("
               + selector
               + "); }"));
 }
Пример #15
0
 public void collapseRow(AjaxRequestTarget target, Integer index) {
   target.appendJavaScript(
       jsClosure(
           "var sw = $('#"
               + getMarkupId()
               + "').swidget(\""
               + getWidgetType()
               + "\"); if (sw) { sw.collapseRow("
               + index
               + "); }"));
 }
Пример #16
0
  @Override
  protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) {
    Fieldlanguagesvalues flv = getModelObject();
    Fieldvalues fv = flv.getFieldvalues();
    Application.getBean(FieldValueDao.class).update(fv, WebSession.getUserId());

    flv.setFieldvalues(fv);
    Application.getBean(FieldLanguagesValuesDao.class).update(flv, WebSession.getUserId());
    hideNewRecord();
    target.add(panel.listContainer);
    target.appendJavaScript("labelsInit();");
  }
Пример #17
0
 public void editCell(AjaxRequestTarget target, Integer rowIndex, Integer colIndex) {
   target.appendJavaScript(
       jsClosure(
           "var sw = $('#"
               + getMarkupId()
               + "').swidget(\""
               + getWidgetType()
               + "\"); if (sw) { sw.editCell("
               + rowIndex
               + ", "
               + colIndex
               + "); }"));
 }
Пример #18
0
 public void reorderColumn(AjaxRequestTarget target, Integer oldIndex, Integer newIndex) {
   target.appendJavaScript(
       jsClosure(
           "var sw = $('#"
               + getMarkupId()
               + "').swidget(\""
               + getWidgetType()
               + "\"); if (sw) { sw.reorderColumn("
               + oldIndex
               + ", "
               + newIndex
               + "); }"));
 }
Пример #19
0
 @Override
 protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) {
   Fieldlanguagesvalues flv = getModelObject();
   if (flv.getFieldlanguagesvalues_id() != null) {
     flv =
         Application.getBean(FieldLanguagesValuesDao.class)
             .get(getModelObject().getFieldlanguagesvalues_id());
   } else {
     flv = new Fieldlanguagesvalues();
   }
   this.setModelObject(flv);
   target.add(this);
   target.appendJavaScript("labelsInit();");
 }
Пример #20
0
 public void sort(AjaxRequestTarget target, String field, Boolean desc, Boolean unsort) {
   target.appendJavaScript(
       jsClosure(
           "var sw = $('#"
               + getMarkupId()
               + "').swidget(\""
               + getWidgetType()
               + "\"); if (sw) { sw.sort(\""
               + field
               + "\", "
               + (desc ? "true" : "false")
               + ","
               + (unsort ? "true" : "false")
               + ")); }"));
 }
Пример #21
0
  /**
   * helper method
   *
   * @param marker
   */
  public void clickAndOpenPopup(Marker marker, AjaxRequestTarget target) {
    String mapId = getOpenLayerMap().getJSInstance();
    String jsToRun =
        "if ("
            + mapId
            + ".popup != null) {"
            + "		"
            + mapId
            + ".map.removePopup("
            + mapId
            + ".popup);"
            + "		"
            + mapId
            + ".popup.destroy();"
            + "		"
            + mapId
            + ".popup = null;"
            + "}";

    target.prependJavaScript(jsToRun);

    // Currently only support clicking on markers!
    getOpenLayerMap().getInfoWindow().getContent().replaceWith(marker.getPopup());
    getOpenLayerMap().getInfoWindow().setContent(marker.getPopup());
    target.add(marker.getPopup());
    jsToRun =
        mapId
            + ".popup = new OpenLayers.Popup('map', "
            + new LonLat(marker.getLonLat().getLng(), marker.getLonLat().getLat())
            + ", "
            + new Size(195, 250).getJSconstructor()
            + ", document.getElementById("
            + mapId
            + ".popupId).innerHTML, true);"
            + mapId
            + ".popup.setBackgroundColor('white');"
            + mapId
            + ".map.addPopup("
            + mapId
            + ".popup);";

    // open info window
    target.appendJavaScript(jsToRun);
  }
Пример #22
0
  /**
   * close the popup
   *
   * @param target
   */
  public void closePopup(AjaxRequestTarget target) {
    String mapId = getOpenLayerMap().getJSInstance();
    String jsToRun =
        "if ("
            + mapId
            + ".popup != null) {"
            + "		"
            + mapId
            + ".map.removePopup("
            + mapId
            + ".popup);"
            + "		"
            + mapId
            + ".popup.destroy();"
            + "		"
            + mapId
            + ".popup = null;"
            + "}";

    target.appendJavaScript(jsToRun);
  }
    @Override
    protected void respond(AjaxRequestTarget pTarget) {
      ImageUploadContentPanel content =
          new ImageUploadContentPanel(modalWindow.getContentId(), uploadFolderPath) {
            private static final long serialVersionUID = 1L;

            @Override
            public void onImageUploaded(
                ImageFileDescription pImageFileDescription, AjaxRequestTarget pTarget) {
              modalWindow.close(pTarget);
              resetModalContent();
              CharSequence url = ImageUploadPanel.this.urlFor(IResourceListener.INTERFACE, null);
              XmlTag xmlImageTag = ImageUploadHelper.createImageTag(pImageFileDescription, url);
              pTarget.appendJavaScript("putImage('" + xmlImageTag.toString() + "');");
            }
          };
      modalWindow.setContent(content);
      // Remember cursor position - it's needed for IE
      pTarget.appendJavaScript("saveBookmark();");
      modalWindow.show(pTarget);
    }
Пример #24
0
 /**
  * Method to enable the progressBar within the ajax request
  *
  * @param ajaxRequestTarget
  */
 public void enable(AjaxRequestTarget ajaxRequestTarget) {
   ajaxRequestTarget.appendJavaScript(this.enable().render().toString());
 }
Пример #25
0
 /**
  * Method to move to top the dialog within the ajax request
  *
  * @param ajaxRequestTarget
  */
 public void moveToTop(AjaxRequestTarget ajaxRequestTarget) {
   ajaxRequestTarget.appendJavaScript(this.moveToTop().render().toString());
 }
Пример #26
0
 /**
  * Method to decrement the value of the progressBar within the ajax request
  *
  * @param ajaxRequestTarget
  * @param decrement The decrement to add to the current value
  */
 public void decrement(AjaxRequestTarget ajaxRequestTarget, int decrement) {
   ajaxRequestTarget.appendJavaScript(this.decrement(decrement).render().toString());
 }
Пример #27
0
 /**
  * Method to increment the value of the progressBar within the ajax request
  *
  * @param ajaxRequestTarget
  */
 public void increment(AjaxRequestTarget ajaxRequestTarget) {
   ajaxRequestTarget.appendJavaScript(this.increment().render().toString());
 }
Пример #28
0
 /**
  * Method to returns the .ui-progressbar element within the ajax request
  *
  * @param ajaxRequestTarget
  */
 public void widget(AjaxRequestTarget ajaxRequestTarget) {
   ajaxRequestTarget.appendJavaScript(this.widget().render().toString());
 }
Пример #29
0
 /**
  * Method to set the current value of the progressBar within the ajax request
  *
  * @param ajaxRequestTarget
  * @param value
  */
 public void value(AjaxRequestTarget ajaxRequestTarget, int value) {
   ajaxRequestTarget.appendJavaScript(this.value(value).render().toString());
 }
Пример #30
0
 /**
  * Method to destroy the progressBar within the ajax request
  *
  * @param ajaxRequestTarget
  */
 public void destroy(AjaxRequestTarget ajaxRequestTarget) {
   ajaxRequestTarget.appendJavaScript(this.destroy().render().toString());
 }