package jp.sourceforge.shovel.form.impl;

import static jp.sourceforge.shovel.FormatType.*;
import static jp.sourceforge.shovel.MethodType.*;
import static jp.sourceforge.shovel.ViewType.*;

import org.seasar.struts.annotation.tiger.StrutsActionForm;

import jp.sourceforge.shovel.FormatType;
import jp.sourceforge.shovel.MethodType;
import jp.sourceforge.shovel.ViewType;
import jp.sourceforge.shovel.form.IDirectMessagesForm;

@StrutsActionForm(name = "directMessagesForm")
public class DirectMessagesFormImpl implements IDirectMessagesForm {
    int count_;
    String recipient_;
    FormatType formatType_;
    MethodType methodType_;
    boolean partial_;
    int page_;
    String sent_;
    ViewType viewType_;
    
    public int getCount() {
        return count_;
    }
    public void setCount(int count) {
        count_ = count;
    }
    public String getRecipient() {
        return recipient_ == null ? "" : recipient_;
    }
    public void setRecipient(String recipient) {
        recipient_ = recipient;
    }
    public String getFormat() {
        return getFormatType().getId();
    }
    public void setFormat(String format) {
        setFormatType(FormatType.find(format));
    }
    public FormatType getFormatType() {
        return formatType_ == null ? HTML : formatType_;
    }
    public void setFormatType(FormatType formatType) {
        formatType_ = formatType;
    }
    public String getMethod() {
        return getMethodType().getId();
    }
    public void setMethod(String method) {
        setMethodType(MethodType.find(method));
    }
    public MethodType getMethodType() {
        return methodType_ == null ? RELOAD: methodType_;
    }
    public void setMethodType(MethodType methodType) {
        methodType_ = methodType;
    }
    public boolean isPartial() {
        return partial_;
    }
    public void setPartial(boolean partial) {
        partial_ = partial;
    }
    public int getPage() {
        return page_;
    }
    public void setPage(int page) {
        page_ = page;
    }
    public String getSent() {
        return sent_ == null ? "" : sent_;
    }
    public boolean isReceive() {
        return !(getSent().compareTo("/sent") == 0);
    }
    public void setSent(String sent) {
        sent_ = sent;
    }
    public String getView() {
        return getViewType().getId();
    }
    public void setView(String view) {
        setViewType(ViewType.find(view));
    }
    public ViewType getViewType() {
        return viewType_ == null ? INBOX : viewType_;
    }
    public void setViewType(ViewType viewType) {
        viewType_ = viewType;
    }
}
