List of usage examples for com.google.gwt.user.client.ui Widget getAbsoluteLeft
public int getAbsoluteLeft()
From source file:org.jbpm.form.builder.ng.model.client.form.items.TabbedLayoutFormItem.java
License:Apache License
public int getTabForCoordinates(int x, int y) { int tabNumber = 0; while (tabNumber < panel.getWidgetCount()) { Widget widget = this.panel.getTabWidget(tabNumber); int left = widget.getAbsoluteLeft(); int top = widget.getAbsoluteTop(); int right = left + widget.getOffsetWidth(); int bottom = top + widget.getOffsetHeight(); if (x > left && x < right && y > top && y < bottom) { return tabNumber; }// w w w. j a v a 2 s . c om tabNumber++; } return panel.getSelectedIndex(); }
From source file:org.kie.guvnor.guided.rule.client.widget.ActionCallMethodWidget.java
License:Apache License
protected void showAddFieldPopup(Widget w) { final DataModelOracle completions = this.getModeller().getSuggestionCompletions(); final FormStylePopup popup = new FormStylePopup(GuidedRuleEditorImages508.INSTANCE.Wizard(), Constants.INSTANCE.ChooseAMethodToInvoke()); final ListBox box = new ListBox(); box.addItem("..."); for (int i = 0; i < fieldCompletionTexts.length; i++) { box.addItem(fieldCompletionTexts[i], fieldCompletionValues[i]); }/* ww w.j av a2 s . c om*/ box.setSelectedIndex(0); popup.addAttribute(Constants.INSTANCE.ChooseAMethodToInvoke(), box); box.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { model.setState(ActionCallMethod.TYPE_DEFINED); String methodName = box.getItemText(box.getSelectedIndex()); String methodNameWithParams = box.getValue(box.getSelectedIndex()); model.setMethodName(methodName); List<String> fieldList = new ArrayList<String>(); fieldList.addAll(completions.getMethodParams(variableClass, methodNameWithParams)); int i = 0; for (String fieldParameter : fieldList) { model.addFieldValue(new ActionFieldFunction(methodName, String.valueOf(i), fieldParameter)); i++; } getModeller().refreshWidget(); popup.hide(); } }); popup.setPopupPosition(w.getAbsoluteLeft(), w.getAbsoluteTop()); popup.show(); }
From source file:org.kie.uberfire.social.activities.client.widgets.userbox.UserBoxDetailsView.java
License:Apache License
private void setupPosition(final Widget followUnfollow) { this.setPopupPositionAndShow(new PositionCallback() { public void setPosition(int offsetWidth, int offsetHeight) { int borderLeft = 4; int left = followUnfollow.getAbsoluteLeft() + borderLeft; int borderTop = 10; int top = followUnfollow.getAbsoluteTop() - borderTop; setPopupPosition(left, top); }//w w w . j av a2 s .co m }); }
From source file:org.mobicents.servlet.management.client.dnd.PickupDragController.java
License:Open Source License
public void dragStart() { super.dragStart(); WidgetLocation currentDraggableLocation = new WidgetLocation(context.draggable, context.boundaryPanel); /*if (getBehaviorDragProxy()) { movablePanel = newDragProxy(context); context.boundaryPanel.add(movablePanel, currentDraggableLocation.getLeft(), currentDraggableLocation.getTop()); } else */ {/*from www .jav a 2 s.c om*/ saveSelectedWidgetsLocationAndStyle(); AbsolutePanel container = new AbsolutePanel(); DOM.setStyleAttribute(container.getElement(), "overflow", "visible"); container.setPixelSize(context.draggable.getOffsetWidth(), context.draggable.getOffsetHeight()); context.boundaryPanel.add(container, currentDraggableLocation.getLeft(), currentDraggableLocation.getTop()); int draggableAbsoluteLeft = context.draggable.getAbsoluteLeft(); int draggableAbsoluteTop = context.draggable.getAbsoluteTop(); HashMap widgetLocation = new HashMap(); for (int q = 0; q < context.selectedWidgets.size(); q++) { Widget widget = (Widget) context.selectedWidgets.get(q); widgetLocation.put(widget, new CoordinateLocation(widget.getAbsoluteLeft(), widget.getAbsoluteTop())); } context.dropController = getIntersectDropController(context.mouseX, context.mouseY); if (context.dropController != null) { context.dropController.onEnter(context); } for (int q = 0; q < context.selectedWidgets.size(); q++) { Widget widget = (Widget) context.selectedWidgets.get(q); Location location = (Location) widgetLocation.get(widget); int relativeX = location.getLeft() - draggableAbsoluteLeft; int relativeY = location.getTop() - draggableAbsoluteTop; container.add(widget, relativeX, relativeY); } movablePanel = container; } movablePanel.addStyleName(PRIVATE_CSS_MOVABLE_PANEL); // one time calculation of boundary panel location for efficiency during dragging Location widgetLocation = new WidgetLocation(context.boundaryPanel, null); boundaryOffsetX = widgetLocation.getLeft() + DOMUtil.getBorderLeft(context.boundaryPanel.getElement()); boundaryOffsetY = widgetLocation.getTop() + DOMUtil.getBorderTop(context.boundaryPanel.getElement()); dropTargetClientWidth = DOMUtil.getClientWidth(getBoundaryPanel().getElement()); dropTargetClientHeight = DOMUtil.getClientHeight(getBoundaryPanel().getElement()); }
From source file:org.nsesa.editor.gwt.core.client.ui.document.sourcefile.actionbar.ActionBarController.java
License:EUPL
/** * Adapts the position of this 'hoovering' toolbar to be placed just above the {@link OverlayWidget}. *///from w w w. java 2 s. com public void adaptPosition(final Widget container) { // hide the panel with our creation elements actionBarCreatePanelController.getView().asWidget().setVisible(false); if (overlayWidget != null) { final Style style = view.asWidget().getElement().getStyle(); final int coordinateY = overlayWidget.asWidget().getAbsoluteTop() - (view.asWidget().getOffsetHeight() - 1); style.setTop(coordinateY, Style.Unit.PX); style.setLeft(overlayWidget.asWidget().getAbsoluteLeft(), Style.Unit.PX); // we need to limit the width to make sure it does not final int width = (container.getOffsetWidth() + container.getAbsoluteLeft()) - overlayWidget.asWidget().getAbsoluteLeft(); style.setWidth((width), Style.Unit.PX); adaptVisibility(); } }
From source file:org.onecmdb.ui.gwt.toolkit.client.view.screen.ci.MoveCIScreen.java
License:Open Source License
protected void update() { setTitleWidget(new CIIconDisplayNameWidget(template)); hPanel.clear();//from www . j av a 2 s . c o m VerticalPanel vPanel = new VerticalPanel(); vPanel.setStyleName("mdv-form"); vPanel.add(new HTML("<h3>Classify CI <i>" + ci.getDisplayName() + "</i><h3>")); HorizontalPanel currentPanel = new HorizontalPanel(); currentPanel.add(new Label("Current Template: ")); currentPanel.add(new CIIconDisplayNameWidget(template)); vPanel.add(currentPanel); final HorizontalPanel newPanel = new HorizontalPanel(); final HTML newTemplateHTML = new HTML("<a href='javascript:;'>Change to Template </a>"); newPanel.add(newTemplateHTML); newTemplateHTML.addClickListener(new ClickListener() { public void onClick(Widget sender) { final DragablePopup popup = new DragablePopup("Select template", false); InheritanceTreeControl control = new InheritanceTreeControl(ci.getDerivedFrom()); control.setFilterInstances(Boolean.TRUE); control.setTreeListener(new TreeListener() { public void onTreeItemSelected(TreeItem item) { if (item.getUserObject() instanceof GWT_CiBean) { newPanel.clear(); newTemplate = (GWT_CiBean) item.getUserObject(); newPanel.add(newTemplateHTML); newPanel.add(new CIIconDisplayNameWidget(newTemplate)); popup.hide(); } } public void onTreeItemStateChanged(TreeItem item) { // TODO Auto-generated method stub } }); CITreeWidget templateTreeWidget = new CITreeWidget(control); popup.setContent(templateTreeWidget); int left = sender.getAbsoluteLeft() + sender.getOffsetWidth(); int top = sender.getAbsoluteTop() + sender.getOffsetHeight(); popup.setPopupPosition(left, top); popup.show(); } }); vPanel.add(newPanel); HorizontalPanel bpanel = new HorizontalPanel(); Button cancel = new Button("CANCEL"); cancel.addClickListener(new ClickListener() { public void onClick(Widget sender) { History.back(); } }); Button ok = new Button("OK"); ok.addClickListener(new ClickListener() { public void onClick(Widget sender) { CIAttributeValueInputControl control = new CIAttributeValueInputControl(ci); control.getLocal().setDerivedFrom(newTemplate.getAlias()); control.commit(new AsyncCallback() { public void onFailure(Throwable caught) { setErrorText("ERROR: " + caught); } public void onSuccess(Object result) { History.back(); } }); } }); bpanel.add(ok); bpanel.add(cancel); vPanel.add(bpanel); hPanel.add(vPanel); }
From source file:org.openelis.gwt.widget.table.PopupTable.java
License:Open Source License
public void showTable(Widget wid) { showingOptions = true;//from w w w . j av a 2 s.co m popup.setPopupPosition(wid.getAbsoluteLeft(), wid.getAbsoluteTop() + wid.getOffsetHeight() - 1); popup.show(); DeferredCommand.addCommand(new Command() { public void execute() { if (view.header != null) view.header.sizeHeader(); scrollToSelection(); } }); focused = true; }
From source file:org.openelis.gwt.widget.table.TableHeaderBar.java
License:Open Source License
/** * Catches mouses Events for resizing columns. *//*from w w w .ja v a 2 s. co m*/ public void onMouseDown(MouseDownEvent event) { Widget sender = (Widget) event.getSource(); // TODO Auto-generated method stub resizing = true; startx = sender.getAbsoluteLeft(); resizeColumn1 = headers.indexOf(sender.getParent()); tableCol1 = resizeColumn1; if (columns.get(tableCol1).getFixedWidth()) { resizing = false; resizeColumn1 = -1; tableCol1 = -1; return; } if (pop.isShowing()) { pop.hide(); menuItem = null; } //menuItem.removeFromParent(); FocusPanel bar = new FocusPanel(); bar.addMouseUpHandler(this); bar.addMouseDownHandler(this); bar.addMouseMoveHandler(this); bar.setHeight((controller.view.cellView.getOffsetHeight() + 17) + "px"); bar.setWidth("1px"); DOM.setStyleAttribute(bar.getElement(), "background", "red"); DOM.setStyleAttribute(bar.getElement(), "position", "absolute"); DOM.setStyleAttribute(bar.getElement(), "left", sender.getAbsoluteLeft() + "px"); DOM.setStyleAttribute(bar.getElement(), "top", sender.getAbsoluteTop() + "px"); RootPanel.get().add(bar); DOM.setCapture(bar.getElement()); DOM.setStyleAttribute(bar.getElement(), "zIndex", "1000"); }
From source file:org.openelis.gwt.widget.table.TableHeaderBar.java
License:Open Source License
/** * Catches mouses Events for resizing columns. *//*from www . j a v a 2 s .c o m*/ public void onMouseMove(MouseMoveEvent event) { Widget sender = (Widget) event.getSource(); if (resizing) { int colA = columns.get(tableCol1).getCurrentWidth() + (sender.getAbsoluteLeft() - startx); int pad = 5; if (columns.get(tableCol1).sortable || columns.get(tableCol1).filterable) pad = 5; if ((event.getX() < 0 && (colA - pad) <= columns.get(tableCol1).getMinWidth())) return; DOM.setStyleAttribute(sender.getElement(), "left", (DOM.getAbsoluteLeft(sender.getElement()) + (event.getX())) + "px"); } }
From source file:org.openelis.gwt.widget.table.TableHeaderBar.java
License:Open Source License
/** * Catches mouses Events for resizing columns. *//*from w w w . j ava2 s . c o m*/ public void onMouseUp(MouseUpEvent event) { Widget sender = (Widget) event.getSource(); if (resizing) { DOM.releaseCapture(sender.getElement()); int colWidth = columns.get(tableCol1).getCurrentWidth() + (sender.getAbsoluteLeft() - startx); int scrollWidth = 0; for (int i = 0; i < headers.size(); i++) { if (tableCol1 != i) scrollWidth += columns.get(i).getCurrentWidth() + 3; } if (scrollWidth + colWidth < controller.getTableWidth()) colWidth = controller.getTableWidth() - scrollWidth - 3; columns.get(tableCol1).setCurrentWidth(colWidth); resizing = false; RootPanel.get().remove(sender); DeferredCommand.addCommand(new Command() { public void execute() { sizeHeader(); for (int j = 0; j < controller.view.table.getRowCount(); j++) { for (int i = 0; i < columns.size(); i++) { controller.view.table.getFlexCellFormatter().setWidth(j, i, (columns.get(i).getCurrentWidth()) + "px"); if (!(controller.columns.get(i).getColumnWidget() instanceof CheckBox)) controller.view.table.getWidget(j, i) .setWidth((columns.get(i).getCurrentWidth()) + "px"); } } } }); } }