java - Vaadin Grid Custom Renderer not working -


i want build custom renderer of grids columns hide text if user doesn't have right read it. it's still important data accessible if user not able read it. wrote custom renderer looks this:

package <package>.util.renderer;  import com.vaadin.client.renderers.renderer; import com.vaadin.client.widget.grid.renderercellreference; import <package>.util.customsecurityconstants; import <package>.baseui;  public class blockedstringrendererclient implements renderer<string> {  private boolean canreadblocked = baseui.getcurrentprincipal().get().getauthorities().contains(customsecurityconstants.read_permission_blocked);  @override public void render(renderercellreference renderercellreference, string s) {     if (canreadblocked) {         renderercellreference.getelement().setinnertext(s);     } else {             renderercellreference.getelement().setinnertext("");        }    } } 

then wrote server side of renderer, following tutorial https://vaadin.com/docs/-/part/framework/clientsidewidgets/clientsidewidgets-grid.html

package <package>.util.renderer;   import com.vaadin.ui.grid;  public class blockedstringrendererserver extends grid.abstractrenderer<string> {     public blockedstringrendererserver() {         super(string.class);     } } 

and connector connect these components:

package <package>.util.renderer;  import com.vaadin.client.connectors.abstractrendererconnector; import com.vaadin.shared.ui.connect;  @connect(blockedstringrendererserver.class) public class blockedstringrendererconnector extends abstractrendererconnector<string> {  @override public blockedstringrendererclient getrenderer() {     return (blockedstringrendererclient) super.getrenderer(); }  } 

but when try use connector follows:

grunddatengrid.getcolumn("name").setrenderer(new blockedstringrendererserver()); 

the grid doesn't show columns contains strings anymore.

i don't know i'm doing wrong think might has connector-annotation not working expected because when try debug client side logic doesn't called. can point me steps i'm missing?

kind regards, fabian


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -