use of com.google.gwt.user.client.Element in project perun by CESNET.
the class AdvancedStackPanel method onBrowserEvent.
@Override
public void onBrowserEvent(Event event) {
boolean continueEvent = true;
if (DOM.eventGetType(event) == Event.ONCLICK) {
Element target = DOM.eventGetTarget(event);
int index = findDividerIndex(target);
if (index != -1) {
continueEvent = showStack(index, true);
if (!continueEvent) {
event.stopPropagation();
}
}
}
if (continueEvent) {
super.onBrowserEvent(event);
}
}
use of com.google.gwt.user.client.Element in project perun by CESNET.
the class GetFormItemsWithPrefilledValues method prepareApplicationForm.
/**
* Prepares the widgets from the items as A DISPLAY FOR THE USER
*/
public void prepareApplicationForm() {
FlexTable ft = new FlexTable();
ft.setCellPadding(10);
ft.setWidth("100%");
FlexCellFormatter fcf = ft.getFlexCellFormatter();
String locale;
if (!Utils.getNativeLanguage().isEmpty() && LocaleInfo.getCurrentLocale().getLocaleName().equals(Utils.getNativeLanguage().get(0))) {
locale = Utils.getNativeLanguage().get(0);
} else {
locale = "en";
}
int i = 0;
for (final ApplicationFormItemWithPrefilledValue item : applFormItems) {
RegistrarFormItemGenerator gen = new RegistrarFormItemGenerator(item, locale);
this.applFormGenerators.add(gen);
gen.addValidationTrigger(new FormValidator() {
public void triggerValidation() {
validateFormValues(false);
}
});
// if button, add onclick
if (item.getFormItem().getType().equals("SUBMIT_BUTTON") || item.getFormItem().getType().equals("AUTO_SUBMIT_BUTTON")) {
this.sendButton = (CustomButton) gen.getWidget();
sendButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
// revalidate again, with force validation
if (!validateFormValues(true)) {
Element elem = DOM.getElementById("input-status-error");
elem.scrollIntoView();
return;
}
if (sendFormHandler != null) {
sendFormHandler.sendApplicationForm(sendButton);
}
}
});
}
// get localized texts
ItemTexts itemTexts = item.getFormItem().getItemTexts(locale);
if (!gen.isVisible()) {
continue;
}
// WITH LABEL (input box ...)
if (gen.isLabelShown()) {
// 0 = label
if (item.getFormItem().isRequired() == true) {
// required
ft.setHTML(i, 0, "<strong>" + gen.getLabelOrShortname() + "*</strong>");
} else {
// optional
ft.setHTML(i, 0, "<strong>" + gen.getLabelOrShortname() + "</strong>");
}
// 1 = widget
Widget w = gen.getWidget();
w.setTitle(itemTexts.getHelp());
ft.setWidget(i, 1, w);
// 2 = status
ft.setWidget(i, 2, gen.getStatusWidget());
// 3 = HELP
if (itemTexts.getHelp() != null && itemTexts.getHelp().length() > 0) {
Label help = new Label(itemTexts.getHelp());
ft.setWidget(i, 3, help);
}
// format
fcf.setStyleName(i, 0, "applicationFormLabel");
fcf.setStyleName(i, 1, "applicationFormWidget");
fcf.setStyleName(i, 2, "applicationFormCheck");
fcf.setStyleName(i, 3, "applicationFormHelp");
ft.setWidth("100%");
// ELSE HTML COMMENT, SUBMIT BUTTON, HEADING
} else {
ft.setWidget(i, 0, gen.getWidget());
// colspan = 2
fcf.setColSpan(i, 0, 4);
fcf.setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_LEFT);
fcf.setVerticalAlignment(i, 0, HasVerticalAlignment.ALIGN_MIDDLE);
}
i++;
}
contents.setWidget(ft);
}
use of com.google.gwt.user.client.Element in project opennms by OpenNMS.
the class VSearchBox method updateScrollPanelSize.
private void updateScrollPanelSize() {
Element topologyComponent = DOM.getElementById("TopologyComponent");
int topoHeight = topologyComponent.getOffsetHeight();
int containerHeight = topoHeight - (m_focusedContainer.getElement().getOffsetTop() + 5);
int tableHeight = m_focusedContainer.getOffsetHeight();
if (containerHeight >= 0) {
m_scrollContainer.setHeight("" + Math.min(containerHeight, tableHeight) + "px");
if (tableHeight > containerHeight) {
m_scrollContainer.getElement().getStyle().setOverflowY(Style.Overflow.SCROLL);
} else {
m_scrollContainer.getElement().getStyle().setOverflowY(Style.Overflow.HIDDEN);
}
}
}
use of com.google.gwt.user.client.Element in project opennms by OpenNMS.
the class LocationPanel method resizeDockPanel.
/**
* <p>resizeDockPanel</p>
*/
public void resizeDockPanel() {
int verticalSpacer = 3;
Element element = listsPanel.getElement();
if (getUserAgent().contains("msie")) {
int newHeight = 100;
if (locationPanel.getOffsetHeight() > 1) {
newHeight = locationPanel.getOffsetHeight() - (tagPanel.getOffsetHeight() + filterPanel.getOffsetHeight() + verticalSpacer);
}
element.getStyle().setHeight(newHeight, Unit.PX);
} else {
int newTop = tagPanel.getOffsetHeight() + filterPanel.getOffsetHeight() + verticalSpacer;
element.getStyle().setTop(newTop, Unit.PX);
}
}
use of com.google.gwt.user.client.Element in project GwtMobile by dennisjzh.
the class ScrollPanel method onDragMove.
@Override
public void onDragMove(DragEvent e) {
Element widgetEle = getWidget().getElement();
int panelHeight = Utils.getHeight(this.getElement());
int widgetHeight = widgetEle.getOffsetHeight();
int current = getScrollPosition();
if (current > 0) {
//exceed top boundary
if (e.OffsetY > 0) {
//resist scroll down.
// need the cast for production mode.
current += (int) (e.OffsetY / 2);
} else {
current += e.OffsetY * 2;
}
} else if (-current + panelHeight > widgetHeight) {
//exceed bottom boundary
if (e.OffsetY < 0) {
//resist scroll up.
current += (int) (e.OffsetY / 2);
} else {
current += e.OffsetY * 2;
}
} else {
current += e.OffsetY;
}
setScrollPosition(current);
}
Aggregations