You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Harry <hk...@csc.com> on 2016/03/04 11:55:09 UTC

Wicket 6.16 How to change an icon at a data table

Hi all,

I have another question.
I try to change an icon at a table.
The icon is a link to open a journal, after click the icon, the journal
opens in a separate window.
Now the icon should be change to another icon, so the user can see, which
journal he has already opened. 

All is working well, only the change of the icon is the problem!
I have no idea how to make it!

Here the code:
private <I, S> ExtendedGrid<WebHAarHistData, HAarHistSearch> createGrid() {
ExtendedGrid<WebHAarHistData, HAarHistSearch> extendedGrid = new
ExtendedGrid<WebHAarHistData, HAarHistSearch>(
				"grid", "haarhist", dp) {
		private static final long serialVersionUID = 1L;
		@Override
		protected void onSubmit(String columnId, IModel<WebHAarHistData> rowModel,
LinkIcon icon) {
			showJournal(rowModel);
		}
	};

	SingleLinkColumn<WebHAarHistData> aColumn;
	// if top parameterization is not defined
	if
(!HistWebSession.get().getPtsWebSession().getPtsConstants().definitionIsEmmpty("ProductSettings",
"aar")) {
		*aColumn = extendedGrid.addSingleLinkColumn("journalLink",
LinkIcon.JOURNAL);
		// To show journal in Popup
		aColumn.setPopupSettings();
		aColumn.setInitialSize(30);*
	};
	extendedGrid.addColumn("HIST.id", HAarHist.ID_COLUMN, HAarHist.ID_COLUMN,
new ColumnScale(80));
	extendedGrid.addColumn("item", HAarHist.ITEM_COLUMN, HAarHist.ITEM_COLUMN,
new ColumnScale(150));
	extendedGrid.addColumn("description", HAarHist.DESCRIPTION_COLUMN,
HAarHist.DESCRIPTION_COLUMN,
		new ColumnScale(240));
	extendedGrid.addColumn("ts", HAarHist.TS_COLUMN, HAarHist.TS_COLUMN, new
ColumnScale(80),
		new PtsDateConverter(true));
	extendedGrid.addColumn("changedby", HAarHist.CHANGEDBY_COLUMN,
HAarHist.CHANGEDBY_COLUMN,
new ColumnScale(80));
	extendedGrid.addColumn("acceptedby", HAarHist.ACCEPTEDBY_COLUMN,
HAarHist.ACCEPTEDBY_COLUMN,
		new ColumnScale(80));
	// Computed column
	extendedGrid.addColumn("HIST.journalFileName", "journalFileName",
"journalFileName", new ColumnScale(120));

	/*
	 * load grid settings from database, if the session contains no settings
	 */
	GridSettingServices<WebHAarHistData> gServ = new
GridSettingServices<WebHAarHistData>(HistWebSession.get());
	GridSetting<WebHAarHistData> gridSetting =
gServ.getGridSetting(extendedGrid.getGridId(),
		extendedGrid.getGridExtension());
	if (!StringUtil.isEmpty(gridSetting.getSettings()))
		gridSetting = new
PtsWebGritSettingsService<WebHAarHistData>().loadGridSettings(HistWebSession.get(),
			gServ.buildGridSettingKey(extendedGrid.getGridId(),
extendedGrid.getGridExtension()));
	extendedGrid.createGrid("grid", gridSetting);
	/*
	 * advanced table settings
	 */
	extendedGrid.getGrid().setClickRowToDeselect(true);
	extendedGrid.getGrid().setClickRowToSelect(true);
	return extendedGrid;
}

Can anyone help here? 

Kind regards
Harry





--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-6-16-How-to-change-an-icon-at-a-data-table-tp4673824.html
Sent from the Users forum 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 6.16 How to change an icon at a data table

Posted by Harry <hk...@csc.com>.
Hi,

Thanks for that information.

Kind regards
Harry

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-6-16-How-to-change-an-icon-at-a-data-table-tp4673824p4673848.html
Sent from the Users forum 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 6.16 How to change an icon at a data table

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Those classes are custom for your application. They are not part of Wicket
or of any of the Wicket UI libraries I have used before.
You will have to see how those custom classes work and modify.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Mar 7, 2016 at 4:20 PM, Harry <hk...@csc.com> wrote:

> Hi Martin,
>
> Thanks for your post.
>
> I use a "SingleLinkColumn" at the icon to open a Journal.
> It wasn't possible for me to change the icon at the table cell an re-paint
> it.
>
> Whenn I used a "AjaxSingleLinkColumn<WebHAarHistData> aColumn2;" it wasn't
> possible for me to open the Journal like before. So I'm not sure what's to
> do!
>
> Kind regards
> Harald
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-6-16-How-to-change-an-icon-at-a-data-table-tp4673824p4673845.html
> Sent from the Users forum 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 6.16 How to change an icon at a data table

Posted by Harry <hk...@csc.com>.
Hi Martin,

Thanks for your post.

I use a "SingleLinkColumn" at the icon to open a Journal.
It wasn't possible for me to change the icon at the table cell an re-paint
it.

Whenn I used a "AjaxSingleLinkColumn<WebHAarHistData> aColumn2;" it wasn't
possible for me to open the Journal like before. So I'm not sure what's to
do!

Kind regards
Harald

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-6-16-How-to-change-an-icon-at-a-data-table-tp4673824p4673845.html
Sent from the Users forum 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 6.16 How to change an icon at a data table

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Fri, Mar 4, 2016 at 11:55 AM, Harry <hk...@csc.com> wrote:

> Hi all,
>
> I have another question.
> I try to change an icon at a table.
> The icon is a link to open a journal, after click the icon, the journal
> opens in a separate window.
> Now the icon should be change to another icon, so the user can see, which
> journal he has already opened.
>
> All is working well, only the change of the icon is the problem!
> I have no idea how to make it!
>
> Here the code:
> private <I, S> ExtendedGrid<WebHAarHistData, HAarHistSearch> createGrid() {
> ExtendedGrid<WebHAarHistData, HAarHistSearch> extendedGrid = new
> ExtendedGrid<WebHAarHistData, HAarHistSearch>(
>                                 "grid", "haarhist", dp) {
>                 private static final long serialVersionUID = 1L;
>                 @Override
>                 protected void onSubmit(String columnId,
> IModel<WebHAarHistData> rowModel,
> LinkIcon icon) {
>                         showJournal(rowModel);
>                 }
>         };
>
>         SingleLinkColumn<WebHAarHistData> aColumn;
>         // if top parameterization is not defined
>         if
>
> (!HistWebSession.get().getPtsWebSession().getPtsConstants().definitionIsEmmpty("ProductSettings",
> "aar")) {
>                 *aColumn = extendedGrid.addSingleLinkColumn("journalLink",
> LinkIcon.JOURNAL);
>

It seems this is the code responsible to create the link with its icon.
You need to re-paint the link after clicking on it to change its icon.
If you want to do this immediately after opening the popup then you have to
use JavaScript.
If you want to render a different icon next time the grid is rendered then
you need to add some condition here and provide another LinkIcon.Xyz.


>                 // To show journal in Popup
>                 aColumn.setPopupSettings();
>                 aColumn.setInitialSize(30);*
>         };
>         extendedGrid.addColumn("HIST.id", HAarHist.ID_COLUMN,
> HAarHist.ID_COLUMN,
> new ColumnScale(80));
>         extendedGrid.addColumn("item", HAarHist.ITEM_COLUMN,
> HAarHist.ITEM_COLUMN,
> new ColumnScale(150));
>         extendedGrid.addColumn("description", HAarHist.DESCRIPTION_COLUMN,
> HAarHist.DESCRIPTION_COLUMN,
>                 new ColumnScale(240));
>         extendedGrid.addColumn("ts", HAarHist.TS_COLUMN,
> HAarHist.TS_COLUMN, new
> ColumnScale(80),
>                 new PtsDateConverter(true));
>         extendedGrid.addColumn("changedby", HAarHist.CHANGEDBY_COLUMN,
> HAarHist.CHANGEDBY_COLUMN,
> new ColumnScale(80));
>         extendedGrid.addColumn("acceptedby", HAarHist.ACCEPTEDBY_COLUMN,
> HAarHist.ACCEPTEDBY_COLUMN,
>                 new ColumnScale(80));
>         // Computed column
>         extendedGrid.addColumn("HIST.journalFileName", "journalFileName",
> "journalFileName", new ColumnScale(120));
>
>         /*
>          * load grid settings from database, if the session contains no
> settings
>          */
>         GridSettingServices<WebHAarHistData> gServ = new
> GridSettingServices<WebHAarHistData>(HistWebSession.get());
>         GridSetting<WebHAarHistData> gridSetting =
> gServ.getGridSetting(extendedGrid.getGridId(),
>                 extendedGrid.getGridExtension());
>         if (!StringUtil.isEmpty(gridSetting.getSettings()))
>                 gridSetting = new
>
> PtsWebGritSettingsService<WebHAarHistData>().loadGridSettings(HistWebSession.get(),
>                         gServ.buildGridSettingKey(extendedGrid.getGridId(),
> extendedGrid.getGridExtension()));
>         extendedGrid.createGrid("grid", gridSetting);
>         /*
>          * advanced table settings
>          */
>         extendedGrid.getGrid().setClickRowToDeselect(true);
>         extendedGrid.getGrid().setClickRowToSelect(true);
>         return extendedGrid;
> }
>
> Can anyone help here?
>
> Kind regards
> Harry
>
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-6-16-How-to-change-an-icon-at-a-data-table-tp4673824.html
> Sent from the Users forum 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
>
>