Java Code Examples for com.google.gwt.user.client.ui.ScrollPanel#addStyleName()

The following examples show how to use com.google.gwt.user.client.ui.ScrollPanel#addStyleName() . 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: HistorySearch.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * HistorySearch
 */
public HistorySearch() {
	stackPanel = new StackLayoutPanel(Unit.PX);
	searchSaved = new SearchSaved();
	userNews = new UserNews();
	scrollSearchSavedPanel = new ScrollPanel();
	scrollUserNewsSavedPanel = new ScrollPanel();

	scrollSearchSavedPanel.addStyleName("okm-PanelSelected");
	scrollUserNewsSavedPanel.addStyleName("okm-PanelSelected");

	scrollSearchSavedPanel.add(searchSaved);
	scrollSearchSavedPanel.setSize("100%", "100%");

	scrollUserNewsSavedPanel.add(userNews);
	scrollUserNewsSavedPanel.setSize("100%", "100%");

	stackPanel.add(scrollSearchSavedPanel, Util.createHeaderHTML("img/icon/stackpanel/find.gif", Main.i18n("leftpanel.label.stored.search")), true, 22);
	stackPanel.add(scrollUserNewsSavedPanel, Util.createHeaderHTML("img/icon/news.gif", Main.i18n("leftpanel.label.user.search")), true, 22);

	stackPanel.showWidget(0);
	stackPanel.setStyleName("okm-StackPanel");
	stackPanel.addStyleName("okm-DisableSelect");
	initWidget(stackPanel);
}
 
Example 2
Source File: CourseFinderMultipleCourses.java    From unitime with Apache License 2.0 6 votes vote down vote up
@Override
public void setCourseDetails(CourseFinderCourseDetails... details) {
	iDetails = details;
	int tabIndex = 0;
	for (CourseFinderCourseDetails detail: iDetails) {
		ScrollPanel panel = new ScrollPanel(detail.asWidget());
		panel.setStyleName("unitime-ScrollPanel-inner");
		panel.addStyleName("course-info");
		iCourseDetailsTabBar.addTab(detail.getName(), true);
		Character ch = UniTimeHeaderPanel.guessAccessKey(detail.getName());
		if (ch != null)
			iTabAccessKeys.put(ch, tabIndex);
		tabIndex++;
	}
	selectLastTab();
}
 
Example 3
Source File: FlowForm.java    From unitime with Apache License 2.0 6 votes vote down vote up
public int addRow(Widget header, Widget... widgets) {
	if (header.getElement().getId() == null || header.getElement().getId().isEmpty())
		header.getElement().setId(DOM.createUniqueId());
	P head = new P(DOM.createSpan(), "header-cell");
	head.add(header);
	add(head);
	for (Widget widget: widgets) {
		P body = new P(DOM.createSpan(), "content-cell");
		add(body);
		if (widget instanceof UniTimeTable) {
			ScrollPanel scroll = new ScrollPanel(widget);
			scroll.addStyleName("scroll");
			body.add(scroll);
		} else {
			body.add(widget);
		}
	}
	if (widgets.length > 0) {
		if (widgets[0] instanceof UniTimeWidget)
			Roles.getTextboxRole().setAriaLabelledbyProperty(((UniTimeWidget)widgets[0]).getWidget().getElement(), Id.of(header.getElement()));
		else
			Roles.getTextboxRole().setAriaLabelledbyProperty(widgets[0].getElement(), Id.of(header.getElement()));			
	}
	return getWidgetCount() - widgets.length;
}
 
Example 4
Source File: SimpleForm.java    From unitime with Apache License 2.0 6 votes vote down vote up
public int addRow(Widget header, Widget widget, int colSpan) {
	header.addStyleName("label-cell");
	int row = getRowCount();
	setWidget(row, 0, header);
	getCellFormatter().setStyleName(row, 0, "label-td");
	if (widget instanceof HasMobileScroll) {
		ScrollPanel scroll = new ScrollPanel(widget);
		scroll.addStyleName("table-cell");
		setWidget(row, 1, scroll);
		getCellFormatter().setStyleName(row, 1, "table-td");
	} else {
		widget.addStyleName("widget-cell");
		setWidget(row, 1, widget);
		getCellFormatter().setStyleName(row, 1, "widget-td");
	}
	if (colSpan != 1)
		getFlexCellFormatter().setColSpan(row, 1, colSpan);
	if (header.getElement().getId() == null || header.getElement().getId().isEmpty())
		header.getElement().setId(DOM.createUniqueId());
	if (widget instanceof UniTimeWidget)
		Roles.getTextboxRole().setAriaLabelledbyProperty(((UniTimeWidget)widget).getWidget().getElement(), Id.of(header.getElement()));
	else
		Roles.getTextboxRole().setAriaLabelledbyProperty(widget.getElement(), Id.of(header.getElement()));
	return row;
}
 
Example 5
Source File: CourseFinderCourses.java    From unitime with Apache License 2.0 6 votes vote down vote up
@Override
public void setCourseDetails(CourseFinderCourseDetails... details) {
	iDetails = details;
	int tabIndex = 0;
	for (CourseFinderCourseDetails detail: iDetails) {
		ScrollPanel panel = new ScrollPanel(detail.asWidget());
		panel.setStyleName("unitime-ScrollPanel-inner");
		panel.addStyleName("course-info");
		iCourseDetailsTabBar.addTab(detail.getName(), true);
		Character ch = UniTimeHeaderPanel.guessAccessKey(detail.getName());
		if (ch != null)
			iTabAccessKeys.put(ch, tabIndex);
		tabIndex++;
	}
	selectLastTab();
}
 
Example 6
Source File: SimpleForm.java    From unitime with Apache License 2.0 5 votes vote down vote up
public int addRow(Widget widget) {
	int row = getRowCount();
	getFlexCellFormatter().setColSpan(row, 0, iColSpan);
	if (widget instanceof HasMobileScroll) {
		ScrollPanel scroll = new ScrollPanel(widget);
		scroll.addStyleName("table-row");
		setWidget(row, 0, scroll);
	} else {
		setWidget(row, 0, widget);
	}
	return row;
}
 
Example 7
Source File: InfoPanel.java    From geomajas-gwt2-quickstart-application with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Init the info panel.
 */
private void initInfoPanel() {

	infoPopupPanel.addStyleName(ApplicationResource.INSTANCE.css().infoPopupPanel());

	HTMLPanel infoPopupPanelWrapper = new HTMLPanel("");

	closeInfoPopupPanelButton.addStyleName(ApplicationResource.INSTANCE.css().closePopupPanelButton());
	closeInfoPopupPanelButton.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			infoPopupPanel.hide();
			ApplicationService.getInstance().setTooltipShowingAllowed(true);
		}
	});

	HTMLPanel closeInfoButtonContainer = new HTMLPanel("");
	closeInfoButtonContainer.addStyleName(ApplicationResource.INSTANCE.css().popupPanelHeader());
	Label infoTitle = new Label(msg.infoPanelTitle());
	closeInfoButtonContainer.add(infoTitle);
	closeInfoButtonContainer.add(closeInfoPopupPanelButton);
	infoPopupPanelWrapper.add(closeInfoButtonContainer);

	infoPopupPanelContent = new HTMLPanel("");
	infoPopupPanelContent.addStyleName(ApplicationResource.INSTANCE.css().infoPopupPanelContent());

	ScrollPanel infoPopupPanelScroll = new ScrollPanel();
	infoPopupPanelScroll.addStyleName(ApplicationResource.INSTANCE.css().infoPopupPanelScroll());
	infoPopupPanelScroll.add(infoPopupPanelContent);

	infoPopupPanelWrapper.add(infoPopupPanelScroll);

	infoPopupPanel.add(infoPopupPanelWrapper);

	infoPopupPanel.hide();
}
 
Example 8
Source File: GwtTreeImplConnector.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected ScrollPanel createWidget() {
  ScrollPanel panel = new ScrollPanel(new GwtTreeImpl());
  panel.addStyleName("ui-scroll-panel-marker");
  GwtUIUtil.fill(panel);
  return panel;
}
 
Example 9
Source File: MessageStack.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * MessageStack
 */
public MessageStack() {
	status = new Status();
	status.setStyleName("okm-StatusPopup");

	stackPanel = new ExtendedStackPanel();
	proposedSubscriptionReceived = new ProposedSubscriptionReceivedStack();
	proposedQueryReceived = new ProposedQueryReceivedStack();
	messageReceived = new MessageReceivedStack();
	messageSent = new MessageSentStack();
	scrollProposeSubscriptionReceivedPanel = new ScrollPanel();
	scrollProposeQueryReceivedPanel = new ScrollPanel();
	scrollMessageReceivedPanel = new ScrollPanel();
	scrollMessageSentPanel = new ScrollPanel();

	scrollProposeSubscriptionReceivedPanel.addStyleName("okm-PanelSelected");
	scrollProposeQueryReceivedPanel.addStyleName("okm-PanelSelected");
	scrollMessageReceivedPanel.addStyleName("okm-PanelSelected");
	scrollMessageSentPanel.addStyleName("okm-PanelSelected");

	scrollProposeSubscriptionReceivedPanel.add(proposedSubscriptionReceived);
	scrollProposeQueryReceivedPanel.add(proposedQueryReceived);
	scrollMessageReceivedPanel.add(messageReceived);
	scrollMessageSentPanel.add(messageSent);
	scrollProposeSubscriptionReceivedPanel.setSize("100%", "100%");
	scrollProposeQueryReceivedPanel.setSize("100%", "100%");
	scrollMessageSentPanel.setSize("100%", "100%");
	// Mandatory can not be a resource bundle due IE problem !
	stackPanel.add(scrollProposeSubscriptionReceivedPanel, UtilComunicator.createHeaderHTML("img/icon/actions/propose_subscription.png",
			GeneralComunicator.i18nExtension("messaging.label.propose")), true, UIDesktopConstants.STACK_HEIGHT);
	stackPanel.add(scrollProposeQueryReceivedPanel, UtilComunicator.createHeaderHTML("img/icon/actions/share_query.gif",
			GeneralComunicator.i18nExtension("messaging.label.share.query")), true, UIDesktopConstants.STACK_HEIGHT);
	stackPanel.add(scrollMessageReceivedPanel, UtilComunicator.createHeaderHTML("img/icon/actions/message_received.png",
			GeneralComunicator.i18nExtension("messaging.label.message.received")), true, UIDesktopConstants.STACK_HEIGHT);
	stackPanel.add(scrollMessageSentPanel, UtilComunicator.createHeaderHTML("img/icon/actions/message.png",
			GeneralComunicator.i18nExtension("messaging.label.message.sent")), true, UIDesktopConstants.STACK_HEIGHT);

	stackPanel.showWidget(0);
	stackPanel.setStartUpFinished();

	stackPanel.setStyleName("okm-StackPanel");
	stackPanel.addStyleName("okm-DisableSelect");
	initWidget(stackPanel);
}
 
Example 10
Source File: Navigator.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public Navigator() {
	stackPanel = new ExtendedStackPanel();
	scrollTaxonomyPanel = new ExtendedScrollPanel();
	scrollTaxonomyPanel.setSize("100%", "100%");
	scrollCategoriesPanel = new ScrollPanel();
	scrollCategoriesPanel.setSize("100%", "100%");
	scrollMetadataPanel = new ScrollPanel();
	scrollMetadataPanel.setSize("100%", "100%");
	scrollThesaurusPanel = new ScrollPanel();
	scrollThesaurusPanel.setSize("100%", "100%");
	scrollTrashPanel = new ScrollPanel();
	scrollTrashPanel.setSize("100%", "100%");
	scrollTemplatePanel = new ExtendedScrollPanel();
	scrollTemplatePanel.setSize("100%", "100%");
	scrollPersonalPanel = new ExtendedScrollPanel();
	scrollPersonalPanel.setSize("100%", "100%");
	scrollMailPanel = new ExtendedScrollPanel();
	scrollMailPanel.setSize("100%", "100%");
	verticalTaxonomyPanel = new VerticalPanel();
	verticalTaxonomyPanel.setSize("100%", "100%");
	verticalCategoriesPanel = new VerticalPanel();
	verticalCategoriesPanel.setSize("100%", "100%");
	verticalMetadataPanel = new VerticalPanel();
	verticalMetadataPanel.setSize("100%", "100%");
	verticalThesaurusPanel = new VerticalPanel();
	verticalThesaurusPanel.setSize("100%", "100%");
	verticalTrashPanel = new VerticalPanel();
	verticalTrashPanel.setSize("100%", "100%");
	verticalTemplatePanel = new VerticalPanel();
	verticalTemplatePanel.setSize("100%", "100%");
	verticalMyDocumentsPanel = new VerticalPanel();
	verticalMyDocumentsPanel.setSize("100%", "100%");
	verticalMailPanel = new VerticalPanel();
	verticalMailPanel.setSize("100%", "100%");

	status = new Status();
	status.setStyleName("okm-StatusPopup");
	trashTree = new TrashTree();
	trashTree.setSize("100%", "100%");
	templateTree = new TemplateTree();
	templateTree.setSize("100%", "100%");
	mailTree = new MailTree();
	mailTree.setSize("100%", "100%");
	personalTree = new PersonalTree();
	personalTree.setSize("100%", "100%");
	thesaurusTree = new ThesaurusTree();
	thesaurusTree.setSize("100%", "100%");
	metadataTree = new MetadataTree();
	metadataTree.setSize("100%", "100%");
	categoriesTree = new CategoriesTree();
	categoriesTree.setSize("100%", "100%");
	taxonomyTree = new TaxonomyTree();
	taxonomyTree.setSize("100%", "100%");

	verticalTaxonomyPanel.add(taxonomyTree);
	scrollTaxonomyPanel.add(verticalTaxonomyPanel);
	verticalCategoriesPanel.add(categoriesTree);
	scrollCategoriesPanel.add(verticalCategoriesPanel);
	verticalMetadataPanel.add(metadataTree);
	scrollMetadataPanel.add(verticalMetadataPanel);
	verticalThesaurusPanel.add(thesaurusTree);
	scrollThesaurusPanel.add(verticalThesaurusPanel);
	verticalTrashPanel.add(trashTree);
	scrollTrashPanel.add(verticalTrashPanel);
	scrollTrashPanel.addStyleName("okm-DisableSelect"); // Disables drag and drop browser text selection
	verticalTemplatePanel.add(templateTree);
	scrollTemplatePanel.add(verticalTemplatePanel);
	verticalMyDocumentsPanel.add(personalTree);
	scrollPersonalPanel.add(verticalMyDocumentsPanel);
	verticalMailPanel.add(mailTree);
	scrollMailPanel.add(verticalMailPanel);

	scrollTaxonomyPanel.setStyleName("okm-Background-White");
	scrollCategoriesPanel.setStyleName("okm-Background-White");
	scrollMetadataPanel.setStyleName("okm-Background-White");
	scrollThesaurusPanel.setStyleName("okm-Background-White");
	scrollTrashPanel.setStyleName("okm-Background-White");
	scrollTemplatePanel.setStyleName("okm-Background-White");
	scrollPersonalPanel.setStyleName("okm-Background-White");
	scrollMailPanel.setStyleName("okm-Background-White");

	stackPanel.setStyleName("okm-StackPanel");

	initWidget(stackPanel);
}
 
Example 11
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 12
Source File: CellBrowser.java    From consulo with Apache License 2.0 4 votes vote down vote up
/**
 * Create a new {@link TreeNodeImpl} and append it to the end of the
 * LayoutPanel.
 *
 * @param <C> the data type of the children
 * @param nodeInfo the info about the node
 * @param value the value of the open node
 */
private <C> TreeNode appendTreeNode(final NodeInfo<C> nodeInfo, Object value) {
  // Create the list view.
  final int level = treeNodes.size();
  final BrowserCellList<C> view = createDisplay(nodeInfo, level);

  // Create a pager and wrap the components in a scrollable container. Set the
  // tabIndex to -1 so the user can tab between lists without going through
  // the scrollable.
  ScrollPanel scrollable = new ScrollPanel();
  scrollable.getElement().setTabIndex(-1);
  final Widget pager = createPager(view);
  if (pager != null) {
    FlowPanel flowPanel = new FlowPanel();
    flowPanel.add(view);
    flowPanel.add(pager);
    scrollable.setWidget(flowPanel);
  } else {
    scrollable.setWidget(view);
  }
  scrollable.setStyleName(style.cellBrowserColumn());
  if (level == 0) {
    scrollable.addStyleName(style.cellBrowserFirstColumn());
  }

  // Create a TreeNode.
  TreeNodeImpl<C> treeNode = new TreeNodeImpl<C>(nodeInfo, value, view, scrollable);
  treeNodes.add(treeNode);

  /*
   * Attach the view to the selection model and node info. Nullify the default
   * selection manager because it is provided by the node info.
   */
  view.setSelectionModel(nodeInfo.getSelectionModel(), null);
  nodeInfo.setDataDisplay(view);

  // Add the view to the LayoutPanel.
  SplitLayoutPanel splitPanel = getSplitLayoutPanel();
  splitPanel.insertLineStart(scrollable, defaultWidth, null);
  splitPanel.setWidgetMinSize(scrollable, minWidth);
  splitPanel.forceLayout();

  // Scroll to the right.
  animation.scrollToEnd();
  return treeNode;
}