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

The following examples show how to use com.google.gwt.dom.client.Style. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: dashbuilder   Source File: NavRootNodeEditorView.java    License: 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 2
@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 3
/**
 * 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 4
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 5
Source Project: gwt-material-addins   Source File: MaterialPathAnimator.java    License: 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 6
Source Project: gwt-material-demo   Source File: PathAnimatorShowcase.java    License: 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 7
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 8
Source Project: core   Source File: BatchView.java    License: 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 9
Source Project: gwteventbinder   Source File: SampleEntryPoint.java    License: 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 10
Source Project: dashbuilder   Source File: SelectorSliderDisplayerView.java    License: 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 11
Source Project: gwt-material-addins   Source File: MaterialWindow.java    License: 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 12
Source Project: gwt-material-addins   Source File: MaterialUploadHeader.java    License: 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 13
@Override
public void refreshProperties() {
  super.refreshProperties();

  Style style = getTarget().getStyle();
  Vector maxDim = getSource().maxDimension().get();
  style.setProperty("maxWidth", maxDim.x + "px");
  style.setProperty("maxHeight", maxDim.y + "px");

  style.setOverflowY(getSource().scroll().get() ? Style.Overflow.SCROLL : Style.Overflow.HIDDEN);
}
 
Example 14
public void execute() {
  Style style = menuButtonContainer.getElement().getStyle();
  if (resizeButtonVisible) {
    style.setDisplay(Display.BLOCK);
  } else {
    style.setDisplay(Display.NONE);
  }
}
 
Example 15
Source Project: core   Source File: JMSEditor.java    License: 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 JMS queues and topics."));

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

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

    topicList = new JMSTopicList(presenter);
    bottomLayout.add(topicList.asWidget(), "Topics");

    bottomLayout.selectTab(0);

    panel.add(bottomLayout);

    return layout;
}
 
Example 16
Source Project: core   Source File: TXMetricViewImpl.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Widget createWidget() {
    HTML refreshBtn = new HTML("<i class='icon-refresh'></i> Refresh Results");
                  refreshBtn.setStyleName("html-link");
                  refreshBtn.getElement().getStyle().setPosition(Style.Position.RELATIVE);
                  refreshBtn.getElement().getStyle().setTop(-80, Style.Unit.PX);
                  refreshBtn.getElement().getStyle().setMarginTop(10, Style.Unit.PX);
                  refreshBtn.getElement().getStyle().setFloat(Style.Float.RIGHT);
                  refreshBtn.getElement().getStyle().setLeft(80, Style.Unit.PCT);

    refreshBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_refresh_tXMetricViewImp());

    refreshBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            presenter.refresh();
        }
    });

    this.executionMetric = new TXExecutionView();
    this.rollbackMetric = new TXRollbackView();
    this.statisticsInfo = new GeneralView();

    SimpleLayout layout = new SimpleLayout()
            .setTitle("Transaction Manager")
            .setHeadline("Transaction Metrics")
            .setDescription(Console.CONSTANTS.subys_tx_metric_desc())
            .addContent("", refreshBtn)
            .addContent("General Info", statisticsInfo.asWidget())
            .addContent("Executions", executionMetric.asWidget())
            .addContent("Rollbacks", rollbackMetric.asWidget());


    return layout.build();
}
 
Example 17
Source Project: swellrt   Source File: DiffHighlightingFilter.java    License: Apache License 2.0 5 votes vote down vote up
private void applyAnnotationsToElement(Element element, ReadableStringMap<Object> annotations) {
  final Style style = element.getStyle();
  annotations.each(new ReadableStringMap.ProcV<Object>() {
    @Override
    public void apply(String key, Object value) {
      if (value != null && value instanceof String) {
        String styleValue = (String) value;
        if (!styleValue.isEmpty()) {
          style.setProperty(StyleAnnotationHandler.suffix(key), styleValue);
        }
      }
    }
  });
}
 
Example 18
@Override
public Widget createWidget() {

    LayoutPanel layout = new LayoutPanel();

    FakeTabPanel titleBar = new FakeTabPanel("Messaging Destinations");
    layout.add(titleBar);

    panel = new PagedView(true);

    jmsEditor = new JMSEditor(presenter);
    connectionFactories = new ConnectionFactoryList(presenter);
    securitySettings = new SecurityDetails(presenter);
    addressingSettings = new AddressingDetails(presenter);
    divertList = new DivertList(presenter);

    panel.addPage("Queues/Topics", jmsEditor.asWidget()) ;
    panel.addPage("Connection Factories", connectionFactories.asWidget()) ;
    panel.addPage("Security Settings", securitySettings.asWidget()) ;
    panel.addPage("Address Settings", addressingSettings.asWidget()) ;
    panel.addPage("Diverts", divertList.asWidget()) ;

    // default page
    panel.showPage(0);

    Widget panelWidget = panel.asWidget();
    layout.add(panelWidget);

    layout.setWidgetTopHeight(titleBar, 0, Style.Unit.PX, 40, Style.Unit.PX);
    layout.setWidgetTopHeight(panelWidget, 40, Style.Unit.PX, 100, Style.Unit.PCT);

    return layout;
}
 
Example 19
Source Project: core   Source File: WebServiceView.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Widget createWidget() {

    createEndpointConfiguration();
    createClientConfiguration();

    SecurityContext securityContext = securityFramework.getSecurityContext(presenter.getProxy().getNameToken());

    providerEditor = new ProviderEditor(circuit, securityContext, descriptionRegistry.lookup(WebServicesStore.WS_SUBSYSTEM));

    tabLayoutpanel = new DefaultTabLayoutPanel(40, Style.Unit.PX);
    tabLayoutpanel.addStyleName("default-tabpanel");
    tabLayoutpanel.add(providerEditor.asWidget(), Console.CONSTANTS.subsys_ws_provider(), true);
    tabLayoutpanel.add(endpointHandlerPages.asWidget(), "Endpoint Configuration", true);
    tabLayoutpanel.add(clientHandlerPages.asWidget(), "Client Configuration", true);
    tabLayoutpanel.selectTab(0);
    tabLayoutpanel.addSelectionHandler(event -> {
        if (1 == event.getSelectedItem()) {
            endpointConfigEditor.notifyDefaultSelection();
        } else if (2 == event.getSelectedItem()) {
            clientConfigEditor.notifyDefaultSelection();
        }
    });


    return tabLayoutpanel;
}
 
Example 20
Source Project: core   Source File: ColumnFilter.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
public Widget asWidget() {
    panel = new LayoutPanel();

    textBox = new TextBox();
    textBox.setMaxLength(30);
    textBox.setVisibleLength(20);
    textBox.addKeyUpHandler(keyUpEvent -> {

        String token = textBox.getText();
        if (token != null
                && !token.equals("")) {

            if (!token.equals(currentFilterExpression)) {  // prevent keyUp w/o value change
                currentFilterExpression = token;
                selection.clear();
                applyFilter(token);
            }

        } else {
            selection.clear();
            clear();
        }
    });

    HTML icon = new HTML("<i class=\"icon-search\"></i>");
    icon.getElement().setAttribute("style", "padding-top:5px");
    textBox.getElement().setAttribute("style", "padding-top:5px");
    panel.add(icon);
    panel.add(textBox);
    panel.setWidgetLeftWidth(icon, 5, Style.Unit.PX, 20, Style.Unit.PX);
    panel.setWidgetLeftWidth(textBox, 25, Style.Unit.PX, 205, Style.Unit.PX);

    panel.getElement().getStyle().setMargin(5, Style.Unit.PX);
    return panel;
}
 
Example 21
Source Project: cuba   Source File: CubaFieldGroupLayoutConnector.java    License: Apache License 2.0 5 votes vote down vote up
protected int getMaxCaptionWidth(VGridLayout.Cell cell) {
    VCaption caption = cell.slot.getCaption();
    Element captionElement = caption.getElement();
    com.google.gwt.dom.client.Element childElement = findCaptionTextChildElement(captionElement);
    if (childElement != null) {
        // In some cases, e.g. by changing CheckBox 'captionManagedByLayout' attribute,
        // a slot has no Caption at first iteration of 'maxCaptionWidth' calculation,
        // as the result, for the second and so forth iterations, when the rest of
        // components get their captions, 'caption.getRenderedWidth()' returns an incorrect value.
        // In order to calculate the really required caption width, regardless of the 'white-space' mode,
        // we need to explicitly set it to 'nowrap'. After calculation, it's reverted back.
        Style style = childElement.getStyle();
        String prevWhiteSpace = style.getWhiteSpace();
        style.setWhiteSpace(Style.WhiteSpace.NOWRAP);
        int renderedWidth = caption.getRenderedWidth();

        if (prevWhiteSpace != null && !prevWhiteSpace.isEmpty()) {
            style.setWhiteSpace(Style.WhiteSpace.valueOf(prevWhiteSpace));
        } else {
            style.clearWhiteSpace();
        }

        return renderedWidth;
    }

    return caption.getRenderedWidth();
}
 
Example 22
protected Element createSVG() {
  Element result = SvgUtil.createSvgElement("svg");
  //without setting absolute position svg element might move down for unknown reason
  Style style = result.getStyle();
  style.setPosition(Style.Position.ABSOLUTE);
  style.setLeft(0, Style.Unit.PX);
  style.setTop(0, Style.Unit.PX);
  return result;
}
 
Example 23
Source Project: core   Source File: SelectPatchStep.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected IsWidget body(final ApplyContext context) {
    FormPanel form = new FormPanel();
    FlowPanel panel = new FlowPanel();
    form.setWidget(panel);
    panel.add(new Label(Console.CONSTANTS.patch_manager_select_patch_body()));

    if (!context.standalone) {
        info = new HTML("");
        info.getElement().getStyle().setMarginTop(2, Style.Unit.EM);
        panel.add(info);
    }

    FlowPanel uploadPanel = new FlowPanel();
    uploadPanel.getElement().getStyle().setMarginTop(2, Style.Unit.EM);
    InlineLabel uploadLabel = new InlineLabel(Console.CONSTANTS.patch_manager_select_patch_upload());
    uploadLabel.getElement().getStyle().setMarginRight(1, Style.Unit.EM);
    uploadPanel.add(uploadLabel);
    context.fileUpload = new FileUpload();
    context.fileUpload.setName("patch_file");
    context.fileUpload.getElement().setId(asId(PREFIX, getClass(), "_Upload"));
    uploadPanel.add(context.fileUpload);
    panel.add(uploadPanel);

    errorMessages = new HTML(
            "<i class=\"icon-exclamation-sign\"></i> " + Console.CONSTANTS.patch_manager_select_file());
    errorMessages.addStyleName("error");
    errorMessages.setVisible(false);
    panel.add(errorMessages);

    return form;
}
 
Example 24
Source Project: cuba   Source File: CubaMainTabSheetWidget.java    License: 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 25
Source Project: core   Source File: EEServicesView.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
Widget asWidget() {

        LayoutPanel layout = new LayoutPanel();

        panel = new PagedView(true);

        contextView = new ServiceViewTemplate(presenter, "Context Services", AddressTemplate.of("{selected.profile}/subsystem=ee/context-service=*"));
        executorView = new ServiceViewTemplate(presenter, "Executor", AddressTemplate.of("{selected.profile}/subsystem=ee/managed-executor-service=*"));
        scheduledView = new ServiceViewTemplate(presenter, "Scheduled Executor", AddressTemplate.of("{selected.profile}/subsystem=ee/managed-scheduled-executor-service=*"));
        threadView = new ServiceViewTemplate(presenter, "Thread Factories", AddressTemplate.of("{selected.profile}/subsystem=ee/managed-thread-factory=*"));
         // TODO: default bindings

        panel.addPage("Context Service", contextView.asWidget());
        panel.addPage("Executor", executorView.asWidget());
        panel.addPage("Scheduled Executor", scheduledView.asWidget());
        panel.addPage("Thread Factories", threadView.asWidget());

        // default page
        panel.showPage(0);

        Widget panelWidget = panel.asWidget();
        layout.add(panelWidget);

        layout.setWidgetTopHeight(panelWidget, 0, Style.Unit.PX, 100, Style.Unit.PCT);

        return layout;
    }
 
Example 26
private void resetSize() {
	Style imgStyle = this.imgElement.getStyle();
	imgStyle.clearProperty(Image.PROP_WIDTH);
	imgStyle.clearProperty(Image.PROP_HEIGHT);
	imgStyle.clearProperty(Image.PROP_MAX_WIDTH);
	imgStyle.clearProperty(Image.PROP_MAX_HEIGHT);

	if (this.widthPx > 0) {
		imgStyle.setPropertyPx(this.keepPropertions ? Image.PROP_MAX_WIDTH : Image.PROP_WIDTH, this.widthPx);
	}
	if (this.heightPx > 0) {
		imgStyle.setPropertyPx(this.keepPropertions ? Image.PROP_MAX_HEIGHT : Image.PROP_HEIGHT, this.heightPx);
	}
}
 
Example 27
Source Project: gwt-material   Source File: StatusDisplayMixin.java    License: 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);
}
 
Example 28
Source Project: gwt-material-demo   Source File: MediaView.java    License: 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 29
Source Project: cuba   Source File: TableWidgetDelegate.java    License: 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 30
Source Project: core   Source File: ConfigAdminView.java    License: 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;
}