Package org.odlabs.wiquery.wijmo.wijsuperpanel

Source Code of org.odlabs.wiquery.wijmo.wijsuperpanel.WijSuperpanelResizableOptions

/*
* Copyright (c) 2010 WiQuery team
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.odlabs.wiquery.wijmo.wijsuperpanel;

import org.odlabs.wiquery.core.options.IComplexOption;
import org.odlabs.wiquery.core.options.LiteralOption;
import org.odlabs.wiquery.core.options.Options;
import org.odlabs.wiquery.ui.resizable.ResizableHandles;

/**
* $Id: WijSuperpanelResizableOptions.java 220 2011-03-06 20:23:30Z roche.jul $
*
* <p>
*   Wijmo type for the resizable behavior
* </p>
*
* @author Julien Roche
* @since 1.0
*/
public class WijSuperpanelResizableOptions implements IComplexOption {
  // Constants
  /** Constant of serialization */
  private static final long serialVersionUID = 1L;
 
  // Properties
  private Options options;
 
  /**
   * Default constructor
   */
  public WijSuperpanelResizableOptions() {
    this.options = new Options();
  }
 
  /**
   * Constructor
   */
  public WijSuperpanelResizableOptions(ResizableHandles handles, String helper){
    this();
    setHandles(handles);
    setHelper(helper);
  }

  /**
   * @return the handles option
   */
  public ResizableHandles getHandles() {
    IComplexOption handles = this.options.getComplexOption("handles");
    if(handles != null && handles instanceof ResizableHandles){
      return (ResizableHandles) handles;
    }
   
    return new ResizableHandles(new LiteralOption("e,s,se"));
  }
 
  /**
   * @return the helper option
   */
  public String getHelper() {
    return options.getLiteral("helper");
  }
 
  /**
   * {@inheritDoc}
   * @see org.odlabs.wiquery.core.options.IComplexOption#getJavascriptOption()
   */
  public CharSequence getJavascriptOption() {
    return this.options.getJavaScriptOptions();
  }
 
  /**
   * If specified as a string, should be a comma-split list of any of the following:
   * 'n, e, s, w, ne, se, sw, nw, all'.
   * The necessary handles will be auto-generated by the plugin.
   *
   * If specified as an object, the following keys are supported: { n, e, s, w, ne, se, sw, nw }.
   * The value of any specified should be a jQuery selector matching the child
   * element of the resizable to use as that handle. If the handle is not a
   * child of the resizable, you can pass in the DOMElement or a valid jQuery
   * object directly.
   * @param handles
   * @return the current instance
   */
  public WijSuperpanelResizableOptions setHandles(ResizableHandles handles) {
    this.options.put("handles", handles);
    return this;
  }
 
  /**Sets the css class that will be added to a proxy element to outline the
   * resize during the drag of the resize handle. Once the resize is complete,
   * the original element is sized.
   * @param helper
   * @return the current instance
   */
  public WijSuperpanelResizableOptions setHelper(String helper) {
    options.putLiteral("helper", helper);
    return this;
  }
}
TOP

Related Classes of org.odlabs.wiquery.wijmo.wijsuperpanel.WijSuperpanelResizableOptions

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.