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

com.citytechinc.cq.component.touchuidialog.container.Section Maven / Gradle / Ivy

There is a newer version: 7.0.0
Show newest version
/**
 *    Copyright 2017 ICF Olson
 *
 *    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 com.citytechinc.cq.component.touchuidialog.container;

import org.codehaus.plexus.util.StringUtils;

import com.citytechinc.cq.component.util.Constants;
import com.citytechinc.cq.component.xml.NameSpacedAttribute;

public class Section extends Container {

	public static final String RESOURCE_TYPE = "granite/ui/components/foundation/section";
	public static final String INCLUDE_RESOURCE_TYPE = "granite/ui/components/foundation/include";

	private NameSpacedAttribute title;
	private String path;
	private String resourceType;
	private final NameSpacedAttribute showOnCreate;
	private final NameSpacedAttribute hideOnEdit;
	private NameSpacedAttribute orderBefore;

	public Section(SectionParameters parameters) {
		super(parameters);

		if (StringUtils.isNotEmpty(parameters.getTitle())) {
			this.title =
				new NameSpacedAttribute(Constants.JCR_NS_URI, Constants.JCR_NS_PREFIX, parameters.getTitle());
		}

		if (StringUtils.isNotEmpty(parameters.getPath())) {
			this.resourceType = RESOURCE_TYPE;
			this.path = parameters.getPath();
		}

		showOnCreate =
			new NameSpacedAttribute(Constants.CQ_NS_URI, Constants.CQ_NS_PREFIX, parameters.isShowOnCreate());

		hideOnEdit =
			new NameSpacedAttribute(Constants.CQ_NS_URI, Constants.CQ_NS_PREFIX, parameters.isHideOnEdit());

		if (StringUtils.isNotEmpty(parameters.getOrderBefore())) {
			orderBefore =
				new NameSpacedAttribute(Constants.SLING_NS_PREFIX, Constants.SLING_NS_PREFIX,
					parameters.getOrderBefore());
		}
	}

	public NameSpacedAttribute getTitle() {
		return title;
	}

	public String getPath() {
		return path;
	}

	public String getResourceType() {
		return resourceType;
	}

	public NameSpacedAttribute getShowOnCreate() {
		return showOnCreate;
	}

	public NameSpacedAttribute getHideOnEdit() {
		return hideOnEdit;
	}

	public NameSpacedAttribute getOrderBefore() {
		return orderBefore;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy