2009-10-23 1 views
0

.NET 및 Java에서 비즈니스 응용 프로그램을 개발 중입니다. .NET에서 나는 basicHttpBinding을 사용하는 웹 서비스를 개발했다. Java 클라이언트에서이 웹 서비스를 사용하고 있습니다. 웹 서비스가 정상적으로 작동하며 Java 코드에서 호출하면 ArrayList 콜렉션이 Holding 클래스로 반환됩니다. 이 클래스는 아래에 설명되어 있습니다 :Swing에서 웹 서비스가 JTable에 반환하는 컬렉션 (ArrayList)을 바인딩하는 방법은 무엇입니까?

@XmlAccessorType(XmlAccessType.FIELD) 
@XmlType(name = "Holding", propOrder = { 
    "companyName", 
    "price", 
    "quantity", 
    "scripCode" 
}) 
public class Holding { 

    @XmlElementRef(
     name = "CompanyName", 
     namespace = "http://schemas.datacontract.org/2004/07/JavaLIB", 
     type = JAXBElement.class) 
    protected JAXBElement<String> companyName; 

    @XmlElementRef(
     name = "Price", 
     namespace = "http://schemas.datacontract.org/2004/07/JavaLIB", 
     type = JAXBElement.class) 
    protected JAXBElement<String> price; 

    @XmlElementRef(
     name = "Quantity", 
     namespace = "http://schemas.datacontract.org/2004/07/JavaLIB", 
     type = JAXBElement.class) 
    protected JAXBElement<String> quantity; 

    @XmlElement(name = "ScripCode") 
    protected Integer scripCode; 

    /** 
    * Gets the value of the companyName property. 
    * 
    * @return 
    *  possible object is 
    *  {@link JAXBElement }{@code <}{@link String }{@code >} 
    *  
    */ 
    public JAXBElement<String> getCompanyName() { 
     return companyName; 
    } 

    /** 
    * Sets the value of the companyName property. 
    * 
    * @param value 
    *  allowed object is 
    *  {@link JAXBElement }{@code <}{@link String }{@code >} 
    *  
    */ 
    public void setCompanyName(JAXBElement<String> value) { 
     this.companyName = ((JAXBElement<String>) value); 
    } 

    /** 
    * Gets the value of the price property. 
    * 
    * @return 
    *  possible object is 
    *  {@link JAXBElement }{@code <}{@link String }{@code >} 
    *  
    */ 
    public JAXBElement<String> getPrice() { 
     return price; 
    } 

    /** 
    * Sets the value of the price property. 
    * 
    * @param value 
    *  allowed object is 
    *  {@link JAXBElement }{@code <}{@link String }{@code >} 
    *  
    */ 
    public void setPrice(JAXBElement<String> value) { 
     this.price = ((JAXBElement<String>) value); 
    } 

    /** 
    * Gets the value of the quantity property. 
    * 
    * @return 
    *  possible object is 
    *  {@link JAXBElement }{@code <}{@link String }{@code >} 
    *  
    */ 
    public JAXBElement<String> getQuantity() { 
     return quantity; 
    } 

    /** 
    * Sets the value of the quantity property. 
    * 
    * @param value 
    *  allowed object is 
    *  {@link JAXBElement }{@code <}{@link String }{@code >} 
    *  
    */ 
    public void setQuantity(JAXBElement<String> value) { 
     this.quantity = ((JAXBElement<String>) value); 
    } 

    /** 
    * Gets the value of the scripCode property. 
    * 
    * @return 
    *  possible object is 
    *  {@link Integer } 
    *  
    */ 
    public Integer getScripCode() { 
     return scripCode; 
    } 

    /** 
    * Sets the value of the scripCode property. 
    * 
    * @param value 
    *  allowed object is 
    *  {@link Integer } 
    *  
    */ 
    public void setScripCode(Integer value) { 
     this.scripCode = value; 
    } 

} 

내 문제는 내가이 ArrayList<Holding>JTable A를 결합하는 방법을 모르는 것입니다 - 나는 스윙에 많은 일을하지 않았습니다.

좋은 튜토리얼 (썬 웹 사이트의 튜토리얼 이외의 링크 - 필자가 본 것)을 제공하거나, TableModel 클래스를 구현하는 방법을 신속하게 안내 할 수 있다면 큰 도움이 될 것입니다.

각 5 초 간격 후에도 웹 서비스에서 데이터를 가져와야하므로 다시 바인딩하는 방법을 설명하는 자습서도 함께 제공하십시오.

답변

1

에 이 좋은 것 그것을 에 대한의 TableModel를 구현하는 방법을 누군가가 빨리 저를 안내 할 수 있습니다.

BeanTableModel 항목을 확인하십시오. JAXBElement 코드로 인해 BeanTableModel을 사용할 수 있을지는 모르지만 JButtonTableModel 예제를 사용하여 내 RowTableModel을 확장하여 사용자 정의 모델을 만드는 방법을 보여줄 수 있어야합니다.

관련 문제