Re: Ideas for wicket 7.0

2015-01-09 Thread Martin Grigorov
Wicket 7.0.0 is about to be released so it's a bit late for ideas.
But what you describe sounds like what  wicketstuff-stateless project
already provides.
On Jan 10, 2015 4:43 AM, Martin Makundi 
martin.maku...@koodaripalvelut.com wrote:

 Hi!

 I tried to add and idea to
 https://cwiki.apache.org/confluence/display/WICKET/Ideas+for+Wicket+7.0

 However I cannot find any edit buttons when Logged in to confluence. The
 contribution page says anybody can contribute?

 My idea is related to Better stateless support
 
 https://cwiki.apache.org/confluence/display/WICKET/Ideas+for+Wicket+7.0#IdeasforWicket7.0-Betterstatelesssupport
 
 :


- Wicket seems to have this inherent MVC design flaw that it's View is
stateful when it would really be sufficient that the Model is stateful
 and
it does not (and neither does controller) need to be serialized.
- It is possible to tweak to implement stateless View but it's quite a
hack because most event listeners are attached to the hierarcy instead
 of
page root which would have avoided the need to keep/serialize state of
 the
view. We have prototypes of FakeAjaxEventBehavior which is bound to
 page
instead of a component; the component event thus invokes the page-level
listener (on gui side) and thus in event processing (page level) we
 don't
need the component itself nor its state.
- Form components, however, are difficult to implement because they
inherently have state in view, but on the other hand it is rare (and
impractical) to actually have 'huge' forms; any such large editing areas
will need to be 'worked around' some another way.


 **
 Martin



Re: Ideas for wicket 7.0

2015-01-09 Thread Martin Makundi
();
if (AjaxRequestTarget.get() != null) {
  getComponent().add(new AttributeAppender(class,true, new
AbstractReadOnlyModelString() {
/**
 * @see org.apache.wicket.model.AbstractReadOnlyModel#getObject()
 */
@SuppressWarnings(synthetic-access)
@Override
public String getObject() {
  if (FakeEventListener.get() == null) {

AjaxRequestTarget.get().addListener(FakeEventListener.getCreate());
  }
  return FACB+
FakeEventListener.get().index(FakeAjaxFormComponentUpdatingBehavior.this.parentMarkupId);
}
  },  ));
  getComponent().add(new AttributeModifier(bs,true,
Model.of(busySignal)));
}
  }


  /**
   *
   * @param target
   */
  public void fireOnEvent(AjaxRequestTarget target) {
onEvent(target);
  }




  /**
   * @see
org.apache.wicket.behavior.AbstractAjaxBehavior#onComponentRendered()
   */
  @Override
  protected void onComponentRendered() {
super.onComponentRendered();
String event = getEvent();
Component component = getComponent();
if(!isCollectScripts()) {
  onComponentRendered(event, component);
}
  }

  /**
   * @see
org.apache.wicket.ajax.AjaxEventBehavior#onComponentTag(org.apache.wicket.markup.ComponentTag)
   */
  @Override
  protected void onComponentTag(ComponentTag tag) {
if(!isCollectScripts()) {
  super.onComponentTag(tag);
}
  }

  /**
   * @param event
   * @param component
   */
  protected static void onComponentRendered(String event, Component
component) {
JavascriptUtils.writeOpenTag(component.getResponse());
component.getResponse().write($('# + component.getMarkupId() +
').change(function() { eval($(this).attr(' + event + ')); }););
JavascriptUtils.writeCloseTag(component.getResponse());
  }

  /**
   * @return Should scripts be collected.
   */
  protected final boolean isCollectScripts() {
return isCollectString;
  }

  /**
   * @see
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#renderHead(org.apache.wicket.markup.html.IHeaderResponse)
   */
  @Override
  public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.renderJavascriptReference(JavaScriptConstants.JS_JQUERY);
if(isCollectScripts()  AjaxRequestTarget.get() != null) {
  response.renderJavascriptReference(FakeAjaxCheckBox.JS);
  if (FakeEventListener.get() == null) {
AjaxRequestTarget.get().addListener(FakeEventListener.getCreate());
  }
  FakeEventListener.get().addScript(parentMarkupId);
}
  }

  /**
   *
   * @param target
   */
  protected abstract void onUpdate(AjaxRequestTarget target);

  /**
   *
   * @return Click script.
   */
  protected String getOnClickScript() {
CharSequence onClickScript = $('# + parentMarkupId + ').trigger(' +
FAKE_EVENT_NAME + ', ' + getComponent().getMarkupId() + '); return 
+ busySignal + ;;
IAjaxCallDecorator decorator = getDecorator();
if (decorator != null) {
  onClickScript = decorator.decorateScript(onClickScript);
} else if (AjaxRequestTarget.get() != null) {
  return null;
}
return onClickScript.toString();
  }



  /**
   * Get decorator. Only {@link
IAjaxCallDecorator#decorateScript(CharSequence)}
   * is used here!
   *
   * @return {@link IAjaxCallDecorator}
   */
  protected IAjaxCallDecorator getDecorator() {
return null;
  }

  /**
   * @return the parentMarkupId
   */
  public String getParentMarkupId() {
return parentMarkupId;
  }

  /**
   * @param parentMarkupId the parentMarkupId to set
   */
  public void setParentMarkupId(String parentMarkupId) {
this.parentMarkupId = parentMarkupId;
  }

  /**
   * @return the isCollectString
   */
  public boolean isCollectString() {
return isCollectString;
  }

  /**
   * @param isCollectString the isCollectString to set
   */
  public void setCollectString(boolean isCollectString) {
this.isCollectString = isCollectString;
  }

  /**
   * @return the busySignal
   */
  public boolean isBusySignal() {
return busySignal;
  }

}




**
Martin


 On Jan 10, 2015 4:43 AM, Martin Makundi 
 martin.maku...@koodaripalvelut.com wrote:

  Hi!
 
  I tried to add and idea to
  https://cwiki.apache.org/confluence/display/WICKET/Ideas+for+Wicket+7.0
 
  However I cannot find any edit buttons when Logged in to confluence. The
  contribution page says anybody can contribute?
 
  My idea is related to Better stateless support
  
 
 https://cwiki.apache.org/confluence/display/WICKET/Ideas+for+Wicket+7.0#IdeasforWicket7.0-Betterstatelesssupport
  
  :
 
 
 - Wicket seems to have this inherent MVC design flaw that it's View is
 stateful when it would really be sufficient that the Model is stateful
  and
 it does not (and neither does controller) need to be serialized.
 - It is possible to tweak to implement stateless View but it's quite a
 hack because most event listeners are attached to the hierarcy instead
  of
 page root which would have avoided the need to keep

Ideas for wicket 7.0

2015-01-09 Thread Martin Makundi
Hi!

I tried to add and idea to
https://cwiki.apache.org/confluence/display/WICKET/Ideas+for+Wicket+7.0

However I cannot find any edit buttons when Logged in to confluence. The
contribution page says anybody can contribute?

My idea is related to Better stateless support
https://cwiki.apache.org/confluence/display/WICKET/Ideas+for+Wicket+7.0#IdeasforWicket7.0-Betterstatelesssupport
:


   - Wicket seems to have this inherent MVC design flaw that it's View is
   stateful when it would really be sufficient that the Model is stateful and
   it does not (and neither does controller) need to be serialized.
   - It is possible to tweak to implement stateless View but it's quite a
   hack because most event listeners are attached to the hierarcy instead of
   page root which would have avoided the need to keep/serialize state of the
   view. We have prototypes of FakeAjaxEventBehavior which is bound to page
   instead of a component; the component event thus invokes the page-level
   listener (on gui side) and thus in event processing (page level) we don't
   need the component itself nor its state.
   - Form components, however, are difficult to implement because they
   inherently have state in view, but on the other hand it is rare (and
   impractical) to actually have 'huge' forms; any such large editing areas
   will need to be 'worked around' some another way.


**
Martin


Re: Ideas for wicket 7.0

2015-01-09 Thread Martin Makundi
(JavaScriptConstants.JS_JQUERY);
 if(isCollectScripts()  AjaxRequestTarget.get() != null) {
   response.renderJavascriptReference(FakeAjaxCheckBox.JS);
   if (FakeEventListener.get() == null) {
 AjaxRequestTarget.get().addListener(FakeEventListener.getCreate());
   }
   FakeEventListener.get().addScript(parentMarkupId);
 }
   }

   /**
*
* @param target
*/
   protected abstract void onUpdate(AjaxRequestTarget target);

   /**
*
* @return Click script.
*/
   protected String getOnClickScript() {
 CharSequence onClickScript = $('# + parentMarkupId + ').trigger('
 + FAKE_EVENT_NAME + ', ' + getComponent().getMarkupId() + '); return 
 + busySignal + ;;
 IAjaxCallDecorator decorator = getDecorator();
 if (decorator != null) {
   onClickScript = decorator.decorateScript(onClickScript);
 } else if (AjaxRequestTarget.get() != null) {
   return null;
 }
 return onClickScript.toString();
   }



   /**
* Get decorator. Only {@link
 IAjaxCallDecorator#decorateScript(CharSequence)}
* is used here!
*
* @return {@link IAjaxCallDecorator}
*/
   protected IAjaxCallDecorator getDecorator() {
 return null;
   }

   /**
* @return the parentMarkupId
*/
   public String getParentMarkupId() {
 return parentMarkupId;
   }

   /**
* @param parentMarkupId the parentMarkupId to set
*/
   public void setParentMarkupId(String parentMarkupId) {
 this.parentMarkupId = parentMarkupId;
   }

   /**
* @return the isCollectString
*/
   public boolean isCollectString() {
 return isCollectString;
   }

   /**
* @param isCollectString the isCollectString to set
*/
   public void setCollectString(boolean isCollectString) {
 this.isCollectString = isCollectString;
   }

   /**
* @return the busySignal
*/
   public boolean isBusySignal() {
 return busySignal;
   }

 }




 **
 Martin


 On Jan 10, 2015 4:43 AM, Martin Makundi 
 martin.maku...@koodaripalvelut.com wrote:

  Hi!
 
  I tried to add and idea to
  https://cwiki.apache.org/confluence/display/WICKET/Ideas+for+Wicket+7.0
 
  However I cannot find any edit buttons when Logged in to confluence. The
  contribution page says anybody can contribute?
 
  My idea is related to Better stateless support
  
 
 https://cwiki.apache.org/confluence/display/WICKET/Ideas+for+Wicket+7.0#IdeasforWicket7.0-Betterstatelesssupport
  
  :
 
 
 - Wicket seems to have this inherent MVC design flaw that it's View
 is
 stateful when it would really be sufficient that the Model is
 stateful
  and
 it does not (and neither does controller) need to be serialized.
 - It is possible to tweak to implement stateless View but it's quite
 a
 hack because most event listeners are attached to the hierarcy
 instead
  of
 page root which would have avoided the need to keep/serialize state
 of
  the
 view. We have prototypes of FakeAjaxEventBehavior which is bound to
  page
 instead of a component; the component event thus invokes the
 page-level
 listener (on gui side) and thus in event processing (page level) we
  don't
 need the component itself nor its state.
 - Form components, however, are difficult to implement because they
 inherently have state in view, but on the other hand it is rare (and
 impractical) to actually have 'huge' forms; any such large editing
 areas
 will need to be 'worked around' some another way.
 
 
  **
  Martin