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

com.alkacon.acacia.client.ui.ValuePanel Maven / Gradle / Ivy

Go to download

A GWT based resource editor. This component is used as a part of OpenCms, 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: 2.1
Show newest version
/*
 * This library is part of the Acacia Editor -
 * an open source inline and form based content editor for GWT.
 *
 * Copyright (c) Alkacon Software GmbH (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
 * 
 * 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 com.alkacon.acacia.client.ui;

import com.alkacon.acacia.client.css.I_LayoutBundle;
import com.alkacon.geranium.client.I_HasResizeOnShow;
import com.alkacon.geranium.client.dnd.DNDHandler.Orientation;
import com.alkacon.geranium.client.dnd.I_Draggable;
import com.alkacon.geranium.client.dnd.I_DropTarget;
import com.alkacon.geranium.client.ui.HighlightingBorder;
import com.alkacon.geranium.client.util.DomUtil;

import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Widget;

/**
 * The attribute values panel.

*/ public class ValuePanel extends FlowPanel implements I_DropTarget, I_HasResizeOnShow { /** The current place holder. */ protected Element m_placeholder; /** The placeholder position index. */ protected int m_placeholderIndex = -1; /** The highlighting border. */ private HighlightingBorder m_highlighting; /** * Constructor.

*/ public ValuePanel() { setStyleName(I_LayoutBundle.INSTANCE.form().attribute()); } /** * @see com.alkacon.geranium.client.dnd.I_DropTarget#checkPosition(int, int, com.alkacon.geranium.client.dnd.DNDHandler.Orientation) */ public boolean checkPosition(int x, int y, Orientation orientation) { return true; } /** * @see com.alkacon.geranium.client.dnd.I_DropTarget#getPlaceholderIndex() */ public int getPlaceholderIndex() { return m_placeholderIndex; } /** * Highlights the outline of this panel.

*/ public void highlightOutline() { m_highlighting = new HighlightingBorder(getElement(), HighlightingBorder.BorderColor.red); add(m_highlighting); } /** * @see com.alkacon.geranium.client.dnd.I_DropTarget#insertPlaceholder(com.google.gwt.dom.client.Element, int, int, com.alkacon.geranium.client.dnd.DNDHandler.Orientation) */ public void insertPlaceholder(Element placeholder, int x, int y, Orientation orientation) { m_placeholder = placeholder; repositionPlaceholder(x, y, orientation); } /** * @see com.alkacon.geranium.client.dnd.I_DropTarget#onDrop(com.alkacon.geranium.client.dnd.I_Draggable) */ public void onDrop(I_Draggable draggable) { // nothing to do } /** * Removes the highlighting border.

*/ public void removeHighlighting() { if (m_highlighting != null) { m_highlighting.removeFromParent(); m_highlighting = null; } } /** * @see com.alkacon.geranium.client.dnd.I_DropTarget#removePlaceholder() */ public void removePlaceholder() { if (m_placeholder == null) { return; } m_placeholder.removeFromParent(); m_placeholder = null; m_placeholderIndex = -1; } /** * @see com.alkacon.geranium.client.dnd.I_DropTarget#repositionPlaceholder(int, int, com.alkacon.geranium.client.dnd.DNDHandler.Orientation) */ public void repositionPlaceholder(int x, int y, Orientation orientation) { // handle vertical orientation only m_placeholderIndex = DomUtil.positionElementInside(m_placeholder, getElement(), m_placeholderIndex, -1, y); } /** * @see com.alkacon.geranium.client.I_HasResizeOnShow#resizeOnShow() */ public void resizeOnShow() { for (Widget w : this) { if (w instanceof I_HasResizeOnShow) { ((I_HasResizeOnShow)w).resizeOnShow(); } } } /** * Updates the highlighting position if present.

*/ public void updateHighlightingPosition() { if (m_highlighting != null) { m_highlighting.resetPosition(); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy