Re: visural-wicket 0.6.5 released!

2010-11-25 Thread Mark Doyle
Great library.  I always expected more of these since component creation and
reuse is one of Wickets a key strengths.

What I like about this lib is it's clean and finished.  There is no feeling
of immaturity or of a project that has died off.


On Thu, Nov 25, 2010 at 2:02 PM, alex shubert alex.shub...@gmail.comwrote:

 I must ask it: why did you make such fat header at your page? Did you
 every try to take a look at this in 1600*900 notebook screen?
 All you writings begins in bottom second part of the screen. It is not
 my busenees of course, but why dont you kill that nice picture and
 resize header to just contain pragmatic without strong empty white
 line?

 Ah, forget it. At least you did not add banner on the top of all of that
  :)

 --
 Best regards
 Alex

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Accessing the cells in a row of a DataTable

2010-10-27 Thread Mark Doyle
Of course, here is the entire Panel constructor:

private DropDownChoiceString dropdown;

public AjaxDropDownChoicePanel(String id, IModelString model,
IModelListString choicesModel) {
super(id);
System.out.println(dropdown model =  + model.getObject());

dropdown = new DropDownChoiceString(dropdown, model, choicesModel);
dropdown.setOutputMarkupId(true);
dropdown.add(new AjaxFormComponentUpdatingBehavior(onchange) {
private static final long serialVersionUID = 1L;

protected void onUpdate(AjaxRequestTarget target) {
dropdown.setEnabled(false);
System.err.println(Not yet implemented but you selected  +
dropdown.getDefaultModelObjectAsString());
target.addComponent(dropdown);
}
});
add(dropdown);
}

On Wed, Oct 27, 2010 at 4:54 AM, Jeremy Thomerson jer...@wickettraining.com
 wrote:

 Show the code for the dropdownchoice creation (in your panel)

 On Tue, Oct 26, 2010 at 6:14 PM, Mark Doyle markjohndo...@googlemail.com
 wrote:

  I suppose this is related so I'll keep the thread going.
 
  As part of the above use case I have created a custom PropertyColumn that
  uses a DropDownChoice.
 
  Everything seems to be working except for the initial display, this is
  always set to Choose One.
 
  The code that builds the dropdown is in the populateItem method of the
  custom Property Column.  As you can see it has a model set
 (propertyModel)
  which wraps a String.
 
  PropertyModelString propertyModel = new PropertyModelString(rowModel,
  getPropertyExpression());
  System.out.println(propertyModel value =  + propertyModel.getObject());
  AjaxDropDownChoicePanel cp = new AjaxDropDownChoicePanel(componentId,
  propertyModel, selectionOptionsModel);
 
  The AjaxDropDownChoicePanel is simply a panel that wraps the DropDown in
 a
  some select tags.  It instantiates a DropDownChoice with the passed in
  parameters.  The DropDownChoice is instantiated is of type String, that
  is, DropDownChoiceString.
 
  NOTE: The syso is printing the expected value.
 
 
 
  On Sat, Oct 23, 2010 at 10:18 PM, James Carman
  ja...@carmanconsulting.comwrote:
 
   Use a fragment.  Search this list for my FragmentColumn.  I think I've
   posted it before
   On Oct 23, 2010 4:04 PM, Mark Doyle markjohndo...@googlemail.com
   wrote:
Ok, I've nearly got this finished.
   
Does anybody know how to add a link in populateItem() that doesn't
  render
   as
[cell]? I could create a customised Panel I suppose but it seems
 like
overkill.
   
Maybe a fragment...hmmm
   
   
On Fri, Oct 22, 2010 at 11:56 AM, Mark Doyle
markjohndo...@googlemail.comwrote:
   
Oh and the table isn't the parent:
   
// get the table to rerender
target.addComponent(this.getParent());
   
I had to do a six step parental grab; I'm sure there is a better
  way!
   :D
   
   
   
On Fri, Oct 22, 2010 at 11:54 AM, Mark Doyle 
   markjohndo...@googlemail.com
 wrote:
   
Thanks Mike, this was definitely a great pointer in the right
   direction;
I'm beginning to grasp the column system now.
   
I do have some issues though as detailed below.
   
Firstly, my business model is out of my control so I had to wrap
 that
   in
   a
class that contains the editable state. I don't like doing that it
  but
   it's
useful to see if I can get it to work and it shouldn't effect the
   process on
the whole.
   
The main difference is I'm attempting to do this using different
   columns,
that is, not having a custom column that takes a type and switches.
  The
problem is that the models for each column seem to wrap different
   instances
of the business object.
   
The code below shows how I'm creating the columns. The link in the
AbstractColumn grabs the business object and toggles editable.
The EditablePropertyColumn's populateItem method then get's it's
   rowModel
object (the business object) and checks the editable state. This is
   where
it goes wrong as each column seems to have it's own copy of the
 rows
business model object. I guess this is how the columns with with
   datagrid.
   
/**
* Creates the columns for the synonym data table
*
* @return
*/
@SuppressWarnings(serial)
private ListIColumnEditStateSynonymWrapper createColumns() {
ListIColumnEditStateSynonymWrapper columns = new
ArrayListIColumnEditStateSynonymWrapper();
   
columns.add(new AbstractColumnEditStateSynonymWrapper(new
ModelString(Edit)) {
public void
  populateItem(ItemICellPopulatorEditStateSynonymWrapper
cellItem, String componentId, IModelEditStateSynonymWrapper
 model)
  {
AjaxFallbackLinkEditStateSynonymWrapper editLink = new
AjaxFallbackLinkEditStateSynonymWrapper(componentId, model) {
@Override
public void onClick(AjaxRequestTarget target) {
EditStateSynonymWrapper selected = (EditStateSynonymWrapper)
getDefaultModelObject

Re: Accessing the cells in a row of a DataTable

2010-10-27 Thread Mark Doyle
Of course, here is the entire Panel constructor:

private DropDownChoiceString dropdown;

public AjaxDropDownChoicePanel(String id, IModelString model,
IModelListString choicesModel) {
super(id);
System.out.println(dropdown model =  + model.getObject());

dropdown = new DropDownChoiceString(dropdown, model, choicesModel);
dropdown.setOutputMarkupId(true);
dropdown.add(new AjaxFormComponentUpdatingBehavior(onchange) {
private static final long serialVersionUID = 1L;

protected void onUpdate(AjaxRequestTarget target) {
dropdown.setEnabled(false);
System.err.println(Not yet implemented but you selected  +
dropdown.getDefaultModelObjectAsString());
target.addComponent(dropdown);
}
});
add(dropdown);
}

On Wed, Oct 27, 2010 at 4:54 AM, Jeremy Thomerson jer...@wickettraining.com
 wrote:

 Show the code for the dropdownchoice creation (in your panel)

 On Tue, Oct 26, 2010 at 6:14 PM, Mark Doyle markjohndo...@googlemail.com
 wrote:

  I suppose this is related so I'll keep the thread going.
 
  As part of the above use case I have created a custom PropertyColumn that
  uses a DropDownChoice.
 
  Everything seems to be working except for the initial display, this is
  always set to Choose One.
 
  The code that builds the dropdown is in the populateItem method of the
  custom Property Column.  As you can see it has a model set
 (propertyModel)
  which wraps a String.
 
  PropertyModelString propertyModel = new PropertyModelString(rowModel,
  getPropertyExpression());
  System.out.println(propertyModel value =  + propertyModel.getObject());
  AjaxDropDownChoicePanel cp = new AjaxDropDownChoicePanel(componentId,
  propertyModel, selectionOptionsModel);
 
  The AjaxDropDownChoicePanel is simply a panel that wraps the DropDown in
 a
  some select tags.  It instantiates a DropDownChoice with the passed in
  parameters.  The DropDownChoice is instantiated is of type String, that
  is, DropDownChoiceString.
 
  NOTE: The syso is printing the expected value.
 
 
 
  On Sat, Oct 23, 2010 at 10:18 PM, James Carman
  ja...@carmanconsulting.comwrote:
 
   Use a fragment.  Search this list for my FragmentColumn.  I think I've
   posted it before
   On Oct 23, 2010 4:04 PM, Mark Doyle markjohndo...@googlemail.com
   wrote:
Ok, I've nearly got this finished.
   
Does anybody know how to add a link in populateItem() that doesn't
  render
   as
[cell]? I could create a customised Panel I suppose but it seems
 like
overkill.
   
Maybe a fragment...hmmm
   
   
On Fri, Oct 22, 2010 at 11:56 AM, Mark Doyle
markjohndo...@googlemail.comwrote:
   
Oh and the table isn't the parent:
   
// get the table to rerender
target.addComponent(this.getParent());
   
I had to do a six step parental grab; I'm sure there is a better
  way!
   :D
   
   
   
On Fri, Oct 22, 2010 at 11:54 AM, Mark Doyle 
   markjohndo...@googlemail.com
 wrote:
   
Thanks Mike, this was definitely a great pointer in the right
   direction;
I'm beginning to grasp the column system now.
   
I do have some issues though as detailed below.
   
Firstly, my business model is out of my control so I had to wrap
 that
   in
   a
class that contains the editable state. I don't like doing that it
  but
   it's
useful to see if I can get it to work and it shouldn't effect the
   process on
the whole.
   
The main difference is I'm attempting to do this using different
   columns,
that is, not having a custom column that takes a type and switches.
  The
problem is that the models for each column seem to wrap different
   instances
of the business object.
   
The code below shows how I'm creating the columns. The link in the
AbstractColumn grabs the business object and toggles editable.
The EditablePropertyColumn's populateItem method then get's it's
   rowModel
object (the business object) and checks the editable state. This is
   where
it goes wrong as each column seems to have it's own copy of the
 rows
business model object. I guess this is how the columns with with
   datagrid.
   
/**
* Creates the columns for the synonym data table
*
* @return
*/
@SuppressWarnings(serial)
private ListIColumnEditStateSynonymWrapper createColumns() {
ListIColumnEditStateSynonymWrapper columns = new
ArrayListIColumnEditStateSynonymWrapper();
   
columns.add(new AbstractColumnEditStateSynonymWrapper(new
ModelString(Edit)) {
public void
  populateItem(ItemICellPopulatorEditStateSynonymWrapper
cellItem, String componentId, IModelEditStateSynonymWrapper
 model)
  {
AjaxFallbackLinkEditStateSynonymWrapper editLink = new
AjaxFallbackLinkEditStateSynonymWrapper(componentId, model) {
@Override
public void onClick(AjaxRequestTarget target) {
EditStateSynonymWrapper selected = (EditStateSynonymWrapper)
getDefaultModelObject

Re: Accessing the cells in a row of a DataTable

2010-10-27 Thread Mark Doyle
I think I may have circumnavigated this issue by discovering the wonders of
AjaxEditableLabel and AjaxEditableChoiceLabel :D

I'll post my results when I've tested it.  Hopefully this will be helpful to
somebody else in the future.

On Wed, Oct 27, 2010 at 10:59 AM, Mark Doyle
markjohndo...@googlemail.comwrote:

 Of course, here is the entire Panel constructor:

 private DropDownChoiceString dropdown;

 public AjaxDropDownChoicePanel(String id, IModelString model,
 IModelListString choicesModel) {
 super(id);
 System.out.println(dropdown model =  + model.getObject());

 dropdown = new DropDownChoiceString(dropdown, model, choicesModel);
 dropdown.setOutputMarkupId(true);
 dropdown.add(new AjaxFormComponentUpdatingBehavior(onchange) {
 private static final long serialVersionUID = 1L;

 protected void onUpdate(AjaxRequestTarget target) {
 dropdown.setEnabled(false);
 System.err.println(Not yet implemented but you selected  +
 dropdown.getDefaultModelObjectAsString());
 target.addComponent(dropdown);
 }
 });
 add(dropdown);
 }

 On Wed, Oct 27, 2010 at 4:54 AM, Jeremy Thomerson 
 jer...@wickettraining.com wrote:

 Show the code for the dropdownchoice creation (in your panel)

 On Tue, Oct 26, 2010 at 6:14 PM, Mark Doyle markjohndo...@googlemail.com
 wrote:

  I suppose this is related so I'll keep the thread going.
 
  As part of the above use case I have created a custom PropertyColumn
 that
  uses a DropDownChoice.
 
  Everything seems to be working except for the initial display, this is
  always set to Choose One.
 
  The code that builds the dropdown is in the populateItem method of the
  custom Property Column.  As you can see it has a model set
 (propertyModel)
  which wraps a String.
 
  PropertyModelString propertyModel = new
 PropertyModelString(rowModel,
  getPropertyExpression());
  System.out.println(propertyModel value =  +
 propertyModel.getObject());
  AjaxDropDownChoicePanel cp = new AjaxDropDownChoicePanel(componentId,
  propertyModel, selectionOptionsModel);
 
  The AjaxDropDownChoicePanel is simply a panel that wraps the DropDown in
 a
  some select tags.  It instantiates a DropDownChoice with the passed in
  parameters.  The DropDownChoice is instantiated is of type String, that
  is, DropDownChoiceString.
 
  NOTE: The syso is printing the expected value.
 
 
 
  On Sat, Oct 23, 2010 at 10:18 PM, James Carman
  ja...@carmanconsulting.comwrote:
 
   Use a fragment.  Search this list for my FragmentColumn.  I think I've
   posted it before
   On Oct 23, 2010 4:04 PM, Mark Doyle markjohndo...@googlemail.com
   wrote:
Ok, I've nearly got this finished.
   
Does anybody know how to add a link in populateItem() that doesn't
  render
   as
[cell]? I could create a customised Panel I suppose but it seems
 like
overkill.
   
Maybe a fragment...hmmm
   
   
On Fri, Oct 22, 2010 at 11:56 AM, Mark Doyle
markjohndo...@googlemail.comwrote:
   
Oh and the table isn't the parent:
   
// get the table to rerender
target.addComponent(this.getParent());
   
I had to do a six step parental grab; I'm sure there is a better
  way!
   :D
   
   
   
On Fri, Oct 22, 2010 at 11:54 AM, Mark Doyle 
   markjohndo...@googlemail.com
 wrote:
   
Thanks Mike, this was definitely a great pointer in the right
   direction;
I'm beginning to grasp the column system now.
   
I do have some issues though as detailed below.
   
Firstly, my business model is out of my control so I had to wrap
 that
   in
   a
class that contains the editable state. I don't like doing that it
  but
   it's
useful to see if I can get it to work and it shouldn't effect the
   process on
the whole.
   
The main difference is I'm attempting to do this using different
   columns,
that is, not having a custom column that takes a type and
 switches.
  The
problem is that the models for each column seem to wrap different
   instances
of the business object.
   
The code below shows how I'm creating the columns. The link in the
AbstractColumn grabs the business object and toggles editable.
The EditablePropertyColumn's populateItem method then get's it's
   rowModel
object (the business object) and checks the editable state. This
 is
   where
it goes wrong as each column seems to have it's own copy of the
 rows
business model object. I guess this is how the columns with with
   datagrid.
   
/**
* Creates the columns for the synonym data table
*
* @return
*/
@SuppressWarnings(serial)
private ListIColumnEditStateSynonymWrapper createColumns() {
ListIColumnEditStateSynonymWrapper columns = new
ArrayListIColumnEditStateSynonymWrapper();
   
columns.add(new AbstractColumnEditStateSynonymWrapper(new
ModelString(Edit)) {
public void
  populateItem(ItemICellPopulatorEditStateSynonymWrapper
cellItem

Re: Accessing the cells in a row of a DataTable

2010-10-26 Thread Mark Doyle
I suppose this is related so I'll keep the thread going.

As part of the above use case I have created a custom PropertyColumn that
uses a DropDownChoice.

Everything seems to be working except for the initial display, this is
always set to Choose One.

The code that builds the dropdown is in the populateItem method of the
custom Property Column.  As you can see it has a model set (propertyModel)
which wraps a String.

PropertyModelString propertyModel = new PropertyModelString(rowModel,
getPropertyExpression());
System.out.println(propertyModel value =  + propertyModel.getObject());
AjaxDropDownChoicePanel cp = new AjaxDropDownChoicePanel(componentId,
propertyModel, selectionOptionsModel);

The AjaxDropDownChoicePanel is simply a panel that wraps the DropDown in a
some select tags.  It instantiates a DropDownChoice with the passed in
parameters.  The DropDownChoice is instantiated is of type String, that
is, DropDownChoiceString.

NOTE: The syso is printing the expected value.



On Sat, Oct 23, 2010 at 10:18 PM, James Carman
ja...@carmanconsulting.comwrote:

 Use a fragment.  Search this list for my FragmentColumn.  I think I've
 posted it before
 On Oct 23, 2010 4:04 PM, Mark Doyle markjohndo...@googlemail.com
 wrote:
  Ok, I've nearly got this finished.
 
  Does anybody know how to add a link in populateItem() that doesn't render
 as
  [cell]? I could create a customised Panel I suppose but it seems like
  overkill.
 
  Maybe a fragment...hmmm
 
 
  On Fri, Oct 22, 2010 at 11:56 AM, Mark Doyle
  markjohndo...@googlemail.comwrote:
 
  Oh and the table isn't the parent:
 
  // get the table to rerender
  target.addComponent(this.getParent());
 
  I had to do a six step parental grab; I'm sure there is a better way!
 :D
 
 
 
  On Fri, Oct 22, 2010 at 11:54 AM, Mark Doyle 
 markjohndo...@googlemail.com
   wrote:
 
  Thanks Mike, this was definitely a great pointer in the right
 direction;
  I'm beginning to grasp the column system now.
 
  I do have some issues though as detailed below.
 
  Firstly, my business model is out of my control so I had to wrap that
 in
 a
  class that contains the editable state. I don't like doing that it but
 it's
  useful to see if I can get it to work and it shouldn't effect the
 process on
  the whole.
 
  The main difference is I'm attempting to do this using different
 columns,
  that is, not having a custom column that takes a type and switches. The
  problem is that the models for each column seem to wrap different
 instances
  of the business object.
 
  The code below shows how I'm creating the columns. The link in the
  AbstractColumn grabs the business object and toggles editable.
  The EditablePropertyColumn's populateItem method then get's it's
 rowModel
  object (the business object) and checks the editable state. This is
 where
  it goes wrong as each column seems to have it's own copy of the rows
  business model object. I guess this is how the columns with with
 datagrid.
 
  /**
  * Creates the columns for the synonym data table
  *
  * @return
  */
  @SuppressWarnings(serial)
  private ListIColumnEditStateSynonymWrapper createColumns() {
  ListIColumnEditStateSynonymWrapper columns = new
  ArrayListIColumnEditStateSynonymWrapper();
 
  columns.add(new AbstractColumnEditStateSynonymWrapper(new
  ModelString(Edit)) {
  public void populateItem(ItemICellPopulatorEditStateSynonymWrapper
  cellItem, String componentId, IModelEditStateSynonymWrapper model) {
  AjaxFallbackLinkEditStateSynonymWrapper editLink = new
  AjaxFallbackLinkEditStateSynonymWrapper(componentId, model) {
  @Override
  public void onClick(AjaxRequestTarget target) {
  EditStateSynonymWrapper selected = (EditStateSynonymWrapper)
  getDefaultModelObject();
  System.out.println(selected value =  +
 selected.wrappedSynonym.value);
  selected.setEditing(!selected.isEditing());
 
  // FIXME WHAT!? There must be a better way than this to get the parent
  table. :D
  MarkupContainer dataTable =
 
 getParent().getParent().getParent().getParent().getParent().getParent();
  target.addComponent(dataTable);
  }
  };
  cellItem.add(editLink);
  // cellItem.add(new EditLinkFragment(componentId,
 SynonymAdminPanel.this,
  model));
  }
  });
 
  columns.add(new PropertyColumnEditStateSynonymWrapper(new
  ModelString(Category), wrappedSynonym.category));
  // columns.add(new EditablePropertyColumnEditStateSynonymWrapper(new
  ModelString(State),
  // wrappedSynonym.state, new PropertyModelSynonym(this,
 selected)));
  columns.add(new EditablePropertyColumnEditStateSynonymWrapper(new
  ModelString(State), wrappedSynonym.state));
  columns.add(new PropertyColumnEditStateSynonymWrapper(new
  ModelString(Root), wrappedSynonym.root));
  columns.add(new PropertyColumnEditStateSynonymWrapper(new
  ModelString(Value), wrappedSynonym.value));
  columns.add(new PropertyColumnEditStateSynonymWrapper(new
  ModelString(Rational), wrappedSynonym.rational));
  columns.add(new PropertyColumnEditStateSynonymWrapper(new

Re: Accessing the cells in a row of a DataTable

2010-10-23 Thread Mark Doyle
Ok, I've nearly got this finished.

Does anybody know how to add a link in populateItem() that doesn't render as
[cell]?  I could create a customised Panel I suppose but it seems like
overkill.

Maybe a fragment...hmmm


On Fri, Oct 22, 2010 at 11:56 AM, Mark Doyle
markjohndo...@googlemail.comwrote:

 Oh and the table isn't the parent:

 // get the table to rerender
  target.addComponent(this.getParent());

 I had to do a six step parental grab; I'm sure there is a better way! :D



 On Fri, Oct 22, 2010 at 11:54 AM, Mark Doyle markjohndo...@googlemail.com
  wrote:

 Thanks Mike, this was definitely a great pointer in the right direction;
 I'm beginning to grasp the column system now.

 I do have some issues though as detailed below.

 Firstly, my business model is out of my control so I had to wrap that in a
 class that contains the editable state.  I don't like doing that it but it's
 useful to see if I can get it to work and it shouldn't effect the process on
 the whole.

 The main difference is I'm attempting to do this using different columns,
 that is, not having a custom column that takes a type and switches.  The
 problem is that the models for each column seem to wrap different instances
 of the business object.

 The code below shows how I'm creating the columns.  The link in the
 AbstractColumn grabs the business object and toggles editable.
  The EditablePropertyColumn's populateItem method then get's it's rowModel
 object (the business object) and checks the editable state.  This is where
 it goes wrong as each column seems to have it's own copy of the rows
 business model object.  I guess this is how the columns with with datagrid.

 /**
  * Creates the columns for the synonym data table
  *
  * @return
  */
 @SuppressWarnings(serial)
  private ListIColumnEditStateSynonymWrapper createColumns() {
 ListIColumnEditStateSynonymWrapper columns = new
 ArrayListIColumnEditStateSynonymWrapper();

 columns.add(new AbstractColumnEditStateSynonymWrapper(new
 ModelString(Edit)) {
  public void populateItem(ItemICellPopulatorEditStateSynonymWrapper
 cellItem, String componentId, IModelEditStateSynonymWrapper model) {
  AjaxFallbackLinkEditStateSynonymWrapper editLink = new
 AjaxFallbackLinkEditStateSynonymWrapper(componentId, model) {
 @Override
  public void onClick(AjaxRequestTarget target) {
 EditStateSynonymWrapper selected = (EditStateSynonymWrapper)
 getDefaultModelObject();
  System.out.println(selected value =  + selected.wrappedSynonym.value);
 selected.setEditing(!selected.isEditing());

 // FIXME WHAT!? There must be a better way than this to get the parent
 table. :D
 MarkupContainer dataTable =
 getParent().getParent().getParent().getParent().getParent().getParent();
  target.addComponent(dataTable);
 }
 };
  cellItem.add(editLink);
 // cellItem.add(new EditLinkFragment(componentId, SynonymAdminPanel.this,
 model));
  }
 });

 columns.add(new PropertyColumnEditStateSynonymWrapper(new
 ModelString(Category), wrappedSynonym.category));
  // columns.add(new EditablePropertyColumnEditStateSynonymWrapper(new
 ModelString(State),
 // wrappedSynonym.state, new PropertyModelSynonym(this, selected)));
  columns.add(new EditablePropertyColumnEditStateSynonymWrapper(new
 ModelString(State), wrappedSynonym.state));
  columns.add(new PropertyColumnEditStateSynonymWrapper(new
 ModelString(Root), wrappedSynonym.root));
 columns.add(new PropertyColumnEditStateSynonymWrapper(new
 ModelString(Value), wrappedSynonym.value));
  columns.add(new PropertyColumnEditStateSynonymWrapper(new
 ModelString(Rational), wrappedSynonym.rational));
  columns.add(new PropertyColumnEditStateSynonymWrapper(new
 ModelString(Taxonomy parent), wrappedSynonym.taxonomyParent));

 return columns;
 }



 On Thu, Oct 21, 2010 at 3:50 PM, Michael O'Cleirigh 
 michael.ocleir...@rivulet.ca wrote:

  Hi Mark,

 The cell's of a datatable are created by the IColumn.  So you need to
 create a wrapping object or additional IModel that contains the edit-ability
 of each row and then use that inside the populateItem(...) method of the
 column to figure out which case to show (i.e. the label or the textfield).

 One way to persist the change immediately is to use an
 AjaxFormComponentUpdatingBehavior on the onblur event of the textfield to
 push the changes through.

 Do something like this:

 class MyColumn extends AbstractColumnBusinessObject {

public static enum ColumnType { LINK, COL1, COL2 };

private ColumnType type;

public MyColumn (IModelStringheader, ColumnType type) {
super (header);
this.type = type;
}
@Override
public void populateItem(ItemICellPopulatorBusinessObject
 cellItem,
String componentId, IModelBusinessObject rowModel) {


switch (this.type) {

case LINK :
// add in the ajax link to the cell item
// inside the onclick do:
// get the row model object and then set its editable
 field

Re: Accessing the cells in a row of a DataTable

2010-10-22 Thread Mark Doyle
Thanks Mike, this was definitely a great pointer in the right direction; I'm
beginning to grasp the column system now.

I do have some issues though as detailed below.

Firstly, my business model is out of my control so I had to wrap that in a
class that contains the editable state.  I don't like doing that it but it's
useful to see if I can get it to work and it shouldn't effect the process on
the whole.

The main difference is I'm attempting to do this using different columns,
that is, not having a custom column that takes a type and switches.  The
problem is that the models for each column seem to wrap different instances
of the business object.

The code below shows how I'm creating the columns.  The link in the
AbstractColumn grabs the business object and toggles editable.
 The EditablePropertyColumn's populateItem method then get's it's rowModel
object (the business object) and checks the editable state.  This is where
it goes wrong as each column seems to have it's own copy of the rows
business model object.  I guess this is how the columns with with datagrid.

/**
 * Creates the columns for the synonym data table
 *
 * @return
 */
@SuppressWarnings(serial)
private ListIColumnEditStateSynonymWrapper createColumns() {
ListIColumnEditStateSynonymWrapper columns = new
ArrayListIColumnEditStateSynonymWrapper();

columns.add(new AbstractColumnEditStateSynonymWrapper(new
ModelString(Edit)) {
 public void populateItem(ItemICellPopulatorEditStateSynonymWrapper
cellItem, String componentId, IModelEditStateSynonymWrapper model) {
AjaxFallbackLinkEditStateSynonymWrapper editLink = new
AjaxFallbackLinkEditStateSynonymWrapper(componentId, model) {
@Override
public void onClick(AjaxRequestTarget target) {
EditStateSynonymWrapper selected = (EditStateSynonymWrapper)
getDefaultModelObject();
System.out.println(selected value =  + selected.wrappedSynonym.value);
selected.setEditing(!selected.isEditing());

// FIXME WHAT!? There must be a better way than this to get the parent
table. :D
MarkupContainer dataTable =
getParent().getParent().getParent().getParent().getParent().getParent();
target.addComponent(dataTable);
}
};
cellItem.add(editLink);
// cellItem.add(new EditLinkFragment(componentId, SynonymAdminPanel.this,
model));
}
});

columns.add(new PropertyColumnEditStateSynonymWrapper(new
ModelString(Category), wrappedSynonym.category));
// columns.add(new EditablePropertyColumnEditStateSynonymWrapper(new
ModelString(State),
// wrappedSynonym.state, new PropertyModelSynonym(this, selected)));
columns.add(new EditablePropertyColumnEditStateSynonymWrapper(new
ModelString(State), wrappedSynonym.state));
columns.add(new PropertyColumnEditStateSynonymWrapper(new
ModelString(Root), wrappedSynonym.root));
columns.add(new PropertyColumnEditStateSynonymWrapper(new
ModelString(Value), wrappedSynonym.value));
columns.add(new PropertyColumnEditStateSynonymWrapper(new
ModelString(Rational), wrappedSynonym.rational));
columns.add(new PropertyColumnEditStateSynonymWrapper(new
ModelString(Taxonomy parent), wrappedSynonym.taxonomyParent));

return columns;
}



On Thu, Oct 21, 2010 at 3:50 PM, Michael O'Cleirigh 
michael.ocleir...@rivulet.ca wrote:

  Hi Mark,

 The cell's of a datatable are created by the IColumn.  So you need to
 create a wrapping object or additional IModel that contains the edit-ability
 of each row and then use that inside the populateItem(...) method of the
 column to figure out which case to show (i.e. the label or the textfield).

 One way to persist the change immediately is to use an
 AjaxFormComponentUpdatingBehavior on the onblur event of the textfield to
 push the changes through.

 Do something like this:

 class MyColumn extends AbstractColumnBusinessObject {

public static enum ColumnType { LINK, COL1, COL2 };

private ColumnType type;

public MyColumn (IModelStringheader, ColumnType type) {
super (header);
this.type = type;
}
@Override
public void populateItem(ItemICellPopulatorBusinessObject cellItem,
String componentId, IModelBusinessObject rowModel) {


switch (this.type) {

case LINK :
// add in the ajax link to the cell item
// inside the onclick do:
// get the row model object and then set its editable field.
cellItem.add(new AjaxLink(componentId) {
public void onClick(AjaxRequestTarget target) {
  BusinessObject bo = rowModel.getObject();


   bo.setEditable(true);
// get the table to rerender
target.addComponent(this.getParent());
}
});

break;

case COL1:
case COL2:

BusinessObject bo = rowModel.getObject();


if (bo.isEditable()) {
// 

Re: Accessing the cells in a row of a DataTable

2010-10-22 Thread Mark Doyle
Oh and the table isn't the parent:
// get the table to rerender
 target.addComponent(this.getParent());

I had to do a six step parental grab; I'm sure there is a better way! :D



On Fri, Oct 22, 2010 at 11:54 AM, Mark Doyle
markjohndo...@googlemail.comwrote:

 Thanks Mike, this was definitely a great pointer in the right direction;
 I'm beginning to grasp the column system now.

 I do have some issues though as detailed below.

 Firstly, my business model is out of my control so I had to wrap that in a
 class that contains the editable state.  I don't like doing that it but it's
 useful to see if I can get it to work and it shouldn't effect the process on
 the whole.

 The main difference is I'm attempting to do this using different columns,
 that is, not having a custom column that takes a type and switches.  The
 problem is that the models for each column seem to wrap different instances
 of the business object.

 The code below shows how I'm creating the columns.  The link in the
 AbstractColumn grabs the business object and toggles editable.
  The EditablePropertyColumn's populateItem method then get's it's rowModel
 object (the business object) and checks the editable state.  This is where
 it goes wrong as each column seems to have it's own copy of the rows
 business model object.  I guess this is how the columns with with datagrid.

 /**
  * Creates the columns for the synonym data table
  *
  * @return
  */
 @SuppressWarnings(serial)
  private ListIColumnEditStateSynonymWrapper createColumns() {
 ListIColumnEditStateSynonymWrapper columns = new
 ArrayListIColumnEditStateSynonymWrapper();

 columns.add(new AbstractColumnEditStateSynonymWrapper(new
 ModelString(Edit)) {
  public void populateItem(ItemICellPopulatorEditStateSynonymWrapper
 cellItem, String componentId, IModelEditStateSynonymWrapper model) {
  AjaxFallbackLinkEditStateSynonymWrapper editLink = new
 AjaxFallbackLinkEditStateSynonymWrapper(componentId, model) {
 @Override
  public void onClick(AjaxRequestTarget target) {
 EditStateSynonymWrapper selected = (EditStateSynonymWrapper)
 getDefaultModelObject();
  System.out.println(selected value =  + selected.wrappedSynonym.value);
 selected.setEditing(!selected.isEditing());

 // FIXME WHAT!? There must be a better way than this to get the parent
 table. :D
 MarkupContainer dataTable =
 getParent().getParent().getParent().getParent().getParent().getParent();
  target.addComponent(dataTable);
 }
 };
  cellItem.add(editLink);
 // cellItem.add(new EditLinkFragment(componentId, SynonymAdminPanel.this,
 model));
  }
 });

 columns.add(new PropertyColumnEditStateSynonymWrapper(new
 ModelString(Category), wrappedSynonym.category));
  // columns.add(new EditablePropertyColumnEditStateSynonymWrapper(new
 ModelString(State),
 // wrappedSynonym.state, new PropertyModelSynonym(this, selected)));
  columns.add(new EditablePropertyColumnEditStateSynonymWrapper(new
 ModelString(State), wrappedSynonym.state));
  columns.add(new PropertyColumnEditStateSynonymWrapper(new
 ModelString(Root), wrappedSynonym.root));
 columns.add(new PropertyColumnEditStateSynonymWrapper(new
 ModelString(Value), wrappedSynonym.value));
  columns.add(new PropertyColumnEditStateSynonymWrapper(new
 ModelString(Rational), wrappedSynonym.rational));
  columns.add(new PropertyColumnEditStateSynonymWrapper(new
 ModelString(Taxonomy parent), wrappedSynonym.taxonomyParent));

 return columns;
 }



 On Thu, Oct 21, 2010 at 3:50 PM, Michael O'Cleirigh 
 michael.ocleir...@rivulet.ca wrote:

  Hi Mark,

 The cell's of a datatable are created by the IColumn.  So you need to
 create a wrapping object or additional IModel that contains the edit-ability
 of each row and then use that inside the populateItem(...) method of the
 column to figure out which case to show (i.e. the label or the textfield).

 One way to persist the change immediately is to use an
 AjaxFormComponentUpdatingBehavior on the onblur event of the textfield to
 push the changes through.

 Do something like this:

 class MyColumn extends AbstractColumnBusinessObject {

public static enum ColumnType { LINK, COL1, COL2 };

private ColumnType type;

public MyColumn (IModelStringheader, ColumnType type) {
super (header);
this.type = type;
}
@Override
public void populateItem(ItemICellPopulatorBusinessObject cellItem,
String componentId, IModelBusinessObject rowModel) {


switch (this.type) {

case LINK :
// add in the ajax link to the cell item
// inside the onclick do:
// get the row model object and then set its editable
 field.
cellItem.add(new AjaxLink(componentId) {
public void onClick(AjaxRequestTarget target) {
  BusinessObject bo = rowModel.getObject();


   bo.setEditable(true);
// get the table

Accessing the cells in a row of a DataTable

2010-10-21 Thread Mark Doyle
Hi all,

I'm having a bit of trouble wrapping my head around the DataTable with
regards to what I need to do.

The perfect example of my goal is in Wicket Examples, namely, the Ajax
Editable Tree Table:
http://wicketstuff.org/wicket14/ajax/tree/table/editable.0

http://wicketstuff.org/wicket14/ajax/tree/table/editable.0Rather than use
the Tree table I must alter an existing DataTable.  I was thinking that
I could create an editable textfield for the cells which I could enable or
disable using an edit link in the first column.

A bit like this:

Edit | col1 | col2

edit | text  | ksfuh
-
edit | text  | fsdkl

Using the edit link I can get the model object of the row but I'm not sure
how I can get the row that represents this and set it's cells to editable.

The Editable text field is much like the one in the example and with the
entire table wrapped in a form.  This means I can deal with the submission
of the changes easy enough.


Perhaps this is the wrong way to go about ithmmm, thoughts?


Re: Trouble creating a behaviour that adds JS and also a Body onLoad event

2010-07-31 Thread Mark Doyle
Ah ok, I'll test that.  I never thought of just adding it to the Page.


What, if any, is the difference between this and adding the behaviour to the
WebPage which is a kind of Component?


On Fri, Jul 30, 2010 at 7:03 PM, Martin Makundi 
martin.maku...@koodaripalvelut.com wrote:

 Hi!

 You could try this:

 public class HomePage extends WebPage implements IHeaderContributor {
  @Override
  public void renderHead(IHeaderResponse response) {
response.renderOnLoadJavascript(javascript)
  }


 **
 Martin

 2010/7/30 Mark Doyle markjohndo...@googlemail.com:
  Firstly, I'm having some trouble finding a decent behaviour tutorial.  If
  anybody knows of one post a link up.
 
  Now, the problem I am having is creating a behaviour that adds some JS to
  the head and sets an onLoad method.  The JS project instructs users to
 add:
 
  body onload=jsfunctionhere ( options, callback );
 
  but I'm not sure how Wicket supports this.
 
  Any ideas?
 
  Cheers
 

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Trouble creating a behaviour that adds JS and also a Body onLoad event

2010-07-31 Thread Mark Doyle
Yeah, I actually messed up the behaviour because I never noticed the
rendOnLoad method.

I've done as you suggested in the behaviour and then simply added that to
the component.  It works perfectly, thanks Martin.


The progression to more advanced Wicket certainly requires more web specific
knowledge that Wicket has shielded me from in the past :)


On Sat, Jul 31, 2010 at 12:48 PM, Martin Makundi 
martin.maku...@koodaripalvelut.com wrote:

 Headercontribution can be added to many things ...

 2010/7/31 Mark Doyle markjohndo...@googlemail.com:
  Ah ok, I'll test that.  I never thought of just adding it to the Page.
 
 
  What, if any, is the difference between this and adding the behaviour to
 the
  WebPage which is a kind of Component?
 
 
  On Fri, Jul 30, 2010 at 7:03 PM, Martin Makundi 
  martin.maku...@koodaripalvelut.com wrote:
 
  Hi!
 
  You could try this:
 
  public class HomePage extends WebPage implements IHeaderContributor {
   @Override
   public void renderHead(IHeaderResponse response) {
 response.renderOnLoadJavascript(javascript)
   }
 
 
  **
  Martin
 
  2010/7/30 Mark Doyle markjohndo...@googlemail.com:
   Firstly, I'm having some trouble finding a decent behaviour tutorial.
  If
   anybody knows of one post a link up.
  
   Now, the problem I am having is creating a behaviour that adds some JS
 to
   the head and sets an onLoad method.  The JS project instructs users to
  add:
  
   body onload=jsfunctionhere ( options, callback );
  
   but I'm not sure how Wicket supports this.
  
   Any ideas?
  
   Cheers
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Trouble creating a behaviour that adds JS and also a Body onLoad event

2010-07-30 Thread Mark Doyle
Firstly, I'm having some trouble finding a decent behaviour tutorial.  If
anybody knows of one post a link up.

Now, the problem I am having is creating a behaviour that adds some JS to
the head and sets an onLoad method.  The JS project instructs users to add:

body onload=jsfunctionhere ( options, callback );

but I'm not sure how Wicket supports this.

Any ideas?

Cheers


Re: Best way to hide a component

2010-07-23 Thread Mark Doyle
Yeah, I do something similar.

You can override the isVisible method in your components, possibly
adding some logic that ties the visibility to a variable.  You only
have to manage the one variable then and all the components will know
when to display or not.

On Fri, Jul 23, 2010 at 9:02 AM, Nivedan Nadaraj shravann...@gmail.com wrote:
 I have done the setVisible too for hiding components. Sometimes if there
 were a group of them, placing them in a container(WebMarkupContainer)
 and setting the visibility to t/f on the container works too.

 Cheers
 Niv


 On Fri, Jul 23, 2010 at 2:36 PM, Andrea Selva selva.an...@gmail.com wrote:

 Hi,
 Instead of switching between components, i think that using the setVisible
 method of component class could be a better solution. This is the principle
 i read in the in Wicket in Action book when the want to hide a container of
 other thing.
 I hope this could help you
  Andrea

 On Thu, Jul 22, 2010 at 11:22 PM, mgoodson matt...@spidertracks.com
 wrote:

 
  Hi, this could be a stupid question but I am just wondering what the best
  way
  is to hide a component.
  Say I have a button on a form and when it renders sometimes I want it to
  show and some times not.
  I could either use 2 fragments, one with the button in it and one that's
  empty and switch between the two. Or the other option that I can think of
  is
  to turn the visibility on and off.
  Anyone got any reasons for or against with option?
  Thanks
  --
  View this message in context:
 
 http://apache-wicket.1842946.n4.nabble.com/Best-way-to-hide-a-component-tp2299412p2299412.html
  Sent from the Wicket - User mailing list archive at Nabble.com.
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Sub tabs in Tabbed Panel

2010-07-23 Thread Mark Doyle
Hi all,

Is there a component that will allows me to add a subset of panel
links to a Tabbed panel which themselves link to new panels?

Perhaps an example of the finished article would explain it better :)
http://www.webdesignerwall.com/tutorials/css3-dropdown-menu/

I guess some tab links would change the panel whilst others would need
a rollover effect that displays the sub-tab link.  The sub tab links
would then behave as normal tabs.


If there is nothing out there already I guess hacking up an extended
TabbedPanel is the only course of action!

Cheers

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org