use of com.google.gwt.dom.client.Element in project che by eclipse.
the class DefaultPresentationRenderer method render.
@Override
public Element render(N node, String domID, Tree.Joint joint, int depth) {
NodePresentation presentation;
if (node instanceof HasPresentation) {
presentation = ((HasPresentation) node).getPresentation(false);
} else {
presentation = new NodePresentation();
presentation.setPresentableText(node.getName());
}
Element rootContainer = getRootContainer(domID);
Element nodeContainer = getNodeContainer();
setIndentLevel(nodeContainer, depth);
Element jointContainer = getJointContainer(joint);
Element iconContainer = getIconContainer(presentation.getPresentableIcon());
Element userElement = getUserElement(presentation.getUserElement());
Element presentableTextContainer = getPresentableTextContainer(createPresentableTextElement(presentation));
Element infoTextContainer = getInfoTextContainer(createInfoTextElement(presentation));
Element descendantsContainer = getDescendantsContainer();
nodeContainer.appendChild(jointContainer);
nodeContainer.appendChild(iconContainer);
nodeContainer.appendChild(userElement == null ? Document.get().createSpanElement() : userElement);
nodeContainer.appendChild(presentableTextContainer);
nodeContainer.appendChild(infoTextContainer);
rootContainer.appendChild(nodeContainer);
rootContainer.appendChild(descendantsContainer);
return rootContainer;
}
use of com.google.gwt.dom.client.Element in project che by eclipse.
the class View method setPopupPosition.
/**
* Sets the popup's position relative to the browser's client area. The
* popup's position may be set before calling {@link #setShowing(boolean)}.
*
* @param left
* the left position, in pixels
* @param top
* the top position, in pixels
*/
public void setPopupPosition(int left, int top) {
// Account for the difference between absolute position and the
// body's positioning context.
left -= Document.get().getBodyOffsetLeft();
top -= Document.get().getBodyOffsetTop();
// Set the popup's position manually, allowing setPopupPosition() to be
// called before show() is called (so a popup can be positioned without it
// 'jumping' on the screen).
Element elem = contentContainer.getElement();
elem.getStyle().setPropertyPx("left", left);
elem.getStyle().setPropertyPx("top", top);
}
use of com.google.gwt.dom.client.Element in project che by eclipse.
the class CustomComboBox method setItemText.
/**
* Sets the text associated with the item at a given index.
*
* @param index
* the index of the item to be set
* @param text
* the item's new text
* @throws IndexOutOfBoundsException
* if the index is out of range
*/
public void setItemText(int index, String text) {
checkIndex(index);
final Element optionElement = (Element) optionsPanel.getElement().getChild(index);
final LabelElement labelElement = (LabelElement) optionElement.getElementsByTagName("label").getItem(0);
labelElement.setInnerText(text);
if (selectedIndex == index) {
currentInputElement.setValue(text);
}
}
use of com.google.gwt.dom.client.Element in project che by eclipse.
the class CustomComboBox method getValue.
/**
* Gets the value associated with the item at a given index.
*
* @param index
* the index of the item to be retrieved
* @return the item's associated value
* @throws IndexOutOfBoundsException
* if the index is out of range
*/
public String getValue(int index) {
checkIndex(index);
final Element optionElement = (Element) optionsPanel.getElement().getChild(index);
final InputElement inputElement = (InputElement) optionElement.getElementsByTagName("input").getItem(0);
return inputElement.getValue();
}
use of com.google.gwt.dom.client.Element in project che by eclipse.
the class Tree method onClick.
private void onClick(Event event) {
NativeTreeEvent e = event.cast();
NodeDescriptor node = getNodeDescriptor((Element) event.getEventTarget().cast());
if (node != null) {
Element jointEl = view.getJointContainer(node);
if (jointEl != null && e.within(jointEl)) {
toggle(node.getNode());
}
}
focus();
}
Aggregations