Java Code Examples for com.google.gwt.user.client.ui.PopupPanel#setStyleName()

The following examples show how to use com.google.gwt.user.client.ui.PopupPanel#setStyleName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HorizontalPanelWithHint.java    From unitime with Apache License 2.0 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 2
Source File: TimeGrid.java    From unitime with Apache License 2.0 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 3
Source File: BootstrapServerDialog.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
BootstrapServerDialog(final BootstrapServerSetup serverSetup) {
    connectPage = new ConnectPage(serverSetup, this);
    configurePage = new ConfigurePage(serverSetup, this);

    deck = new DeckLayoutPanel();
    deck.addStyleName("window-content"); // white background for forms
    deck.addStyleName("default-window-content");
    deck.add(connectPage);
    deck.add(configurePage);

    int width = 750;
    popupPanel = new PopupPanel(false, true);
    popupPanel.setGlassEnabled(true);
    popupPanel.setAnimationEnabled(false);
    popupPanel.setWidget(deck);
    popupPanel.setWidth(String.valueOf(width) + "px");
    popupPanel.setHeight(String.valueOf(width / DefaultWindow.GOLDEN_RATIO) + "px");
    popupPanel.setStyleName("default-window");
}
 
Example 4
Source File: UniTimeTable.java    From unitime with Apache License 2.0 5 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 5
Source File: GuidedTourHelper.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
static void init(BootstrapContext bootstrapContext) {
    String locale = Preferences.get(Preferences.Key.LOCALE, "en");
    String url = bootstrapContext.getProperty(ApplicationProperties.GUIDED_TOUR) + "/" +
            (bootstrapContext.isStandalone() ? "standalone" : "domain") + "/step1.html?setLng=" + locale;

    Frame tourFrame = new Frame(url);
    tourFrame.setWidth("100%");
    tourFrame.setHeight("100%");

    guidedTour = new PopupPanel(true, true) {
        {
            Window.addResizeHandler(resizeEvent -> {
                if (isShowing()) {
                    center();
                }
            });
        }

        @Override
        protected void onPreviewNativeEvent(Event.NativePreviewEvent event) {
            if (Event.ONKEYUP == event.getTypeInt()) {
                if (event.getNativeEvent().getKeyCode() == KeyboardEvent.KeyCode.ESC) {
                    hide();
                }
            }
        }
    };
    guidedTour.setGlassEnabled(true);
    guidedTour.setAnimationEnabled(false);
    guidedTour.setWidget(tourFrame);
    guidedTour.setWidth("1120px");
    guidedTour.setHeight("800px");
    guidedTour.setStyleName("default-window");

    exportCloseMethod();
}
 
Example 6
Source File: SubsystemTreeBuilder.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static void displaySubsystemHelp(HasTreeItems subsysTree) {
    PopupPanel help = new PopupPanel();
    help.setStyleName("help-panel-open");
    help.getElement().setAttribute("style", "padding:15px");
    help.setWidget(new HTML("Mostly likely there is no UI provided to manage a particular subsystem. " +
            "It might as well be, that the profile doesn't include any subsystems at all."));

    Widget widget = (Widget) subsysTree;
    help.setPopupPosition(widget.getAbsoluteLeft()+50, widget.getAbsoluteTop()+20);
    help.setWidth("240px");
    help.setHeight("80px");
    help.setAutoHideEnabled(true);
    help.show();

}
 
Example 7
Source File: AriaSuggestBox.java    From unitime with Apache License 2.0 4 votes vote down vote up
public AriaSuggestBox(AriaTextBox box, SuggestOracle oracle) {
	iOracle = oracle;
	iText = box;
	iText.setStyleName("gwt-SuggestBox");
	initWidget(iText);
	
	addEventsToTextBox();
	
	iSuggestionMenu = new SuggestionMenu();
	
	iPopupScroll = new ScrollPanel(iSuggestionMenu);
	iPopupScroll.addStyleName("scroll");
	
	iSuggestionPopup = new PopupPanel(true, false);
	iSuggestionPopup.setPreviewingAllNativeEvents(true);
	iSuggestionPopup.setStyleName("unitime-SuggestBoxPopup");
	iSuggestionPopup.setWidget(iPopupScroll);
	iSuggestionPopup.addAutoHidePartner(getElement());
	
	iSuggestionCallback = new SuggestionCallback() {
		@Override
		public void onSuggestionSelected(Suggestion suggestion) {
			if (!suggestion.getReplacementString().isEmpty()) {
				setStatus(ARIA.suggestionSelected(status(suggestion)));
			}
			iCurrentText = suggestion.getReplacementString();
			setText(suggestion.getReplacementString());
			hideSuggestionList();
			fireSuggestionEvent(suggestion);
		}
	};
	
	iOracleCallback = new SuggestOracle.Callback() {
		@Override
		public void onSuggestionsReady(Request request, Response response) {
			if (response.getSuggestions() == null || response.getSuggestions().isEmpty()) {
				if (iSuggestionPopup.isShowing()) iSuggestionPopup.hide();
			} else {
				iSuggestionMenu.clearItems();
				SuggestOracle.Suggestion first = null;
				for (SuggestOracle.Suggestion suggestion: response.getSuggestions()) {
					iSuggestionMenu.addItem(new SuggestionMenuItem(suggestion));
					if (first == null) first = suggestion;
				}
				iSuggestionMenu.selectItem(0);
				ToolBox.setMinWidth(iSuggestionMenu.getElement().getStyle(), (iText.getElement().getClientWidth() - 4) + "px");
				iSuggestionPopup.showRelativeTo(iText);
				iSuggestionMenu.scrollToView();
				if (response.getSuggestions().size() == 1) {
					if (first.getReplacementString().isEmpty())
						setStatus(status(first));
					else
						setStatus(ARIA.showingOneSuggestion(status(first)));
				} else {
					setStatus(ARIA.showingMultipleSuggestions(response.getSuggestions().size(), request.getQuery(), status(first)));
				}
			}
		}
	};
	
	Roles.getTextboxRole().setAriaAutocompleteProperty(iText.getElement(), AutocompleteValue.NONE);
	
	iSuggestionPopup.getElement().setAttribute("id", DOM.createUniqueId());
	Roles.getTextboxRole().setAriaOwnsProperty(iText.getElement(), Id.of(iSuggestionPopup.getElement()));
}
 
Example 8
Source File: InfoPanelImpl.java    From unitime with Apache License 2.0 4 votes vote down vote up
public InfoPanelImpl() {
	super("cell");
	iText = new P("text");
	add(iText);
	
	iHint = new ClickableHint(""); iHint.setStyleName("hint");
	add(iHint);
	
	iUpdateInfo = new Callback() {
		@Override
		public void execute(Callback callback) {
			if (callback != null) callback.execute(null);
		}
	};
	
	iInfo = new FlexTable();
	iInfo.setStyleName("unitime-InfoTable");
	// iUpdateInfo = updateInfo;
	iInfoPanel = new PopupPanel();
	iInfoPanel.setWidget(iInfo);
	iInfoPanel.setStyleName("unitime-PopupHint");
	sinkEvents(Event.ONMOUSEOVER);
	sinkEvents(Event.ONMOUSEOUT);
	sinkEvents(Event.ONMOUSEMOVE);
	iShowInfo = new Timer() {
		@Override
		public void run() {
			if (iInfo.getRowCount() == 0) return;
			iUpdateInfo.execute(new Callback() {
				public void execute(Callback callback) {
					iInfoPanel.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
						@Override
						public void setPosition(int offsetWidth, int offsetHeight) {
							int maxX = Window.getScrollLeft() + Window.getClientWidth() - offsetWidth - 10;
							iInfoPanel.setPopupPosition(Math.min(iX, maxX), iY);
						}
					});
					if (callback != null) callback.execute(null);
				}
			});
		}
	};
	iHideInfo = new Timer() {
		@Override
		public void run() {
			iInfoPanel.hide();
		}
	};
	
	iDefaultClickHandler = new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			if (iUrl != null && !iUrl.isEmpty())
				ToolBox.open(GWT.getHostPageBaseURL() + iUrl);
		}
	};
	iTextClick = iHint.addClickHandler(iDefaultClickHandler);
	iHintClick = iText.addClickHandler(iDefaultClickHandler);
	iHint.setTabIndex(-1);
}