You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Lukasz Lipka <lu...@gmail.com> on 2008/08/21 22:53:43 UTC

Wicket-phonebook problem with cleaning fields in FilterToolbar

Hi,
I looked into wicket-phonebook application and base on this I want to create
very simple application to only display some data from database, with
possibility of filtering of information. Almost every thing work perfect:)
but one element is not working is "clean" button. I thought that
GoAndClearFilter will automatically clean the fields in
table.addTopToolbar(new FilterToolbar(table, form, dataProvider));  Now I 
try to find what is going on after clicking on "clean" in may case it's work
exactly like "go". I hope that somebody give me some advice how to make
cleaning of filtering fileds. First I was using wicket 1.3.3 now I switch to
1.4-SNAPSHOT, but id didn't change anything. I would be thankful for any
help. My code bellow:

public class TabIndeksSortablePanel extends Panel {

	
	public TabIndeksSortablePanel(String id) {
		super(id);
		init();
	}

	private void init() {
		final IndeksDataProvider dataProvider = new IndeksDataProvider();
		IColumn[] columns = createColumns();
		final DefaultDataTable table = new DefaultDataTable("datatable",
				Arrays.asList(columns), dataProvider, 10);

		// create the form used to contain all filter components
		final FilterForm form = new FilterForm("filter-form", dataProvider) {
			private static final long serialVersionUID = 1L;

			@Override
			protected void onSubmit() {
				table.setCurrentPage(0);
			}
		};

		table.addTopToolbar(new FilterToolbar(table, form, dataProvider));
		form.add(table);
		add(form);

	}
	
	private IColumn[] createColumns(){
		IColumn[] columns = new IColumn[10];
		columns[0] = createColumn("symbol", "symbol", "symbol");
		columns[1] = createColumn("nazwa1", "nazwa1", "nazwa1");
		columns[2] = new ChoiceFilteredPropertyColumn(new ResourceModel("jm"),
				"jm", "jm", new LoadableDetachableModel() {
			@Override
			protected Object load() {
				List<String> list = getIndeksDao().findJM();
				list.add(0,"");
				return list;
			}
		});
		columns[3] = createColumn("cena_zbyt", "cena_zbyt", "cena_zbyt");
		columns[4] = createColumn("symb_wo", "symb_wo", "symb_wo");
		columns[5] = createColumn("proc_vat", "proc_vat", "proc_vat");
		columns[6] = createColumn("kat_vat", "kat_vat", "kat_vat");
		columns[7] = createColumn("mar_zbyt", "mar_zbyt", "mar_zbyt");
		columns[8] = createColumn("data_wpr", "data_wpr", "data_wpr");
		columns[9] = createActionsColumn();
		return columns;
	}
	
	
	private TextFilteredPropertyColumn createColumn(String key,
			String sortProperty, String propertyExpression) {
		return new TextFilteredPropertyColumn(new ResourceModel(key),
				sortProperty, propertyExpression);
	}

	/**
	 * Create a composite column extending FilteredAbstractColumn. This column
	 * adds a UserActionsPanel as its cell contents. It also provides the
	 * go-and-clear filter control panel.
	 */
	private FilteredAbstractColumn createActionsColumn() {
		// getString("actions")
		return new FilteredAbstractColumn(new Model("actions")) {
			// return the go-and-clear filter for the filter toolbar
			public Component getFilter(String componentId, FilterForm form) {
				// FIXME zmienic Model na ResourceModel
				return new GoAndClearFilter(componentId, form,
						new ResourceModel("filter"), new ResourceModel("clear"));
			}

			// add the UserActionsPanel to the cell item
			public void populateItem(Item cellItem, String componentId,
					IModel model) {
				cellItem.add(new UserActionsPanel(componentId, model));
			}
		};
	}

	/**
	 * Provides a composite User Actions panel for the Actions column.
	 * 
	 * @author igor
	 */
	private static class UserActionsPanel extends Panel {
		public UserActionsPanel(String id, IModel indeksModel) {
			super(id);
		}

	}

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * @return the companyDaoI
	 */
	public IIndeksDao getIndeksDao() {
		WicketSignYourMailApplication application =
(WicketSignYourMailApplication) getApplication();
		return application.getIndeksDao();
	}

}

public class DetachableIndeksModel extends AbstractReadOnlyModel<Indeks> {

	private static final long serialVersionUID = 1L;
	private final int id;
	private transient Indeks indeks;
	
	public DetachableIndeksModel(final Indeks indeks) {
		this(indeks.getRecno());
		this.indeks = indeks;
		
	}
	/**
	 * @param companyId
	 */
	public DetachableIndeksModel(final Integer indeksID) {
		this.id = indeksID;
	}
	
	/* (non-Javadoc)
	 * @see org.apache.wicket.model.AbstractReadOnlyModel#getObject()
	 */
	@Override
	public Indeks getObject() {
		return indeks;
	}
	
	public IModel getNestedModel(){
		return null;
	}
	
	protected void onDetach(){
		indeks = null;
	}
	
	protected void onAttach(){
		indeks = getIndeksDao().getIndeks(id);
	}
	/**
	 * @return
	 */
	private IIndeksDao getIndeksDao() {
		return ((WicketSignYourMailApplication)Application.get()).getIndeksDao();
	}

}



-- 
View this message in context: http://www.nabble.com/Wicket-phonebook-problem-with-cleaning-fields-in-FilterToolbar-tp19096695p19096695.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


RE: Wicket-phonebook problem with cleaning fields in FilterToolbar

Posted by Kai Mütz <km...@googlemail.com>.
Lukasz Lipka <ma...@gmail.com> wrote:
> Can you show what did you change in your code that it start to work?

Just

clear.setDefaultFormProcessing(true);

But this seems to be fixed in newer versions. So I have no clue what's the
problem.

Sorry, Kai


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


Re: Wicket-phonebook problem with cleaning fields in FilterToolbar

Posted by Łukasz Lipka <lu...@gmail.com>.
Can you show what did you change in your code that it start to work?

Best regards
Łukasz Lipkaa

2008/8/21 Kai Mutz <km...@googlemail.com>

> "Clear button of FilterForm is set as defaultFormProcessing false by
> default. Change it to true."
>
> See
>
> http://www.nabble.com/Problems-with-clearing-of-filter-form-td16098239.html#
> a16129385<http://www.nabble.com/Problems-with-clearing-of-filter-form-td16098239.html#a16129385>
>
> Lukasz Lipka <ma...@gmail.com> wrote:
> > Hi,
> > I looked into wicket-phonebook application and base on this I
> > want to create
> > very simple application to only display some data from database, with
> > possibility of filtering of information. Almost every thing work
> > perfect:) but one element is not working is "clean" button. I thought
> > that GoAndClearFilter will automatically clean the fields in
> > table.addTopToolbar(new FilterToolbar(table, form, dataProvider));
> > Now I try to find what is going on after clicking on "clean" in may
> > case it's work
> > exactly like "go". I hope that somebody give me some advice how to
> > make cleaning of filtering fileds. First I was using wicket 1.3.3 now
> > I switch to
> > 1.4-SNAPSHOT, but id didn't change anything. I would be thankful for
> > any help. My code bellow:
> >
> > public class TabIndeksSortablePanel extends Panel {
> >
> >
> >       public TabIndeksSortablePanel(String id) {
> >               super(id);
> >               init();
> >       }
> >
> >       private void init() {
> >               final IndeksDataProvider dataProvider = new
> > IndeksDataProvider();
> >               IColumn[] columns = createColumns();
> >               final DefaultDataTable table = new
> > DefaultDataTable("datatable",
> >                               Arrays.asList(columns), dataProvider, 10);
> >
> >               // create the form used to contain all filter components
>              final
> > FilterForm form = new FilterForm("filter-form", dataProvider) {
> >                       private static final long serialVersionUID = 1L;
> >
> >                       @Override
> >                       protected void onSubmit() {
> >                               table.setCurrentPage(0);
> >                       }
> >               };
> >
> >               table.addTopToolbar(new FilterToolbar(table, form,
> > dataProvider));
> >               form.add(table);
> >               add(form);
> >
> >       }
> >
> >       private IColumn[] createColumns(){
> >               IColumn[] columns = new IColumn[10];
> >               columns[0] = createColumn("symbol", "symbol", "symbol");
> >               columns[1] = createColumn("nazwa1", "nazwa1", "nazwa1");
> >               columns[2] = new ChoiceFilteredPropertyColumn(new
> > ResourceModel("jm"),
> >                               "jm", "jm", new LoadableDetachableModel() {
> >                       @Override
> >                       protected Object load() {
> >                               List<String> list =
> getIndeksDao().findJM();
> >                               list.add(0,"");
> >                               return list;
> >                       }
> >               });
> >               columns[3] = createColumn("cena_zbyt", "cena_zbyt",
> "cena_zbyt");
> >               columns[4] = createColumn("symb_wo", "symb_wo", "symb_wo");
> >               columns[5] = createColumn("proc_vat", "proc_vat",
> "proc_vat");
> >               columns[6] = createColumn("kat_vat", "kat_vat", "kat_vat");
> >               columns[7] = createColumn("mar_zbyt", "mar_zbyt",
> "mar_zbyt");
> >               columns[8] = createColumn("data_wpr", "data_wpr",
> "data_wpr");
> >               columns[9] = createActionsColumn();
> >               return columns;
> >       }
> >
> >
> >       private TextFilteredPropertyColumn createColumn(String key,
> >                       String sortProperty, String propertyExpression) {
> >               return new TextFilteredPropertyColumn(new
> > ResourceModel(key),
> >                               sortProperty, propertyExpression);
> >       }
> >
> >       /**
> >        * Create a composite column extending
> > FilteredAbstractColumn. This column
> >        * adds a UserActionsPanel as its cell contents. It also
> > provides the
> >        * go-and-clear filter control panel.
> >        */
> >       private FilteredAbstractColumn createActionsColumn() {          //
> >               getString("actions") return new FilteredAbstractColumn(new
> >                       Model("actions")) { // return the go-and-clear
> filter for the
> > filter toolbar
> >                       public Component getFilter(String
> > componentId, FilterForm form) {
> >                               // FIXME zmienic Model na ResourceModel
> >                               return new
> > GoAndClearFilter(componentId, form,
> >                                               new
> > ResourceModel("filter"), new ResourceModel("clear"));
>     }
> >
> >                       // add the UserActionsPanel to the cell item
> >                       public void populateItem(Item cellItem,
> > String componentId,
> >                                       IModel model) {
> >                               cellItem.add(new
> > UserActionsPanel(componentId, model));
> >                       }
> >               };
> >       }
> >
> >       /**
> >        * Provides a composite User Actions panel for the Actions column.
> > *
> >        * @author igor
> >        */
> >       private static class UserActionsPanel extends Panel {
> >               public UserActionsPanel(String id, IModel indeksModel) {
> >               super(id); }
> >
> >       }
> >
> >       /**
> >        *
> >        */
> >       private static final long serialVersionUID = 1L;
> >       /**
> >        * @return the companyDaoI
> >        */
> >       public IIndeksDao getIndeksDao() {
> >               WicketSignYourMailApplication application =
> > (WicketSignYourMailApplication) getApplication();
> >               return application.getIndeksDao();
> >       }
> >
> > }
> >
> > public class DetachableIndeksModel extends
> > AbstractReadOnlyModel<Indeks> {
> >
> >       private static final long serialVersionUID = 1L;
> >       private final int id;
> >       private transient Indeks indeks;
> >
> >       public DetachableIndeksModel(final Indeks indeks) {
> >               this(indeks.getRecno()); this.indeks = indeks;
> >
> >       }
> >       /**
> >        * @param companyId
> >        */
> >       public DetachableIndeksModel(final Integer indeksID) {
> this.id =
> >       indeksID; }
> >
> >       /* (non-Javadoc)
> >        * @see org.apache.wicket.model.AbstractReadOnlyModel#getObject()
> >       */ @Override
> >       public Indeks getObject() {
> >               return indeks;
> >       }
> >
> >       public IModel getNestedModel(){
> >               return null;
> >       }
> >
> >       protected void onDetach(){
> >               indeks = null;
> >       }
> >
> >       protected void onAttach(){
> >               indeks = getIndeksDao().getIndeks(id);
> >       }
> >       /**
> >        * @return
> >        */
> >       private IIndeksDao getIndeksDao() {
> >               return
> > ((WicketSignYourMailApplication)Application.get()).getIndeksDao();    }
> >
> > }
> >
> >
> >
> s-in-FilterToolbar-tp19096695p19096695.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Wicket-phonebook problem with cleaning fields in FilterToolbar

Posted by Łukasz Lipka <lu...@gmail.com>.
hi,
thanks for answer , but I looked into 1.4Snaphot wicket source code and it's
look correct, but it doesn't work in my case. Did you change something more
?

public GoAndClearFilter(String id, FilterForm form, IModel<String> goModel,
        IModel<String> clearModel)
    {
        super(id, goModel);

        originalState = Objects.cloneModel(form.getDefaultModelObject());

        clear = new Button("clear", clearModel)
        {
            private static final long serialVersionUID = 1L;

            @Override
            public void onSubmit()
            {
                onClearSubmit(this);
            }
        };

        clear.setDefaultFormProcessing(true);

        add(clear);
    }

Best regards
Łukasz Lipka

2008/8/21 Kai Mutz <km...@googlemail.com>

> "Clear button of FilterForm is set as defaultFormProcessing false by
> default. Change it to true."
>
> See
>
> http://www.nabble.com/Problems-with-clearing-of-filter-form-td16098239.html#
> a16129385<http://www.nabble.com/Problems-with-clearing-of-filter-form-td16098239.html#a16129385>
>
> Lukasz Lipka <ma...@gmail.com> wrote:
> > Hi,
> > I looked into wicket-phonebook application and base on this I
> > want to create
> > very simple application to only display some data from database, with
> > possibility of filtering of information. Almost every thing work
> > perfect:) but one element is not working is "clean" button. I thought
> > that GoAndClearFilter will automatically clean the fields in
> > table.addTopToolbar(new FilterToolbar(table, form, dataProvider));
> > Now I try to find what is going on after clicking on "clean" in may
> > case it's work
> > exactly like "go". I hope that somebody give me some advice how to
> > make cleaning of filtering fileds. First I was using wicket 1.3.3 now
> > I switch to
> > 1.4-SNAPSHOT, but id didn't change anything. I would be thankful for
> > any help. My code bellow:
> >
> > public class TabIndeksSortablePanel extends Panel {
> >
> >
> >       public TabIndeksSortablePanel(String id) {
> >               super(id);
> >               init();
> >       }
> >
> >       private void init() {
> >               final IndeksDataProvider dataProvider = new
> > IndeksDataProvider();
> >               IColumn[] columns = createColumns();
> >               final DefaultDataTable table = new
> > DefaultDataTable("datatable",
> >                               Arrays.asList(columns), dataProvider, 10);
> >
> >               // create the form used to contain all filter components
>              final
> > FilterForm form = new FilterForm("filter-form", dataProvider) {
> >                       private static final long serialVersionUID = 1L;
> >
> >                       @Override
> >                       protected void onSubmit() {
> >                               table.setCurrentPage(0);
> >                       }
> >               };
> >
> >               table.addTopToolbar(new FilterToolbar(table, form,
> > dataProvider));
> >               form.add(table);
> >               add(form);
> >
> >       }
> >
> >       private IColumn[] createColumns(){
> >               IColumn[] columns = new IColumn[10];
> >               columns[0] = createColumn("symbol", "symbol", "symbol");
> >               columns[1] = createColumn("nazwa1", "nazwa1", "nazwa1");
> >               columns[2] = new ChoiceFilteredPropertyColumn(new
> > ResourceModel("jm"),
> >                               "jm", "jm", new LoadableDetachableModel() {
> >                       @Override
> >                       protected Object load() {
> >                               List<String> list =
> getIndeksDao().findJM();
> >                               list.add(0,"");
> >                               return list;
> >                       }
> >               });
> >               columns[3] = createColumn("cena_zbyt", "cena_zbyt",
> "cena_zbyt");
> >               columns[4] = createColumn("symb_wo", "symb_wo", "symb_wo");
> >               columns[5] = createColumn("proc_vat", "proc_vat",
> "proc_vat");
> >               columns[6] = createColumn("kat_vat", "kat_vat", "kat_vat");
> >               columns[7] = createColumn("mar_zbyt", "mar_zbyt",
> "mar_zbyt");
> >               columns[8] = createColumn("data_wpr", "data_wpr",
> "data_wpr");
> >               columns[9] = createActionsColumn();
> >               return columns;
> >       }
> >
> >
> >       private TextFilteredPropertyColumn createColumn(String key,
> >                       String sortProperty, String propertyExpression) {
> >               return new TextFilteredPropertyColumn(new
> > ResourceModel(key),
> >                               sortProperty, propertyExpression);
> >       }
> >
> >       /**
> >        * Create a composite column extending
> > FilteredAbstractColumn. This column
> >        * adds a UserActionsPanel as its cell contents. It also
> > provides the
> >        * go-and-clear filter control panel.
> >        */
> >       private FilteredAbstractColumn createActionsColumn() {          //
> >               getString("actions") return new FilteredAbstractColumn(new
> >                       Model("actions")) { // return the go-and-clear
> filter for the
> > filter toolbar
> >                       public Component getFilter(String
> > componentId, FilterForm form) {
> >                               // FIXME zmienic Model na ResourceModel
> >                               return new
> > GoAndClearFilter(componentId, form,
> >                                               new
> > ResourceModel("filter"), new ResourceModel("clear"));
>     }
> >
> >                       // add the UserActionsPanel to the cell item
> >                       public void populateItem(Item cellItem,
> > String componentId,
> >                                       IModel model) {
> >                               cellItem.add(new
> > UserActionsPanel(componentId, model));
> >                       }
> >               };
> >       }
> >
> >       /**
> >        * Provides a composite User Actions panel for the Actions column.
> > *
> >        * @author igor
> >        */
> >       private static class UserActionsPanel extends Panel {
> >               public UserActionsPanel(String id, IModel indeksModel) {
> >               super(id); }
> >
> >       }
> >
> >       /**
> >        *
> >        */
> >       private static final long serialVersionUID = 1L;
> >       /**
> >        * @return the companyDaoI
> >        */
> >       public IIndeksDao getIndeksDao() {
> >               WicketSignYourMailApplication application =
> > (WicketSignYourMailApplication) getApplication();
> >               return application.getIndeksDao();
> >       }
> >
> > }
> >
> > public class DetachableIndeksModel extends
> > AbstractReadOnlyModel<Indeks> {
> >
> >       private static final long serialVersionUID = 1L;
> >       private final int id;
> >       private transient Indeks indeks;
> >
> >       public DetachableIndeksModel(final Indeks indeks) {
> >               this(indeks.getRecno()); this.indeks = indeks;
> >
> >       }
> >       /**
> >        * @param companyId
> >        */
> >       public DetachableIndeksModel(final Integer indeksID) {
> this.id =
> >       indeksID; }
> >
> >       /* (non-Javadoc)
> >        * @see org.apache.wicket.model.AbstractReadOnlyModel#getObject()
> >       */ @Override
> >       public Indeks getObject() {
> >               return indeks;
> >       }
> >
> >       public IModel getNestedModel(){
> >               return null;
> >       }
> >
> >       protected void onDetach(){
> >               indeks = null;
> >       }
> >
> >       protected void onAttach(){
> >               indeks = getIndeksDao().getIndeks(id);
> >       }
> >       /**
> >        * @return
> >        */
> >       private IIndeksDao getIndeksDao() {
> >               return
> > ((WicketSignYourMailApplication)Application.get()).getIndeksDao();    }
> >
> > }
> >
> >
> >
> s-in-FilterToolbar-tp19096695p19096695.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

RE: Wicket-phonebook problem with cleaning fields in FilterToolbar

Posted by Kai Mutz <km...@googlemail.com>.
"Clear button of FilterForm is set as defaultFormProcessing false by
default. Change it to true."

See
http://www.nabble.com/Problems-with-clearing-of-filter-form-td16098239.html#
a16129385

Lukasz Lipka <ma...@gmail.com> wrote:
> Hi,
> I looked into wicket-phonebook application and base on this I
> want to create
> very simple application to only display some data from database, with
> possibility of filtering of information. Almost every thing work
> perfect:) but one element is not working is "clean" button. I thought
> that GoAndClearFilter will automatically clean the fields in
> table.addTopToolbar(new FilterToolbar(table, form, dataProvider));
> Now I try to find what is going on after clicking on "clean" in may
> case it's work
> exactly like "go". I hope that somebody give me some advice how to
> make cleaning of filtering fileds. First I was using wicket 1.3.3 now
> I switch to
> 1.4-SNAPSHOT, but id didn't change anything. I would be thankful for
> any help. My code bellow:
>
> public class TabIndeksSortablePanel extends Panel {
>
>
> 	public TabIndeksSortablePanel(String id) {
> 		super(id);
> 		init();
> 	}
>
> 	private void init() {
> 		final IndeksDataProvider dataProvider = new
> IndeksDataProvider();
> 		IColumn[] columns = createColumns();
> 		final DefaultDataTable table = new
> DefaultDataTable("datatable",
> 				Arrays.asList(columns), dataProvider, 10);
>
> 		// create the form used to contain all filter components 		final
> FilterForm form = new FilterForm("filter-form", dataProvider) {
> 			private static final long serialVersionUID = 1L;
>
> 			@Override
> 			protected void onSubmit() {
> 				table.setCurrentPage(0);
> 			}
> 		};
>
> 		table.addTopToolbar(new FilterToolbar(table, form,
> dataProvider));
> 		form.add(table);
> 		add(form);
>
> 	}
>
> 	private IColumn[] createColumns(){
> 		IColumn[] columns = new IColumn[10];
> 		columns[0] = createColumn("symbol", "symbol", "symbol");
> 		columns[1] = createColumn("nazwa1", "nazwa1", "nazwa1");
> 		columns[2] = new ChoiceFilteredPropertyColumn(new
> ResourceModel("jm"),
> 				"jm", "jm", new LoadableDetachableModel() {
> 			@Override
> 			protected Object load() {
> 				List<String> list = getIndeksDao().findJM();
> 				list.add(0,"");
> 				return list;
> 			}
> 		});
> 		columns[3] = createColumn("cena_zbyt", "cena_zbyt", "cena_zbyt");
> 		columns[4] = createColumn("symb_wo", "symb_wo", "symb_wo");
> 		columns[5] = createColumn("proc_vat", "proc_vat", "proc_vat");
> 		columns[6] = createColumn("kat_vat", "kat_vat", "kat_vat");
> 		columns[7] = createColumn("mar_zbyt", "mar_zbyt", "mar_zbyt");
> 		columns[8] = createColumn("data_wpr", "data_wpr", "data_wpr");
> 		columns[9] = createActionsColumn();
> 		return columns;
> 	}
>
>
> 	private TextFilteredPropertyColumn createColumn(String key,
> 			String sortProperty, String propertyExpression) {
> 		return new TextFilteredPropertyColumn(new
> ResourceModel(key),
> 				sortProperty, propertyExpression);
> 	}
>
> 	/**
> 	 * Create a composite column extending
> FilteredAbstractColumn. This column
> 	 * adds a UserActionsPanel as its cell contents. It also
> provides the
> 	 * go-and-clear filter control panel.
> 	 */
> 	private FilteredAbstractColumn createActionsColumn() { 		//
> 		getString("actions") return new FilteredAbstractColumn(new
> 			Model("actions")) { // return the go-and-clear filter for the
> filter toolbar
> 			public Component getFilter(String
> componentId, FilterForm form) {
> 				// FIXME zmienic Model na ResourceModel
> 				return new
> GoAndClearFilter(componentId, form,
> 						new
> ResourceModel("filter"), new ResourceModel("clear")); 			}
>
> 			// add the UserActionsPanel to the cell item
> 			public void populateItem(Item cellItem,
> String componentId,
> 					IModel model) {
> 				cellItem.add(new
> UserActionsPanel(componentId, model));
> 			}
> 		};
> 	}
>
> 	/**
> 	 * Provides a composite User Actions panel for the Actions column.
> *
> 	 * @author igor
> 	 */
> 	private static class UserActionsPanel extends Panel {
> 		public UserActionsPanel(String id, IModel indeksModel) {
> 		super(id); }
>
> 	}
>
> 	/**
> 	 *
> 	 */
> 	private static final long serialVersionUID = 1L;
> 	/**
> 	 * @return the companyDaoI
> 	 */
> 	public IIndeksDao getIndeksDao() {
> 		WicketSignYourMailApplication application =
> (WicketSignYourMailApplication) getApplication();
> 		return application.getIndeksDao();
> 	}
>
> }
>
> public class DetachableIndeksModel extends
> AbstractReadOnlyModel<Indeks> {
>
> 	private static final long serialVersionUID = 1L;
> 	private final int id;
> 	private transient Indeks indeks;
>
> 	public DetachableIndeksModel(final Indeks indeks) {
> 		this(indeks.getRecno()); this.indeks = indeks;
>
> 	}
> 	/**
> 	 * @param companyId
> 	 */
> 	public DetachableIndeksModel(final Integer indeksID) { 		this.id =
> 	indeksID; }
>
> 	/* (non-Javadoc)
> 	 * @see org.apache.wicket.model.AbstractReadOnlyModel#getObject()
> 	*/ @Override
> 	public Indeks getObject() {
> 		return indeks;
> 	}
>
> 	public IModel getNestedModel(){
> 		return null;
> 	}
>
> 	protected void onDetach(){
> 		indeks = null;
> 	}
>
> 	protected void onAttach(){
> 		indeks = getIndeksDao().getIndeks(id);
> 	}
> 	/**
> 	 * @return
> 	 */
> 	private IIndeksDao getIndeksDao() {
> 		return
> ((WicketSignYourMailApplication)Application.get()).getIndeksDao(); 	}
>
> }
>
>
>
s-in-FilterToolbar-tp19096695p19096695.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


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