All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.primefaces.component.resizable.Resizable Maven / Gradle / Ivy

Go to download

PrimeFaces is one of the most popular UI libraries in Java EE Ecosystem and widely used by software companies, world renowned brands, banks, financial institutions, insurance companies, universities and more.

There is a newer version: 14.0.0-RC2
Show newest version
/*
 * Generated, Do Not Modify
 */
/*
 * Copyright 2009-2013 PrimeTek.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.primefaces.component.resizable;

import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;
import javax.faces.component.UINamingContainer;
import javax.el.ValueExpression;
import javax.el.MethodExpression;
import javax.faces.render.Renderer;
import java.io.IOException;
import javax.faces.component.UIComponent;
import javax.faces.event.AbortProcessingException;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import java.util.List;
import java.util.ArrayList;
import org.primefaces.util.ComponentUtils;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.Collections;
import org.primefaces.event.ResizeEvent;
import org.primefaces.util.Constants;
import javax.faces.event.AjaxBehaviorEvent;
import javax.faces.event.FacesEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.BehaviorEvent;

@ResourceDependencies({
	@ResourceDependency(library="primefaces", name="components.css"),
	@ResourceDependency(library="primefaces", name="jquery/jquery.js"),
	@ResourceDependency(library="primefaces", name="jquery/jquery-plugins.js"),
	@ResourceDependency(library="primefaces", name="core.js"),
	@ResourceDependency(library="primefaces", name="components.js")
})
public class Resizable extends UIComponentBase implements org.primefaces.component.api.Widget,javax.faces.component.behavior.ClientBehaviorHolder,org.primefaces.component.api.PrimeClientBehaviorHolder {


	public static final String COMPONENT_TYPE = "org.primefaces.component.Resizable";
	public static final String COMPONENT_FAMILY = "org.primefaces.component";
	public static final String DEFAULT_RENDERER = "org.primefaces.component.ResizableRenderer";

	public enum PropertyKeys {

		widgetVar
		,forValue("for")
		,aspectRatio
		,proxy
		,handles
		,ghost
		,animate
		,effect
		,effectDuration
		,maxWidth
		,maxHeight
		,minWidth
		,minHeight
		,containment
		,grid
		,onStart
		,onResize
		,onStop;

		String toString;

		PropertyKeys(String toString) {
			this.toString = toString;
		}

		PropertyKeys() {}

		public String toString() {
			return ((this.toString != null) ? this.toString : super.toString());
}
	}

	public Resizable() {
		setRendererType(DEFAULT_RENDERER);
	}

	public String getFamily() {
		return COMPONENT_FAMILY;
	}

	public java.lang.String getWidgetVar() {
		return (java.lang.String) getStateHelper().eval(PropertyKeys.widgetVar, null);
	}
	public void setWidgetVar(java.lang.String _widgetVar) {
		getStateHelper().put(PropertyKeys.widgetVar, _widgetVar);
	}

	public java.lang.String getFor() {
		return (java.lang.String) getStateHelper().eval(PropertyKeys.forValue, null);
	}
	public void setFor(java.lang.String _for) {
		getStateHelper().put(PropertyKeys.forValue, _for);
	}

	public boolean isAspectRatio() {
		return (java.lang.Boolean) getStateHelper().eval(PropertyKeys.aspectRatio, false);
	}
	public void setAspectRatio(boolean _aspectRatio) {
		getStateHelper().put(PropertyKeys.aspectRatio, _aspectRatio);
	}

	public boolean isProxy() {
		return (java.lang.Boolean) getStateHelper().eval(PropertyKeys.proxy, false);
	}
	public void setProxy(boolean _proxy) {
		getStateHelper().put(PropertyKeys.proxy, _proxy);
	}

	public java.lang.String getHandles() {
		return (java.lang.String) getStateHelper().eval(PropertyKeys.handles, null);
	}
	public void setHandles(java.lang.String _handles) {
		getStateHelper().put(PropertyKeys.handles, _handles);
	}

	public boolean isGhost() {
		return (java.lang.Boolean) getStateHelper().eval(PropertyKeys.ghost, false);
	}
	public void setGhost(boolean _ghost) {
		getStateHelper().put(PropertyKeys.ghost, _ghost);
	}

	public boolean isAnimate() {
		return (java.lang.Boolean) getStateHelper().eval(PropertyKeys.animate, false);
	}
	public void setAnimate(boolean _animate) {
		getStateHelper().put(PropertyKeys.animate, _animate);
	}

	public java.lang.String getEffect() {
		return (java.lang.String) getStateHelper().eval(PropertyKeys.effect, "swing");
	}
	public void setEffect(java.lang.String _effect) {
		getStateHelper().put(PropertyKeys.effect, _effect);
	}

	public java.lang.String getEffectDuration() {
		return (java.lang.String) getStateHelper().eval(PropertyKeys.effectDuration, "normal");
	}
	public void setEffectDuration(java.lang.String _effectDuration) {
		getStateHelper().put(PropertyKeys.effectDuration, _effectDuration);
	}

	public int getMaxWidth() {
		return (java.lang.Integer) getStateHelper().eval(PropertyKeys.maxWidth, Integer.MAX_VALUE);
	}
	public void setMaxWidth(int _maxWidth) {
		getStateHelper().put(PropertyKeys.maxWidth, _maxWidth);
	}

	public int getMaxHeight() {
		return (java.lang.Integer) getStateHelper().eval(PropertyKeys.maxHeight, Integer.MAX_VALUE);
	}
	public void setMaxHeight(int _maxHeight) {
		getStateHelper().put(PropertyKeys.maxHeight, _maxHeight);
	}

	public int getMinWidth() {
		return (java.lang.Integer) getStateHelper().eval(PropertyKeys.minWidth, Integer.MIN_VALUE);
	}
	public void setMinWidth(int _minWidth) {
		getStateHelper().put(PropertyKeys.minWidth, _minWidth);
	}

	public int getMinHeight() {
		return (java.lang.Integer) getStateHelper().eval(PropertyKeys.minHeight, Integer.MIN_VALUE);
	}
	public void setMinHeight(int _minHeight) {
		getStateHelper().put(PropertyKeys.minHeight, _minHeight);
	}

	public boolean isContainment() {
		return (java.lang.Boolean) getStateHelper().eval(PropertyKeys.containment, false);
	}
	public void setContainment(boolean _containment) {
		getStateHelper().put(PropertyKeys.containment, _containment);
	}

	public int getGrid() {
		return (java.lang.Integer) getStateHelper().eval(PropertyKeys.grid, 1);
	}
	public void setGrid(int _grid) {
		getStateHelper().put(PropertyKeys.grid, _grid);
	}

	public java.lang.String getOnStart() {
		return (java.lang.String) getStateHelper().eval(PropertyKeys.onStart, null);
	}
	public void setOnStart(java.lang.String _onStart) {
		getStateHelper().put(PropertyKeys.onStart, _onStart);
	}

	public java.lang.String getOnResize() {
		return (java.lang.String) getStateHelper().eval(PropertyKeys.onResize, null);
	}
	public void setOnResize(java.lang.String _onResize) {
		getStateHelper().put(PropertyKeys.onResize, _onResize);
	}

	public java.lang.String getOnStop() {
		return (java.lang.String) getStateHelper().eval(PropertyKeys.onStop, null);
	}
	public void setOnStop(java.lang.String _onStop) {
		getStateHelper().put(PropertyKeys.onStop, _onStop);
	}


        private final static String DEFAULT_EVENT = "resize";

        private static final Map> BEHAVIOR_EVENT_MAPPING = Collections.unmodifiableMap(new HashMap>() {{
            put("resize", ResizeEvent.class);
        }});

        private static final Collection EVENT_NAMES = BEHAVIOR_EVENT_MAPPING.keySet();

        @Override
        public Map> getBehaviorEventMapping() {
             return BEHAVIOR_EVENT_MAPPING;
        }

        @Override
        public Collection getEventNames() {
            return EVENT_NAMES;
        }

        @Override
        public String getDefaultEventName() {
            return DEFAULT_EVENT;
        }

        @Override
        public void queueEvent(FacesEvent event) {
            FacesContext context = getFacesContext();
            Map params = context.getExternalContext().getRequestParameterMap();

            if(ComponentUtils.isRequestSource(this, context)) {
                String eventName = params.get(Constants.RequestParams.PARTIAL_BEHAVIOR_EVENT_PARAM);
                String clientId = getClientId(context);
                
                if(eventName.equals("resize")) {
                    AjaxBehaviorEvent behaviorEvent = (AjaxBehaviorEvent) event;
                    int width = Integer.parseInt(params.get(clientId + "_width"));
                    int height = Integer.parseInt(params.get(clientId + "_height"));

                    super.queueEvent(new ResizeEvent(this, behaviorEvent.getBehavior(), width, height));
                }
                
            } else {
                super.queueEvent(event);
            }
        }
	public String resolveWidgetVar() {
		return ComponentUtils.resolveWidgetVar(getFacesContext(), this);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy