Re: Tree table with check box

2010-01-14 Thread prati


Hi,

I am also stuck in similar problem.If you can share your code snippets of
how u did that will be of great help.
Thanks

Pratibha

vela wrote:
 
 Hello again,
 
 The links and nodes are added in the TreeFragment class. But the
 TreeFragment is a private inner class in Treetable, could you tell how to
 use the TreeFragment to acheive this functionality
 
 
 
 
 
 
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Tree-table-with-check-box-tp26080852p27164039.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



Re: Tree table with check box

2010-01-18 Thread prati

Hi Peter,

Many thanks for your reply.My problem is exactly same as second one
discussed in the post.
I need checkbox in other column .

Code is
TreeTable.html
/tr
  trtd wicket:id=treeTable class=my-tree/td
  td  /td
  
  /tr
TreeTable.java

public TreeTablePage()
{

IColumn columns[] = new IColumn[] { col1(), col2() };

tree = new TreeTable(treeTable, createTreeModel(), columns);
tree.getTreeState().setAllowSelectMultiple(true);



add(tree);
tree.getTreeState().collapseAll();
}



private PropertyTreeColumn col1() {
return new PropertyTreeColumn(new 
ColumnLocation(Alignment.MIDDLE, 5,
Unit.PROPORTIONAL), Check, 
userObject.name);
}

private PropertyTreeColumn col2() {
return new PropertyTreeColumn(new 
ColumnLocation(Alignment.LEFT, 
7, Unit.EM), L2,
userObject.name) {


@Override
public Component newCell(MarkupContainer parent, String 
id, TreeNode
node, int level) {
DefaultMutableTreeNode n = 
(DefaultMutableTreeNode) node;
CheckBoxPanel boxPanel = new 
CheckBoxPanel(mypanel);
return boxPanel;
}
};
}

I am getting no getter methods defined for ModelBean.

Am i doing it in a right way particularly HTML
Thanks
Prati

aldaris wrote:
 
 Hi,
 
 check out wicket-tree (http://code.google.com/p/wicket-tree/) and see 
 the example app, I think it will solve your problem.
 
 Regards,
 Peter
 
 prati írta:
 
 Hi,
 
 I am also stuck in similar problem.If you can share your code snippets of
 how u did that will be of great help.
 Thanks
 
 Pratibha
 
 vela wrote:
 Hello again,

 The links and nodes are added in the TreeFragment class. But the
 TreeFragment is a private inner class in Treetable, could you tell how
 to
 use the TreeFragment to acheive this functionality
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Tree-table-with-check-box-tp26080852p27208990.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



Re: Tree table with check box

2010-01-18 Thread prati

Hey it worked,i wanted checkbox in other column
Above apparoach works perfectly.
Thanks


prati wrote:
 
 Hi Peter,
 
 Many thanks for your reply.My problem is exactly same as second one
 discussed in the post.
 I need checkbox in other column .
 
 Code is
 TreeTable.html
 /tr
   trtd wicket:id=treeTable class=my-tree/td
   td  /td
   
   /tr
 TreeTable.java
 
 public TreeTablePage()
   {
 
   IColumn columns[] = new IColumn[] { col1(), col2() };
   
   tree = new TreeTable(treeTable, createTreeModel(), columns);
   tree.getTreeState().setAllowSelectMultiple(true);
 
 
 
   add(tree);
   tree.getTreeState().collapseAll();
   }
 
 
 
   private PropertyTreeColumn col1() {
   return new PropertyTreeColumn(new 
   ColumnLocation(Alignment.MIDDLE, 5,
   Unit.PROPORTIONAL), Check, 
 userObject.name);
   }
 
   private PropertyTreeColumn col2() {
   return new PropertyTreeColumn(new 
 ColumnLocation(Alignment.LEFT, 
   7, Unit.EM), L2,
   userObject.name) {
   
   
   @Override
   public Component newCell(MarkupContainer parent, String 
 id, TreeNode
 node, int level) {
   DefaultMutableTreeNode n = 
 (DefaultMutableTreeNode) node;
   CheckBoxPanel boxPanel = new 
 CheckBoxPanel(mypanel);
   return boxPanel;
   }
   };
   }
 
 I am getting no getter methods defined for ModelBean.
 
 Am i doing it in a right way particularly HTML
 Thanks
 Prati
 
 aldaris wrote:
 
 Hi,
 
 check out wicket-tree (http://code.google.com/p/wicket-tree/) and see 
 the example app, I think it will solve your problem.
 
 Regards,
 Peter
 
 prati írta:
 
 Hi,
 
 I am also stuck in similar problem.If you can share your code snippets
 of
 how u did that will be of great help.
 Thanks
 
 Pratibha
 
 vela wrote:
 Hello again,

 The links and nodes are added in the TreeFragment class. But the
 TreeFragment is a private inner class in Treetable, could you tell how
 to
 use the TreeFragment to acheive this functionality
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Tree-table-with-check-box-tp26080852p27209139.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



Re: Dynamically update TreeTable model

2010-01-19 Thread prati

Hi i too am facing  this problem.

When i refresh the page the tree collapses to its original state.

Please guide me how to solve this

Thanks
Prati

CrocodileShoes wrote:
 
 I've finally got this working by extending DefaultTreeState and overriding
 the isNodeSelected to calculate the selection based upon the wicket model
 containing the data.  This makes more sense since the tree's state is
 representative of the actual data now!
 

-- 
View this message in context: 
http://old.nabble.com/Dynamically-update-TreeTable-model-tp21056846p27234506.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



Re: Checkbox tree component

2010-01-20 Thread prati

Hi i also am having same kind of problem.
I got checkboxes in tree panel ,how to iterate over the selected nodes on
checkbox click.

Thanks
Partibha

Edi wrote:
 
 I am not able to configure the above example Doug.
 
 Could you give me .war file. please
 
 thanks and regards,
 edi
 
 
 Doug Leeper wrote:
 
 If the tree is pre-loaded, it is easier.  When the checkbox is selected,
 iterate through the children nodes and set its state to selected.
 
 The dynamically loaded is alot trickier...as you would have to load the
 tree from the selected node and then iterate and set the children notes
 to selected.
 
 Are you sure you want to select the children nodes or is it the parent
 nodes you want to select?
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Checkbox-tree-component-tp13433102p27250675.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



Re: Integrating Hibernate Validator with Wicket

2010-02-16 Thread prati

Hi

I integrated Hibernate Validator given in Wicket stuff with my application

I am getting this error
org.hibernate.PropertyValueException: not-null property references a null or
transient value:
Any ideas?

Thanks
P

Carlos Vara wrote:
 
 Hi,
 
 if you prefer to use JSR 303 Bean Validation (it's very similar to
 Hibernate
 Validator, in fact, it is the reference implementation), I made a blog
 post
 about how to integrate it with Wicket:
 
 http://carinae.net/2009/12/integration-of-jsr-303-bean-validation-standard-and-wicket-1-4/
 
 
 On Mon, Jan 4, 2010 at 11:28 AM, ayman elwany aymanelw...@gmail.com
 wrote:
 
 thanks Martin for the link , I used it but I had a problem;


 public class CarPage extends WebPage {

 *   ..*
 *   ..*
UserModel user= 
 ((LoginSession)getSession()).getUserBean();
  *  ..*
 *..*
 *   ..*
 private void fillPersonalInfoComponents(Form personalForm) {
  *   ..*
  *   ..   *
PropertyModel fullnamepropertyModel =new
 PropertyModelString(user, fullNameValue);
 fullName = new TextField(fullName, fullnamepropertyModel);
  personalForm.add(fullName);
 //System.out.println(Model =
 +fullnamepropertyModel.getChainedModel().getClass().getName());
 fullName.add(new HibernateValidatorString(fullnamepropertyModel,
 fullNameValue));

  }
 }



 And the user model is

 public class UserModel implements Serializable {

 /**
  *
  */
 private static final long serialVersionUID = 1011452297289823651L;
*   ..*
 *   ..*
 *   ..*

 @NotNull
 @NotEmpty
 private String fullNameValue;
*   ..*
 *   ..*
 *   ..*
 }


 but it always fails and gives me that my model is null .  but the strange
 behaviour that when I changed  HibernateValidator constructor

 *from*

 public HibernateValidator(I*Model entityModel*, String property) {
 this.property = property;
 if (entityModel != null)
 hibernateValidator = new
 ClassValidator(*entityModel.getObject().getClass()*
 );
 }


 *TO*
 public HibernateValidator(*Object bean, *String property) {
 this.property = property;
 //if (entityModel != null)
 hibernateValidator = new ClassValidator(*bean.getClass()*);
 }

 and did this

 fullName.add(new HibernateValidatorString(user, fullNameValue));

 the validation worked *fine *!!!

 so is there is any problem in the propertymodel with hibernate
 validator???

 On Mon, Jan 4, 2010 at 8:37 AM, Martin Makundi 
 martin.maku...@koodaripalvelut.com wrote:

  http://42lines.net/content/integrating-hibernate-validator-and-wicket
 
  2010/1/4 ayman elwany aymanelw...@gmail.com:
   Hi,
  
   Is there any common practice to integrate wicket with hibernate
 validator
  ?
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 

 
 

-- 
View this message in context: 
http://old.nabble.com/Integrating-Hibernate-Validator-with-Wicket-tp27009326p27607538.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



Re: How to access ListItem from ListView from AjaxLink?

2010-03-11 Thread prati

Hi 

I have got a refreshing view ,it contains list of links.I need to highlight
the link when i click on that link.

It works properly but if i click the next item in the list,the previous text
remains highlighted.

wicket:extend

table cellspacing=0 class=dataview
tr

thFirst Name/th

/tr
tr wicket:id=view
td # /td
   
/tr
/table

/wicket:extend



public class RefreshingPage extends BasePage {


public RefreshingPage()
{
final ListIModel contacts = new ArrayListIModel(10);

// populate list of contacts to be displayed

IteratorContact it = rgetContacts().iterator();
while (it.hasNext())
{
contacts.add(new Model(it.next()));
}

// create the refreshing view
RefreshingView view = new RefreshingView(view)
{
/**
 * Return an iterator over models for items in the view
 */
@Override
protected IteratorIModel getItemModels()
{
return contacts.iterator();
}

@Override
protected void populateItem(final Item item)
{
Contact contact = (Contact) 
item.getModelObject();

final Label contacteLabel = new 
Label(aname,contact.getName());
contacteLabel.setOutputMarkupId(true);

item.add(new AjaxLink(name) {

private static final long 
serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget 
target) {

if(target!= null) {
contacteLabel.add(new

AttributeModifier(style, true, new AbstractReadOnlyModel() {

@Override

public String getObject() {

return background-color:#80b6ed;;

}
}));

target.addComponent(contacteLabel);
}

}



}.add(contacteLabel));
}
};

add(view);


}
}


Regards
P


moontz wrote:
 
 i tried that before.  did not work.  no compile or runtime errors, but the
 source did not show the change.
 
 im thinking, since its an ajax link and because only the target panel
 refreshes, the change to the link is not applied because the actual link
 is not refreshed.  only the other panel is.  in which case i would need to
 append javascript.  i was hping there was a pure wicket solutioin though
 without using JS.
 
 
 
 igor.vaynberg wrote:
 
 final ListItem item
 
 -igor
 
 On Fri, Feb 13, 2009 at 7:36 AM, moontz bmun...@yahoo.com wrote:

 I would like to add an attribute to the ListItem element in the markup
 (basically change the class style) on click of the link.  Below is my
 snippet.  Any insight on how I can accomplish this?  Thanks in advance!

 ListView lv = new ListView(tabListView, tabList) {
 protected void populateItem(ListItem item) {
 AjaxLink ajaxLink = new AjaxLink(tabLink,
 item.getModel()) {
   public void onClick(AjaxRequestTarget target)
 {
item.add(new
 SimpleAttributeModifier(class, on));  //
 want to do this but do not have access to item object from inner class 
 --
 ideas for this?
 .
 .
 .


 --
 View this message in context:
 http://www.nabble.com/How-to-access-ListItem-from-ListView-from-AjaxLink--tp21998739p21998739.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


 
 -

Re: How to access ListItem from ListView from AjaxLink?

2010-03-11 Thread prati

Hi Cemal,

Thanks for replying me,but the list gets rendered only once,and i am able to
capture previous value on click but then how to move further.


Regards
P

jWeekend wrote:
 
 Prati,
 
 This is because you are only re-rendering the most recently selected
 label.
 
 One solution is keep track of the previous current selection
 (probably in your RefreshingView implementation - eg declare
 Component currentSelection;), which you update in your Link's
 onClick (ie currentSelecton = contactLabel;) _after_ you remove the
 style attribute (that you previously set) on currentSelection and add
 currrentSelection to the AjaxRequestTarget so it too gets refreshed.
 
 Make sense?
 
 Regards - Cemal
 jWeekend
 OO  Java Technologies, Wicket
 Consulting, Development, Training
 http://jWeekend.com
 
 On 11 March 2010 18:09, prati pratibha.pari...@gmail.com wrote:

 Hi

 I have got a refreshing view ,it contains list of links.I need to
 highlight
 the link when i click on that link.

 It works properly but if i click the next item in the list,the previous
 text
 remains highlighted.

 wicket:extend

 table cellspacing=0 class=dataview
    tr

        thFirst Name/th

    /tr
    tr wicket:id=view
        td #     /td

    /tr
 /table

 /wicket:extend



 public class RefreshingPage extends BasePage {


        public RefreshingPage()
        {
                final ListIModel contacts = new ArrayListIModel(10);

                // populate list of contacts to be displayed

                IteratorContact it = rgetContacts().iterator();
                while (it.hasNext())
                {
                        contacts.add(new Model(it.next()));
                }

                // create the refreshing view
                RefreshingView view = new RefreshingView(view)
                {
                        /**
                         * Return an iterator over models for items in the
 view
                         */
                       �...@override
                        protected IteratorIModel getItemModels()
                        {
                                return contacts.iterator();
                        }

                       �...@override
                        protected void populateItem(final Item item)
                        {
                                Contact contact = (Contact)
 item.getModelObject();

                                final Label contacteLabel = new
 Label(aname,contact.getName());
                                contacteLabel.setOutputMarkupId(true);

                                item.add(new AjaxLink(name) {

                                        private static final long
 serialVersionUID = 1L;

                                       �...@override
                                        public void
 onClick(AjaxRequestTarget target) {

                                                if(target!= null) {
                                                      
  contacteLabel.add(new
                                                                      
  AttributeModifier(style, true, new AbstractReadOnlyModel() {
                                                                          
     �...@override
                                                                          
      public String getObject() {
                                                                          
              return background-color:#80b6ed;;
                                                                          
      }
                                                                      
  }));
                                                      
  target.addComponent(contacteLabel);
                                                }

                                        }



                                }.add(contacteLabel));
                        }
                };

                add(view);


        }
 }


 Regards
 P


 moontz wrote:

 i tried that before.  did not work.  no compile or runtime errors, but
 the
 source did not show the change.

 im thinking, since its an ajax link and because only the target panel
 refreshes, the change to the link is not applied because the actual link
 is not refreshed.  only the other panel is.  in which case i would need
 to
 append javascript.  i was hping there was a pure wicket solutioin though
 without using JS.



 igor.vaynberg wrote:

 final ListItem item

 -igor

 On Fri, Feb 13, 2009 at 7:36 AM, moontz bmun...@yahoo.com wrote:

 I would like to add an attribute to the ListItem element in the markup
 (basically change the class style) on click of the link.  Below is my
 snippet.  Any insight on how I can accomplish this?  Thanks in
 advance!

 ListView lv = new ListView(tabListView, tabList) {
                 protected void populateItem(ListItem item) {
                         AjaxLink ajaxLink = new AjaxLink(tabLink,
 item.getModel()) {
                           public void onClick

Re: How to delete an item from List view.

2010-03-15 Thread prati

Hi,

I am also having similar issue, it all the time removes last row.
I have attached code.


OptionGroupPageForm(String id) {

super(id);

final MarkupContainer rowPanel = new 
WebMarkupContainer(rowPanel);
rowPanel.setOutputMarkupId(true);
add(rowPanel);

// List all rows


rows.add(new String());

RefreshingView lv = new RefreshingView(rows) {

@Override
protected IteratorIModel getItemModels()
{
List models = new ArrayList();

for(int i=0;irows.size();i++){
models.add(new Model( (String) 
rows.get(i)));
}

return models.iterator(); 
//return rows.iterator();
}

@Override
protected void populateItem(final Item item) {

int index = item.getIndex() + 1;

item.add(new Label(index, 
Option+index + .));

TextField text = new TextField(text, 
item.getModel());

RadioChoice rc = new 
RadioChoice(status, STATUS);

item.add(text);

item.add(rc);

item.add(new AjaxLink(removeRow) {

@Override
public void 
onClick(AjaxRequestTarget target) {




if (target != null) {

target.addComponent(rowPanel);
}
}
} );
}
};


lv.setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance());
rowPanel.add(lv);

AjaxSubmitLink addLink = new AjaxSubmitLink(addRow, 
this) {
@Override
public void onSubmit(AjaxRequestTarget target, 
Form form) {

rows.add(new String());



if (target != null)
target.addComponent(rowPanel);
}
};

addLink.setDefaultFormProcessing(false);

add(addLink);




}

Thanks

 Prati

Johan Compagner wrote:
 
 You do use a delete button, so i guess the values are submitted.
 Then if you store those first in the model objects you won't loose
 anything
 
 johan
 
 
 
 On Feb 4, 2008 2:35 PM, pnerkar pner...@gmail.com wrote:
 

 Hi Johan,

 Yes that will be quickest solution ,
 But this will clear the fields of all vehicles.

 -Pnerkar


 Johan Compagner wrote:
 
  wasn't the quickest solution:
 
  public void onSubmit() {
 List vehicles = (List) getParent().getParent().getModelObject();
 vehicles.remove(index);
 listView.removeAll();
  }
 
  Then if the list itself is stable on the server side (if other persons
 can
  also delete or add stuff to that list you really should do it
 differently)
  that should work fine. After you alter the listviews model you have to
  remove all the items so that it will rebuild
 
  johan
 
 
 
 
  On Feb 1, 2008 12:49 AM, pnerkar pner...@gmail.com wrote:
 
 
  Hi All,
 
  I have rendered a list view on a Web Page.
 
  vehicle1X
  vehicle2X
  vehicle3X
 
  when a person click on 'X', that item should be deleted.
  But I'm facing an issue, when i click on 'X', last item get deleted.
  Actually when I delete vehicle2 from my list, it deletes vehicle2 but
  that
  component is still there.
  So while rendering it render vehicle1  vehicle2.
 
  public void onSubmit() {
 List vehicles = (List)
 getParent().getParent().getModelObject();
 vehicles.remove(index);
  }
 
  can please help out ??
 
 
 
  --
  View this message in context:
 
 http://www.nabble.com/How-to-delete-an-item-from-List-view.-tp15217608p15217608.html
  Sent from the Wicket - User mailing list archive at
  Nabble.com http://nabble.com/http://nabble.com/
  .
 
 
  -
  To unsubscribe, e

Re: How to delete an item from List view.

2010-03-17 Thread prati

Hi

I have got a refreshingView with a delete link in each row and only one
AddLink,AddLink adds the 

row properly but deleteRow everytime deletes the last row,its driving me
crazy,I have posted my 

code also.I will apprecaite if any one can help me in this.

Honestly its not that easy the way it seams.


Thanks

Prati 



prati wrote:
 
 Hi,
 
 I am also having similar issue, it all the time removes last row.
 I have attached code.
 
 
 OptionGroupPageForm(String id) {
 
   super(id);
 
   final MarkupContainer rowPanel = new 
 WebMarkupContainer(rowPanel);
   rowPanel.setOutputMarkupId(true);
   add(rowPanel);
 
   // List all rows
 
 
   rows.add(new String());
 
   RefreshingView lv = new RefreshingView(rows) {
 
   @Override
   protected IteratorIModel getItemModels()
   {
   List models = new ArrayList();
 
   for(int i=0;irows.size();i++){
   models.add(new Model( (String) 
 rows.get(i)));
   }
 
   return models.iterator(); 
   //return rows.iterator();
   }
 
   @Override
   protected void populateItem(final Item item) {
 
   int index = item.getIndex() + 1;
 
   item.add(new Label(index, 
 Option+index + .));
 
   TextField text = new TextField(text, 
 item.getModel());
 
   RadioChoice rc = new 
 RadioChoice(status, STATUS);
 
   item.add(text);
 
   item.add(rc);
 
   item.add(new AjaxLink(removeRow) {
 
   @Override
   public void 
 onClick(AjaxRequestTarget target) {
 
 
   
 
   if (target != null) {
   
 target.addComponent(rowPanel);
   }
   }
   } );
   }
   };
 
   
 lv.setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance());
   rowPanel.add(lv);
 
   AjaxSubmitLink addLink = new AjaxSubmitLink(addRow, 
 this) {
   @Override
   public void onSubmit(AjaxRequestTarget target, 
 Form form) {
 
   rows.add(new String());
 
 
 
   if (target != null)
   target.addComponent(rowPanel);
   }
   };
 
   addLink.setDefaultFormProcessing(false);
 
   add(addLink);
 
 
 
 
   }
 
 Thanks
 
  Prati
 
 Johan Compagner wrote:
 
 You do use a delete button, so i guess the values are submitted.
 Then if you store those first in the model objects you won't loose
 anything
 
 johan
 
 
 
 On Feb 4, 2008 2:35 PM, pnerkar pner...@gmail.com wrote:
 

 Hi Johan,

 Yes that will be quickest solution ,
 But this will clear the fields of all vehicles.

 -Pnerkar


 Johan Compagner wrote:
 
  wasn't the quickest solution:
 
  public void onSubmit() {
 List vehicles = (List)
 getParent().getParent().getModelObject();
 vehicles.remove(index);
 listView.removeAll();
  }
 
  Then if the list itself is stable on the server side (if other persons
 can
  also delete or add stuff to that list you really should do it
 differently)
  that should work fine. After you alter the listviews model you have to
  remove all the items so that it will rebuild
 
  johan
 
 
 
 
  On Feb 1, 2008 12:49 AM, pnerkar pner...@gmail.com wrote:
 
 
  Hi All,
 
  I have rendered a list view on a Web Page.
 
  vehicle1X
  vehicle2X
  vehicle3X
 
  when a person click on 'X', that item should be deleted.
  But I'm facing an issue, when i click on 'X', last item get deleted.
  Actually when I delete vehicle2 from my list, it deletes vehicle2 but
  that
  component is still there.
  So while rendering it render vehicle1  vehicle2.
 
  public void onSubmit() {
 List vehicles = (List)
 getParent().getParent().getModelObject();
 vehicles.remove(index);
  }
 
  can please

Re: How to delete an item from List view.

2010-03-17 Thread prati

Hi Team,

Also i dont want to remove values , i want to remove the entire row.
My row contains(TextBox and option group)


Thanks
Prati


prati wrote:
 
 Hi
 
 I have got a refreshingView with a delete link in each row and only one
 AddLink,AddLink adds the 
 
 row properly but deleteRow everytime deletes the last row,its driving me
 crazy,I have posted my 
 
 code also.I will apprecaite if any one can help me in this.
 
 Honestly its not that easy the way it seams.
 
 
 Thanks
 
 Prati 
 
 
 
 prati wrote:
 
 Hi,
 
 I am also having similar issue, it all the time removes last row.
 I have attached code.
 
 
 OptionGroupPageForm(String id) {
 
  super(id);
 
  final MarkupContainer rowPanel = new 
 WebMarkupContainer(rowPanel);
  rowPanel.setOutputMarkupId(true);
  add(rowPanel);
 
  // List all rows
 
 
  rows.add(new String());
 
  RefreshingView lv = new RefreshingView(rows) {
 
  @Override
  protected IteratorIModel getItemModels()
  {
  List models = new ArrayList();
 
  for(int i=0;irows.size();i++){
  models.add(new Model( (String) 
 rows.get(i)));
  }
 
  return models.iterator(); 
  //return rows.iterator();
  }
 
  @Override
  protected void populateItem(final Item item) {
 
  int index = item.getIndex() + 1;
 
  item.add(new Label(index, 
 Option+index + .));
 
  TextField text = new TextField(text, 
 item.getModel());
 
  RadioChoice rc = new 
 RadioChoice(status, STATUS);
 
  item.add(text);
 
  item.add(rc);
 
  item.add(new AjaxLink(removeRow) {
 
  @Override
  public void 
 onClick(AjaxRequestTarget target) {
 
 
  
 
  if (target != null) {
  
 target.addComponent(rowPanel);
  }
  }
  } );
  }
  };
 
  
 lv.setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance());
  rowPanel.add(lv);
 
  AjaxSubmitLink addLink = new AjaxSubmitLink(addRow, 
 this) {
  @Override
  public void onSubmit(AjaxRequestTarget target, 
 Form form) {
 
  rows.add(new String());
 
 
 
  if (target != null)
  target.addComponent(rowPanel);
  }
  };
 
  addLink.setDefaultFormProcessing(false);
 
  add(addLink);
 
 
 
 
  }
 
 Thanks
 
  Prati
 
 Johan Compagner wrote:
 
 You do use a delete button, so i guess the values are submitted.
 Then if you store those first in the model objects you won't loose
 anything
 
 johan
 
 
 
 On Feb 4, 2008 2:35 PM, pnerkar pner...@gmail.com wrote:
 

 Hi Johan,

 Yes that will be quickest solution ,
 But this will clear the fields of all vehicles.

 -Pnerkar


 Johan Compagner wrote:
 
  wasn't the quickest solution:
 
  public void onSubmit() {
 List vehicles = (List)
 getParent().getParent().getModelObject();
 vehicles.remove(index);
 listView.removeAll();
  }
 
  Then if the list itself is stable on the server side (if other
 persons
 can
  also delete or add stuff to that list you really should do it
 differently)
  that should work fine. After you alter the listviews model you have
 to
  remove all the items so that it will rebuild
 
  johan
 
 
 
 
  On Feb 1, 2008 12:49 AM, pnerkar pner...@gmail.com wrote:
 
 
  Hi All,
 
  I have rendered a list view on a Web Page.
 
  vehicle1X
  vehicle2X
  vehicle3X
 
  when a person click on 'X', that item should be deleted.
  But I'm facing an issue, when i click on 'X', last item get deleted.
  Actually when I delete vehicle2 from my list, it deletes vehicle2
 but
  that
  component is still there.
  So while rendering it render vehicle1  vehicle2.
 
  public void onSubmit

Re: How to delete an item from List view.

2010-03-17 Thread prati

Hi ListView/Refreshing View any willd o

but dont know how to solve this.

Thanks
P

prati wrote:
 
 Hi Team,
 
 Also i dont want to remove values , i want to remove the entire row.
 My row contains(TextBox and option group)
 
 
 Thanks
 Prati
 
 
 prati wrote:
 
 Hi
 
 I have got a refreshingView with a delete link in each row and only one
 AddLink,AddLink adds the 
 
 row properly but deleteRow everytime deletes the last row,its driving me
 crazy,I have posted my 
 
 code also.I will apprecaite if any one can help me in this.
 
 Honestly its not that easy the way it seams.
 
 
 Thanks
 
 Prati 
 
 
 
 prati wrote:
 
 Hi,
 
 I am also having similar issue, it all the time removes last row.
 I have attached code.
 
 
 OptionGroupPageForm(String id) {
 
 super(id);
 
 final MarkupContainer rowPanel = new 
 WebMarkupContainer(rowPanel);
 rowPanel.setOutputMarkupId(true);
 add(rowPanel);
 
 // List all rows
 
 
 rows.add(new String());
 
 RefreshingView lv = new RefreshingView(rows) {
 
 @Override
 protected IteratorIModel getItemModels()
 {
 List models = new ArrayList();
 
 for(int i=0;irows.size();i++){
 models.add(new Model( (String) 
 rows.get(i)));
 }
 
 return models.iterator(); 
 //return rows.iterator();
 }
 
 @Override
 protected void populateItem(final Item item) {
 
 int index = item.getIndex() + 1;
 
 item.add(new Label(index, 
 Option+index + .));
 
 TextField text = new TextField(text, 
 item.getModel());
 
 RadioChoice rc = new 
 RadioChoice(status, STATUS);
 
 item.add(text);
 
 item.add(rc);
 
 item.add(new AjaxLink(removeRow) {
 
 @Override
 public void 
 onClick(AjaxRequestTarget target) {
 
 
 
 
 if (target != null) {
 
 target.addComponent(rowPanel);
 }
 }
 } );
 }
 };
 
 
 lv.setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance());
 rowPanel.add(lv);
 
 AjaxSubmitLink addLink = new AjaxSubmitLink(addRow, 
 this) {
 @Override
 public void onSubmit(AjaxRequestTarget target, 
 Form form) {
 
 rows.add(new String());
 
 
 
 if (target != null)
 target.addComponent(rowPanel);
 }
 };
 
 addLink.setDefaultFormProcessing(false);
 
 add(addLink);
 
 
 
 
 }
 
 Thanks
 
  Prati
 
 Johan Compagner wrote:
 
 You do use a delete button, so i guess the values are submitted.
 Then if you store those first in the model objects you won't loose
 anything
 
 johan
 
 
 
 On Feb 4, 2008 2:35 PM, pnerkar pner...@gmail.com wrote:
 

 Hi Johan,

 Yes that will be quickest solution ,
 But this will clear the fields of all vehicles.

 -Pnerkar


 Johan Compagner wrote:
 
  wasn't the quickest solution:
 
  public void onSubmit() {
 List vehicles = (List)
 getParent().getParent().getModelObject();
 vehicles.remove(index);
 listView.removeAll();
  }
 
  Then if the list itself is stable on the server side (if other
 persons
 can
  also delete or add stuff to that list you really should do it
 differently)
  that should work fine. After you alter the listviews model you have
 to
  remove all the items so that it will rebuild
 
  johan
 
 
 
 
  On Feb 1, 2008 12:49 AM, pnerkar pner...@gmail.com wrote:
 
 
  Hi All,
 
  I have rendered a list view on a Web Page.
 
  vehicle1X
  vehicle2X
  vehicle3X
 
  when a person click on 'X', that item should be deleted.
  But I'm facing an issue, when i click on 'X', last item get
 deleted.
  Actually when I delete vehicle2 from my list, it deletes vehicle2
 but
  that
  component is still there.
  So while