예제 #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
파일: HomePage.java 프로젝트: b-cuts/blogs
    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());
 }