Java 类com.google.gwt.user.client.ui.PopupPanel.PositionCallback 实例源码

项目:riscoss-corporate    文件:RiscossWebApp.java   
public void show() {
    HorizontalPanel h = new HorizontalPanel();
    h.add( new Button( "Cancel", new ClickHandler() {
        @Override
        public void onClick( ClickEvent event ) {
            dialog.hide();
        }} ) );
    panel.add( h );
    dialog.setWidget( panel );
    dialog.setText( "Select Domain" );
    dialog.setPopupPositionAndShow( new PositionCallback() {
        @Override
        public void setPosition( int offsetWidth, int offsetHeight ) {
            dialog.setPopupPosition( offsetWidth /2, offsetHeight /2 );
        }
    } );
}
项目:riscoss-corporate    文件:WaitWidget.java   
public void show() {
        this.panel.setPopupPositionAndShow( new PositionCallback(){
            @Override
            public void setPosition( int offsetWidth, int offsetHeight )
            {

                panel.getElement().getStyle().setPosition( Position.FIXED );
                panel.getElement().getStyle().setTop( 0, Unit.PX );
//              panel.getElement().getStyle().setLeft( 0, Unit.PX );
//              panel.getElement().getStyle().setBottom( 0, Unit.PX );
                panel.getElement().getStyle().setRight( 0, Unit.PX );
                panel.getElement().getStyle().setProperty( "left", "" );
                panel.getElement().getStyle().setProperty( "bottom", "" );

//              DOM.setStyleAttribute( panel.getElement(), "position", "fixed" );
//              DOM.setStyleAttribute( panel.getElement(), "top", "0" );
//              DOM.setStyleAttribute( panel.getElement(), "left", "" );
//              DOM.setStyleAttribute( panel.getElement(), "bottom", "" );
//              DOM.setStyleAttribute( panel.getElement(), "right", "0px" );
            }
        } );
    }
项目:gwt-gantt    文件:CellDateImpl.java   
@Override
protected void onEnterKeyDown(Context context, final Element parent, Date value,
    NativeEvent event, ValueUpdater<Date> valueUpdater) {
  this.lastKey = context.getKey();
  this.lastParent = parent;
  this.lastValue = value;
  this.valueUpdater = valueUpdater;

  Date viewData = getViewData(context.getKey());
  Date date = (viewData == null) ? value : viewData;
  datePicker.setCurrentMonth(date);
  datePicker.setValue(date);
  panel.setPopupPositionAndShow(new PositionCallback() {
    public void setPosition(int offsetWidth, int offsetHeight) {
      panel.setPopupPosition(parent.getAbsoluteLeft() + offsetX,
          parent.getAbsoluteTop() + offsetY);
    }
  });
}
项目:geomajas-project-client-gwt2    文件:MapLegendDropDown.java   
protected void showPopup() {
    positionPopup();
    popup.show();

    popup.setPopupPositionAndShow(new PositionCallback() {

        public void setPosition(int offsetWidth, int offsetHeight) {
            positionPopup();
            if (timer != null) {
                timer.cancel();
            }
            timer = new Timer() {

                public void run() {
                    positionPopup();
                }
            };
            timer.schedule(1);
        }
    });
}
项目:gwtutil    文件:FixedDatePickerCell.java   
@Override
protected void onEnterKeyDown(Context context, Element parent, Date value,
    NativeEvent event, ValueUpdater<Date> valueUpdater) {
  this.lastKey = context.getKey();
  this.lastParent = parent;
  this.lastValue = value;
  this.lastIndex = context.getIndex();
  this.lastColumn = context.getColumn();
  this.valueUpdater = valueUpdater;

  Date viewData = getViewData(lastKey);
  Date date = (viewData == null) ? lastValue : viewData;
  datePicker.setCurrentMonth(date);
  datePicker.setValue(date);
  panel.setPopupPositionAndShow(new PositionCallback() {
    public void setPosition(int offsetWidth, int offsetHeight) {
      panel.setPopupPosition(lastParent.getAbsoluteLeft() + offsetX,
          lastParent.getAbsoluteTop() + offsetY);
    }
  });
}
项目:wte4j    文件:PopupCell.java   
@Override
public void onBrowserEvent(Cell.Context context, Element parent, T value,
        NativeEvent event, ValueUpdater<T> valueUpdater) {
    contentCell.onBrowserEvent(context, parent, value, event, valueUpdater);
    EventTarget eventTarget = event.getEventTarget();
    if (!BrowserEvents.CLICK.equals(event.getType())) {
        return;
    }
    final Element domElement = Element.as(eventTarget);
    popupPanel.setPopupPositionAndShow(new PositionCallback() {
        @Override
        public void setPosition(int offsetWidth, int offsetHeight) {

            int positionLeft = domElement.getAbsoluteLeft();
            int outerleft = domElement.getAbsoluteLeft() + popupPanel.getOffsetWidth();
            if (outerleft > Window.getClientWidth()) {
                positionLeft = domElement.getAbsoluteLeft() - popupPanel.getOffsetWidth() + domElement.getOffsetWidth();
            }

            int positionTop = domElement.getAbsoluteTop();
            int outerTop = domElement.getAbsoluteTop() + popupPanel.getOffsetWidth();
            if (outerTop > Window.getClientHeight()) {
                positionTop = domElement.getAbsoluteTop() - popupPanel.getOffsetHeight() + domElement.getOffsetHeight();
            }
            popupPanel.setPopupPosition(positionLeft, positionTop);
        }
    });
}
项目:riscoss-corporate    文件:UserMenu.java   
public void show() {
    this.panel.setPopupPositionAndShow( new PositionCallback(){
        @Override
        public void setPosition( int offsetWidth, int offsetHeight )
        {

            panel.getElement().getStyle().setPosition( Position.FIXED );
            panel.getElement().getStyle().setTop( 0, Unit.PX );
            panel.getElement().getStyle().setRight( 0, Unit.PX );
            panel.getElement().getStyle().setProperty( "left", "" );
            panel.getElement().getStyle().setProperty( "bottom", "" );
        }
    } );
}
项目:google-apis-explorer    文件:EditorHelper.java   
/**
 * Show the specified popup panel below and to the right of the specified widget.
 */
public static void discloseLowerRight(final PopupPanel toDisclose, final Widget relativeTo) {
  toDisclose.setPopupPositionAndShow(new PositionCallback() {
    @Override
    public void setPosition(int offsetWidth, int offsetHeight) {
      int left = relativeTo.getAbsoluteLeft() + relativeTo.getOffsetWidth();
      int top = relativeTo.getAbsoluteTop() + relativeTo.getOffsetHeight();
      toDisclose.setPopupPosition(left, top);
    }
  });
}
项目:google-apis-explorer    文件:RequestBodyForm.java   
@UiHandler("switchEditorMenu")
void discloseSwitchEditorMenu(ClickEvent event) {
  menuPopup.setPopupPositionAndShow(new PositionCallback() {
    @Override
    public void setPosition(int offsetWidth, int offsetHeight) {
      int left =
          switchEditorMenu.getAbsoluteLeft() + switchEditorMenu.getOffsetWidth() - offsetWidth;
      int top = switchEditorMenu.getAbsoluteTop() + switchEditorMenu.getOffsetHeight();
      menuPopup.setPopupPosition(left, top);
    }
  });
}
项目:google-apis-explorer    文件:AuthView.java   
private void showScopeInfoPopup() {
  scopeInfoPopup.setPopupPositionAndShow(new PositionCallback() {
    @Override
    public void setPosition(int offsetWidth, int offsetHeight) {
      int left = discloseScopeInfo.getAbsoluteLeft() - offsetWidth
          + discloseScopeInfo.getOffsetWidth();
      int top = discloseScopeInfo.getAbsoluteTop() + discloseScopeInfo.getOffsetHeight();
      scopeInfoPopup.setPopupPosition(left, top);
    }
  });
}
项目:qafe-platform    文件:AbstractComponentRenderer.java   
public static void applyContextMenu(final Event event, ComponentGVO componentGVO, String uuid, String parent) {
    contextMenu = new PopupMenu();
    MenuItemGVO menuItemGVO = componentGVO.getMenu();
    if (menuItemGVO != null && menuItemGVO.getSubMenus() != null) {
        RendererHelper.fillIn(menuItemGVO, contextMenu, uuid, parent, componentGVO.getContext());

        for (int i = 0; i < menuItemGVO.getSubMenus().length; i++) {
            if (menuItemGVO.getSubMenus()[i].getSubMenus() != null && menuItemGVO.getSubMenus()[i].getSubMenus().length > 0) {
                MenuBar menu = new MenuBar(true);
                tempString = menuItemGVO.getSubMenus()[i].getDisplayname();
                processMenu(menu, menuItemGVO.getSubMenus()[i].getSubMenus(), menuItemGVO.getSubMenus()[i].getDisplayname(), uuid, parent);
            } else {
                MenuItem menuItem = new MenuItem(menuItemGVO.getSubMenus()[i].getDisplayname(), new Command() {
                    public void execute() {
                    }
                });
                RendererHelper.fillIn(menuItemGVO.getSubMenus()[i], menuItem, uuid, parent, componentGVO.getContext());
                contextMenu.addItem(menuItem);
            }
        }
    }
    contextMenu.setPopupPositionAndShow(new PositionCallback() {
        public void setPosition(int offsetWidth, int offsetHeight) {
            contextMenu.setPopupPosition(event.getClientX(), event.getClientY());
        }
    });
}
项目:opennmszh    文件:SuggestionComboboxViewImpl.java   
@Override
public void setData(List<NodeDetail> dataList) {
    m_dataList.setList(dataList);

    m_popupPanel.setPopupPositionAndShow(new PositionCallback() {

        @Override
        public void setPosition(int offsetWidth, int offsetHeight) {
            m_popupPanel.setWidth((getOffsetWidth() - 5) + "px");
            m_popupPanel.setPopupPosition(getAbsoluteLeft(), getAbsoluteTop() + 24);
        }
    });
}
项目:opennmszh    文件:KscComboboxViewImpl.java   
@Override
public void setDataList(List<KscReportDetail> dataList) {
    m_dataList.setList(dataList);

    m_popupPanel.setPopupPositionAndShow(new PositionCallback() {

        @Override
        public void setPosition(int offsetWidth, int offsetHeight) {
            m_popupPanel.setWidth((getOffsetWidth() - 5) + "px");
            m_popupPanel.setPopupPosition(getAbsoluteLeft(), getAbsoluteTop() + 24);
        }
    });
}
项目:geomajas-project-client-gwt2    文件:ExceptionDialog.java   
public void show() {
    clear();
    stackPanel.setHTML(new SafeHtmlBuilder().appendEscapedLines(stack).toSafeHtml());
    messageLabel.setText(message);
    messageLabel.setWordWrap(true);
    exceptionDialog.setPopupPositionAndShow(new PositionCallback() {

        @Override
        public void setPosition(int offsetWidth, int offsetHeight) {
            exceptionDialog.center();
        }
    });
    exceptionDialog.center();
}
项目:kie-wb-common    文件:PopupNumericBigIntegerEditCell.java   
@Override
protected void startEditing( final Context context,
                             final Element parent,
                             final BigInteger value ) {

    textBox.setValue( ( value == null ? "" : value.toString() ) );

    panel.setPopupPositionAndShow( new PositionCallback() {
        public void setPosition( int offsetWidth,
                                 int offsetHeight ) {
            panel.setPopupPosition( parent.getAbsoluteLeft()
                                            + offsetX,
                                    parent.getAbsoluteTop()
                                            + offsetY );

            // Focus the first enabled control
            Scheduler.get().scheduleDeferred( new ScheduledCommand() {

                public void execute() {
                    String text = textBox.getValue();
                    textBox.setFocus( true );
                    textBox.setCursorPos( text.length() );
                    textBox.setSelectionRange( 0,
                                               text.length() );
                }

            } );
        }
    } );

}
项目:kie-wb-common    文件:PopupNumericShortEditCell.java   
@Override
protected void startEditing( final Context context,
                             final Element parent,
                             final Short value ) {

    textBox.setValue( ( value == null ? "" : value.toString() ) );

    panel.setPopupPositionAndShow( new PositionCallback() {
        public void setPosition( int offsetWidth,
                                 int offsetHeight ) {
            panel.setPopupPosition( parent.getAbsoluteLeft()
                                            + offsetX,
                                    parent.getAbsoluteTop()
                                            + offsetY );

            // Focus the first enabled control
            Scheduler.get().scheduleDeferred( new ScheduledCommand() {

                public void execute() {
                    String text = textBox.getValue();
                    textBox.setFocus( true );
                    textBox.setCursorPos( text.length() );
                    textBox.setSelectionRange( 0,
                                               text.length() );
                }

            } );
        }
    } );

}
项目:kie-wb-common    文件:PopupNumericBigDecimalEditCell.java   
@Override
protected void startEditing( final Context context,
                             final Element parent,
                             final BigDecimal value ) {

    textBox.setValue( ( value == null ? "" : value.toPlainString() ) );

    panel.setPopupPositionAndShow( new PositionCallback() {
        public void setPosition( int offsetWidth,
                                 int offsetHeight ) {
            panel.setPopupPosition( parent.getAbsoluteLeft()
                                            + offsetX,
                                    parent.getAbsoluteTop()
                                            + offsetY );

            // Focus the first enabled control
            Scheduler.get().scheduleDeferred( new ScheduledCommand() {

                public void execute() {
                    String text = textBox.getValue();
                    textBox.setFocus( true );
                    textBox.setCursorPos( text.length() );
                    textBox.setSelectionRange( 0,
                                               text.length() );
                }

            } );
        }
    } );

}
项目:kie-wb-common    文件:PopupNumericLongEditCell.java   
@Override
protected void startEditing( final Context context,
                             final Element parent,
                             final Long value ) {

    textBox.setValue( ( value == null ? "" : value.toString() ) );

    panel.setPopupPositionAndShow( new PositionCallback() {
        public void setPosition( int offsetWidth,
                                 int offsetHeight ) {
            panel.setPopupPosition( parent.getAbsoluteLeft()
                                            + offsetX,
                                    parent.getAbsoluteTop()
                                            + offsetY );

            // Focus the first enabled control
            Scheduler.get().scheduleDeferred( new ScheduledCommand() {

                public void execute() {
                    String text = textBox.getValue();
                    textBox.setFocus( true );
                    textBox.setCursorPos( text.length() );
                    textBox.setSelectionRange( 0,
                                               text.length() );
                }

            } );
        }
    } );

}
项目:kie-wb-common    文件:PopupNumericDoubleEditCell.java   
@Override
protected void startEditing( final Context context,
                             final Element parent,
                             final Double value ) {

    textBox.setValue( ( value == null ? "" : value.toString() ) );

    panel.setPopupPositionAndShow( new PositionCallback() {
        public void setPosition( int offsetWidth,
                                 int offsetHeight ) {
            panel.setPopupPosition( parent.getAbsoluteLeft()
                                            + offsetX,
                                    parent.getAbsoluteTop()
                                            + offsetY );

            // Focus the first enabled control
            Scheduler.get().scheduleDeferred( new ScheduledCommand() {

                public void execute() {
                    String text = textBox.getValue();
                    textBox.setFocus( true );
                    textBox.setCursorPos( text.length() );
                    textBox.setSelectionRange( 0,
                                               text.length() );
                }

            } );
        }
    } );

}
项目:kie-wb-common    文件:PopupDateEditCell.java   
@Override
@SuppressWarnings("deprecation")
protected void startEditing( final Context context,
                             final Element parent,
                             final Date value ) {

    // Default date
    Date date = value;
    if ( value == null ) {
        Date d = new Date();
        int year = d.getYear();
        int month = d.getMonth();
        int dom = d.getDate();
        date = new Date( year,
                         month,
                         dom );
    }
    datePicker.setValue( date );

    panel.setPopupPositionAndShow( new PositionCallback() {
        public void setPosition( int offsetWidth,
                                 int offsetHeight ) {
            panel.setPopupPosition( parent.getAbsoluteLeft()
                                            + offsetX,
                                    parent.getAbsoluteTop()
                                            + offsetY );
        }
    } );

}
项目:kie-wb-common    文件:PopupTextEditCell.java   
@Override
protected void startEditing( final Context context,
                             final Element parent,
                             String value ) {

    textBox.setValue( value );

    panel.setPopupPositionAndShow( new PositionCallback() {
        public void setPosition( int offsetWidth,
                                 int offsetHeight ) {
            panel.setPopupPosition( parent.getAbsoluteLeft()
                                            + offsetX,
                                    parent.getAbsoluteTop()
                                            + offsetY );

            // Focus the first enabled control
            Scheduler.get().scheduleDeferred( new ScheduledCommand() {

                public void execute() {
                    String text = textBox.getValue();
                    textBox.setFocus( true );
                    textBox.setCursorPos( text.length() );
                    textBox.setSelectionRange( 0,
                                               text.length() );
                }

            } );
        }
    } );

}
项目:kie-wb-common    文件:PopupNumericEditCell.java   
@Override
protected void startEditing( final Context context,
                             final Element parent,
                             final BigDecimal value ) {

    textBox.setValue( ( value == null ? "" : value.toPlainString() ) );

    panel.setPopupPositionAndShow( new PositionCallback() {
        public void setPosition( int offsetWidth,
                                 int offsetHeight ) {
            panel.setPopupPosition( parent.getAbsoluteLeft()
                                            + offsetX,
                                    parent.getAbsoluteTop()
                                            + offsetY );

            // Focus the first enabled control
            Scheduler.get().scheduleDeferred( new ScheduledCommand() {

                public void execute() {
                    String text = textBox.getValue();
                    textBox.setFocus( true );
                    textBox.setCursorPos( text.length() );
                    textBox.setSelectionRange( 0,
                                               text.length() );
                }

            } );
        }
    } );

}
项目:kie-wb-common    文件:PopupNumericIntegerEditCell.java   
@Override
protected void startEditing( final Context context,
                             final Element parent,
                             final Integer value ) {

    textBox.setValue( ( value == null ? "" : value.toString() ) );

    panel.setPopupPositionAndShow( new PositionCallback() {
        public void setPosition( int offsetWidth,
                                 int offsetHeight ) {
            panel.setPopupPosition( parent.getAbsoluteLeft()
                                            + offsetX,
                                    parent.getAbsoluteTop()
                                            + offsetY );

            // Focus the first enabled control
            Scheduler.get().scheduleDeferred( new ScheduledCommand() {

                public void execute() {
                    String text = textBox.getValue();
                    textBox.setFocus( true );
                    textBox.setCursorPos( text.length() );
                    textBox.setSelectionRange( 0,
                                               text.length() );
                }

            } );
        }
    } );

}
项目:kie-wb-common    文件:PopupNumericByteEditCell.java   
@Override
protected void startEditing( final Context context,
                             final Element parent,
                             final Byte value ) {

    textBox.setValue( ( value == null ? "" : value.toString() ) );

    panel.setPopupPositionAndShow( new PositionCallback() {
        public void setPosition( int offsetWidth,
                                 int offsetHeight ) {
            panel.setPopupPosition( parent.getAbsoluteLeft()
                                            + offsetX,
                                    parent.getAbsoluteTop()
                                            + offsetY );

            // Focus the first enabled control
            Scheduler.get().scheduleDeferred( new ScheduledCommand() {

                public void execute() {
                    String text = textBox.getValue();
                    textBox.setFocus( true );
                    textBox.setCursorPos( text.length() );
                    textBox.setSelectionRange( 0,
                                               text.length() );
                }

            } );
        }
    } );

}
项目:kie-wb-common    文件:PopupDialectDropDownEditCell.java   
@Override
protected void startEditing( final Context context,
                             final Element parent,
                             final String value ) {

    // Select the appropriate item
    boolean emptyValue = ( value == null );
    if ( emptyValue ) {
        listBox.setSelectedIndex( 0 );
    } else {
        for ( int i = 0; i < listBox.getItemCount(); i++ ) {
            if ( listBox.getValue( i ).equals( value ) ) {
                listBox.setSelectedIndex( i );
                break;
            }
        }
    }

    panel.setPopupPositionAndShow( new PositionCallback() {
        public void setPosition( int offsetWidth,
                                 int offsetHeight ) {
            panel.setPopupPosition( parent.getAbsoluteLeft()
                                            + offsetX,
                                    parent.getAbsoluteTop()
                                            + offsetY );

            // Focus the first enabled control
            Scheduler.get().scheduleDeferred( new ScheduledCommand() {

                public void execute() {
                    listBox.setFocus( true );
                }

            } );
        }
    } );

}
项目:kie-wb-common    文件:PopupNumericFloatEditCell.java   
@Override
protected void startEditing( final Context context,
                             final Element parent,
                             final Float value ) {

    textBox.setValue( ( value == null ? "" : value.toString() ) );

    panel.setPopupPositionAndShow( new PositionCallback() {
        public void setPosition( int offsetWidth,
                                 int offsetHeight ) {
            panel.setPopupPosition( parent.getAbsoluteLeft()
                                            + offsetX,
                                    parent.getAbsoluteTop()
                                            + offsetY );

            // Focus the first enabled control
            Scheduler.get().scheduleDeferred( new ScheduledCommand() {

                public void execute() {
                    String text = textBox.getValue();
                    textBox.setFocus( true );
                    textBox.setCursorPos( text.length() );
                    textBox.setSelectionRange( 0,
                                               text.length() );
                }

            } );
        }
    } );

}
项目:OpenNMS    文件:SuggestionComboboxViewImpl.java   
@Override
public void setData(List<NodeDetail> dataList) {
    m_dataList.setList(dataList);

    m_popupPanel.setPopupPositionAndShow(new PositionCallback() {

        @Override
        public void setPosition(int offsetWidth, int offsetHeight) {
            m_popupPanel.setWidth((getOffsetWidth() - 5) + "px");
            m_popupPanel.setPopupPosition(getAbsoluteLeft(), getAbsoluteTop() + 24);
        }
    });
}
项目:OpenNMS    文件:SuggestionComboboxViewImpl.java   
@Override
public void setData(List<NodeDetail> dataList) {
    m_dataList.setList(dataList);

    m_popupPanel.setPopupPositionAndShow(new PositionCallback() {

        @Override
        public void setPosition(int offsetWidth, int offsetHeight) {
            m_popupPanel.setWidth((getOffsetWidth() - 5) + "px");
            m_popupPanel.setPopupPosition(getAbsoluteLeft(), getAbsoluteTop() + 24);
        }
    });
}
项目:OpenNMS    文件:KscComboboxViewImpl.java   
@Override
public void setDataList(List<KscReportDetail> dataList) {
    m_dataList.setList(dataList);

    m_popupPanel.setPopupPositionAndShow(new PositionCallback() {

        @Override
        public void setPosition(int offsetWidth, int offsetHeight) {
            m_popupPanel.setWidth((getOffsetWidth() - 5) + "px");
            m_popupPanel.setPopupPosition(getAbsoluteLeft(), getAbsoluteTop() + 24);
        }
    });
}
项目:OpenNMS    文件:KscComboboxViewImpl.java   
@Override
public void setDataList(List<KscReportDetail> dataList) {
    m_dataList.setList(dataList);

    m_popupPanel.setPopupPositionAndShow(new PositionCallback() {

        @Override
        public void setPosition(int offsetWidth, int offsetHeight) {
            m_popupPanel.setWidth((getOffsetWidth() - 5) + "px");
            m_popupPanel.setPopupPosition(getAbsoluteLeft(), getAbsoluteTop() + 24);
        }
    });
}
项目:daris    文件:GraphWidget.java   
private void setMouseOverNode(final Node n) {

        if (n == null) {
            _mouseOverNode = null;
            if (_toolTip != null) {
                _toolTip.hide();
            }
            return;
        }
        if (n == _mouseOverNode) {
            return;
        }
        if (_toolTip != null) {
            if (_toolTip.isShowing()) {
                _toolTip.hide();
            }
        }
        _mouseOverNode = n;
        _toolTip = new PopupPanel();
        _toolTip.setWidth(60);
        _toolTip.setHeight(30);

        MethodAndStep mas = n.data();
        HTML html = new HTML(mas.asHtmlString());
        html.fitToParent();
        html.setFontSize(10);
        html.setOpacity(0.9);
        html.setPadding(5);
        html.setBackgroundColour(new RGB(0xdd,0xdd,0xdd));
        html.setBorder(1, new RGB(0xf0,0xf0,0xf0));
        html.setBorderRadius(3);
        html.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {

                _toolTip.hide();
            }
        });
        _toolTip.setContent(html);
        _toolTip.setPopupPositionAndShow(new PositionCallback() {

            @Override
            public void setPosition(int offsetWidth, int offsetHeight) {

                int px = ((int) (_mouseOverNode.x() * _gc.width()))
                        + _gc.absoluteLeft();
                int py = ((int) ((_mouseOverNode.y() + _mouseOverNode.height()) * _gc
                        .height())) + _gc.absoluteTop();
                int cw = com.google.gwt.user.client.Window.getClientWidth();
                int ch = com.google.gwt.user.client.Window.getClientHeight();
                if (px + offsetWidth > cw) {
                    px = px - (px + offsetWidth - cw);
                }
                if (py + offsetHeight > ch) {
                    py = py - (py + offsetHeight - ch);
                }
                _toolTip.setPopupPosition(px, py);
            }
        });
        Timer t = new Timer() {
            @Override
            public void run() {
                if (_toolTip.isShowing()) {
                    _toolTip.hide();
                }
            }
        };
        t.schedule(3000);
    }
项目:daris    文件:CTypeFilterItem.java   
public void show() {
    if (_pp != null && _pp.isShowing()) {
        return;
    }
    int pLeft = _partner.getAbsoluteLeft();
    int pTop = _partner.getAbsoluteTop();
    int cw = com.google.gwt.user.client.Window.getClientWidth();
    int ch = com.google.gwt.user.client.Window.getClientHeight();
    if (_pp == null) {
        _pp = new PopupPanel();
        _pp.setPartner(_partner);
        _pp.setAutoHideEnabled(true);

        _pp.setBorder(1, new RGB(0xaa, 0xaa, 0xaa));
        _pp.setBackgroundColour(new RGB(0xf8, 0xf8, 0xf8));
        _pp.setBorderRadius(2);

        _pp.setWidth(DEFAULT_WIDTH <= cw - pLeft ? DEFAULT_WIDTH : cw - pLeft);
        _pp.setBoxShadow(2, 2, 4, 2, new RGBA(0, 0, 0, 0.3));

        _pp.setPopupPositionAndShow(new PositionCallback() {
            public void setPosition(int offsetWidth, int offsetHeight) {

                int x = _partner.absoluteLeft();
                int y = _partner.absoluteBottom();
                _pp.setPopupPosition(x, y);
            }
        });

        _pp.addCloseHander(new PopupCloseHandler() {
            public void closed(PopupPanel p) {
                _pp = null;
            }
        });

        _ap = new AbsolutePanel();
        _ap.fitToParent();
        _ap.add(new ResizeHandle(_ap, 15));
        _ap.add(_vp);
    }
    _pp.setContent(_ap);
    int h = DEFAULT_HEIGHT <= ch - pTop - 28 ? DEFAULT_HEIGHT : ch - pTop - 28;
    _pp.setHeight(h);
}
项目:daris    文件:MessageBox.java   
private static void display(Type type, final BasePoint bp, String title, String message, int seconds) {

        if (_pp != null) {
            _pp.hide();
        }
        _pp = new PopupPanel();
        _pp.setAutoHideEnabled(true);
        // _pp.setWidth(MIN_WIDTH);
        // _pp.setHeight(MIN_HEIGHT);

        VerticalPanel vp = new VerticalPanel();
        vp.fitToParent();
        vp.setPadding(5);
        vp.setOpacity(0.9);
        vp.setBackgroundColour(new RGB(0x99, 0x99, 0x99));
        vp.setBorder(1, new RGB(0xee, 0xee, 0xee));
        vp.setBorderRadius(3);

        HorizontalPanel hp1 = new HorizontalPanel();
        hp1.setHeight(22);
        hp1.setPaddingLeft(5);
        vp.add(hp1);

        HTML titleHtml = new HTML(title);
        titleHtml.setHeight100();
        titleHtml.setFontSize(12);
        titleHtml.setFontWeight(FontWeight.BOLD);
        hp1.add(titleHtml);

        HorizontalPanel hp2 = new HorizontalPanel();
        hp2.fitToParent();
        vp.add(hp2);

        Image icon = iconFor(type);
        hp2.add(icon);

        HTML messageHtml = new HTML(message);
        hp2.add(messageHtml);

        _pp.setContent(vp);
        _pp.setPopupPositionAndShow(new PositionCallback() {

            @Override
            public void setPosition(int offsetWidth, int offsetHeight) {

                int clientWidth = com.google.gwt.user.client.Window.getClientWidth();
                int clientHeight = com.google.gwt.user.client.Window.getClientHeight();
                int tlx = bp.topLeftX(offsetWidth, offsetHeight, clientWidth, clientHeight);
                int tly = bp.topLeftY(offsetWidth, offsetHeight, clientWidth, clientHeight);
                _pp.setPopupPosition(tlx, tly);
            }
        });
        _pp.show();
        final PopupPanel pp = _pp;
        Timer timer = new Timer() {
            @Override
            public void run() {

                pp.hide();
                cancel();
            }
        };
        timer.schedule(seconds * 1000);
    }
项目:kie-wb-common    文件:AbstractProxyPopupDropDownEditCell.java   
@Override
protected void startEditing(final Context context,
                            final Element parent,
                            final C value) {

    //We need to get the list of potential values for the enumeration. Since the content 
    //of the list may be different for each cell (dependent enumerations) the list
    //has to be populated "on demand". 
    DropDownData dd = dmo.getEnums(this.factType,
                                   this.factField,
                                   this.dropDownManager.getCurrentValueMap(context));
    if (dd == null) {
        //If no enumeration exists show a TextBox
        delegate = singleValueEditor;
        delegate.setValue(value);
        vPanel.clear();
        vPanel.add(delegate.asWidget());
    } else {
        //Otherwise show a drop-down list box
        delegate = multipleValueEditor;
        delegate.setDropDownData(dd);
        vPanel.clear();
        vPanel.add(delegate.asWidget());
    }
    delegate.startEditing(context,
                          parent,
                          value);

    panel.setPopupPositionAndShow(new PositionCallback() {
        public void setPosition(int offsetWidth,
                                int offsetHeight) {
            panel.setPopupPosition(parent.getAbsoluteLeft()
                                           + offsetX,
                                   parent.getAbsoluteTop()
                                           + offsetY);

            // Focus the first enabled control
            Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                public void execute() {
                    delegate.setFocus(true);
                }
            });
        }
    });
}
项目:kie-wb-common    文件:PopupDropDownEditCell.java   
@Override
protected void startEditing(final Context context,
                            final Element parent,
                            final String value) {

    //We need to get the list of potential values for the enumeration. Since the content 
    //of the list may be different for each cell (dependent enumerations) the list
    //has to be populated "on demand". 
    DropDownData dd = dmo.getEnums(this.factType,
                                   this.factField,
                                   this.dropDownManager.getCurrentValueMap(context));
    if (dd == null) {
        return;
    }

    utilities.setDropDownData(value,
                              dd,
                              isMultipleSelect,
                              dmo.getResourcePath(),
                              listBox);

    // Select the appropriate item
    boolean emptyValue = (value == null);
    if (emptyValue) {
        listBox.setSelectedIndex(0);
    } else {
        if (listBox.isMultipleSelect()) {
            final List<String> values = Arrays.asList(value.split(","));
            for (int i = 0; i < listBox.getItemCount(); i++) {
                listBox.setItemSelected(i,
                                        values.contains(listBox.getValue(i)));
            }
        } else {
            for (int i = 0; i < listBox.getItemCount(); i++) {
                if (listBox.getValue(i).equals(value)) {
                    listBox.setSelectedIndex(i);
                    break;
                }
            }
        }
    }

    panel.setPopupPositionAndShow(new PositionCallback() {
        public void setPosition(int offsetWidth,
                                int offsetHeight) {
            panel.setPopupPosition(parent.getAbsoluteLeft()
                                           + offsetX,
                                   parent.getAbsoluteTop()
                                           + offsetY);

            // Focus the first enabled control
            Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                public void execute() {
                    listBox.setFocus(true);
                }
            });
        }
    });
}
项目:kie-wb-common    文件:PopupValueListDropDownEditCell.java   
@Override
protected void startEditing( final Context context,
                             final Element parent,
                             final String value ) {

    // Select the appropriate item
    boolean emptyValue = (value == null);
    if ( emptyValue ) {
        listBox.setSelectedIndex( 0 );
    } else {
        if ( listBox.isMultipleSelect() ) {
            final List<String> values = Arrays.asList( value.split( "," ) );
            for (int i = 0; i < listBox.getItemCount(); i++) {
                listBox.setItemSelected( i,
                                         values.contains( listBox.getValue( i ) ) );
            }

        } else {
            for (int i = 0; i < listBox.getItemCount(); i++) {
                if ( listBox.getValue( i ).equals( value ) ) {
                    listBox.setSelectedIndex( i );
                    break;
                }
            }
        }
    }

    panel.setPopupPositionAndShow( new PositionCallback() {
        public void setPosition( int offsetWidth,
                                 int offsetHeight ) {
            panel.setPopupPosition( parent.getAbsoluteLeft()
                                            + offsetX,
                                    parent.getAbsoluteTop()
                                            + offsetY );

            // Focus the first enabled control
            Scheduler.get().scheduleDeferred( new ScheduledCommand() {

                public void execute() {
                    listBox.setFocus( true );
                }

            } );
        }
    } );

}