You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by Carlos Lobato <lo...@gmail.com> on 2012/03/08 17:08:20 UTC
ExportTable and ActionLink
Hi,
I'm creating an ExportTable with a Edit PageLink and a Delete ActionLink.
So far no problems with the PageLink however the ExportTable does not seem
to like ActionLinks. When I click it, it does delete the record but it
crashes, the relevant parts of the exception thrown go like this:
[Click] [error] Velocity: Exception rendering
#parse(/comision/ReporteProspectos.htm) at /border-template.htm[line 186,
column 25]
[Click] [error] handleException: java.lang.NullPointerException
at org.apache.click.control.ActionLink.getHref(ActionLink.java:292)
at org.apache.click.control.ActionLink.getHref(ActionLink.java:345)
at org.apache.click.control.AbstractLink.render(AbstractLink.java:629)
at
pue.gob.mx.sle.utils.TableExportContainer.renderExportBanner(TableExportContainer.java:135)
at
pue.gob.mx.sle.utils.TableExportContainer.render(TableExportContainer.java:52)
at pue.gob.mx.sle.utils.ExportTable.render(ExportTable.java:216)
At first I thought I should be overriding the Form's onProcess method like
the Edit FormTable page from the examples, but still get the same error.
Maybe I should make ExportTable extend FormTable? Thanks in advance,
-Carlos
Re: ExportTable and ActionLink
Posted by Carlos Lobato <lo...@gmail.com>.
Bob, a co-worker suggested we should generate the ExportTable again at the
ActionLink method and add it to the form via addControl(exportTable). I'm
not sure this is the best way to do it but so far it's working.
Regards,
-Carlos
On Sun, Mar 11, 2012 at 5:53 PM, Carlos Lobato <lo...@gmail.com> wrote:
> alrite Bob, will try that. Thanks always for your time,
>
> best,
> -Carlos
>
>
> On Sun, Mar 11, 2012 at 3:24 AM, Bob Schellink <sa...@gmail.com> wrote:
>
>> Hi,
>>
>> Cannot see anything obvious from the code.
>>
>> I did a small test by adding a delete link to the ExcelTableExportPage
>> example, which I assume your code is based on? Adding the delete link
>> worked just fine though. At this stage you might want to back out some of
>> your code to just a bare bones page with a edit/delete link and make sure
>> that works and then fleshing it out?
>>
>> regards
>>
>> Bob
>>
>>
>> On 08/03/2012 20:46 PM, Carlos Lobato wrote:
>>
>>> protected ExportTable tablaProspectos;
>>> private PageLink editLink = new PageLink("Editar",
>>> AltaProspecto.class);
>>> private ActionLink deleteLink = new ActionLink("Borrar", this,
>>> "onDeleteClick");
>>>
>>> @Override
>>> public void onInit() {
>>> super.onInit();
>>> /* a list of IDs I need to load my table (tablaProspectos)
>>> records*/
>>> idList = (ArrayList<String>) getContext().**
>>> getSessionAttribute("idList");
>>> prospectos = new ArrayList<Prospecto>();
>>> prospecto = new Prospecto();
>>> tablaProspectos = null;
>>> /*table properties setup*/
>>> tablaProspectos = new ExportTable("tablaProspectos")**;
>>> tablaProspectos.setClass(**Table.CLASS_BLUE2);
>>> tablaProspectos.setShowBanner(**true);
>>> tablaProspectos.setPageSize(**10);
>>> tablaProspectos.setSortable(**true);
>>> /*load table records*/
>>> prospectos = prospecto.**cargarProspectosPorSector(**idList);
>>>
>>> if (!prospectos.isEmpty()) {
>>> prospectos = prospectos.subList(0, prospectos.size());
>>> tablaProspectos.setRowList(**prospectos);
>>> }
>>> /*table construction*/
>>> /* estatus is a check or cross image matched to a status active
>>> or inactive*/
>>> Column estatus = new Column("estatus", "Estatus");
>>> estatus.setTextAlign("center")**;
>>> estatus.setDecorator(new Decorator() {
>>> @Override
>>> public String render(Object row, Context context) {
>>> Prospecto prospecto = (Prospecto) row;
>>> if (prospecto.getEstatus().**equals("A")) {
>>> return "<img src='" + context.getRequest().**getContextPath()
>>> + "/Img/yes.png'
>>> alt='ACTIVO' />";
>>> } else {
>>> return "<img src='" + context.getRequest().**getContextPath()
>>> + "/Img/no.png'
>>> alt='NO ACTIVO' />";
>>> }
>>> }
>>> });
>>> tablaProspectos.addColumn(**estatus);
>>> /*a record property*/
>>> Column column = new Column("sectorDesc", "Categoria");
>>> column.setTextAlign("left");
>>> tablaProspectos.addColumn(**column);
>>> /*a record property*/
>>> column = new Column("trato", "Trato");
>>> column.setTextAlign("left");
>>> tablaProspectos.addColumn(**column);
>>> /*a record property/*
>>> column = new Column("apellido1", "Primer Apellido");
>>> column.setTextAlign("left");
>>> tablaProspectos.addColumn(**column);
>>> /*more record properties*/
>>> ...
>>> /*edit PageLink setup*/
>>> editLink.setImageSrc("/Img/**table-edit3.png");
>>> editLink.setTitle("Editar Prospecto");
>>> editLink.setParameter("**referrer",
>>> "/comision/ReporteProspectos.**htm");
>>> editLink.setParameter("action"**, "editar");
>>> editLink.setAttribute("**onclick", "fSubmittingPage();");
>>> addControl(editLink);
>>>
>>> /*delete ActionLink setup*/
>>> deleteLink.setImageSrc("/Img/**table-delete2.png");
>>> deleteLink.setTitle("Borrar Prospecto");
>>> deleteLink.setAttribute("**onclick", "return
>>> window.confirm('¿Esta seguro que desea dar de
>>> baja el registro?');");
>>> addControl(deleteLink);
>>> /* add edit PageLink to table*/
>>> Column edicion = new Column("Editar");
>>> edicion.setTextAlign("center")**;
>>> edicion.setDecorator(new LinkDecorator(tablaProspectos,
>>> editLink, "idProspecto"));
>>> edicion.setSortable(false);
>>> tablaProspectos.addColumn(**edicion);
>>>
>>> /* add delete ActionLink to table */
>>> Column borrar = new Column("Borrar");
>>> borrar.setTextAlign("center");
>>> borrar.setDecorator(new LinkDecorator(tablaProspectos,
>>> deleteLink, "idProspecto"));
>>> borrar.setSortable(false);
>>> tablaProspectos.addColumn(**borrar);
>>> setupExporter(tablaProspectos)**;
>>> tablaProspectos.**setExportAttachment(**
>>> ExportTable.EXPORTER_ATTACHED)**;
>>>
>>> addControl(tablaProspectos);
>>> tablaProspectos.**getControlLink().**setActionListener(new
>>> ActionListener() {
>>>
>>> public boolean onAction(Control source) {
>>>
>>> tablaProspectos.saveState(**getContext());
>>> return true;
>>> }
>>> });
>>>
>>> tablaProspectos.restoreState(**getContext());
>>> }
>>>
>>> Thanks and best regards,
>>> -Carlos
>>>
>>> On Thu, Mar 8, 2012 at 11:46 AM, Bob Schellink <sabob1@gmail.com<mailto:
>>> sabob1@gmail.com>> wrote:
>>> >
>>> > Hi,
>>> >
>>> > Can you post a snippet how you construct the table, links and how you
>>> > add them to the table? Looking at the source it looks like the
>>> > ActionLink does not have a name set, hence the NullPointerException.
>>> >
>>> > regards
>>> >
>>> > Bob
>>> >
>>> > On Thu, Mar 8, 2012 at 6:08 PM, Carlos Lobato <lobato87@gmail.com<mailto:
>>> lobato87@gmail.com>> wrote:
>>> > > Hi,
>>> > >
>>> > > I'm creating an ExportTable with a Edit PageLink and a Delete
>>> > > ActionLink. So
>>> > > far no problems with the PageLink however the ExportTable does not
>>> seem
>>> > > to
>>> > > like ActionLinks. When I click it, it does delete the record but it
>>> > > crashes,
>>> > > the relevant parts of the exception thrown go like this:
>>> > >
>>> > > [Click] [error] Velocity: Exception rendering
>>> > > #parse(/comision/**ReporteProspectos.htm) at
>>> /border-template.htm[line
>>> > > 186,
>>> > > column 25]
>>> > > [Click] [error] handleException: java.lang.NullPointerException
>>> > > at org.apache.click.control.**ActionLink.getHref(ActionLink.**
>>> java:292)
>>> > > at org.apache.click.control.**ActionLink.getHref(ActionLink.**
>>> java:345)
>>> > > at org.apache.click.control.**AbstractLink.render(**
>>> AbstractLink.java:629)
>>> > > at
>>> > >
>>> > > pue.gob.mx.sle.utils.**TableExportContainer.**renderExportBanner(**
>>> TableExportContainer.java:135)
>>> > > at
>>> > >
>>> > > pue.gob.mx.sle.utils.**TableExportContainer.render(**
>>> TableExportContainer.java:52)
>>> > > at pue.gob.mx.sle.utils.**ExportTable.render(**
>>> ExportTable.java:216)
>>> > >
>>> > > At first I thought I should be overriding the Form's onProcess
>>> method
>>> > > like
>>> > > the Edit FormTable page from the examples, but still get the same
>>> error.
>>> > > Maybe I should make ExportTable extend FormTable? Thanks in advance,
>>> > >
>>> > > -Carlos
>>>
>>>
>>
>
Re: ExportTable and ActionLink
Posted by Carlos Lobato <lo...@gmail.com>.
alrite Bob, will try that. Thanks always for your time,
best,
-Carlos
On Sun, Mar 11, 2012 at 3:24 AM, Bob Schellink <sa...@gmail.com> wrote:
> Hi,
>
> Cannot see anything obvious from the code.
>
> I did a small test by adding a delete link to the ExcelTableExportPage
> example, which I assume your code is based on? Adding the delete link
> worked just fine though. At this stage you might want to back out some of
> your code to just a bare bones page with a edit/delete link and make sure
> that works and then fleshing it out?
>
> regards
>
> Bob
>
>
> On 08/03/2012 20:46 PM, Carlos Lobato wrote:
>
>> protected ExportTable tablaProspectos;
>> private PageLink editLink = new PageLink("Editar", AltaProspecto.class);
>> private ActionLink deleteLink = new ActionLink("Borrar", this,
>> "onDeleteClick");
>>
>> @Override
>> public void onInit() {
>> super.onInit();
>> /* a list of IDs I need to load my table (tablaProspectos)
>> records*/
>> idList = (ArrayList<String>) getContext().**
>> getSessionAttribute("idList");
>> prospectos = new ArrayList<Prospecto>();
>> prospecto = new Prospecto();
>> tablaProspectos = null;
>> /*table properties setup*/
>> tablaProspectos = new ExportTable("tablaProspectos")**;
>> tablaProspectos.setClass(**Table.CLASS_BLUE2);
>> tablaProspectos.setShowBanner(**true);
>> tablaProspectos.setPageSize(**10);
>> tablaProspectos.setSortable(**true);
>> /*load table records*/
>> prospectos = prospecto.**cargarProspectosPorSector(**idList);
>>
>> if (!prospectos.isEmpty()) {
>> prospectos = prospectos.subList(0, prospectos.size());
>> tablaProspectos.setRowList(**prospectos);
>> }
>> /*table construction*/
>> /* estatus is a check or cross image matched to a status active
>> or inactive*/
>> Column estatus = new Column("estatus", "Estatus");
>> estatus.setTextAlign("center")**;
>> estatus.setDecorator(new Decorator() {
>> @Override
>> public String render(Object row, Context context) {
>> Prospecto prospecto = (Prospecto) row;
>> if (prospecto.getEstatus().**equals("A")) {
>> return "<img src='" + context.getRequest().**getContextPath()
>> + "/Img/yes.png'
>> alt='ACTIVO' />";
>> } else {
>> return "<img src='" + context.getRequest().**getContextPath()
>> + "/Img/no.png'
>> alt='NO ACTIVO' />";
>> }
>> }
>> });
>> tablaProspectos.addColumn(**estatus);
>> /*a record property*/
>> Column column = new Column("sectorDesc", "Categoria");
>> column.setTextAlign("left");
>> tablaProspectos.addColumn(**column);
>> /*a record property*/
>> column = new Column("trato", "Trato");
>> column.setTextAlign("left");
>> tablaProspectos.addColumn(**column);
>> /*a record property/*
>> column = new Column("apellido1", "Primer Apellido");
>> column.setTextAlign("left");
>> tablaProspectos.addColumn(**column);
>> /*more record properties*/
>> ...
>> /*edit PageLink setup*/
>> editLink.setImageSrc("/Img/**table-edit3.png");
>> editLink.setTitle("Editar Prospecto");
>> editLink.setParameter("**referrer", "/comision/ReporteProspectos.
>> **htm");
>> editLink.setParameter("action"**, "editar");
>> editLink.setAttribute("**onclick", "fSubmittingPage();");
>> addControl(editLink);
>>
>> /*delete ActionLink setup*/
>> deleteLink.setImageSrc("/Img/**table-delete2.png");
>> deleteLink.setTitle("Borrar Prospecto");
>> deleteLink.setAttribute("**onclick", "return
>> window.confirm('¿Esta seguro que desea dar de
>> baja el registro?');");
>> addControl(deleteLink);
>> /* add edit PageLink to table*/
>> Column edicion = new Column("Editar");
>> edicion.setTextAlign("center")**;
>> edicion.setDecorator(new LinkDecorator(tablaProspectos, editLink,
>> "idProspecto"));
>> edicion.setSortable(false);
>> tablaProspectos.addColumn(**edicion);
>>
>> /* add delete ActionLink to table */
>> Column borrar = new Column("Borrar");
>> borrar.setTextAlign("center");
>> borrar.setDecorator(new LinkDecorator(tablaProspectos,
>> deleteLink, "idProspecto"));
>> borrar.setSortable(false);
>> tablaProspectos.addColumn(**borrar);
>> setupExporter(tablaProspectos)**;
>> tablaProspectos.**setExportAttachment(**
>> ExportTable.EXPORTER_ATTACHED)**;
>>
>> addControl(tablaProspectos);
>> tablaProspectos.**getControlLink().**setActionListener(new
>> ActionListener() {
>>
>> public boolean onAction(Control source) {
>>
>> tablaProspectos.saveState(**getContext());
>> return true;
>> }
>> });
>>
>> tablaProspectos.restoreState(**getContext());
>> }
>>
>> Thanks and best regards,
>> -Carlos
>>
>> On Thu, Mar 8, 2012 at 11:46 AM, Bob Schellink <sabob1@gmail.com <mailto:
>> sabob1@gmail.com>> wrote:
>> >
>> > Hi,
>> >
>> > Can you post a snippet how you construct the table, links and how you
>> > add them to the table? Looking at the source it looks like the
>> > ActionLink does not have a name set, hence the NullPointerException.
>> >
>> > regards
>> >
>> > Bob
>> >
>> > On Thu, Mar 8, 2012 at 6:08 PM, Carlos Lobato <lobato87@gmail.com<mailto:
>> lobato87@gmail.com>> wrote:
>> > > Hi,
>> > >
>> > > I'm creating an ExportTable with a Edit PageLink and a Delete
>> > > ActionLink. So
>> > > far no problems with the PageLink however the ExportTable does not
>> seem
>> > > to
>> > > like ActionLinks. When I click it, it does delete the record but it
>> > > crashes,
>> > > the relevant parts of the exception thrown go like this:
>> > >
>> > > [Click] [error] Velocity: Exception rendering
>> > > #parse(/comision/**ReporteProspectos.htm) at
>> /border-template.htm[line
>> > > 186,
>> > > column 25]
>> > > [Click] [error] handleException: java.lang.NullPointerException
>> > > at org.apache.click.control.**ActionLink.getHref(ActionLink.**
>> java:292)
>> > > at org.apache.click.control.**ActionLink.getHref(ActionLink.**
>> java:345)
>> > > at org.apache.click.control.**AbstractLink.render(**
>> AbstractLink.java:629)
>> > > at
>> > >
>> > > pue.gob.mx.sle.utils.**TableExportContainer.**renderExportBanner(**
>> TableExportContainer.java:135)
>> > > at
>> > >
>> > > pue.gob.mx.sle.utils.**TableExportContainer.render(**
>> TableExportContainer.java:52)
>> > > at pue.gob.mx.sle.utils.**ExportTable.render(**ExportTable.java:216)
>> > >
>> > > At first I thought I should be overriding the Form's onProcess method
>> > > like
>> > > the Edit FormTable page from the examples, but still get the same
>> error.
>> > > Maybe I should make ExportTable extend FormTable? Thanks in advance,
>> > >
>> > > -Carlos
>>
>>
>
Re: ExportTable and ActionLink
Posted by Bob Schellink <sa...@gmail.com>.
Hi,
Cannot see anything obvious from the code.
I did a small test by adding a delete link to the ExcelTableExportPage example, which I assume your
code is based on? Adding the delete link worked just fine though. At this stage you might want to
back out some of your code to just a bare bones page with a edit/delete link and make sure that
works and then fleshing it out?
regards
Bob
On 08/03/2012 20:46 PM, Carlos Lobato wrote:
> protected ExportTable tablaProspectos;
> private PageLink editLink = new PageLink("Editar", AltaProspecto.class);
> private ActionLink deleteLink = new ActionLink("Borrar", this, "onDeleteClick");
>
> @Override
> public void onInit() {
> super.onInit();
> /* a list of IDs I need to load my table (tablaProspectos) records*/
> idList = (ArrayList<String>) getContext().getSessionAttribute("idList");
> prospectos = new ArrayList<Prospecto>();
> prospecto = new Prospecto();
> tablaProspectos = null;
> /*table properties setup*/
> tablaProspectos = new ExportTable("tablaProspectos");
> tablaProspectos.setClass(Table.CLASS_BLUE2);
> tablaProspectos.setShowBanner(true);
> tablaProspectos.setPageSize(10);
> tablaProspectos.setSortable(true);
> /*load table records*/
> prospectos = prospecto.cargarProspectosPorSector(idList);
>
> if (!prospectos.isEmpty()) {
> prospectos = prospectos.subList(0, prospectos.size());
> tablaProspectos.setRowList(prospectos);
> }
> /*table construction*/
> /* estatus is a check or cross image matched to a status active or inactive*/
> Column estatus = new Column("estatus", "Estatus");
> estatus.setTextAlign("center");
> estatus.setDecorator(new Decorator() {
> @Override
> public String render(Object row, Context context) {
> Prospecto prospecto = (Prospecto) row;
> if (prospecto.getEstatus().equals("A")) {
> return "<img src='" + context.getRequest().getContextPath() + "/Img/yes.png'
> alt='ACTIVO' />";
> } else {
> return "<img src='" + context.getRequest().getContextPath() + "/Img/no.png'
> alt='NO ACTIVO' />";
> }
> }
> });
> tablaProspectos.addColumn(estatus);
> /*a record property*/
> Column column = new Column("sectorDesc", "Categoria");
> column.setTextAlign("left");
> tablaProspectos.addColumn(column);
> /*a record property*/
> column = new Column("trato", "Trato");
> column.setTextAlign("left");
> tablaProspectos.addColumn(column);
> /*a record property/*
> column = new Column("apellido1", "Primer Apellido");
> column.setTextAlign("left");
> tablaProspectos.addColumn(column);
> /*more record properties*/
> ...
> /*edit PageLink setup*/
> editLink.setImageSrc("/Img/table-edit3.png");
> editLink.setTitle("Editar Prospecto");
> editLink.setParameter("referrer", "/comision/ReporteProspectos.htm");
> editLink.setParameter("action", "editar");
> editLink.setAttribute("onclick", "fSubmittingPage();");
> addControl(editLink);
>
> /*delete ActionLink setup*/
> deleteLink.setImageSrc("/Img/table-delete2.png");
> deleteLink.setTitle("Borrar Prospecto");
> deleteLink.setAttribute("onclick", "return window.confirm('¿Esta seguro que desea dar de
> baja el registro?');");
> addControl(deleteLink);
> /* add edit PageLink to table*/
> Column edicion = new Column("Editar");
> edicion.setTextAlign("center");
> edicion.setDecorator(new LinkDecorator(tablaProspectos, editLink, "idProspecto"));
> edicion.setSortable(false);
> tablaProspectos.addColumn(edicion);
>
> /* add delete ActionLink to table */
> Column borrar = new Column("Borrar");
> borrar.setTextAlign("center");
> borrar.setDecorator(new LinkDecorator(tablaProspectos, deleteLink, "idProspecto"));
> borrar.setSortable(false);
> tablaProspectos.addColumn(borrar);
> setupExporter(tablaProspectos);
> tablaProspectos.setExportAttachment(ExportTable.EXPORTER_ATTACHED);
>
> addControl(tablaProspectos);
> tablaProspectos.getControlLink().setActionListener(new ActionListener() {
>
> public boolean onAction(Control source) {
>
> tablaProspectos.saveState(getContext());
> return true;
> }
> });
>
> tablaProspectos.restoreState(getContext());
> }
>
> Thanks and best regards,
> -Carlos
>
> On Thu, Mar 8, 2012 at 11:46 AM, Bob Schellink <sabob1@gmail.com <ma...@gmail.com>> wrote:
> >
> > Hi,
> >
> > Can you post a snippet how you construct the table, links and how you
> > add them to the table? Looking at the source it looks like the
> > ActionLink does not have a name set, hence the NullPointerException.
> >
> > regards
> >
> > Bob
> >
> > On Thu, Mar 8, 2012 at 6:08 PM, Carlos Lobato <lobato87@gmail.com <ma...@gmail.com>> wrote:
> > > Hi,
> > >
> > > I'm creating an ExportTable with a Edit PageLink and a Delete
> > > ActionLink. So
> > > far no problems with the PageLink however the ExportTable does not seem
> > > to
> > > like ActionLinks. When I click it, it does delete the record but it
> > > crashes,
> > > the relevant parts of the exception thrown go like this:
> > >
> > > [Click] [error] Velocity: Exception rendering
> > > #parse(/comision/ReporteProspectos.htm) at /border-template.htm[line
> > > 186,
> > > column 25]
> > > [Click] [error] handleException: java.lang.NullPointerException
> > > at org.apache.click.control.ActionLink.getHref(ActionLink.java:292)
> > > at org.apache.click.control.ActionLink.getHref(ActionLink.java:345)
> > > at org.apache.click.control.AbstractLink.render(AbstractLink.java:629)
> > > at
> > >
> > > pue.gob.mx.sle.utils.TableExportContainer.renderExportBanner(TableExportContainer.java:135)
> > > at
> > >
> > > pue.gob.mx.sle.utils.TableExportContainer.render(TableExportContainer.java:52)
> > > at pue.gob.mx.sle.utils.ExportTable.render(ExportTable.java:216)
> > >
> > > At first I thought I should be overriding the Form's onProcess method
> > > like
> > > the Edit FormTable page from the examples, but still get the same error.
> > > Maybe I should make ExportTable extend FormTable? Thanks in advance,
> > >
> > > -Carlos
>
Re: ExportTable and ActionLink
Posted by Carlos Lobato <lo...@gmail.com>.
protected ExportTable tablaProspectos;
private PageLink editLink = new PageLink("Editar", AltaProspecto.class);
private ActionLink deleteLink = new ActionLink("Borrar", this,
"onDeleteClick");
@Override
public void onInit() {
super.onInit();
/* a list of IDs I need to load my table (tablaProspectos) records*/
idList = (ArrayList<String>)
getContext().getSessionAttribute("idList");
prospectos = new ArrayList<Prospecto>();
prospecto = new Prospecto();
tablaProspectos = null;
/*table properties setup*/
tablaProspectos = new ExportTable("tablaProspectos");
tablaProspectos.setClass(Table.CLASS_BLUE2);
tablaProspectos.setShowBanner(true);
tablaProspectos.setPageSize(10);
tablaProspectos.setSortable(true);
/*load table records*/
prospectos = prospecto.cargarProspectosPorSector(idList);
if (!prospectos.isEmpty()) {
prospectos = prospectos.subList(0, prospectos.size());
tablaProspectos.setRowList(prospectos);
}
/*table construction*/
/* estatus is a check or cross image matched to a status active or
inactive*/
Column estatus = new Column("estatus", "Estatus");
estatus.setTextAlign("center");
estatus.setDecorator(new Decorator() {
@Override
public String render(Object row, Context context) {
Prospecto prospecto = (Prospecto) row;
if (prospecto.getEstatus().equals("A")) {
return "<img src='" +
context.getRequest().getContextPath() + "/Img/yes.png' alt='ACTIVO' />";
} else {
return "<img src='" +
context.getRequest().getContextPath() + "/Img/no.png' alt='NO ACTIVO' />";
}
}
});
tablaProspectos.addColumn(estatus);
/*a record property*/
Column column = new Column("sectorDesc", "Categoria");
column.setTextAlign("left");
tablaProspectos.addColumn(column);
/*a record property*/
column = new Column("trato", "Trato");
column.setTextAlign("left");
tablaProspectos.addColumn(column);
/*a record property/*
column = new Column("apellido1", "Primer Apellido");
column.setTextAlign("left");
tablaProspectos.addColumn(column);
/*more record properties*/
...
/*edit PageLink setup*/
editLink.setImageSrc("/Img/table-edit3.png");
editLink.setTitle("Editar Prospecto");
editLink.setParameter("referrer",
"/comision/ReporteProspectos.htm");
editLink.setParameter("action", "editar");
editLink.setAttribute("onclick", "fSubmittingPage();");
addControl(editLink);
/*delete ActionLink setup*/
deleteLink.setImageSrc("/Img/table-delete2.png");
deleteLink.setTitle("Borrar Prospecto");
deleteLink.setAttribute("onclick", "return window.confirm('¿Esta
seguro que desea dar de baja el registro?');");
addControl(deleteLink);
/* add edit PageLink to table*/
Column edicion = new Column("Editar");
edicion.setTextAlign("center");
edicion.setDecorator(new LinkDecorator(tablaProspectos, editLink,
"idProspecto"));
edicion.setSortable(false);
tablaProspectos.addColumn(edicion);
/* add delete ActionLink to table */
Column borrar = new Column("Borrar");
borrar.setTextAlign("center");
borrar.setDecorator(new LinkDecorator(tablaProspectos, deleteLink,
"idProspecto"));
borrar.setSortable(false);
tablaProspectos.addColumn(borrar);
setupExporter(tablaProspectos);
tablaProspectos.setExportAttachment(ExportTable.EXPORTER_ATTACHED);
addControl(tablaProspectos);
tablaProspectos.getControlLink().setActionListener(new
ActionListener() {
public boolean onAction(Control source) {
tablaProspectos.saveState(getContext());
return true;
}
});
tablaProspectos.restoreState(getContext());
}
Thanks and best regards,
-Carlos
On Thu, Mar 8, 2012 at 11:46 AM, Bob Schellink <sa...@gmail.com> wrote:
>
> Hi,
>
> Can you post a snippet how you construct the table, links and how you
> add them to the table? Looking at the source it looks like the
> ActionLink does not have a name set, hence the NullPointerException.
>
> regards
>
> Bob
>
> On Thu, Mar 8, 2012 at 6:08 PM, Carlos Lobato <lo...@gmail.com> wrote:
> > Hi,
> >
> > I'm creating an ExportTable with a Edit PageLink and a Delete
> > ActionLink. So
> > far no problems with the PageLink however the ExportTable does not seem
> > to
> > like ActionLinks. When I click it, it does delete the record but it
> > crashes,
> > the relevant parts of the exception thrown go like this:
> >
> > [Click] [error] Velocity: Exception rendering
> > #parse(/comision/ReporteProspectos.htm) at /border-template.htm[line
> > 186,
> > column 25]
> > [Click] [error] handleException: java.lang.NullPointerException
> > at org.apache.click.control.ActionLink.getHref(ActionLink.java:292)
> > at org.apache.click.control.ActionLink.getHref(ActionLink.java:345)
> > at org.apache.click.control.AbstractLink.render(AbstractLink.java:629)
> > at
> >
> >
pue.gob.mx.sle.utils.TableExportContainer.renderExportBanner(TableExportContainer.java:135)
> > at
> >
> >
pue.gob.mx.sle.utils.TableExportContainer.render(TableExportContainer.java:52)
> > at pue.gob.mx.sle.utils.ExportTable.render(ExportTable.java:216)
> >
> > At first I thought I should be overriding the Form's onProcess method
> > like
> > the Edit FormTable page from the examples, but still get the same error.
> > Maybe I should make ExportTable extend FormTable? Thanks in advance,
> >
> > -Carlos
Re: ExportTable and ActionLink
Posted by Bob Schellink <sa...@gmail.com>.
Hi,
Can you post a snippet how you construct the table, links and how you
add them to the table? Looking at the source it looks like the
ActionLink does not have a name set, hence the NullPointerException.
regards
Bob
On Thu, Mar 8, 2012 at 6:08 PM, Carlos Lobato <lo...@gmail.com> wrote:
> Hi,
>
> I'm creating an ExportTable with a Edit PageLink and a Delete ActionLink. So
> far no problems with the PageLink however the ExportTable does not seem to
> like ActionLinks. When I click it, it does delete the record but it crashes,
> the relevant parts of the exception thrown go like this:
>
> [Click] [error] Velocity: Exception rendering
> #parse(/comision/ReporteProspectos.htm) at /border-template.htm[line 186,
> column 25]
> [Click] [error] handleException: java.lang.NullPointerException
> at org.apache.click.control.ActionLink.getHref(ActionLink.java:292)
> at org.apache.click.control.ActionLink.getHref(ActionLink.java:345)
> at org.apache.click.control.AbstractLink.render(AbstractLink.java:629)
> at
> pue.gob.mx.sle.utils.TableExportContainer.renderExportBanner(TableExportContainer.java:135)
> at
> pue.gob.mx.sle.utils.TableExportContainer.render(TableExportContainer.java:52)
> at pue.gob.mx.sle.utils.ExportTable.render(ExportTable.java:216)
>
> At first I thought I should be overriding the Form's onProcess method like
> the Edit FormTable page from the examples, but still get the same error.
> Maybe I should make ExportTable extend FormTable? Thanks in advance,
>
> -Carlos