English 中文(简体)
如何在梅塔维德植被增加与商业目标相关的行动?
原标题:How to add action related to a business object in Metawidget?

我使用Netbeans 6.8,并试图通过使用小米植被和JPA来获取用户界面。 我不能说,

@Action
public void save( ActionEvent event )
{
    mSearchMetawidget.save();
}

这一说明在进口后加上“不相容的类型”错误。

import org.metawidget.inspector.impl.actionstyle.Action;

What to do? How can I add an action related to my User entity. I want to do "register" action. Thanks in advance

<>Response to Richard

我认为,“行动”是一种梅塔维兹诺言,由于进口错误而成为头痛。 我现在谈谈这个问题。 我还需要增加周转图书馆。 “行动说明”属于SwaingAppFramework。

事实上,我们要更新由梅塔维德人自动提取的用户界面数据库记录。 我们设立了实体班级,并试图加以修改,以达到目的。 我们怎么能向我们的用户接口班说,如果用接口领域的已输入数据对一个子子施加压力,那么这些记录就会更新?

感谢。

<>Response 2 to Richard

我想利用JPA的实体管理。 是否应在纽顿行动清单中添加与实体管理有关的代码? 在以下类别中,其听众是“User”

我有一个实体类别,即用户。

package datamodeldemo;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import org.metawidget.inspector.annotation.*;
import org.metawidget.inspector.annotation.UiAction;

import org.metawidget.inspector.commons.jexl.UiJexlAttribute;

@Entity
@Table(name="ShineeUser")
@Inheritance(strategy=InheritanceType.JOINED)
@DiscriminatorColumn(name="USER_TYPE",
              discriminatorType= DiscriminatorType.STRING, length=20)

public class User implements Serializable
{

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name="USER_ID", nullable = false)
    private Integer user_id;

    @Column(name="USER_NAME", nullable = false)
    private String user_name;

    @Column(name="PASSWORD", nullable = false)
    private String password;

    @Column(name="USER_TYPE")
    private UserType userType;

    @Column( name = "EMAIL")
    private String e_mail;

    @Column( name = "TELEPHONE")
    private String telephone;

    public enum UserType {customer, hotelAdmin, agencyAdmin};

    @UiHidden
    public Integer getId() {
        return user_id;
    }

    public void setId(Integer id) {
        this.user_id = id;
    }

    @UiComesAfter( "user_name" )
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @UiComesAfter( "user_id" )
    public String getUser_name() {
        return user_name;
    }

    public void setUser_name(String user_name) {
        this.user_name = user_name;
    }

    @UiComesAfter( "password" )
    public UserType getUserType() {
        return userType;
    }

    public void setUserType(UserType userType) {
        this.userType = userType;
    }
     @UiComesAfter( "userType" )
    public String getE_mail() {
        return e_mail;
    }

    public void setE_mail(String e_mail) {
        this.e_mail = e_mail;
    }
     @UiComesAfter( "e_mail" )
    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (user_id != null ? user_id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won t work in the case the id fields are not set
        if (!(object instanceof User)) {
            return false;
        }
        User other = (User) object;
        if ((this.user_id == null && other.user_id != null) ||
            (this.user_id != null && !this.user_id.equals(other.user_id))) {
                return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "datamodeldemo.User[id=" + user_id + "]";
    }

    @UiAction
    @UiJexlAttribute( name = "HIDDEN", expression = "this.user != null" )
    public void addUser()
    {
        //Database update???
    }
}

谢谢。

最佳回答

我认为你正在做一个打字。 org.metawidget.inspector.impl.action Format. 行动是一个接口,而不是说明。 我认为你指的是:

@UiAction

当然,除非你打算使用SwaingAppFramework @Action annotation,在这种情况下,你需要确保进口不会发生冲突。 您应使用:

@org.jdesktop.application.Action

希望会有所帮助。

Richard。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签