Java Code Examples for com.google.gwt.user.client.ui.PopupPanel

The following are top voted examples for showing how to use com.google.gwt.user.client.ui.PopupPanel. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: unitimes   File: UniTimeTable.java   View source code 6 votes vote down vote up
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());
}
 
Example 2
Project: unitimes   File: HorizontalPanelWithHint.java   View source code 6 votes vote down vote up
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();
		}
	};
}
 
Example 3
Project: unitimes   File: UniTimeTableHeader.java   View source code 6 votes vote down vote up
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();
		}
	});
}
 
Example 4
Project: unitimes   File: TimeGrid.java   View source code 6 votes vote down vote up
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);
}
 
Example 5
Project: appinventor-extensions   File: AdditionalChoicePropertyEditor.java   View source code 6 votes vote down vote up
/**
 * 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);
    }
  });
}
 
Example 6
Project: vaadin-combobox-multiselect   File: VComboBoxMultiselect.java   View source code 6 votes vote down vote up
@Override
public void onClose(CloseEvent<PopupPanel> event) {
	debug("VComboBoxMultiselect.SP: onClose(" + event.isAutoClosed() + ")");

	if (event.isAutoClosed()) {
		this.lastAutoClosed = new Date().getTime();
	}
}
 
Example 7
Project: LAS   File: ColumnEditorWidget.java   View source code 6 votes vote down vote up
@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();
}
 
Example 8
Project: LAS   File: DropDown.java   View source code 6 votes vote down vote up
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);
}
 
Example 9
Project: cuba   File: CubaTreeWidget.java   View source code 6 votes vote down vote up
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);
}
 
Example 10
Project: x-cure-chat   File: SiteManagerUI.java   View source code 6 votes vote down vote up
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;
}
 
Example 11
Project: vaadin-overlays   File: CustomOverlayWidget.java   View source code 6 votes vote down vote up
/**
 * 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();
            }
        }
    });
}
 
Example 12
Project: rosa   File: MultiLineTextDisplayElement.java   View source code 6 votes vote down vote up
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);
}
 
Example 13
Project: rosa   File: MultiLineTextDisplayElement.java   View source code 6 votes vote down vote up
@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;
}
 
Example 14
Project: gwittir   File: PopupValidationFeedback.java   View source code 6 votes vote down vote up
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();
            }
        }
    }
}
 
Example 15
Project: gwtmockito   File: GwtMockitoWidgetBaseClassesTest.java   View source code 6 votes vote down vote up
@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() {});
}
 
Example 16
Project: unitimes   File: CurriculaCourses.java   View source code 5 votes vote down vote up
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);
}
 
Example 17
Project: appinventor-extensions   File: ErrorReporter.java   View source code 5 votes vote down vote up
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();
      }
    });
  }
}
 
Example 18
Project: appinventor-extensions   File: ContextMenu.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 19
Project: appinventor-extensions   File: GalleryClient.java   View source code 5 votes vote down vote up
/**
* 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;
}
 
Example 20
Project: appinventor-extensions   File: RpcStatusPopup.java   View source code 5 votes vote down vote up
/**
 * 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);
    }
  });
}
 
Example 21
Project: LAS   File: SettingsWidget.java   View source code 5 votes vote down vote up
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);	

}
 
Example 22
Project: gwt-uploader   File: SourceCodePopupPanel.java   View source code 5 votes vote down vote up
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);
    }
  });
}
 
Example 23
Project: Wiab.pro   File: Popup.java   View source code 5 votes vote down vote up
/**
 * Creates a popup.
 *
 * @param reference   reference element for the positioner
 * @param positioner  strategy for positioning the popup
 */
public Popup(Element reference, RelativePopupPositioner positioner) {
  this.reference = reference;
  this.positioner = positioner;
  popupPanel.addStyleName("editor-popup");
  popupPanel.setAnimationEnabled(true);
  popupPanel.addCloseHandler(
      new CloseHandler<PopupPanel>() {
        
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
          Popup.this.hide();
        }
      });
}
 
Example 24
Project: x-cure-chat   File: SendMessageDialogUI.java   View source code 5 votes vote down vote up
/**
 * 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();		
}
 
Example 25
Project: x-cure-chat   File: SendChatMessageDialogUI.java   View source code 5 votes vote down vote up
/**
 * A constructor creates a send chat message dialog with the preset recipient.
 * @param roomID the id of the room we will be sending the message from
 * @param recepientID the recepient's ID
 * @param recepientLoginName the recipient's login name
 * @param roomsManager the instane of the rooms manager
 */
SendChatMessageDialogUI( final int roomID, final ClickHandler smileyActionLinkClickHandler, final RoomsManagerUI roomsManager ) {
	super( true, false, false, null );
	
	//Store the parameters
	this.commonWidgets = new SendChatMessageWidgets( roomID, smileyActionLinkClickHandler, this, false, roomsManager );
	this.roomsManager = roomsManager;
	
	//Add style
	this.addStyleName( CommonResourcesContainer.SEND_CHAT_MESSAGE_DIALOG_EXTRA_STYLE );
	
	//Update the dialog's title
	updateDialogTitle();
	
	//Call the onClose method to clean up data
	this.addCloseHandler( new CloseHandler<PopupPanel>(){
		public void onClose(CloseEvent<PopupPanel> e) {
			if( e.getTarget() == thisDialog ) {
				//Save the current dialog data
				SendChatMessageManager.getInstance().saveChatMessageDataFromCurrentUI();
			}
		}
	} );
	
	//Initialize the common components
	commonWidgets.initialize();
	
	//Fill dialog with data
	populateDialog();
	
	//Update the list of recipients for the case of no recipients set
	updateMessageRecipientsPanel( );
}
 
Example 26
Project: wte4j   File: PopupCell.java   View source code 5 votes vote down vote up
public PopupCell(PopupPanel popupPanel, Cell<T> contentCell) {
	this.contentCell = contentCell;
	this.popupPanel = popupPanel;

	consumedEvents = new HashSet<String>();
	if (contentCell.getConsumedEvents() != null) {
		consumedEvents.addAll(contentCell.getConsumedEvents());
	}
	consumedEvents.add(BrowserEvents.CLICK);

}
 
Example 27
Project: kie-docker-ci   File: ContainersView.java   View source code 5 votes vote down vote up
private void showDetails(final KieContainer container) {
    final PopupPanel detailsPopup = new PopupPanel();
    detailsPopup.setTitle(Constants.INSTANCE.detailsForContainer() + " " + container.getId());
    detailsPopup.setAutoHideEnabled(true);
    detailsPopup.setModal(true);
    detailsPopup.setGlassEnabled(true);
    detailsPopup.add(detailsWidget);
    detailsPopup.center();
    detailsPopup.show();
    detailsWidget.show(container);
}
 
Example 28
Project: vaadin-combobox-multiselect   File: VComboBoxMultiselect.java   View source code 5 votes vote down vote up
@Override
public void onClose(CloseEvent<PopupPanel> event) {
	debug("VComboBoxMultiselect.SP: onClose(" + event.isAutoClosed() + ")");

	if (event.isAutoClosed()) {
		this.lastAutoClosed = new Date().getTime();
	}
}
 
Example 29
Project: gwt-chronoscope   File: BrowserInfoWindow.java   View source code 5 votes vote down vote up
public BrowserInfoWindow(GwtView view, PopupPanel pp) {
  this.view = view;
  this.pp = pp;
  manager = new HandlerManager(this);
  pp.addPopupListener(new PopupListener() {

    public void onPopupClosed(PopupPanel sender, boolean autoClosed) {
      manager.fireEvent(new InfoWindowEvent());
    }
  });
}
 
Example 30
Project: gwt-chronoscope   File: GwtView.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 31
Project: aggregate   File: AccessConfigurationSheet.java   View source code 5 votes vote down vote up
@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);
    }
  });
}
 
Example 32
Project: aggregate   File: AbstractPopupBase.java   View source code 5 votes vote down vote up
public PopupPanel.PositionCallback getPositionCallBack() {
  return 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);
        setPopupPosition(left, top);
    }
  };
}
 
Example 33
Project: hawkbit   File: SuggestionsSelectList.java   View source code 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 34
Project: circuitjs1   File: ScrollValuePopup.java   View source code 5 votes vote down vote up
ScrollValuePopup(final int x, final int y, int dy, CircuitElm e, CirSim s) {
		super();
		myElm=e;
		deltaY=0;
		sim=s;
		sim.pushUndo();
		vp=new VerticalPanel();
		setWidget(vp);
		setupValues();
		vp.add(new Label(name));
		labels=new Label[labMax];
		for (int i=0; i<labMax; i++) {
			labels[i] = new Label("---");
			labels[i].setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
			if (i==2)
				labels[i].addStyleDependentName("selected");
			else if (i==1 || i==3)
				labels[i].addStyleDependentName("1off");
			else 
				labels[i].addStyleDependentName("2off");
			vp.add(labels[i]);
		}
		doDeltaY(dy);
		this.addDomHandler(this, MouseOutEvent.getType());
		this.addDomHandler(this, MouseWheelEvent.getType());
		this.addDomHandler(this, MouseDownEvent.getType());
//		this.addDomHandler(this, KeyPressEvent.getType());
        setPopupPositionAndShow(new PopupPanel.PositionCallback() {
            public void setPosition(int offsetWidth, int offsetHeight) {
              int left = Math.max(0, (x - offsetWidth/4));
              int top = Math.max(0, y - 7*offsetHeight/12);
              setPopupPosition(left, top);
            }
          });
	}
 
Example 35
Project: che   File: QuickOpenViewImpl.java   View source code 5 votes vote down vote up
@Inject
public QuickOpenViewImpl(
    Resources resources,
    AutoCompleteResources autoCompleteResources,
    QuickOpenViewImplUiBinder uiBinder,
    LanguageServerResources languageServerResources) {
  this.resources = resources;
  this.languageServerResources = languageServerResources;

  css = autoCompleteResources.autocompleteComponentCss();
  css.ensureInjected();

  DockLayoutPanel rootElement = uiBinder.createAndBindUi(this);
  setWidget(rootElement);
  setAutoHideEnabled(true);
  setAnimationEnabled(true);

  layoutPanel.setWidgetHidden(actionsPanel, true);

  addCloseHandler(
      new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
          delegate.onClose(event.isAutoClosed());
        }
      });
}
 
Example 36
Project: che   File: QuickDocViewImpl.java   View source code 5 votes vote down vote up
@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);
}
 
Example 37
Project: gerrit-ci   File: ProjectConfigurationScreen.java   View source code 5 votes vote down vote up
public static void addCronToggleButton(HTMLPanel p, final Button deleteButton) {
    final PopupPanel pop = new PopupPanel(true);
    final HTMLPanel cronSyntax = new HTMLPanel(GerritCiPlugin.cronToggle.toString());
    Button toggleButton = new Button("Build Schedule Syntax");
    toggleButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            pop.setWidget(cronSyntax);
            pop.showRelativeTo(deleteButton);
        }
    });
    p.addAndReplaceElement(toggleButton, "toggleButton");
}
 
Example 38
Project: firefly   File: PopupUtil.java   View source code 5 votes vote down vote up
public static void showMinimalError(Widget anchor, String msg) {
    final PopupPanel p = new PopupPanel(true);
    p.setAnimationEnabled(true);
    p.addStyleName("onTopDialog");
    p.setWidget(new HTML(msg));
    p.setPopupPosition(anchor.getAbsoluteLeft() + anchor.getOffsetWidth(), anchor.getAbsoluteTop() + anchor.getOffsetHeight());
    p.show();
    new Timer(){
            public void run() {
                p.hide();
            }
        }.schedule(4000);

}
 
Example 39
Project: firefly   File: BackgroundManager.java   View source code 5 votes vote down vote up
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);
}
 
Example 40
Project: firefly   File: GwtUtil.java   View source code 5 votes vote down vote up
public static void showAtCenter(PopupPanel popup) {
    int h = Window.getClientHeight();
    int w = Window.getClientWidth();
    popup.show();
    int offsetx = StringUtils.getInt(DOM.getStyleAttribute(popup.getElement(), "width"), 300);
    int offsety = StringUtils.getInt(DOM.getStyleAttribute(popup.getElement(), "height"), 200);
    int x = (w - offsetx) / 2;
    int y = (h - offsety) / 2;
    popup.setPopupPosition(x, y);
}