Package com.webobjects.directtoweb._ajax

Source Code of com.webobjects.directtoweb._ajax.D2WAjaxEditToOneFault

package com.webobjects.directtoweb._ajax;

import com.webobjects.appserver.WOComponent;
import com.webobjects.appserver.WOContext;
import com.webobjects.directtoweb.D2W;
import com.webobjects.directtoweb.D2WEditToOneFault;
import com.webobjects.directtoweb.InspectPageInterface;
import com.webobjects.eocontrol.EOEnterpriseObject;

// Generated by the WOLips Templateengine Plug-in at May 31, 2008 6:35:02 PM
public class D2WAjaxEditToOneFault extends D2WEditToOneFault {
  public static float effectDuration = 0.8F; // FIXME: turn into property
 
    public D2WAjaxEditToOneFault(WOContext context) {
        super(context);
    }
   
    // accessors
    public boolean hasObjectPropertyValue() {
      return (objectPropertyValue() != null);
    }
   
    public String removeBoxID() {
      return id() + "_remove";
    }
   
    public String addBoxID() {
      return id() + "_add";
    }
   
    public String onSuccess() {
      return "function(e){ new Effect.Fade('" + removeBoxID() + "', {duration: " + effectDuration + "}); new Effect.Appear('" + addBoxID() + "', { queue: 'end', duration: " + effectDuration + "}); }";
    }
   
    public String displayStyle() {
      return hasObjectPropertyValue() ? "display: none;" : null;
    }
   
    public String id() {
      return (String) d2wContext().valueForKey("id");
    }
   
    // actions (ajax)
    public WOComponent removeFromToOneRelationshipAction() {
        object().removeObjectFromBothSidesOfRelationshipWithKey((EOEnterpriseObject) objectPropertyValue(), propertyKey());
        return null;
    }
   
    @Override
    public WOComponent toOneAction() {
        EOEnterpriseObject anEO = object();
        if(anEO == null) {
            return null;
        } else {
            InspectPageInterface inspectPage = (InspectPageInterface) D2W.factory().pageForConfigurationNamed("AjaxInspect" + anEO.entityName(), session());
            inspectPage.setObject(anEO);
            inspectPage.setNextPage(context().page());
            return (WOComponent)inspectPage;
        }
    }
}
TOP

Related Classes of com.webobjects.directtoweb._ajax.D2WAjaxEditToOneFault

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.