使用什么方式可以使Browse.xml界面自定义跳转到某一个Edit.xml界面

image

你好,欢迎加入社区!

跳转到某个edit界面是由 EditAction 决定的。你图中的方法是可以的。看错误是没有 import com.haulmont.cuba.gui.actions.list.EditAction; ?

另外,编辑操作还可以直接在xml配置:

    <layout expand="productsTable"
            spacing="true">
        <filter id="filter"
                applyTo="productsTable"
                dataLoader="productsDl">
            <properties include=".*"/>
        </filter>
        <groupTable id="productsTable"
                    width="100%"
                    dataContainer="productsDc">
            <actions>
                <action id="create" type="create"/>
<!--                这个是原来的edit action -->
<!--                <action id="edit" type="edit"/>-->
                <action id="remove" type="remove"/>
<!--                这个是新配置的edit action 打开自定义的编辑界面 -->
                <action id="edit" type="edit">
                    <properties>
                        <property name="openMode" value="DIALOG"/>
                        <property name="screenClass" value="com.company.sales.web.customer.CustomerEdit"/>
                    </properties>
                </action>
            </actions>
            <columns>
                <column id="name"/>
                <column id="price"/>
            </columns>
            <rowsCount/>
            <buttonsPanel id="buttonsPanel"
                          alwaysVisible="true">
                <button id="createBtn" action="productsTable.create"/>
                <button id="editBtn" action="productsTable.edit"/>
                <button id="removeBtn" action="productsTable.remove"/>
            </buttonsPanel>
        </groupTable>
        <hbox id="lookupActions" spacing="true" visible="false">
            <button action="lookupSelectAction"/>
            <button action="lookupCancelAction"/>
        </hbox>
    </layout>

感谢回复, 可是我使用XML的方式修改代码, 代码会爆红, 报错信息是 : Element properties is not allowed here (此处不允许使用元素属性)
image

哦?请问你用的是哪个版本的CUBA?

在CUBA菜单,双击 properties就能看到CUBA版本:
image

是7.1.1

7.1 是一个中间版本。升级到7.2吧,点版本右边那个 Change… 就可以升级了。CUBA以后只提供 7.2 版本的维护了。

感谢, 标签爆红问题已解决, 但是升级版本后打开界面报错, 以下是界面所显示的具体报错信息 : com.haulmont.cuba.web.sys.remoting.LocalServiceAccessException: Unable to connect to middleware. Service svms-core/cuba_TrustedClientService is not registered in LocalServiceDirectory

Due to this error, ‘web’ block cannot connect to the co-located ‘core’ block.
Most probably the ‘core’ block didn’t start properly, so check the server log for exceptions.
If there are no prior exceptions in the log, check that ‘cuba.connectionUrlList’ property value ends with the web context name of the ‘core’ block, e.g. ‘cuba.connectionUrlList = http://localhost:8080/app-core

You can turn off this information using ‘cuba.web.productionMode’ application property.

好的,启动日志中的报错信息发一下,看上去是启动的时候core模块启动失败

补充一些报错信息 :

  1. Caused by: org.postgresql.util.PSQLException: ERROR: column “group_names” does not exist
  2. java.lang.RuntimeException: Unable to create anonymous session. It is required for system to start
  3. 16:39:09.784 ERROR o.s.j.l.DefaultMessageListenerContainer - Could not refresh JMS Connection for destination ‘svms_carusage_topic’ - retrying using FixedBackOff{interval=5000, currentAttempts=1, maxAttempts=unlimited}. Cause: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused: connect
  4. com.haulmont.cuba.web.sys.remoting.LocalServiceAccessException: Unable to connect to middleware. Service svms-core/cuba_TrustedClientService is not registered in LocalServiceDirectory
  5. 16:39:14.901 ERROR c.h.c.c.sys.remoting.RemotingServlet - Context initialization failed
    java.lang.IllegalStateException: BeanFactory not initialized or already closed - call ‘refresh’ before accessing beans via the ApplicationContext
  6. 严重: Servlet.init() for servlet [remoting] threw exception
    java.lang.IllegalStateException: BeanFactory not initialized or already closed - call ‘refresh’ before accessing beans via the ApplicationContext
  7. com.haulmont.cuba.web.sys.remoting.LocalServiceAccessException: Unable to connect to middleware. Service svms-core/cuba_TrustedClientService is not registered in LocalServiceDirectory

image

group_names这些表是版本更新后所需要的系统表吗, 更新前启动项目没有报过这样的错

是的,这些是 7.2 新加的字段。可以添加这些sql脚本解决:

alter table SEC_USER add column group_names varchar;  
alter table SEC_USER add column sys_tenant_id varchar;  
alter table SEC_ROLE add column security_scope varchar;  
alter table SEC_ROLE add column sys_tenant_id varchar;  
alter table SEC_GROUP add column sys_tenant_id varchar;  
alter table SEC_USER_ROLE add column role_name varchar;
alter table SEC_CONSTRAINT add column sys_tenant_id varchar;
alter table SEC_SESSION_ATTR add column sys_tenant_id varchar;

这个又是个什么错误 : com.haulmont.cuba.core.global.DevelopmentException: Unable to set action property ‘userClass’: cannot find setter method with single parameter, image

代码里面搜一下,你在某个action里面用到了 userClass 吗?

是在这里报错, 这个属性的值写些什么
image

这个 property 标签是设置 action 的属性,不能随便写的。

比如说,对于 EditAction, 看源码我们可以发现,带 @StudioPropertiesItem 注解的有下列属性,这些才能写到 property 里。

image

你的XML中,指定的是界面类,因此 property 需要填写 screenClass

1 个赞

image
screenClass是实体类的名称吗

不是,就直接写 <property name="screenClass" value="com.company.sales.web.customer.CustomerEdit"/>

后面的value才是实体类

问题已解决, 感谢