Java Code Examples for com.google.gwt.dom.client.StyleInjector#inject()

The following examples show how to use com.google.gwt.dom.client.StyleInjector#inject() . 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: BasicToolBar.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
private void initializew3wPanel() {
	w3wPanel = new HorizontalPanel();
	w3wPanel.setSpacing(5);
	w3wPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
	StyleInjector.inject(".w3wPanel { " + "background: #E0ECF8;"
			+ "border-radius: 5px 10px;" + "opacity: 0.8}");
	w3wPanel.setStyleName("w3wPanel");
	w3wPanel.setWidth("415px");

	wordsLabel = new Label();
	w3wAnchor = new AnchorBuilder().setHref("https://what3words.com/")
			.setText(UIMessages.INSTANCE.what3Words())
			.setTitle("https://what3words.com/").build();
	w3wAnchor.getElement().getStyle().setColor("#FF0000");
	w3wAnchor.setVisible(false);
	w3wPanel.add(w3wAnchor);
	w3wPanel.add(wordsLabel);
}
 
Example 2
Source File: StatusPanelWidget.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
private void initializeStatusPanel() {
	String comboWidth = "125px";
	statusPanel = new VerticalPanel();
	StyleInjector.inject(".statusPanelStyle { " + "background: #E0ECF8;"
			+ "border-radius: 5px 10px;" + "opacity: 0.8}");
	statusPanel.setStyleName("statusPanelStyle");

	statusPanel.setSpacing(5);
	statusPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

	initializeLayerCombo(comboWidth);
	initializeEpsgCombo(comboWidth);
	initializeStatusGrid();

	statusPanel.add(new FieldLabel(layerCombo, UIMessages.INSTANCE
			.sbSelectLayerLabel()));
	statusPanel.add(new FieldLabel(epsgCombo, UIMessages.INSTANCE
			.sbEpsgLabel()));
	statusPanel.add(statusGrid);

	statusPanel.setVisible(false);
}
 
Example 3
Source File: SelectorSliderDisplayerView.java    From dashbuilder with Apache License 2.0 6 votes vote down vote up
@Override
public void init(SelectorSliderDisplayer presenter) {
    super.setPresenter(presenter);
    super.setVisualization(container);

    // Enlarge the tooltip max width
    StyleInjector.inject(".slider .tooltip-inner { max-width: 900px; }");

    header.setVisible(false);
    slider.setHandle(HandleType.ROUND);
    slider.setFormatter(r -> presenter.formatRange(r.getMinValue(), r.getMaxValue()));
    slider.addSlideStopHandler(e -> presenter.onSliderChange(e.getValue().getMinValue(), e.getValue().getMaxValue()));
    slider.getElement().getStyle().setWidth(100, Style.Unit.PCT);
    inputs.getElement().getStyle().setWidth(100, Style.Unit.PCT);

    body.add(slider);
    body.getElement().getStyle().setMarginLeft(10, Style.Unit.PX);

    container.add(header);
    container.add(body);
    container.add(inputs);
    container.add(error);
}
 
Example 4
Source File: VerticalLegend.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private void createContentPanel() {
	this.contentPanel = new VerticalPanel();
	StyleInjector.inject(".mapLegendPanel { " + "background: #FFFFFF;"
			+ "border-radius: 5px 10px;" + "opacity: 0.8}");
	contentPanel.setStyleName("mapLegendPanel");
	contentPanel.setSize(WIDTH, HEIGHT);
	contentPanel.add(getHeader());
	setData(getData());
}
 
Example 5
Source File: LinksWidget.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Widget asWidget() {
	if (widget == null) {
		//String width="320px";
		String width="370px";
		String height="50px";
		widget = new HorizontalLayoutContainer();
		widget.getElement().getStyle().setPosition(Position.ABSOLUTE);
		widget.getElement().getStyle().setRight(5, Unit.PX);
		widget.getElement().getStyle().setTop(0, Unit.PX);
		widget.setSize(width, height);
		
		hp = new HorizontalPanel();
		hp.setSpacing(10);
		StyleInjector.inject(".linkPanel { " + "background: #FFFFFF;"
				+ "border-radius: 5px 10px;" + "opacity: 0.8}");
		hp.setStyleName("linkPanel");
		hp.setSize(width, height);
		
		ScrollSupport scrollSupport = widget.getScrollSupport();
		scrollSupport.setScrollMode(ScrollMode.AUTOX);
		
		setDefaultLinks();
		
		widget.add(hp);
	}
	return widget;
}
 
Example 6
Source File: CellContainerToDomMapper.java    From jetpad-projectional-open-source with Apache License 2.0 5 votes vote down vote up
private static void ensureIndentInjected() {
  if (ourIndentInjected) return;

  StyleInjector.flush();

  double width = TextMetricsCalculator.calculate(TextCell.DEFAULT_FONT, "xx").dimension().x;
  StyleInjector.inject("." + CSS.indented() + "{ padding-left: " + width + "px }", true);
  ourIndentInjected = true;
}
 
Example 7
Source File: MaterialDesignBase.java    From gwt-material with Apache License 2.0 4 votes vote down vote up
public static void injectCss(TextResource resource) {
    StyleInjector.inject(resource.getText());
}
 
Example 8
Source File: Game.java    From shortyz with GNU General Public License v3.0 4 votes vote down vote up
@Inject
public Game(RootPanel rootPanel, PuzzleServiceProxy service,
    Resources resources, final PuzzleListView plv, Renderer renderer) {
    this.service = service;
    this.plv = plv;
    this.renderer = renderer;
    this.css = resources.css();

    History.newItem("list", false);
    History.addValueChangeHandler(new ValueChangeHandler<String>() {
            @Override
            public void onValueChange(ValueChangeEvent<String> event) {
                if (event.getValue().equals("list")) {
                    if (closingRegistration != null) {
                        closingRegistration.removeHandler();
                        closingRegistration = null;
                    }

                    if (autoSaveTimer != null) {
                        autoSaveTimer.cancel();
                        autoSaveTimer.run();
                        autoSaveTimer = null;
                    }

                    mainPanel.setWidget(plv);
                    keyboardIntercept.removeKeyboardListener(l);

                    getDisplayChangeListener().onDisplayChange();
                } else if (event.getValue().startsWith("play=")) {
                    Long id = Long.parseLong(event.getValue().split("=")[1]);
                    loadPuzzle(id);
                }
            }
        });
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setWidth("100%");
    StyleInjector.inject(resources.css().getText());
    keyboardIntercept.setWidth("1px");
    keyboardIntercept.setHeight("1px");
    keyboardIntercept.setStyleName(css.keyboardIntercept());
    rootPanel.add(keyboardIntercept);

    verticalPanel.add(status);
    verticalPanel.setCellHorizontalAlignment(status,
        HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.add(mainPanel);
    verticalPanel.setCellHorizontalAlignment(mainPanel,
        HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.add(below);
    display.add(verticalPanel);
    display.setWidth("97%");
    rootPanel.add(display);
}
 
Example 9
Source File: GeocodingPanelWidget.java    From geowe-core with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Widget asWidget() {

	if (panel == null) {
		panel = new ContentPanel();
		panel.setBorders(true);
		panel.setPixelSize(490, 47);
		panel.setHeaderVisible(false);
		panel.setPosition(300, 0);
		panel.getElement().getStyle().setPosition(Position.ABSOLUTE);

		StyleInjector.inject(".statusBarStyle { " + "position: absolute; " + "bottom: 35 px;"
				+ "background: #E0ECF8;" + "border-radius: 5px 10px;" + "opacity: 0.8}");
		panel.setStyleName("geocodingPanelStyle");

		final HorizontalPanel horizontalGroup = new HorizontalPanel();
		horizontalGroup.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
		horizontalGroup.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
		horizontalGroup.setSpacing(5);
		horizontalGroup.getElement().getStyle().setBackgroundColor("#E0ECF8");

		addressTextField.setWidth("320px");
		addressTextField.setEmptyText(UIMessages.INSTANCE.gcAddressTextField());
		addressTextField.getElement().setId("autocompletar");

		addressTextField.addKeyDownHandler(new KeyDownHandler() {
			@Override
			public void onKeyDown(final KeyDownEvent event) {
				if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
					searchGeocoding(addressTextField.getText());
				}
			}
		});

		horizontalGroup.add(addressTextField);
		horizontalGroup.add(getSearchButton());
		horizontalGroup.add(getW3WLocationButton());
		horizontalGroup.add(getLocationMenuButton());
		panel.setWidget(horizontalGroup);
		panel.setVisible(false);
	}
	return panel;
}