I’m trying to remove an action from a button,
and it does not seem to be working,
I get this error:
Caused by: com.haulmont.cuba.gui.GuiDevelopmentException: Can’t find action openArchivoInterno
you can see the code and the variables here:
I’m trying to remove an action from a button,
and it does not seem to be working,
I get this error:
Caused by: com.haulmont.cuba.gui.GuiDevelopmentException: Can’t find action openArchivoInterno
you can see the code and the variables here:
Thank you for your response,
The overall screen is an edit screen,
the actions on the buttons open screenFragments that are located within the edit screen, and we want to remove the actions in some circumstances, the “removeAction” function appears to ve there but doesn’t really work when the application is running.
button XML goes like this:
<popupButton id="btnArchivos" width="146" height="28" caption="msg://Archivos" icon="FILE">
<actions>
<action id="openArchivoPublico" caption="Archivos Publicos" icon="FILE"/>
<action id="openArchivoInterno" caption="Archivos Internos"/>
<action id="openArchivoFaltante" caption="Archivos Faltantes"/>
</actions>
</popupButton>
Hello @arturoams
What version of the platform are you using?
At what point in time does the GuiDevelopmentException
occur? Could you send a stacktrace?
Regards,
Gleb
I always use the latest version… ill send the stacktrace in a moment
this is the function to disable the actions depending on the role
Collection<String> roles = userSessionSource.getUserSession().getRoles();
if (roles.contains("Publico")) {
System.out.println("hola");
btnArchivos.removeAction("openArchivoPublico");
btnArchivos.removeAction("openArchivoFaltante");
}
and this is the stacktrace
hola
14:59:14.854 ERROR com.haulmont.cuba.web.log.AppLog - Exception in com.haulmont.cuba.web.gui.components.WebGroupTable$CubaGroupTableExt:
com.vaadin.event.ListenerMethod$MethodException: Invocation of method itemClick in com.haulmont.cuba.web.gui.components.WebAbstractTable$$Lambda$778/0x0000000101051040 failed.
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:516) ~[vaadin-server-8.9.2-19-cuba.jar:8.9.2-19-cuba]
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:273) ~[vaadin-server-8.9.2-19-cuba.jar:8.9.2-19-cuba]
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:237) ~[vaadin-server-8.9.2-19-cuba.jar:8.9.2-19-cuba]
at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1041) ~[vaadin-server-8.9.2-19-cuba.jar:8.9.2-19-cuba]
at com.vaadin.v7.ui.Table.handleClickEvent(Table.java:3142) ~[vaadin-compatibility-server-8.9.2-19-cuba.jar:8.9.2-19-cuba]
at com.vaadin.v7.ui.Table.changeVariables(Table.java:2934) ~[vaadin-compatibility-server-8.9.2-19-cuba.jar:8.9.2-19-cuba]
at com.haulmont.cuba.web.widgets.CubaTable.changeVariables(CubaTable.java:366) ~[cuba-web-widgets-7.2.12.jar:na]
at com.haulmont.cuba.web.widgets.CubaGroupTable.changeVariables(CubaGroupTable.java:297) ~[cuba-web-widgets-7.2.12.jar:na]
at com.vaadin.server.communication.ServerRpcHandler.changeVariables(ServerRpcHandler.java:611) ~[vaadin-server-8.9.2-19-cuba.jar:8.9.2-19-cuba]
at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:457) ~[vaadin-server-8.9.2-19-cuba.jar:8.9.2-19-cuba]
at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:400) ~[vaadin-server-8.9.2-19-cuba.jar:8.9.2-19-cuba]
at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:260) ~[vaadin-server-8.9.2-19-cuba.jar:8.9.2-19-cuba]
at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:82) ~[vaadin-server-8.9.2-19-cuba.jar:8.9.2-19-cuba]
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40) ~[vaadin-server-8.9.2-19-cuba.jar:8.9.2-19-cuba]
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1578) ~[vaadin-server-8.9.2-19-cuba.jar:8.9.2-19-cuba]
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:425) ~[vaadin-server-8.9.2-19-cuba.jar:8.9.2-19-cuba]
at com.haulmont.cuba.web.sys.CubaApplicationServlet.serviceAppRequest(CubaApplicationServlet.java:329) ~[cuba-web-7.2.12.jar:7.2.12]
at com.haulmont.cuba.web.sys.CubaApplicationServlet.service(CubaApplicationServlet.java:215) ~[cuba-web-7.2.12.jar:7.2.12]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[servlet-api.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[catalina.jar:9.0.27]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.27]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-websocket.jar:9.0.27]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:9.0.27]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.27]
at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:108) ~[spring-web-5.2.9.RELEASE.jar:5.2.9.RELEASE]
at org.springframework.web.filter.CompositeFilter.doFilter(CompositeFilter.java:74) ~[spring-web-5.2.9.RELEASE.jar:5.2.9.RELEASE]
at com.haulmont.cuba.web.sys.CubaHttpFilter.doFilter(CubaHttpFilter.java:93) ~[cuba-web-7.2.12.jar:7.2.12]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:9.0.27]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.27]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[catalina.jar:9.0.27]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[catalina.jar:9.0.27]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526) ~[catalina.jar:9.0.27]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) ~[catalina.jar:9.0.27]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[catalina.jar:9.0.27]
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) ~[catalina.jar:9.0.27]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[catalina.jar:9.0.27]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[catalina.jar:9.0.27]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) ~[tomcat-coyote.jar:9.0.27]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) ~[tomcat-coyote.jar:9.0.27]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861) ~[tomcat-coyote.jar:9.0.27]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1579) ~[tomcat-coyote.jar:9.0.27]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-coyote.jar:9.0.27]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-util.jar:9.0.27]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: com.haulmont.cuba.gui.GuiDevelopmentException: Can’t find action openArchivoPublico
at com.haulmont.cuba.gui.xml.layout.loaders.AbstractAssignActionPostInitTask.execute(AbstractAssignActionPostInitTask.java:81) ~[cuba-gui-7.2.12.jar:7.2.12]
at com.haulmont.cuba.gui.xml.layout.loaders.ComponentLoaderContext.executePostInitTasks(ComponentLoaderContext.java:153) ~[cuba-gui-7.2.12.jar:7.2.12]
at com.haulmont.cuba.web.sys.WebScreens.createScreen(WebScreens.java:267) ~[cuba-web-7.2.12.jar:7.2.12]
at com.haulmont.cuba.web.sys.WebScreens.create(WebScreens.java:179) ~[cuba-web-7.2.12.jar:7.2.12]
at com.haulmont.cuba.gui.builders.EditorBuilderProcessor.createScreen(EditorBuilderProcessor.java:340) ~[cuba-gui-7.2.12.jar:7.2.12]
at com.haulmont.cuba.gui.builders.EditorBuilderProcessor.buildEditor(EditorBuilderProcessor.java:93) ~[cuba-gui-7.2.12.jar:7.2.12]
at com.haulmont.cuba.gui.builders.EditorBuilder.build(EditorBuilder.java:359) ~[cuba-gui-7.2.12.jar:7.2.12]
at com.haulmont.cuba.gui.actions.list.EditAction.execute(EditAction.java:337) ~[cuba-gui-7.2.12.jar:7.2.12]
at com.haulmont.cuba.gui.actions.list.EditAction.actionPerform(EditAction.java:298) ~[cuba-gui-7.2.12.jar:7.2.12]
at com.haulmont.cuba.web.gui.components.WebAbstractTable.handleClickAction(WebAbstractTable.java:1295) ~[cuba-web-7.2.12.jar:7.2.12]
at com.haulmont.cuba.web.gui.components.WebAbstractTable.lambda$initComponent$db766529$1(WebAbstractTable.java:1048) ~[cuba-web-7.2.12.jar:7.2.12]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:496) ~[vaadin-server-8.9.2-19-cuba.jar:8.9.2-19-cuba]
… 45 common frames omitted
Hello @arturoams
Regards,
Gleb
Based on the snippet of code you sent, the exception occurs in the AbstractAssignActionPostInitTask#execute
method. This method runs between InitEvent
and AfterInitEvent
.
popupButton
component with actions.InitEvent
listener.AbstractAssignActionPostInitTask#execute
method runs. The method has a list of actions from the loader, which at the moment does not equal to the actual list of actions, so an exception is thrown.You could try to move your method to AfterInitEvent
listener.
Regards,
Gleb
Thank you so much, this solved it. It was a simple issue.