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

org.opencms.acacia.client.widgets.CmsLocationPickerWidget Maven / Gradle / Ivy

Go to download

OpenCms is an enterprise-ready, easy to use website content management system based on Java and XML technology. Offering a complete set of features, OpenCms helps content managers worldwide to create and maintain beautiful websites fast and efficiently.

There is a newer version: 18.0
Show newest version
/*
 * This library is part of OpenCms -
 * the Open Source Content Management System
 *
 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * For further information about Alkacon Software, please see the
 * company website: http://www.alkacon.com
 *
 * For further information about OpenCms, please see the
 * project website: http://www.opencms.org
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package org.opencms.acacia.client.widgets;

import org.opencms.gwt.client.I_CmsHasResizeOnShow;
import org.opencms.gwt.client.ui.input.location.CmsLocationPicker;

import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.FocusEvent;
import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.Composite;

/**
 * Provides a display only widget, for use on a widget dialog.
* If there is no value in the content xml, the value
* set in the configuration string of the xsd is shown.

* * */ public class CmsLocationPickerWidget extends Composite implements I_CmsEditWidget, I_CmsHasResizeOnShow { /** Value of the activation. */ private boolean m_active = true; /** The disabled textbox to show the value. */ private CmsLocationPicker m_locationPicker; /** * Creates a new display widget.

* * @param config The configuration string given from OpenCms XSD. */ public CmsLocationPickerWidget(String config) { m_locationPicker = new CmsLocationPicker(config); initWidget(m_locationPicker); } /** * @see com.google.gwt.event.dom.client.HasFocusHandlers#addFocusHandler(com.google.gwt.event.dom.client.FocusHandler) */ public HandlerRegistration addFocusHandler(FocusHandler handler) { return addDomHandler(handler, FocusEvent.getType()); } /** * @see org.opencms.acacia.client.widgets.I_CmsEditWidget#addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) */ public HandlerRegistration addValueChangeHandler(ValueChangeHandler handler) { return m_locationPicker.addHandler(handler, ValueChangeEvent.getType()); } /** * Represents a value change event.

* */ public void fireChangeEvent() { ValueChangeEvent.fire(m_locationPicker, m_locationPicker.getStringValue()); } /** * @see com.google.gwt.user.client.ui.HasValue#getValue() */ public String getValue() { return m_locationPicker.getStringValue(); } /** * @see org.opencms.acacia.client.widgets.I_CmsEditWidget#isActive() */ public boolean isActive() { return m_active; } /** * @see org.opencms.acacia.client.widgets.I_CmsEditWidget#onAttachWidget() */ public void onAttachWidget() { super.onAttach(); } /** * @see org.opencms.acacia.client.widgets.I_CmsEditWidget#owns(com.google.gwt.dom.client.Element) */ public boolean owns(Element element) { return getElement().isOrHasChild(element); } /** * @see org.opencms.gwt.client.I_CmsHasResizeOnShow#resizeOnShow() */ public void resizeOnShow() { m_locationPicker.resizeOnShow(); } /** * @see org.opencms.acacia.client.widgets.I_CmsEditWidget#setActive(boolean) */ public void setActive(boolean active) { // check if the value has changed. If there is no change do nothing. if (m_active == active) { return; } m_active = active; m_locationPicker.setEnabled(m_active); if (active) { fireChangeEvent(); } } /** * @see org.opencms.acacia.client.widgets.I_CmsEditWidget#setName(java.lang.String) */ public void setName(String name) { // no input field so nothing to do } /** * @see com.google.gwt.user.client.ui.HasValue#setValue(java.lang.Object) */ public void setValue(String value) { setValue(value, false); } /** * @see com.google.gwt.user.client.ui.HasValue#setValue(java.lang.Object, boolean) */ public void setValue(String value, boolean fireEvents) { m_locationPicker.setValue(value); if (fireEvents) { fireChangeEvent(); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy