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

项目:unitimes    文件:UniTimeTable.java   
public UniTimeTable() {
    setCellPadding(2);
    setCellSpacing(0);
    sinkEvents(Event.ONMOUSEOVER);
    sinkEvents(Event.ONMOUSEOUT);
    sinkEvents(Event.ONCLICK);
    sinkEvents(Event.ONKEYDOWN);
    sinkEvents(Event.ONDBLCLICK);
    setStylePrimaryName("unitime-MainTable");
    iHintPanel = new PopupPanel();
    iHintPanel.setStyleName("unitime-PopupHint");
    Roles.getGridRole().set(getElement());
}
项目:unitimes    文件:HorizontalPanelWithHint.java   
public HorizontalPanelWithHint(Widget hint) {
    super();
    iHint = new PopupPanel();
    iHint.setWidget(hint);
    iHint.setStyleName("unitime-PopupHint");
    sinkEvents(Event.ONMOUSEOVER);
    sinkEvents(Event.ONMOUSEOUT);
    sinkEvents(Event.ONMOUSEMOVE);
    iShowHint = new Timer() {
        @Override
        public void run() {
            iHint.show();
        }
    };
    iHideHint = new Timer() {
        @Override
        public void run() {
            iHint.hide();
        }
    };
}
项目:unitimes    文件:UniTimeTableHeader.java   
public UniTimeTableHeader(String title, int colSpan, HorizontalAlignmentConstant align) {
    super(title, false);
    iColSpan = colSpan;
    iAlign = align;
    iTitle = title;

    addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            final PopupPanel popup = new PopupPanel(true);
            popup.addStyleName("unitime-Menu");
            if (!setMenu(popup)) return;
            popup.showRelativeTo((Widget)event.getSource());
            ((MenuBar)popup.getWidget()).focus();
        }
    });
}
项目:unitimes    文件:TimeGrid.java   
public SelectionLayer() {
    setStyleName("selection-layer");

    iPopup = new PopupPanel();
    iPopup.setStyleName("unitime-TimeGridSelectionPopup");
    iHint = new P("content");
    iPopup.setWidget(iHint);

    iSelection = new SelectionPanel();
    iSelection.setVisible(false);
    add(iSelection, 0, 0);

    sinkEvents(Event.ONMOUSEDOWN);
    sinkEvents(Event.ONMOUSEUP);
    sinkEvents(Event.ONMOUSEMOVE);
    sinkEvents(Event.ONMOUSEOVER);
    sinkEvents(Event.ONMOUSEOUT);
}
项目:appinventor-extensions    文件:AdditionalChoicePropertyEditor.java   
/**
 * Opens the additional choice dialog.
 */
protected void openAdditionalChoiceDialog() {
  popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
    public void setPosition(int offsetWidth, int offsetHeight){
      // adjust the x and y positions so that the entire panel
      // is on-screen
      int xPosition = getAbsoluteLeft();
      int yPosition = getAbsoluteTop();
      int xExtrude =
        xPosition + offsetWidth - Window.getClientWidth() - Window.getScrollLeft();
      int yExtrude =
        yPosition + offsetHeight - Window.getClientHeight() - Window.getScrollTop();
      if (xExtrude > 0) {
        xPosition -= (xExtrude + ADDITIONAL_CHOICE_ONSCREEN_PADDING);
      }
      if (yExtrude > 0) {
        yPosition -= (yExtrude + ADDITIONAL_CHOICE_ONSCREEN_PADDING);
      }
      popup.setPopupPosition(xPosition, yPosition);
    }
  });
}
项目:vaadin-combobox-multiselect    文件:VComboBoxMultiselect.java   
@Override
public void onClose(CloseEvent<PopupPanel> event) {
    debug("VComboBoxMultiselect.SP: onClose(" + event.isAutoClosed() + ")");

    if (event.isAutoClosed()) {
        this.lastAutoClosed = new Date().getTime();
    }
}
项目:LAS    文件:ColumnEditorWidget.java   
@Override
public void onResponseReceived(Request request, Response response) {
    String text = response.getText();
    PopupPanel popup = new PopupPanel(true);
    popup.add(new HTML("<strong>Saved edits for:<p></p></strong>"+text+"<p></p>Click outside box to dismiss."));
    popup.setPopupPosition(200, Window.getClientHeight()/3);
    popup.show();
    CellFormatter formatter = datatable.getCellFormatter();
    for (Iterator dirtyIt = dirtyrows.keySet().iterator(); dirtyIt.hasNext();) {
        Integer widgetrow = (Integer) dirtyIt.next();
        for (int i = 0; i < headers.length; i++) {
            formatter.removeStyleName(widgetrow, i, "dirty");
        }

        CheckBox box = (CheckBox) datatable.getWidget(widgetrow, 0);
        box.setValue(false);
    }
    dirtyrows.clear();
}
项目:LAS    文件:DropDown.java   
public DropDown() {
    current = new FlexTable();
    current.addStyleName("datatable");
    itemlist = new FlexTable();
    dropdown = new PopupPanel(true);
    scroller = new ScrollPanel();
    scroller.add(itemlist);
    dropdown.add(scroller);
    down =new HTML(" &#9660;");
    down.addStyleName("current-item");
    initWidget(current);
    HTML load = new HTML("loading...");
    load.addStyleName("current-item");
    current.setWidget(0, 0, load);
    current.setWidget(0, 1, down);
    current.addClickHandler(show);
}
项目:cuba    文件:CubaTreeWidget.java   
protected void showContextMenuPopup(int left, int top) {
    if (customContextMenu instanceof HasWidgets) {
        if (!((HasWidgets) customContextMenu).iterator().hasNext()) {
            // there are no actions to show
            return;
        }
    }

    customContextMenuPopup = Tools.createCubaTableContextMenu();
    customContextMenuPopup.setOwner(this);
    customContextMenuPopup.setWidget(customContextMenu);

    customContextMenuPopup.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
            customContextMenuPopup = null;
        }
    });

    Tools.showPopup(customContextMenuPopup, left, top);
}
项目:x-cure-chat    文件:SiteManagerUI.java   
public void closeAllRegisteredPopups() {
    //Set the closing all marker
    isCloseAllPopupInProgress = true;
    //Iterate through all the popups and close them, Iterate the list backwards
    //because we typically have a stack of dialog windows that are open
    ListIterator<PopupPanel> iterWindows = openedPopUps.listIterator( openedPopUps.size() );
    while( iterWindows.hasPrevious() ) {
        try {
            iterWindows.previous().hide();
        } catch( Throwable e) {
            //DO nothing if the exceptions happened then we window is probably already closed or smth.
        }
    }
    //Clear the list of popups
    openedPopUps.clear();
    //Remove the closing all marker
    isCloseAllPopupInProgress = false;
}
项目:x-cure-chat    文件:SendMessageDialogUI.java   
/**
 * The constructor that has to be used when we send
 * a message to a particular user 
 * @param parentDialog the parent dialog, i.e. the one we open this dialog from
 * @param toUserID the ID of the user we send the message to
 * @param toUserLoginName the login name of the user we send the message to
 * @param replyMsgData if not null then this is the message we reply to
 */
public SendMessageDialogUI( final DialogBox parentDialog, final int toUserID,
                            final String toUserLoginName, final PrivateMessageData replyMsgData) {
    super( true, false, true, parentDialog );

    //Store the local value of the message we reply to
    this.replyMsgData = replyMsgData;

    //Increment the number of opened send message dialogs
    openSendMessageDialogCounter++;
    this.addCloseHandler( new CloseHandler<PopupPanel>(){
        public void onClose( CloseEvent<PopupPanel> e ) {
            if( e.getTarget() == thisDialog ) {
                //The send message is closed, decrement the number of
                //opened send message dialogs
                if( openSendMessageDialogCounter > 0 ) {
                    openSendMessageDialogCounter--;
                }
            }
        }
    } );

    //Set the message recepient
    setMessageRecepient(toUserID, toUserLoginName);

    //Set title and style
    this.setText(titlesI18N.sendPersonalMessageDialogTitle() );
    this.setStyleName( CommonResourcesContainer.USER_DIALOG_STYLE_NAME );

    //Fill dialog with data
    populateDialog();       
}
项目:gwt-chronoscope    文件:GwtView.java   
/**
 * Opens an HTML popup info window at the given screen coordinates (within the
 * plot bounds)
 * 
 * It sets the same font family, size, color and bgcolor defined for markers, if
 * you wanted override them use the css selector div.chrono-infoWindow-content.
 * 
 * FIXME: (MCM) this should be a unique instance of popup: ask Shawn
 */
public InfoWindow createInfoWindow(String html, double x, double y) {
  final PopupPanel pp = new DecoratedPopupPanel(true);
  pp.addStyleName("chrono-infoWindow");
  Widget content = new HTML(html);
  content.setStyleName("chrono-infoWindow-content");
  pp.setWidget(content);
  pp.setPopupPosition(getElement().getAbsoluteLeft() + (int)x, getElement().getAbsoluteTop() + (int)y);

  GssProperties markerProperties = gssContext.getPropertiesBySelector("marker");
  if (markerProperties != null) {
    pp.getElement().getStyle().setBackgroundColor(markerProperties.bgColor.toString());
    pp.getElement().getStyle().setColor(markerProperties.color.toString());
    pp.getElement().getStyle().setProperty("fontFamily", markerProperties.fontFamily.toString());
    pp.getElement().getStyle().setProperty("fontSize", markerProperties.fontSize.toString());
    pp.getElement().getStyle().setPadding(5, Unit.PX);
  }
  pp.getElement().getStyle().setZIndex(9999);
  pp.show();

  return new BrowserInfoWindow(this, pp);
}
项目:aggregate    文件:AccessConfigurationSheet.java   
@Override
public void execute(UserSecurityInfo object) {
  if (isUiOutOfSyncWithServer()) {
    Window
        .alert("Unsaved changes exist. "
            + "\nPlease save changes, or reset the changes by refreshing the screen.\nThen you may change passwords.");
    return;
  }

  final PopupPanel popup = new ChangePasswordPopup(object);
  popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
    @Override
    public void setPosition(int offsetWidth, int offsetHeight) {
      int left = ((Window.getScrollLeft() + Window.getClientWidth() - offsetWidth) / 2);
      int top = ((Window.getScrollTop() + Window.getClientHeight() - offsetHeight) / 2);
      popup.setPopupPosition(left, top);
    }
  });
}
项目:hawkbit    文件:SuggestionsSelectList.java   
/**
 * Adds suggestions to the suggestion menu bar.
 * 
 * @param suggestions
 *            the suggestions to be added
 * @param textFieldWidget
 *            the text field which the suggestion is attached to to bring
 *            back the focus after selection
 * @param popupPanel
 *            pop-up panel where the menu bar is shown to hide it after
 *            selection
 * @param suggestionServerRpc
 *            server RPC to ask for new suggestion after a selection
 */
public void addItems(final List<SuggestTokenDto> suggestions, final VTextField textFieldWidget,
        final PopupPanel popupPanel, final TextFieldSuggestionBoxServerRpc suggestionServerRpc) {
    for (int index = 0; index < suggestions.size(); index++) {
        final SuggestTokenDto suggestToken = suggestions.get(index);
        final MenuItem mi = new MenuItem(suggestToken.getSuggestion(), true, new ScheduledCommand() {
            @Override
            public void execute() {
                final String tmpSuggestion = suggestToken.getSuggestion();
                final TokenStartEnd tokenStartEnd = tokenMap.get(tmpSuggestion);
                final String text = textFieldWidget.getValue();
                final StringBuilder builder = new StringBuilder(text);
                builder.replace(tokenStartEnd.getStart(), tokenStartEnd.getEnd() + 1, tmpSuggestion);
                textFieldWidget.setValue(builder.toString(), true);
                popupPanel.hide();
                textFieldWidget.setFocus(true);
                suggestionServerRpc.suggest(builder.toString(), textFieldWidget.getCursorPos());
            }
        });
        tokenMap.put(suggestToken.getSuggestion(),
                new TokenStartEnd(suggestToken.getStart(), suggestToken.getEnd()));
        Roles.getListitemRole().set(mi.getElement());
        WidgetUtil.sinkOnloadForImages(mi.getElement());
        addItem(mi);
    }
}
项目:che    文件:QuickDocViewImpl.java   
@Inject
public QuickDocViewImpl() {
  super(true, true);
  addCloseHandler(
      new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
          if (delegate != null) {
            delegate.onCloseView();
          }
        }
      });

  setSize("400px", "200px");
  Style style = getElement().getStyle();
  style.setProperty("resize", "both");
  style.setPaddingBottom(0, Style.Unit.PX);
  style.setPaddingTop(3, Style.Unit.PX);
  style.setPaddingLeft(3, Style.Unit.PX);
  style.setPaddingRight(3, Style.Unit.PX);
  createFrame();
  add(frame);
}
项目:firefly    文件:BackgroundManager.java   
private void animationIconCSS(int mills, int startX, int startY) {
    Image icon = new Image(ONE_GEAR_ICON_LARGE);
    final PopupPanel popup= new PopupPanel();
    popup.setStyleName("");
    popup.addStyleName("animationLevel");
    popup.setAnimationEnabled(false);
    popup.setWidget(icon);
    Widget w= button.getIcon()!=null ? button.getIcon() : button;
    int endX= w.getAbsoluteLeft();
    int endY= w.getAbsoluteTop();
    setupCssAnimation(startX,startY,endX,endY);
    int extra= 35;
    CssAnimation.setAnimationStyle(popup,"iconAnimate "+ (mills+extra) +"ms ease-in-out 1 normal");
    popup.setPopupPosition(endX, endY);
    popup.show();
    Timer t= new Timer() {
        @Override
        public void run() {
            popup.hide();
        }
    };
    t.schedule( mills);
}
项目:gerrit    文件:GlobalKey.java   
public static void dialog(PopupPanel panel) {
  initEvents();
  initDialog();
  assert panel.isShowing();
  assert active == global;
  active = new State(panel);
  active.add(new HidePopupPanelCommand(0, KeyCodes.KEY_ESCAPE, panel));
  panel.addCloseHandler(restoreGlobal);
  panel.addDomHandler(
      new KeyDownHandler() {
        @Override
        public void onKeyDown(KeyDownEvent event) {
          if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
            panel.hide();
          }
        }
      },
      KeyDownEvent.getType());
}
项目:gerrit    文件:PopupHelper.java   
void show() {
  final PopupPanel p = new PopupPanel(true);
  p.setStyleName(Resources.I.style().popup());
  p.addAutoHidePartner(activatingButton.getElement());
  p.addCloseHandler(
      new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
          activatingButton.unlink();
          if (popup == p) {
            popup = null;
          }
        }
      });
  p.add(panel);
  p.showRelativeTo(activatingButton);
  GlobalKey.dialog(p);
  popup = p;
}
项目:gerrit    文件:ProjectListPopup.java   
protected PopupPanel.PositionCallback getPositionCallback() {
  return new PopupPanel.PositionCallback() {
    @Override
    public void setPosition(int offsetWidth, int offsetHeight) {
      if (preferredTop + offsetHeight > Window.getClientWidth()) {
        preferredTop = Window.getClientWidth() - offsetHeight;
      }
      if (preferredLeft + offsetWidth > Window.getClientWidth()) {
        preferredLeft = Window.getClientWidth() - offsetWidth;
      }

      if (preferredTop < 0) {
        sp.setHeight((sp.getOffsetHeight() + preferredTop) + "px");
        preferredTop = 0;
      }
      if (preferredLeft < 0) {
        sp.setWidth((sp.getOffsetWidth() + preferredLeft) + "px");
        preferredLeft = 0;
      }

      popup.setPopupPosition(preferredLeft, preferredTop);
    }
  };
}
项目:gerrit    文件:ActionMessageBox.java   
void show() {
  if (popup != null) {
    popup.hide();
    popup = null;
    return;
  }

  final PopupPanel p = new PopupPanel(true);
  p.setStyleName(style.popup());
  p.addAutoHidePartner(activatingButton.getElement());
  p.addCloseHandler(
      new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
          if (popup == p) {
            popup = null;
          }
        }
      });
  p.add(this);
  p.showRelativeTo(activatingButton);
  GlobalKey.dialog(p);
  message.setFocus(true);
  popup = p;
}
项目:unitime    文件:HorizontalPanelWithHint.java   
public HorizontalPanelWithHint(Widget hint) {
    super();
    iHint = new PopupPanel();
    iHint.setWidget(hint);
    iHint.setStyleName("unitime-PopupHint");
    sinkEvents(Event.ONMOUSEOVER);
    sinkEvents(Event.ONMOUSEOUT);
    sinkEvents(Event.ONMOUSEMOVE);
    iShowHint = new Timer() {
        @Override
        public void run() {
            iHint.show();
        }
    };
    iHideHint = new Timer() {
        @Override
        public void run() {
            iHint.hide();
        }
    };
}
项目:unitime    文件:UniTimeTableHeader.java   
public UniTimeTableHeader(String title, int colSpan, HorizontalAlignmentConstant align) {
    super(title, false);
    iColSpan = colSpan;
    iAlign = align;
    iTitle = title;

    addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            final PopupPanel popup = new PopupPanel(true);
            popup.addStyleName("unitime-Menu");
            if (!setMenu(popup)) return;
            popup.showRelativeTo((Widget)event.getSource());
            ((MenuBar)popup.getWidget()).focus();
        }
    });
}
项目:unitime    文件:TimeGrid.java   
public SelectionLayer() {
    setStyleName("selection-layer");

    iPopup = new PopupPanel();
    iPopup.setStyleName("unitime-TimeGridSelectionPopup");
    iHint = new P("content");
    iPopup.setWidget(iHint);

    iSelection = new SelectionPanel();
    iSelection.setVisible(false);
    add(iSelection, 0, 0);

    sinkEvents(Event.ONMOUSEDOWN);
    sinkEvents(Event.ONMOUSEUP);
    sinkEvents(Event.ONMOUSEMOVE);
    sinkEvents(Event.ONMOUSEOVER);
    sinkEvents(Event.ONMOUSEOUT);
}
项目:appformer    文件:UberfireColumnPicker.java   
public Button createToggleButton() {
    final Button button = GWT.create(Button.class);
    button.addStyleName(UFTableResources.INSTANCE.CSS().columnPickerButton());
    button.setDataToggle(Toggle.BUTTON);
    button.setIcon(IconType.LIST_UL);
    button.setTitle(CommonConstants.INSTANCE.ColumnPickerButtonTooltip());

    popup.addStyleName(UFTableResources.INSTANCE.CSS().columnPickerPopup());
    popup.addAutoHidePartner(button.getElement());
    popup.addCloseHandler(new CloseHandler<PopupPanel>() {
        public void onClose(CloseEvent<PopupPanel> popupPanelCloseEvent) {
            if (popupPanelCloseEvent.isAutoClosed()) {
                button.setActive(false);
            }
        }
    });

    button.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            if (!button.isActive()) {
                showColumnPickerPopup(button.getAbsoluteLeft() + button.getOffsetWidth(),
                                      button.getAbsoluteTop() + button.getOffsetHeight());
            } else {
                popup.hide(false);
            }
        }
    });
    return button;
}
项目:google-apis-explorer    文件:AuthView.java   
public AuthView(AuthManager authManager, ApiService service, AnalyticsManager analytics) {
  initWidget(uiBinder.createAndBindUi(this));

  this.presenter = new AuthPresenter(service, authManager, analytics, this);

  serviceName.setText(service.displayTitle());

  // Unless you show then hide popup windows they do not initialize properly.
  scopePopup.show();
  scopePopup.hide();

  scopeInfoPopup.show();
  scopeInfoPopup.hide();

  scopeInfoPopup.addCloseHandler(new CloseHandler<PopupPanel>() {
    @Override
    public void onClose(CloseEvent<PopupPanel> event) {
      GWT.log("Handler for closing popup.");
      clickedToDiscloseScopeInfo = false;
    }
  });
}
项目:atom    文件:Frame.java   
public void deliverError(ValidationError ve) {
    AtomTools.log(Level.FINE, "Frame.deliverError using generic implementation", this);

    final PopupPanel popupPanel = new PopupPanel(false);
    popupPanel.getElement().getStyle().setZIndex(1000);
    VerticalPanel popUpPanelContents = new VerticalPanel();
    popupPanel.setTitle("Error");
    HTML message = new HTML(ve.getMessage());
    Button button = new Button("Close", new ClickHandler() {

        public void onClick(ClickEvent event) {
            popupPanel.hide();
        }
    });
    SimplePanel holder = new SimplePanel();
    holder.add(button);
    popUpPanelContents.add(message);
    popUpPanelContents.add(holder);
    popupPanel.setWidget(popUpPanelContents);
    popupPanel.center();
}
项目:openchemlib-js    文件:AbstractTypeAction.java   
private synchronized void createPopup(final Window parent, Point2D pt, int row)
{

    if (popup == null || !popup.isShowing()) {
        popup = createPane();
        popup.setModal(true);
        popup.setPopupPositionAndShow(new PopupPanel.PositionCallback()
        {
            public void setPosition(int offsetWidth, int offsetHeight)
            {
                int left = parent.getNative().getAbsoluteLeft() + (int) ToolBar.IMAGE_WIDTH;
                int top = parent.getNative().getAbsoluteTop() + (int) (ToolBar.IMAGE_HEIGHT*scale / ToolBar.ROWS * 3);
                popup.setPopupPosition(left, top);
                popup.requestLayout();

            }
        });
    }
}
项目:gwtbootstrap3    文件:SuggestBox.java   
/**
 * Resize the popup panel to the size of the suggestBox and place it below the SuggestBox. This is not
 * ideal but works better in a mobile environment.
 *
 * @param box the box the SuggestBox.
 */
private void resizePopup(final com.google.gwt.user.client.ui.SuggestBox box) {
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            PopupPanel panel = getPopupPanel();
            if (box.isAttached())
            {
              Element e = box.getElement();
              panel.setWidth((e.getAbsoluteRight() - e.getAbsoluteLeft() - 2) + Unit.PX.getType());
              panel.setPopupPosition(e.getAbsoluteLeft(), e.getAbsoluteBottom());
            }
            else
            {
              panel.hide();
            }  
        }
    });
}
项目:vaadin-overlays    文件:CustomOverlayWidget.java   
/**
 * The constructor should first call super() to initialize the component and
 * then handle any initialization relevant to Vaadin.
 */
public CustomOverlayWidget() {
    setWidget(new HTML()); // Seems that we need this one
    overlay = new PopupPanel();
    overlay.addStyleName(CLASSNAME);
    overlay.setAutoHideEnabled(false);
    overlay.setAnimationEnabled(false);
    overlay.setModal(false);

    Event.addNativePreviewHandler(new NativePreviewHandler() {
        public void onPreviewNativeEvent(NativePreviewEvent event) {
            int typeInt = event.getTypeInt();
            // We're only listening for these
            if (typeInt == Event.ONSCROLL) {
                CustomOverlayWidget.this.updateOverlayPosition();
            }
        }
    });
}
项目:rosa    文件:MultiLineTextDisplayElement.java   
public MultiLineTextDisplayElement(String id, int x, int y, int width, int height,
        String text, String label, int[][] coords) {
    super(id, x, y, width, height);
    this.coords = coords;
    this.label = label;
    this.text = text;

    popup = new PopupPanel(true, false);
    HTML content = new HTML(text);

    popup.setStylePrimaryName("PopupPanel");
    popup.addStyleName("AnnotationPopup");
    popup.setWidget(content);

 // Create a canvas containing the filled polygon with no border
    Canvas sub_canvas = Canvas.createIfSupported();
    sub_canvas.setCoordinateSpaceWidth(width);
    sub_canvas.setCoordinateSpaceHeight(height);

    Context2d context = sub_canvas.getContext2d();
    context.beginPath();
    context.moveTo(coords[0][0] - baseLeft(), coords[0][1] - baseTop());

    for (int i = 1; i < coords.length; i++) {
        context.lineTo(coords[i][0] - baseLeft(), coords[i][1] - baseTop());
    }

    context.setFillStyle(color_fill);
    context.fill();

    context.closePath();

    this.image_data = context.getImageData(0, 0, width, height);
}
项目:rosa    文件:MultiLineTextDisplayElement.java   
@Override
public boolean doElementAction(final int x, final int y) {
    if (never_show) {
        return false;
    }

    popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
        int left = x;
        int top = y;

        public void setPosition(int width, int height) {
            if (left + width > Window.getClientWidth()) {
                left = Window.getClientWidth() - width;
            }

            if (top + height > Window.getClientHeight()) {
                top = Window.getClientHeight() - height;
            }

            popup.setPopupPosition(left, top);
        }
    });

    return true;
}
项目:gwittir    文件:PopupValidationFeedback.java   
public void resolve(Object source) {
    PopupPanel p = (PopupPanel) popups.get( source );
    if( p != null ){
        p.hide();
        popups.remove( source );
        if( listeners.containsKey( source ) ){
            try{
                ((SourcesPropertyChangeEvents) source)
                .removePropertyChangeListener("attach", 
                        (PropertyChangeListener) listeners.remove(source) );
                ((SourcesPropertyChangeEvents) source)
                .removePropertyChangeListener("visible",
                        (PropertyChangeListener) listeners.remove(source));

            } catch(RuntimeException re){
                re.printStackTrace();
            }
        }
    }
}
项目:gwtmockito    文件:GwtMockitoWidgetBaseClassesTest.java   
@Test
public void testPanels() throws Exception {
  invokeAllAccessibleMethods(new AbsolutePanel() {});
  invokeAllAccessibleMethods(new CellPanel() {});
  invokeAllAccessibleMethods(new ComplexPanel() {});
  invokeAllAccessibleMethods(new DeckLayoutPanel() {});
  invokeAllAccessibleMethods(new DeckPanel() {});
  invokeAllAccessibleMethods(new DecoratorPanel() {});
  invokeAllAccessibleMethods(new DockLayoutPanel(Unit.PX) {});
  invokeAllAccessibleMethods(new DockPanel() {});
  invokeAllAccessibleMethods(new FlowPanel() {});
  invokeAllAccessibleMethods(new FocusPanel() {});
  invokeAllAccessibleMethods(new HorizontalPanel() {});
  invokeAllAccessibleMethods(new HTMLPanel("") {});
  invokeAllAccessibleMethods(new LayoutPanel() {});
  invokeAllAccessibleMethods(new PopupPanel() {});
  invokeAllAccessibleMethods(new RenderablePanel("") {});
  invokeAllAccessibleMethods(new ResizeLayoutPanel() {});
  invokeAllAccessibleMethods(new SimpleLayoutPanel() {});
  invokeAllAccessibleMethods(new SimplePanel() {});
  invokeAllAccessibleMethods(new SplitLayoutPanel() {});
  invokeAllAccessibleMethods(new StackPanel() {});
  invokeAllAccessibleMethods(new VerticalPanel() {});
}
项目:unitimes    文件:CurriculaCourses.java   
public void addBlankLine() {
    List<Widget> line = new ArrayList<Widget>();

    HorizontalPanel hp = new HorizontalPanel();
    line.add(hp);

    CurriculaCourseSelectionBox cx = new CurriculaCourseSelectionBox();
    cx.setWidth("130px");
    cx.addCourseSelectionHandler(iCourseChangedHandler);
    if (cx.getCourseFinder() instanceof HasOpenHandlers)
        ((HasOpenHandlers<PopupPanel>)cx.getCourseFinder()).addOpenHandler(new OpenHandler<PopupPanel>() {
            @Override
            public void onOpen(OpenEvent<PopupPanel> event) {
                iTable.clearHover();
            }
        });
    if (!iEditable) cx.setEnabled(false);
    line.add(cx);

    for (int col = 0; col < iClassifications.getClassifications().size(); col++) {
        ShareTextBox ex = new ShareTextBox(col, null, null);
        if (!iEditable) ex.setReadOnly(true);
        line.add(ex);
        EnrollmentLabel note = new EnrollmentLabel(col, null, null, null, null, null, null);
        line.add(note);
    }

    int row = iTable.addRow("", line);
    iTable.getRowFormatter().addStyleName(row, "unitime-NoPrint");
    if (iVisibleCourses != null) iTable.getRowFormatter().setVisible(row, false);
    for (int col = 0; col < line.size(); col++)
        if (!iTable.getCellFormatter().isVisible(0, col))
            iTable.getCellFormatter().setVisible(row, col, false);
}
项目:appinventor-extensions    文件:ErrorReporter.java   
private static void reportMessage(String message) {
  if (!Ode.isWindowClosing()) {
    POPUP.setMessageHTML(message);

    // Position the popup before showing it to prevent flashing.
    POPUP.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
      @Override
      public void setPosition(int offsetWidth, int offsetHeight) {
        POPUP.centerTopPopup();
      }
    });
  }
}
项目:appinventor-extensions    文件:ContextMenu.java   
/**
 * Creates a new context menu.
 */
public ContextMenu() {
  popupPanel = new PopupPanel(true);  // autoHide
  //Enabling Glass under the popups so that clicks on the iframe (blockly) also hide the panel
  popupPanel.setGlassEnabled(true);
  popupPanel.setGlassStyleName("none"); //No style is passed (the default grays out the window)
  menuBar = new MenuBar(true);
  menuBar.setStylePrimaryName("ode-ContextMenu");
  popupPanel.add(menuBar);
}
项目:appinventor-extensions    文件:GalleryClient.java   
/**
* loadSourceFile opens the app as a new app inventor project
* @param gApp the app to open
* @return True if success, otherwise false
*/
public boolean loadSourceFile(GalleryApp gApp, String newProjectName, final PopupPanel popup) {
  final String projectName = newProjectName;
  final String sourceKey = getGallerySettings().getSourceKey(gApp.getGalleryAppId());
  final long galleryId = gApp.getGalleryAppId();

  // first check name to see if valid and unique...
  if (!TextValidators.checkNewProjectName(projectName))
    return false;  // the above function takes care of error messages
  // Callback for updating the project explorer after the project is created on the back-end
  final Ode ode = Ode.getInstance();

  final OdeAsyncCallback<UserProject> callback = new OdeAsyncCallback<UserProject>(
  // failure message
  MESSAGES.createProjectError()) {
    @Override
    public void onSuccess(UserProject projectInfo) {
      Project project = ode.getProjectManager().addProject(projectInfo);
      Ode.getInstance().openYoungAndroidProjectInDesigner(project);
      popup.hide();
    }
    @Override
    public void onFailure(Throwable caught) {
      popup.hide();
      super.onFailure(caught);
    }
  };
  // this is really what's happening here, we call server to load project
  ode.getProjectService().newProjectFromGallery(projectName, sourceKey, galleryId, callback);
  return true;
}
项目:appinventor-extensions    文件:RpcStatusPopup.java   
/**
 * Initializes the LoadingPopup.
 */
public RpcStatusPopup() {
  super(/* autoHide = */ false);
  setStyleName("ode-RpcStatusMessage");
  setWidget(label);

  // Re-center the loading message when the window is resized.
  // TODO(halabelson): Replace the deprecated methods
  Window.addWindowResizeListener(new WindowResizeListener() {
    @Override
    public void onWindowResized(int width, int height) {
      positionPopup(getOffsetWidth());
    }
  });

  // Reposition the message to the top of the screen when the
  // window is scrolled
  // TODO(halabelson): get rid of the flashing on vertical scrolling
  Window.addWindowScrollListener(new WindowScrollListener() {
    @Override
    public void onWindowScrolled(int scrollLeft, int scrollTop) {
      positionPopup(getOffsetWidth());
    }
  });

  // Position the popup before showing it to prevent flashing.
  setPopupPositionAndShow(new PopupPanel.PositionCallback() {
    @Override
    public void setPosition(int offsetWidth, int offsetHeight) {
      positionPopup(offsetWidth);
    }
  });
}
项目:LAS    文件:SettingsWidget.java   
public SettingsWidget(String title, String panelID, String operationID, String optionID) {
    this.operationID = operationID;
    this.optionID = optionID;

    closeButton = new PushButton("Close");
    closeButton.addStyleDependentName("SMALLER");
    closeButton.setTitle("Close settings panel for "+panelID);
    closeButton.addClickListener(closeClick);
    buttonBar = new HorizontalPanel();
    buttonBar.add(closeButton);

    datasetButton = new DatasetButton();        
    optionsButton = new OptionsButton(optionID, 300);
    datasetButton.setOffset(0);

    operations = new OperationsWidget(title);
    operations.addClickHandler(operationsClickHandler);

    settingsButton = new PushButton (title);
    settingsButton.addStyleDependentName("SMALLER");
    settingsButton.addClickListener(settingsButtonClick);
    settingsPopup = new PopupPanel(false);

    buttonBar.add(datasetButton);
    buttonBar.add(optionsButton);

    settingsLayout = new FlexTable();
    settingsLayout.setWidget(0, 0, buttonBar);
    settingsLayout.setWidget(1, 0, operations);


    settingsPopup.add(settingsLayout);
    settingsButton.setWidth("65px");
    initWidget(settingsButton); 

}
项目:gwt-uploader    文件:SourceCodePopupPanel.java   
public void showSourceCode(String sourceCode) {
  int width = (Window.getClientWidth() - 200);
  int height = (Window.getClientHeight() - 200);
  html.setHTML(
      "<pre style='width: " + width + "px; height: " + height + "px; overflow: scroll;'>"
      + sourceCode + "</pre>");
  setPopupPositionAndShow(new PopupPanel.PositionCallback() {
    public void setPosition(int offsetWidth, int offsetHeight) {
      int left = (Window.getClientWidth() - offsetWidth) / 2;
      int top = (Window.getClientHeight() - offsetHeight) / 2;
      setPopupPosition(left, top);
    }
  });
}