use of com.google.gwt.dom.client.Element in project actor-platform by actorapp.
the class JsFacade method handleLinkClick.
@UsedByApp
public void handleLinkClick(Event event) {
Element target = Element.as(event.getEventTarget());
String href = target.getAttribute("href");
if (href.startsWith("send:")) {
String msg = href.substring("send:".length());
msg = URL.decode(msg);
if (lastVisiblePeer != null) {
messenger.sendMessage(lastVisiblePeer, msg);
event.preventDefault();
}
} else {
if (JsElectronApp.isElectron()) {
JsElectronApp.openUrlExternal(href);
event.preventDefault();
}
}
}
use of com.google.gwt.dom.client.Element in project che by eclipse.
the class OutputConsoleViewImpl method getText.
@Override
public String getText() {
String text = "";
NodeList<Node> nodes = consoleLines.getElement().getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.getItem(i);
Element element = node.cast();
text += element.getInnerText() + "\r\n";
}
return text;
}
use of com.google.gwt.dom.client.Element in project che by eclipse.
the class EditCommandsViewImpl method createButtons.
private void createButtons() {
saveButton = createButton(coreLocale.save(), "window-edit-commands-save", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
delegate.onSaveClicked();
}
});
saveButton.addStyleName(Window.resources.windowCss().primaryButton());
buttonsPanel.add(saveButton);
cancelButton = createButton(coreLocale.cancel(), "window-edit-commands-cancel", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
delegate.onCancelClicked();
}
});
buttonsPanel.add(cancelButton);
closeButton = createButton(coreLocale.close(), "window-edit-commands-close", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
delegate.onCloseClicked();
}
});
closeButton.addDomHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent blurEvent) {
//set default focus
selectText(filterInputField.getElement());
}
}, BlurEvent.getType());
addButtonToFooter(closeButton);
Element dummyFocusElement = DOM.createSpan();
dummyFocusElement.setTabIndex(0);
getFooter().getElement().appendChild(dummyFocusElement);
}
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);
}
Aggregations