private int getHeight() { int height = Window.getClientHeight() - widget.getAbsoluteTop() - getMarginSize() - 14; if (height < 0) { return 0; } return height; }
/** * Show on the left of the provided widget * * @param widget */ public void showWestOf(Widget widget, String text) { init(text); clearStyleDependentName(); addStyleDependentName(EAST); show(); int top = widget.getAbsoluteTop() - ((this.getOffsetHeight() - widget.getOffsetHeight()) / 2); int left = widget.getAbsoluteLeft() - 1; moveTo(top, left); }
private void internalSetWidget(Widget widget) { // this.widget = widget; if (widget == null || widget == RootPanel.get()) { widgetLeft = 0; widgetTop = 0; } else { widgetLeft = widget.getAbsoluteLeft() - widget.getElement().getScrollLeft(); widgetTop = widget.getAbsoluteTop() - widget.getElement().getScrollTop(); } }
private void internalSetReference(Widget reference) { // this.reference = reference; if (reference == null || reference == RootPanel.get()) { referenceAdjustLeft = 0; referenceAdjustTop = 0; } else { referenceAdjustLeft = reference.getAbsoluteLeft() + DOMUtil.getBorderLeft(reference.getElement()); referenceAdjustTop = reference.getAbsoluteTop() + DOMUtil.getBorderTop(reference.getElement()); } }
public WidgetArea(Widget widget, Widget reference) { setLeft(widget.getAbsoluteLeft()); setTop(widget.getAbsoluteTop()); if (reference != null) { setLeft( getLeft() - reference.getAbsoluteLeft() - DOMUtil.getBorderLeft(reference.getElement())); setTop(getTop() - reference.getAbsoluteTop() - DOMUtil.getBorderTop(reference.getElement())); } setRight(getLeft() + widget.getOffsetWidth()); setBottom(getTop() + widget.getOffsetHeight()); Element elem = widget.getElement().getOffsetParent(); Element p; while (elem != null && (p = elem.getOffsetParent()) != null) { int left = elem.getAbsoluteLeft(); if (getLeft() < left) { setLeft(left); } int top = elem.getAbsoluteTop(); if (getTop() < top) { setTop(top); } int bottom = top + elem.getOffsetHeight(); if (getBottom() > bottom) { setBottom(bottom); } int right = left + elem.getOffsetWidth(); if (getRight() > right) { setRight(right); } elem = p; } }
protected void showAddFieldPopup(final Widget w) { final FormStylePopup popup = new FormStylePopup( TestScenarioAltedImages.INSTANCE.Wizard(), TestScenarioConstants.INSTANCE.ChooseAMethodToInvoke()); ListBox box = new ListBox(); box.addItem("..."); for (int i = 0; i < fieldCompletionTexts.length; i++) { box.addItem(fieldCompletionTexts[i], fieldCompletionValues[i]); } box.setSelectedIndex(0); popup.addAttribute(TestScenarioConstants.INSTANCE.ChooseAMethodToInvoke(), box); box.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { mCall.setState(ActionCallMethod.TYPE_DEFINED); ListBox sourceW = (ListBox) event.getSource(); final String methodName = sourceW.getItemText(sourceW.getSelectedIndex()); final String methodNameWithParams = sourceW.getValue(sourceW.getSelectedIndex()); mCall.setMethodName(methodName); oracle.getMethodParams( variableClass, methodNameWithParams, new Callback<List<String>>() { @Override public void callback(final List<String> fieldList) { // String fieldType = oracle.getFieldType( variableClass, fieldName ); int i = 0; for (String fieldParameter : fieldList) { mCall.addFieldValue( new CallFieldValue(methodName, String.valueOf(i), fieldParameter)); i++; } parent.renderEditor(); popup.hide(); } }); } }); popup.setPopupPosition(w.getAbsoluteLeft(), w.getAbsoluteTop()); popup.show(); }
/** * Show on the right of the provided widget * * @param widget */ public void showEastOf(Widget widget, String text) { init(text); clearStyleDependentName(); addStyleDependentName(WEST); show(); if (this.getOffsetWidth() + widget.getOffsetWidth() + widget.getAbsoluteLeft() > Window.getClientWidth()) { showNorthOf(widget, text); return; } int top = widget.getAbsoluteTop() - ((this.getOffsetHeight() - widget.getOffsetHeight()) / 2); int left = widget.getAbsoluteLeft() + widget.getOffsetWidth() + 1; moveTo(top, left); }
@UiHandler({"editBtn"}) public void editBtnCmd(ClickEvent ev) { final PopupPanel p = new PopupPanel(); // p.setTitle("Добавление экземпляра сущности..."); // p.setModal(false); p.setAutoHideEnabled(true); Widget source = (Widget) ev.getSource(); int left = source.getAbsoluteLeft(); int top = source.getAbsoluteTop(); p.setPopupPosition(left, top); // p.setPopupPosition(200, 200); // p.setSize("190px", "100px"); p.setSize("100%", "100%"); Anchor editSel = new Anchor("Изменить выбор"); Anchor editField = new Anchor("Изменить структуру"); Anchor editItems = new Anchor("К элементам"); editSel.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent ev) { editSelectionCmd(ev); p.hide(); } }); editField.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent ev) { editFieldCmd(ev); p.hide(); } }); editItems.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent ev) { editItemsCmd(ev); p.hide(); } }); VerticalPanel pnl = new VerticalPanel(); pnl.add(editSel); pnl.add(editField); pnl.add(editItems); p.add(pnl); p.show(); }
@Override public void onResize(ResizeEvent event) { if (receptor != null) { Element elem = simplePanel.getElement(); DOM.setStyleAttribute( elem, "left", receptor.getAbsoluteLeft() + "px"); // $NON-NLS-1$ //$NON-NLS-2$ DOM.setStyleAttribute( elem, "top", receptor.getAbsoluteTop() + "px"); // $NON-NLS-1$ //$NON-NLS-2$ DOM.setStyleAttribute( elem, "width", receptor.getOffsetWidth() + "px"); // $NON-NLS-1$ //$NON-NLS-2$ DOM.setStyleAttribute( elem, "height", receptor.getOffsetHeight() + "px"); // $NON-NLS-1$ //$NON-NLS-2$ DOM.setStyleAttribute(elem, "position", "absolute"); // $NON-NLS-1$ //$NON-NLS-2$ DOM.setStyleAttribute(elem, "zIndex", "1005"); // $NON-NLS-1$ //$NON-NLS-2$ } }
protected void showAddFieldPopup(Widget w) { final SuggestionCompletionEngine completions = this.getModeller().getSuggestionCompletions(); final FormStylePopup popup = new FormStylePopup( DroolsGuvnorImages.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]); } box.setSelectedIndex(0); popup.addAttribute(Constants.INSTANCE.ChooseAMethodToInvoke(), box); box.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { model.state = ActionCallMethod.TYPE_DEFINED; String methodName = box.getItemText(box.getSelectedIndex()); String methodNameWithParams = box.getValue(box.getSelectedIndex()); model.methodName = 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(); }
@Override public void onClick(ClickEvent event) { Widget sender = (Widget) event.getSource(); if (editFields == null) { editFields = new TrustActionEditFields(); } int left = 0; if (sender == newButton) { left = sender.getAbsoluteLeft() + 10; } else { left = sender.getAbsoluteLeft() - 250; } int top = sender.getAbsoluteTop() + 10; editFields.setPopupPosition(left, top); if (sender == newButton) { editFields.init(); } else { editFields.init(idHolder.findId(sender)); } editFields.show(); }
/** * Determine if the given click was inside the boundaries of the given widget. * * @param pWidget the widget * @param pClickEvent the click * @return <code>true</code> if yes */ public static boolean isInside(final Widget pWidget, final ClickEvent pClickEvent) { LOG.enter("isInside"); // $NON-NLS-1$ boolean result = false; final int cx = pClickEvent.getClientX(); final int cy = pClickEvent.getClientY(); final int wleft = pWidget.getAbsoluteLeft(); final int wtop = pWidget.getAbsoluteTop(); if (LOG.isDetailEnabled()) { LOG.detail( "isInside", //$NON-NLS-1$ "Click at (" + cx + ',' + cy //$NON-NLS-1$ + "), widget pos (" + wleft + ',' + wtop //$NON-NLS-1$ + "), widget dims [" + pWidget.getOffsetWidth() + ',' //$NON-NLS-1$ + pWidget.getOffsetHeight() + ']'); } if (cx >= wleft && cy >= wtop && cx < wleft + pWidget.getOffsetWidth() && cy < wtop + pWidget.getOffsetHeight()) { result = true; } LOG.exit("isInside", Boolean.valueOf(result)); // $NON-NLS-1$ return result; }
public void showAndAdapt(Widget w) { receptor = w; show(w.getAbsoluteLeft(), w.getAbsoluteTop(), w.getOffsetWidth(), w.getOffsetHeight()); }
public void show(Widget w) { show(w.getAbsoluteLeft(), w.getAbsoluteTop(), w.getOffsetWidth(), w.getOffsetHeight()); }
@Override public Point2D getTopRightLocation() { Widget w = rootPanel; return new Point2D(w.getAbsoluteLeft() + w.getOffsetWidth(), w.getAbsoluteTop()); }