com.google.gwt.dom.client.Style Java Examples

The following examples show how to use com.google.gwt.dom.client.Style. 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: ConstantPermissionMappingEditor.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void setupTable() {
    table = new DefaultCellTable<>(5);
    table.setSelectionModel(selectionModel);

    // columns
    Column<ModelNode, String> classNameColumn = createColumn("class-name");
    Column<ModelNode, String> moduleColumn = createColumn("module");
    Column<ModelNode, String> targetNameColumn = createColumn("target-name");
    Column<ModelNode, String> actionColumn = createColumn("action");
    classNameColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    moduleColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    targetNameColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    actionColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    table.addColumn(classNameColumn, "Class name");
    table.addColumn(moduleColumn, "Module");
    table.addColumn(targetNameColumn, "Target name");
    table.addColumn(actionColumn, "Action");
    table.setColumnWidth(classNameColumn, 40, Style.Unit.PCT);
    table.setColumnWidth(moduleColumn, 20, Style.Unit.PCT);
    table.setColumnWidth(targetNameColumn, 25, Style.Unit.PCT);
    table.setColumnWidth(actionColumn, 15, Style.Unit.PCT);
}
 
Example #2
Source File: BatchView.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public Widget createWidget() {
    SecurityContext securityContext = securityFramework.getSecurityContext(presenter.getProxy().getNameToken());
    batchPanel = new BatchPanel(statementContext, securityContext, presenter);
    threadPoolPanel = new ThreadPoolPanel(statementContext, securityContext, presenter);
    threadFactoriesPanel = new ThreadFactoriesPanel(statementContext, securityContext, presenter);

    DefaultTabLayoutPanel tabs = new DefaultTabLayoutPanel(40, Style.Unit.PX);
    tabs.addStyleName("default-tabpanel");
    tabs.add(batchPanel, "Batch");
    tabs.add(threadPoolPanel, "Thread Pool");
    tabs.add(threadFactoriesPanel, "Thread Factories");
    tabs.selectTab(0);

    return tabs;
}
 
Example #3
Source File: MechanismProviderFilteringSaslServerFilterEditor.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void setupTable() {
    table = new DefaultCellTable<>(5, nameProvider);
    table.setSelectionModel(selectionModel);

    // columns
    Column<ModelNode, String> providerNameColumn = createColumn("provider-name");
    Column<ModelNode, String> mechanismNameColumn = createColumn("mechanism-name");
    Column<ModelNode, String> providerVersionColumn = createColumn("provider-version");
    Column<ModelNode, String> versionComparisonColumn = createColumn("version-comparison");
    providerNameColumn.setSortable(true);
    providerNameColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    mechanismNameColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    providerVersionColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    versionComparisonColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    table.addColumn(providerNameColumn, "Provider Name");
    table.addColumn(mechanismNameColumn, "Mechanism Name");
    table.addColumn(providerVersionColumn, "Provider Version");
    table.addColumn(versionComparisonColumn, "Version Comparison");
    table.setColumnWidth(providerNameColumn, 30, Style.Unit.PCT);
    table.setColumnWidth(mechanismNameColumn, 30, Style.Unit.PCT);
    table.setColumnWidth(providerVersionColumn, 20, Style.Unit.PCT);
    table.setColumnWidth(versionComparisonColumn, 20, Style.Unit.PCT);
}
 
Example #4
Source File: MaterialPathAnimator.java    From gwt-material-addins with Apache License 2.0 6 votes vote down vote up
/**
 * Animate the path animator
 */
public void animate() {
    detectOutOfScopeElement(targetElement, () -> {
        $("document").ready(() -> {
            onStartAnimateCallback();
            JsPathAnimator.cta(sourceElement, targetElement, options, () -> {
                if (animateCallback != null) {
                    animateCallback.call();
                } else {
                    // For default animateCallback when animateCallback is null
                    targetElement.getStyle().setVisibility(Style.Visibility.VISIBLE);
                    targetElement.getStyle().setOpacity(1);
                }

                if (completedCallback != null) {
                    completedCallback.call();
                }
            });
        });
    });
}
 
Example #5
Source File: ExtendedDockPanel.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * SetWidgetsSize
 */
private void setWidgetsSize() {
	// Calculating real height
	usableHeight = Window.getClientHeight();
	if (Main.get().hasHeaderCustomization) {
		usableHeight -= 72;
		RootLayoutPanel.get().setWidgetTopBottom(Main.get().mainPanel, 72, Style.Unit.PX, 0, Style.Unit.PX);
	}

	// Initialize dockPanel size
	dockPanel.setSize("" + Window.getClientWidth() + "px", "" + usableHeight + "px");

	// The active panel must be the last on initalization because establishes coordenates
	leftBorderPanel.setSize(VERTICAL_BORDER_PANEL_WIDTH, usableHeight - (TopPanel.PANEL_HEIGHT + BottomPanel.PANEL_HEIGHT));
	rightBorderPanel.setSize(VERTICAL_BORDER_PANEL_WIDTH, usableHeight - (TopPanel.PANEL_HEIGHT + BottomPanel.PANEL_HEIGHT));

	centerWidth = Window.getClientWidth() - (2 * VERTICAL_BORDER_PANEL_WIDTH);
	centerHeight = usableHeight - (TopPanel.PANEL_HEIGHT + BottomPanel.PANEL_HEIGHT);

	topPanel.setWidth("" + Window.getClientWidth() + "px");
	desktop.setSize(centerWidth, centerHeight);
	search.setSize(centerWidth, centerHeight);
	dashboard.setSize(centerWidth, centerHeight);
	administration.setSize(centerWidth, centerHeight);
}
 
Example #6
Source File: MaterialUploadHeader.java    From gwt-material-addins with Apache License 2.0 6 votes vote down vote up
@Override
protected void onLoad() {
    super.onLoad();

    $(iconColaps.getElement()).click(e -> {
        if (toggle) {
            $(getPreview().getUploadCollection().getElement()).css("visibility", "hidden");
            $(iconColaps).html("keyboard_arrow_up");
            $(getPreview().getUploadCollection().getElement()).css("height", "0px");
            toggle = false;
        } else {
            $(getPreview().getUploadCollection().getElement()).css("visibility", "visible");
            $(iconColaps).html("keyboard_arrow_down");
            $(getPreview().getUploadCollection().getElement()).css("height", "initial");
            toggle = true;
        }
        return true;
    });

    registerHandler(iconClose.addClickHandler(clickEvent -> preview.setVisibility(Style.Visibility.HIDDEN)));
}
 
Example #7
Source File: ServiceProviderView.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public Widget createWidget() {
    //noinspection Duplicates
    SecurityContext securityContext = securityFramework.getSecurityContext(presenter.getProxy().getNameToken());

    serviceProviderEditor = new ServiceProviderEditor(presenter, securityContext, statementContext,
            descriptionRegistry.lookup(SERVICE_PROVIDER_TEMPLATE));
    handlerEditor = new ServiceProviderHandlerEditor(presenter, dispatcher, securityContext, statementContext,
            descriptionRegistry.lookup(SERVICE_PROVIDER_HANDLER_TEMPLATE), "SAML Handler");

    PagedView pagedView = new PagedView(true);
    pagedView.addPage("Service Provider", serviceProviderEditor.asWidget());
    pagedView.addPage("SAML Handlers", handlerEditor.asWidget());

    pagedView.showPage(0);

    DefaultTabLayoutPanel root = new DefaultTabLayoutPanel(40, Style.Unit.PX);
    root.addStyleName("default-tabpanel");
    root.add(pagedView.asWidget(), "Service Provider");
    root.selectTab(0);

    return root.asWidget();
}
 
Example #8
Source File: PathAnimatorShowcase.java    From gwt-material-demo with Apache License 2.0 6 votes vote down vote up
@UiHandler("btnFAB")
void onFAB(ClickEvent e){
    // Execute the opening callback once the fab is clicked
    MaterialPathAnimator.animate(btnFAB.getElement(), musicPanel.getElement(), () -> {
        // Hide the fab with zoom out animation
        new MaterialAnimation().transition(Transition.ZOOMOUT).animate(btnFAB);
        btnFAB.setVisibility(Style.Visibility.HIDDEN);
        btnFAB.setOpacity(0);

        // Setting the visibility of the music panel
        musicPanel.setVisibility(Style.Visibility.VISIBLE);
        musicPanel.setOpacity(1);

        // Setting the music label with Bounce up animation
        lblMusic.setText("Pharell Williams / Love Yourself to Dance");
        new MaterialAnimation().transition(Transition.BOUNCEINUP).animate(lblMusic);

        // Setting the image of the artist
        imgMusic.setUrl("http://thatgrapejuice.net/wp-content/uploads/2013/08/pharrell-williams-that-grape-juice.png");
    });
}
 
Example #9
Source File: NavRootNodeEditorView.java    From dashbuilder with Apache License 2.0 6 votes vote down vote up
@Override
public void addCommand(String name, Command command) {
    AnchorElement anchor = Document.get().createAnchorElement();
    anchor.setInnerText(name);

    LIElement li = Document.get().createLIElement();
    li.getStyle().setCursor(Style.Cursor.POINTER);
    li.appendChild(anchor);
    commandMenu.appendChild((Node) li);

    Event.sinkEvents(anchor, Event.ONCLICK);
    Event.setEventListener(anchor, event -> {
        if(Event.ONCLICK == event.getTypeInt()) {
            command.execute();
        }
    });
}
 
Example #10
Source File: SampleEntryPoint.java    From gwteventbinder with Apache License 2.0 6 votes vote down vote up
@Override
public void onModuleLoad() {
  // Create the object graph - a real application would use Gin
  SimpleEventBus eventBus = new SimpleEventBus();

  SidebarPresenter sidebarPresenter = new SidebarPresenter(eventBus);
  Button sidebarView = new Button("Contacts");
  sidebarView.getElement().getStyle().setFloat(Style.Float.LEFT);
  sidebarView.getElement().getStyle().setMarginRight(20, Unit.PX);
  sidebarPresenter.setView(sidebarView);
  RootPanel.get().add(sidebarView);

  ContactsPresenter contactsPresenter = new ContactsPresenter(eventBus);
  VerticalPanel contactsView = new VerticalPanel();
  contactsPresenter.setView(contactsView);
  RootPanel.get().add(contactsView);

  // Start listening for events in the presenter
  contactsPresenter.start();

  // Eagerly bind the server proxy
  ServerProxy server = new ServerProxy(eventBus);
}
 
Example #11
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 #12
Source File: MaterialWindow.java    From gwt-material-addins with Apache License 2.0 6 votes vote down vote up
/**
 * Close the window.
 */
public void close() {
    // Turn back the cursor to POINTER
    RootPanel.get().getElement().getStyle().setCursor(Style.Cursor.DEFAULT);

    windowCount--;
    if (closeAnimation == null) {
        getOpenMixin().setOn(false);
        if (windowOverlay != null && windowOverlay.isAttached() && windowCount < 1) {
            windowOverlay.removeFromParent();
        }
        CloseEvent.fire(this, false);
    } else {
        closeAnimation.animate(this, () -> {
            getOpenMixin().setOn(false);
            if (windowOverlay != null && windowOverlay.isAttached() && windowCount < 1) {
                windowOverlay.removeFromParent();
            }
            CloseEvent.fire(this, false);
        });
    }
}
 
Example #13
Source File: Footer.java    From lumongo with Apache License 2.0 5 votes vote down vote up
public Footer() {

		setBackgroundColor(Color.GREY_DARKEN_2);

		MaterialRow row = new MaterialRow();
		MaterialColumn leftColumn = new MaterialColumn(12, 6, 6);
		MaterialColumn rightColumn = new MaterialColumn(12, 6, 6);
		row.add(leftColumn);
		row.add(rightColumn);
		add(row);

		setType(FooterType.FIXED);
		MaterialLabel label = new MaterialLabel("LuMongo is distributed under a commercially friendly Apache Software license");
		label.setTextColor(Color.WHITE);
		label.setMarginTop(15);
		leftColumn.add(label);

		MaterialButton chatButton = new MaterialButton("Chat with Us");
		chatButton.setMarginTop(10);
		chatButton.setMarginLeft(20);
		chatButton.setFloat(Style.Float.RIGHT);
		chatButton.setIconType(IconType.CHAT_BUBBLE);
		chatButton.addClickHandler(clickEvent -> Window
				.open("https://gitter.im/lumongo/lumongo?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge", "_blank",
						"menubar=1,status=1,toolbar=1,scrollbars=1,resizable=1"));
		rightColumn.add(chatButton);

		MaterialButton sourceButton = new MaterialButton("Source");
		sourceButton.setMarginTop(10);
		sourceButton.setIconType(IconType.CODE);
		sourceButton.setFloat(Style.Float.RIGHT);
		sourceButton.addClickHandler(
				clickEvent -> Window.open("https://github.com/lumongo/lumongo", "_blank", "menubar=1,status=1,toolbar=1,scrollbars=1,resizable=1"));
		rightColumn.add(sourceButton);

	}
 
Example #14
Source File: CubaMainTabSheetWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void updateContentNodeHeight() {
    if (!isDynamicHeight()) {
        ComputedStyle fullHeight = new ComputedStyle(getElement());
        double contentHeight = fullHeight.getHeight();

        ComputedStyle tabsCs = new ComputedStyle(tabs);
        contentHeight -= tabsCs.getHeight();

        contentHeight -= deco.getOffsetHeight();

        ComputedStyle cs = new ComputedStyle(contentNode);
        contentHeight -= cs.getPaddingHeight();
        contentHeight -= cs.getBorderHeight();

        if (contentHeight < 0) {
            contentHeight = 0;
        }

        // Set proper values for content element
        double ceilHeight = Math.ceil(contentHeight);

        contentNode.getStyle().setHeight(ceilHeight, Style.Unit.PX);
    } else {
        contentNode.getStyle().clearHeight();
    }
}
 
Example #15
Source File: ViewContainerToElementMapper.java    From jetpad-projectional-open-source with Apache License 2.0 5 votes vote down vote up
public ViewContainerToElementMapper(ViewContainer source, Element target, final boolean eventsDisabled) {
  super(source, target);

  myCtx = new ViewToDomContext() {
    @Override
    public ReadableProperty<Rectangle> visibleArea() {
      return myVisibleArea;
    }

    @Override
    public MapperFactory<View, Element> getFactory() {
      return ViewMapperFactory.factory(this);
    }

    @Override
    public Boolean areEventsDisabled() {
      return eventsDisabled;
    }
  };

  disablePopup(myRootDiv);
  target.appendChild(myRootDiv);
  myRootDiv.setTabIndex(0);

  final Style rootDivStyle = myRootDiv.getStyle();
  rootDivStyle.setPosition(Style.Position.RELATIVE);
  rootDivStyle.setPadding(0, Style.Unit.PX);
  rootDivStyle.setOverflow(Style.Overflow.VISIBLE);
  rootDivStyle.setOutlineStyle(Style.OutlineStyle.NONE);
}
 
Example #16
Source File: HorizontalViewMapper.java    From jetpad-projectional-open-source with Apache License 2.0 5 votes vote down vote up
HorizontalViewMapper(ViewToDomContext ctx, HorizontalView source) {
  super(ctx, source, DOM.createDiv());
  myContainer = DOM.createDiv();
  getTarget().appendChild(myContainer);

  Element clear = DOM.createDiv();
  clear.getStyle().setClear(Style.Clear.BOTH);
  getTarget().appendChild(clear);
}
 
Example #17
Source File: CoreQueueEditor.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Widget asWidget() {
    LayoutPanel layout = new LayoutPanel();

    VerticalPanel panel = new VerticalPanel();
    panel.setStyleName("rhs-content-panel");

    ScrollPanel scroll = new ScrollPanel(panel);
    layout.add(scroll);
    layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT);

    serverName = new HTML("Replace me");
    serverName.setStyleName("content-header-label");

    panel.add(serverName);
    panel.add(new ContentDescription("Configuration for core queues."));

    TabPanel bottomLayout = new TabPanel();
    bottomLayout.addStyleName("default-tabpanel");
    bottomLayout.addStyleName("master_detail-detail");

    queueList = new CoreQueueList(presenter);
    bottomLayout.add(queueList.asWidget(), "Queues");

    bottomLayout.selectTab(0);

    panel.add(bottomLayout);

    return layout;
}
 
Example #18
Source File: MaterialComboBox.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
@Override
protected void onLoad() {
    label.setInitialClasses(AddinsCssName.SELECT2LABEL);
    addWidget(listbox);
    addWidget(label);
    addWidget(errorLabel);
    errorLabel.setMarginTop(8);
    listbox.setGwtDisplay(Style.Display.BLOCK);

    super.onLoad();

    load();

    registerHandler(addSelectionHandler(valueChangeEvent -> $(getElement()).find("input").val("")));
}
 
Example #19
Source File: GwtEditorImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
public GutterPanel(int lineCount, GwtEditorImpl editor) {
  super(lineCount + 1, 1);

  // dummy element - fill free space with same background and resize it
  set(lineCount, new InlineHTML("&#8205;"));

  getCellFormatter().getElement(lineCount, 0).getStyle().setHeight(100, Style.Unit.PCT);

  getElement().getStyle().setWhiteSpace(Style.WhiteSpace.NOWRAP);
  getElement().addClassName(GwtEditorSchemeKeys.GUTTER_BACKGROUND + "_bg");
  getElement().addClassName(GwtEditorSchemeKeys.TEARLINE_COLOR + "_brc");
  getElement().getStyle().setProperty("borderRightStyle", "solid");
  getElement().getStyle().setProperty("borderRightWidth", "1px");
}
 
Example #20
Source File: RecycleManager.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to add the provided widgets with {@link RecycleType} defined
 */
protected void add(List<Widget> widgets) {
    switch (type) {
        case DETACH:
            for (Widget widget : widgets) {
                parent.add(widget);
            }

            break;
        case DISPLAY:
            widgets.forEach(widget -> widget.getElement().getStyle().setDisplay(Style.Display.BLOCK));
            break;
    }
}
 
Example #21
Source File: SimplePermissionMappingEditor.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void setupTable() {
    table = new DefaultCellTable<>(5);
    table.setSelectionModel(selectionModel);

    // columns
    Column<ModelNode, String> matchAll = createColumn("match-all");
    Column<ModelNode, String> principals = createColumn("principals");
    Column<ModelNode, String> roles = createColumn(ROLES);
    Column<ModelNode, ModelNode> linkOpenDetailsColumn = new Column<ModelNode, ModelNode>(
            new ViewLinkCell<>(Console.CONSTANTS.common_label_view(), this::showDetailModal)) {
        @Override
        public ModelNode getValue(ModelNode node) {
            return node;
        }
    };

    matchAll.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    principals.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    roles.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    linkOpenDetailsColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    table.addColumn(matchAll, "Match All");
    table.addColumn(principals, "Principals");
    table.addColumn(roles, "Roles");
    table.addColumn(linkOpenDetailsColumn, "Permissions");
    table.setColumnWidth(matchAll, 20, Style.Unit.PCT);
    table.setColumnWidth(principals, 30, Style.Unit.PCT);
    table.setColumnWidth(roles, 30, Style.Unit.PCT);
    table.setColumnWidth(linkOpenDetailsColumn, 20, Style.Unit.PCT);
}
 
Example #22
Source File: Affix.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void clearElementStyle() {
	Element e = this.getElement();
	Style style = e.getStyle();

	style.clearPosition();
	style.clearTop();
	style.clearBottom();
	style.clearWidth();
	style.clearHeight();
	style.clearZIndex();
	e.getParentElement().getStyle().clearPaddingTop();
}
 
Example #23
Source File: StyleHelper.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
public static Style.Unit getMeasurementUnit(String value) {
    if (value == null) {
        return null;
    }
    try {
        return Style.Unit.valueOf(
                value.replaceAll("[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?", "").toUpperCase());
    } catch (IllegalArgumentException e) {
        // Silently catch invalid units
        return null;
    }
}
 
Example #24
Source File: FieldTypeMixin.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
@Override
public void setFieldWidth(double percentWidth) {
    if (field != null) {
        field.getElement().getStyle().setWidth(percentWidth, Style.Unit.PCT);
    } else {
        GWT.log("Field is not defined", new IllegalStateException());
    }
}
 
Example #25
Source File: MapEditorView.java    From dashbuilder with Apache License 2.0 5 votes vote down vote up
private void addColumn(final com.google.gwt.user.cellview.client.Column<Map.Entry<String, String>, String> column,
                       final int columnIndex, final String header, final boolean isSortable, final int width) {
    column.setSortable(isSortable);
    column.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    grid.addColumn(column, header);
    grid.setColumnWidth(column, width, Style.Unit.PCT);
    column.setFieldUpdater(new FieldUpdater<Map.Entry<String, String>, String>() {
        @Override
        public void update(final int index, final Map.Entry<String, String> object, final String value) {
            presenter.update(columnIndex, index, object, value);
        }
    });
}
 
Example #26
Source File: MaterialWidgetTest.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
public void testFloat() {
    // UiBinder
    // given
    T widget = getWidget(false);

    // when / then
    widget.setFloat(Style.Float.LEFT);
    assertEquals(Style.Float.LEFT, widget.getFloat());

    widget.setFloat(Style.Float.RIGHT);
    assertEquals(Style.Float.RIGHT, widget.getFloat());

    widget.setFloat(Style.Float.NONE);
    assertEquals(Style.Float.NONE, widget.getFloat());

    // Standard
    // given
    attachWidget();
    final Element element = widget.getElement();

    // when / then
    widget.setFloat(Style.Float.LEFT);
    assertTrue(element.hasClassName(Style.Float.LEFT.getCssName()));

    widget.setFloat(Style.Float.RIGHT);
    assertTrue(element.hasClassName(Style.Float.RIGHT.getCssName()));

    widget.setFloat(Style.Float.NONE);
    assertTrue(element.hasClassName(Style.Float.NONE.getCssName()));
}
 
Example #27
Source File: ConfigAdminView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Widget createWidget() {
    configAdminEditor = new ConfigAdminEditor(presenter);

    DefaultTabLayoutPanel tabLayoutPanel = new DefaultTabLayoutPanel(40, Style.Unit.PX);
    tabLayoutPanel.addStyleName("default-tabpanel");

    tabLayoutPanel.add(configAdminEditor.asWidget(), Console.CONSTANTS.subsys_configadmin());
    tabLayoutPanel.selectTab(0);

    return tabLayoutPanel;
}
 
Example #28
Source File: TableWidgetDelegate.java    From cuba with Apache License 2.0 5 votes vote down vote up
public void updateHeaderCellWidth(VScrollTable.HeaderCell hCell, int minWidth, double realColWidth) {
    if (realColWidth > minWidth) {
        Style hStyle = hCell.getElement().getStyle();
        hStyle.setProperty("width", realColWidth + "px");
        hStyle.setProperty("minWidth", realColWidth + "px");
        hStyle.setProperty("maxWidth", realColWidth + "px");
    }
}
 
Example #29
Source File: MediaView.java    From gwt-material-demo with Apache License 2.0 5 votes vote down vote up
private void setFullscreen(boolean fullscreen) {
    slider.setFullscreen(fullscreen);

    if(fullscreen) {
        slider.getElement().getStyle().setPosition(Style.Position.FIXED);
        slider.getElement().getStyle().setZIndex(9998);
        slider.setHeight("100%");

        fullscreenBtn.getElement().getStyle().setPosition(Style.Position.FIXED);
        fullscreenBtn.getElement().getStyle().setZIndex(9999);
        fullscreenBtn.getElement().getStyle().setBottom(0, Style.Unit.PX);
        fullscreenBtn.getElement().getStyle().setLeft(0, Style.Unit.PX);
        fullscreenBtn.setIconType(IconType.FULLSCREEN_EXIT);
        fullscreenBtn.setText("Close Fullscreen");
    } else {
        slider.getElement().getStyle().clearPosition();
        slider.getElement().getStyle().clearZIndex();
        slider.getElement().getStyle().clearHeight();

        fullscreenBtn.getElement().getStyle().clearPosition();
        fullscreenBtn.getElement().getStyle().clearZIndex();
        fullscreenBtn.getElement().getStyle().clearBottom();
        fullscreenBtn.getElement().getStyle().clearLeft();
        fullscreenBtn.setIconType(IconType.FULLSCREEN);
        fullscreenBtn.setText("Fullscreen Slider");
    }
}
 
Example #30
Source File: StatusDisplayMixin.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
/**
 * If the message tooltip is our of vertical viewport then we update the position to be at the bottom
 */
protected void showStatus() {
    if (position == null) {
        if (!new ScrollHelper().isInViewPort(textObject.getElement())) {
            position = Position.TOP;
        } else {
            position = Position.LEFT;
        }
    }

    updatePosition(position);
    textObject.getElement().getStyle().setVisibility(Style.Visibility.VISIBLE);
}