• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CSSStyleDeclaration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中elemental.css.CSSStyleDeclaration的典型用法代码示例。如果您正苦于以下问题:Java CSSStyleDeclaration类的具体用法?Java CSSStyleDeclaration怎么用?Java CSSStyleDeclaration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CSSStyleDeclaration类属于elemental.css包,在下文中一共展示了CSSStyleDeclaration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: buildIncludedElement

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
private elemental.dom.Element buildIncludedElement(Annotation annotation, int offset) {
  final elemental.dom.Element element = annotation.getImageElement();
  final CSSStyleDeclaration style = element.getStyle();
  int layer = annotation.getLayer();
  style.setZIndex(layer);
  style.setPosition(ABSOLUTE);
  style.setTop("0");
  style.setLeft("0");
  style.setRight("0");
  style.setBottom("0");

  element.getDataset().setAt(MESSAGE_DATASET_NAME, annotation.getText());
  element.getDataset().setAt(TYPE_DATASET_NAME, annotation.getType());
  element.getDataset().setAt(LAYER_DATASET_NAME, Integer.toString(layer));
  element.getDataset().setAt(OFFSET_DATASET_NAME, Integer.toString(offset));

  return element;
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:AnnotationGroupImpl.java


示例2: ensureChildrenContainer

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
/**
 * If this node does not have a children container, but has children data, then we coerce a
 * children container into existence.
 */
final void ensureChildrenContainer(NodeDataAdapter<D> dataAdapter, Tree.Css css) {
  if (!hasChildrenContainer()) {
    D data = getData();
    if (dataAdapter.hasChildren(data)) {
      Element childrenContainer = Elements.createElement("ul", css.childrenContainer());
      this.appendChild(childrenContainer);
      childrenContainer.getStyle().setDisplay(CSSStyleDeclaration.Display.NONE);
      ((Element) getExpandControl().getChildNodes().item(0)).getStyle().setDisplay("block");
      ((Element) getExpandControl().getChildNodes().item(1)).getStyle().setDisplay("none");

    } else {
      getExpandControl().setClassName(css.expandControl() + " " + css.leafIcon());
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:TreeNodeElement.java


示例3: calculateSize

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
/** Calculates (or recalculates) the sizes of the scrollbars. */
public void calculateSize() {
  Element container = createContainer();

  // No scrollbars
  container.getStyle().setOverflow(CSSStyleDeclaration.Overflow.HIDDEN);
  int noScrollbarClientHeight = container.getClientHeight();
  int noScrollbarClientWidth = container.getClientWidth();

  // Force scrollbars
  container.getStyle().setOverflow(CSSStyleDeclaration.Overflow.SCROLL);
  heightOfHorizontalScrollbar = noScrollbarClientHeight - container.getClientHeight();
  widthOfVerticalScrollbar = noScrollbarClientWidth - container.getClientWidth();

  DomUtils.removeFromParent(container);
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:ScrollbarSizeCalculator.java


示例4: setDisplayVisibility2

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
/**
 * Sets the visibility of an element via the {@code display} CSS property.
 *
 * @param defaultVisible if true, the element is visible by default (according to its classes)
 * @param displayVisibleValue if {@code defaultVisible} is false, this must be given. This is the
 *     preferred 'display' value to make it visible
 */
public static void setDisplayVisibility2(
    Element element, boolean visible, boolean defaultVisible, String displayVisibleValue) {
  if (visible) {
    if (defaultVisible) {
      element.getStyle().removeProperty("display");
    } else {
      element.getStyle().setDisplay(displayVisibleValue);
    }
  } else {
    if (defaultVisible) {
      element.getStyle().setDisplay(CSSStyleDeclaration.Display.NONE);
    } else {
      element.getStyle().removeProperty("display");
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:CssUtils.java


示例5: animatePropertySet

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
/**
 * Enables animations prior to setting the value for the specified style property on the supplied
 * element. The end result is that there property is transitioned to.
 *
 * @param elem the {@link Element} we want to set the style property on.
 * @param property the name of the style property we want to set.
 * @param value the target value of the style property.
 * @param duration the time in seconds we want the transition to last.
 * @param animationCallback callback that is invoked when the animation completes. It will be
 *     passed a {@code null} event if the animation was pre-empted by some other animation on the
 *     same element.
 */
public static void animatePropertySet(
    final Element elem,
    String property,
    String value,
    double duration,
    final EventListener animationCallback) {
  final CSSStyleDeclaration style = elem.getStyle();
  enableTransitions(style, duration);

  if (UserAgent.isFirefox()) {
    // For FF4.
    new TransitionEndHandler(animationCallback).handleEndFor(elem, "transitionend");
  } else {
    // For webkit based browsers.
    // TODO: Keep an eye on whether or not webkit supports the
    // vendor prefix free version. If they ever do we should remove this.
    new TransitionEndHandler(animationCallback).handleEndFor(elem, Event.WEBKITTRANSITIONEND);
  }

  style.setProperty(property, value);
}
 
开发者ID:eclipse,项目名称:che,代码行数:34,代码来源:AnimationUtils.java


示例6: getAllNamesFromStyles

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
private List<String> getAllNamesFromStyles(ViewOn<Integer> view) {
	CSSStyleDeclaration styles = ((Element) view.getView().dom()).getStyle();
	List<String> result = new ArrayList<>();
	for (int x = 0; x < styles.getLength(); x++) {
		result.add(styles.item(x));
	}
	Collections.sort(result);
	return result;
}
 
开发者ID:nielsbaloe,项目名称:vertxui,代码行数:10,代码来源:FluentRenderer.java


示例7: setElementLeftAndTop

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
/** Sets an elements left and top to the provided values. */
private void setElementLeftAndTop(double left, double top) {
  CSSStyleDeclaration style = element.getStyle();
  if (left != IGNORE) {
    style.setLeft(left, Unit.PX);
  }
  if (top != IGNORE) {
    style.setTop(top, Unit.PX);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:PositionController.java


示例8: resetElementPosition

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
/**
 * Resets an element's position by removing top/right/bottom/left and setting position to
 * absolute.
 */
private void resetElementPosition() {
  CSSStyleDeclaration style = element.getStyle();
  style.setPosition("absolute");
  style.clearTop();
  style.clearRight();
  style.clearBottom();
  style.clearLeft();

  elementPositioner.appendElementToContainer(element);
}
 
开发者ID:eclipse,项目名称:che,代码行数:15,代码来源:PositionController.java


示例9: ensureVisibleAndGetRect

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
/**
 * Ensures that an element is not display: none and is just visibility hidden so we can get an
 * accurate client rect.
 */
private static ClientRect ensureVisibleAndGetRect(Element element) {
  // Try to get rect and see if it isn't all 0's
  ClientRect rect = element.getBoundingClientRect();
  double rectSum =
      rect.getBottom()
          + rect.getTop()
          + rect.getLeft()
          + rect.getRight()
          + rect.getHeight()
          + rect.getWidth();
  if (rectSum != 0) {
    return rect;
  }

  // We make an attempt to get an accurate measurement of the element
  CSSStyleDeclaration style = element.getStyle();
  String visibility = CssUtils.setAndSaveProperty(element, "visibility", "hidden");
  String display = style.getDisplay();

  // if display set to none we remove it and let its normal style show through
  if (style.getDisplay().equals("none")) {
    style.removeProperty("display");
  } else {
    // it's likely display: none in a css class so we just have to guess.
    // We guess display:block since that's common on containers.
    style.setDisplay("block");
  }
  rect = element.getBoundingClientRect();
  style.setDisplay(display);
  style.setVisibility(visibility);

  return rect;
}
 
开发者ID:eclipse,项目名称:che,代码行数:38,代码来源:PositionController.java


示例10: applyImageResource

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
/**
 * Applies the image resource to the specified element with the specified horizontal and vertical
 * background positions.
 *
 * <p>The height and width of the element are not modified under the presumption that if you
 * specify the horizontal and vertical position, the image will not be the only content of the
 * element.
 */
public static void applyImageResource(
    Element elem, ImageResource image, String hPos, String vPos) {
  CSSStyleDeclaration style = elem.getStyle();
  style.setBackgroundImage("url(" + image.getSafeUri().asString() + ")");
  style.setProperty("background-repeat", "no-repeat");
  style.setProperty("background-position", hPos + " " + vPos);
  style.setOverflow("hidden");
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:ImageResourceUtils.java


示例11: createContainer

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
private Element createContainer() {
  Element container = Elements.createDivElement();

  final int containerSize = 500;
  CSSStyleDeclaration containerStyle = container.getStyle();
  containerStyle.setWidth(containerSize, CSSStyleDeclaration.Unit.PX);
  containerStyle.setHeight(containerSize, CSSStyleDeclaration.Unit.PX);
  containerStyle.setPosition(CSSStyleDeclaration.Position.ABSOLUTE);
  containerStyle.setLeft(-containerSize, CSSStyleDeclaration.Unit.PX);
  containerStyle.setTop(-containerSize, CSSStyleDeclaration.Unit.PX);

  Elements.getBody().appendChild(container);

  return container;
}
 
开发者ID:eclipse,项目名称:che,代码行数:16,代码来源:ScrollbarSizeCalculator.java


示例12: FontDimensionsCalculator

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
private FontDimensionsCalculator(String fontClassName) {
  this.fontClassName = fontClassName;
  // This handler will be called when the browser window zooms
  Window.addResizeHandler(
      new ResizeHandler() {
        @Override
        public void onResize(ResizeEvent arg0) {
          measureAndDispatch();
        }
      });

  // Build a multirow text block so we can measure it
  StringBuilder htmlContent = new StringBuilder(SAMPLE_TEXT);
  for (int i = 1; i < SAMPLE_ROWS; i++) {
    htmlContent.append("<br/>");
    htmlContent.append(SAMPLE_TEXT);
  }

  dummyElement = Elements.createSpanElement(fontClassName);
  dummyElement.setInnerHTML(htmlContent.toString());
  dummyElement.getStyle().setVisibility(CSSStyleDeclaration.Visibility.HIDDEN);
  dummyElement.getStyle().setPosition(CSSStyleDeclaration.Position.ABSOLUTE);
  Elements.getBody().appendChild(dummyElement);

  fontDimensions = new FontDimensionsImpl();

  repeater.schedule(pollingDelay);

  /*
   * Force an initial measure (the dispatch won't happen since no one is
   * attached)
   */
  measureAndDispatch();
}
 
开发者ID:eclipse,项目名称:che,代码行数:35,代码来源:FontDimensionsCalculator.java


示例13: setDisplayVisibility

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
/**
 * Sets the visibility of an element via the {@code display} CSS property. When visible, the
 * {@code display} will be set to {@code block}.
 */
@Deprecated
public static void setDisplayVisibility(Element element, boolean visible) {
  if (visible) {
    element.getStyle().setDisplay(CSSStyleDeclaration.Display.BLOCK);
  } else {
    element.getStyle().setDisplay(CSSStyleDeclaration.Display.NONE);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:13,代码来源:CssUtils.java


示例14: getCurrentHeight

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
/** Returns the height as would be set on the CSS "height" property. */
private int getCurrentHeight(final Element element) {
  // TODO: test to see if horizontal scroll plays nicely
  CSSStyleDeclaration style = CssUtils.getComputedStyle(element);
  return element.getClientHeight()
      - CssUtils.parsePixels(style.getPaddingTop())
      - CssUtils.parsePixels(style.getPaddingBottom());
}
 
开发者ID:eclipse,项目名称:che,代码行数:9,代码来源:AnimationController.java


示例15: hideWithoutAnimating

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
/**
 * Hide the element without animating it out of view. Use this method to set the initial state of
 * the element.
 */
public void hideWithoutAnimating(Element element) {
  if (isAnyState(element, State.HIDDEN)) {
    return;
  }
  cancel(element);
  element.getStyle().setDisplay(CSSStyleDeclaration.Display.NONE);
  setState(element, State.HIDDEN);
}
 
开发者ID:eclipse,项目名称:che,代码行数:13,代码来源:AnimationController.java


示例16: cancel

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
/** Cancel the currently executing animation without completing it. */
private void cancel(Element element) {
  // Cancel all handlers.
  setLastCommandImpl(element, null);
  hideEndHandler.unhandleEndFor(element);
  showEndHandler.unhandleEndFor(element);

  // Disable animations.
  CSSStyleDeclaration style = element.getStyle();
  AnimationUtils.removeTransitions(style);
  if (options.collapse) {
    AnimationUtils.restoreOverflow(style);
  }

  // Remove the height and properties we set.
  if (options.collapse) {
    style.removeProperty("height");
    style.removeProperty("margin-top");
    style.removeProperty("margin-bottom");
    style.removeProperty("padding-top");
    style.removeProperty("padding-bottom");
  }
  if (options.fade) {
    style.removeProperty("opacity");
  }
  CssUtils.removeBoxShadow(element);
}
 
开发者ID:eclipse,项目名称:che,代码行数:28,代码来源:AnimationController.java


示例17: removeTransitions

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
/** Removes CSS3 transitions, returning them to their original state. */
public static void removeTransitions(CSSStyleDeclaration style) {
  style.removeProperty("-webkit-transition-property");
  style.removeProperty("-moz-transition-property");
  style.removeProperty("-webkit-transition-duration");
  style.removeProperty("-moz-transition-duration");
}
 
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:AnimationUtils.java


示例18: fadeIn

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
public static void fadeIn(final Element elem) {
  elem.getStyle().setDisplay(CSSStyleDeclaration.Display.BLOCK);

  // TODO: This smells like a chrome bug to me that we need to do a
  // deferred command here.
  Scheduler.get()
      .scheduleDeferred(
          new ScheduledCommand() {
            @Override
            public void execute() {
              animatePropertySet(elem, "opacity", "1.0", SHORT_TRANSITION_DURATION);
            }
          });
}
 
开发者ID:eclipse,项目名称:che,代码行数:15,代码来源:AnimationUtils.java


示例19: isVisible

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
/** Test if the element his its {@code display} set to something other than {@code none}. */
public static boolean isVisible(Element element) {
  return !element.getStyle().getDisplay().equals(CSSStyleDeclaration.Display.NONE);
}
 
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:CssUtils.java


示例20: isPixels

import elemental.css.CSSStyleDeclaration; //导入依赖的package包/类
public static boolean isPixels(String value) {
  return value.toLowerCase().endsWith(CSSStyleDeclaration.Unit.PX);
}
 
开发者ID:eclipse,项目名称:che,代码行数:4,代码来源:CssUtils.java



注:本文中的elemental.css.CSSStyleDeclaration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RuleDelegation类代码示例发布时间:2022-05-16
下一篇:
Java SignedSoftwareCertificate类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap