当前位置: 首页>>代码示例>>Java>>正文


Java Layer类代码示例

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


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

示例1: remove

import com.google.gwt.layout.client.Layout.Layer; //导入依赖的package包/类
@Override
public boolean remove(Widget widget) {
  boolean removed = super.remove(widget);
  if (removed) {
    Layer layer = (Layer) widget.getLayoutData();
    layout.removeChild(layer);
    widget.setLayoutData(null);

    if (visibleWidget == widget) {
      visibleWidget = null;
    }
    if (hidingWidget == widget) {
      hidingWidget = null;
    }
    if (lastVisibleWidget == widget) {
      lastVisibleWidget = null;
    }
  }
  return removed;
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:21,代码来源:CustomDeckLayoutPanel.java

示例2: schedule

import com.google.gwt.layout.client.Layout.Layer; //导入依赖的package包/类
@Override
public void schedule(int duration, final AnimationCallback callback) {
  super.schedule(duration, new AnimationCallback() {
    @Override
    public void onAnimationComplete() {
      CustomDeckLayoutPanel.this.doAfterLayout();
      if (callback != null) {
        callback.onAnimationComplete();
      }
    }

    @Override
    public void onLayout(Layer layer, double progress) {
      if (callback != null) {
        callback.onLayout(layer, progress);
      }
    }
  });
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:20,代码来源:CustomDeckLayoutPanel.java

示例3: insert

import com.google.gwt.layout.client.Layout.Layer; //导入依赖的package包/类
/**
 * Insert a widget before the specified widget. If the widget is already a
 * child of this panel, this method behaves as though {@link #remove(Widget)}
 * had already been called.
 *
 * @param widget the widget to be added
 * @param before the widget before which to insert the new child, or <code>null</code> to append
 */
public void insert(Widget widget, Widget before) {
  assertIsChild(before);

  // Detach new child.
  widget.removeFromParent();

  // Logical attach.
  WidgetCollection children = getChildren();
  if (before == null) {
    children.add(widget);
  } else {
    int index = children.indexOf(before);
    children.insert(widget, index);
  }

  // Physical attach.
  Layer layer = layout.attachChild(widget.getElement(), (before != null)
      ? before.getElement() : null, widget);
  setWidgetVisible(widget, layer, false);
  widget.setLayoutData(layer);

  // Adopt.
  adopt(widget);

  // Update the layout.
  animate(0);
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:36,代码来源:CustomDeckLayoutPanel.java

示例4: doAfterLayout

import com.google.gwt.layout.client.Layout.Layer; //导入依赖的package包/类
/**
 * Hide the widget that just slid out of view.
 */
private void doAfterLayout() {
  if (hidingWidget != null) {
    Layer layer = (Layer) hidingWidget.getLayoutData();
    setWidgetVisible(hidingWidget, layer, false);
    layout.layout();
    hidingWidget = null;
  }
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:12,代码来源:CustomDeckLayoutPanel.java

示例5: setWidgetVisible

import com.google.gwt.layout.client.Layout.Layer; //导入依赖的package包/类
private void setWidgetVisible(Widget widget, Layer layer, boolean visible) {
  layer.setVisible(visible);

  /*
   * Set the visibility of the widget. This is used by lazy panel to
   * initialize the widget.
   */
  widget.setVisible(visible);
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:10,代码来源:CustomDeckLayoutPanel.java

示例6: show

import com.google.gwt.layout.client.Layout.Layer; //导入依赖的package包/类
private void show(final int newIndex) {
	if (newIndex == currentIndex) {
		return;
	}

	boolean fromLeft = newIndex < currentIndex;
	currentIndex = newIndex;

	final Widget widget = widgets.get(newIndex);
	final Widget current = layoutPanel.getWidget(0);

	// Initialize the layout.
	layoutPanel.add(widget);
	layoutPanel.setWidgetLeftWidth(current, 0, Unit.PCT, 100, Unit.PCT);
	if (fromLeft) {
		layoutPanel.setWidgetLeftWidth(widget, -100, Unit.PCT, 100, Unit.PCT);
	} else {
		layoutPanel.setWidgetLeftWidth(widget, 100, Unit.PCT, 100, Unit.PCT);
	}
	layoutPanel.forceLayout();

	// Slide into view.
	if (fromLeft) {
		layoutPanel.setWidgetLeftWidth(current, 100, Unit.PCT, 100, Unit.PCT);
	} else {
		layoutPanel.setWidgetLeftWidth(current, -100, Unit.PCT, 100, Unit.PCT);
	}
	layoutPanel.setWidgetLeftWidth(widget, 0, Unit.PCT, 100, Unit.PCT);
	layoutPanel.animate(500, new Layout.AnimationCallback() {

		public void onAnimationComplete() {
			// Remove the old widget when the animation completes.
			layoutPanel.remove(current);
			if (eventBus != null) {
				eventBus.fireEvent(new AnimationCompleteEvent(widget, newIndex));
			}
		}

		public void onLayout(Layer layer, double progress) {
			/*
			 * on lay out
			 */
		}
	});
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:46,代码来源:SlidingPanel.java

示例7: onLayout

import com.google.gwt.layout.client.Layout.Layer; //导入依赖的package包/类
@Override
public void onLayout(Layer arg0, double progres) {
  navContent.setSize(getNewSize(progres) + "px", "100%");
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:5,代码来源:AppLayout.java

示例8: doBeforeLayout

import com.google.gwt.layout.client.Layout.Layer; //导入依赖的package包/类
/**
 * Initialize the location of the widget that will slide into view.
 */
private void doBeforeLayout() {
  Layer oldLayer = (lastVisibleWidget == null) ? null
      : (Layer) lastVisibleWidget.getLayoutData();
  Layer newLayer = (visibleWidget == null) ? null
      : (Layer) visibleWidget.getLayoutData();

  // Calculate the direction that the new widget will enter.
  int oldIndex = getWidgetIndex(lastVisibleWidget);
  int newIndex = getWidgetIndex(visibleWidget);
  double direction = (oldIndex < newIndex) ? 100.0 : -100.0;
  double vertDirection = isAnimationVertical ? direction : 0.0;
  double horizDirection = isAnimationVertical ? 0.0
      : LocaleInfo.getCurrentLocale().isRTL() ? -direction : direction;

  /*
   * Position the old widget in the center of the panel, and the new widget
   * off to one side. If the old widget is the same as the new widget, then
   * skip this step.
   */
  hidingWidget = null;
  if (visibleWidget != lastVisibleWidget) {
    // Position the layers in their start positions.
    if (oldLayer != null) {
      // The old layer starts centered in the panel.
      oldLayer.setTopHeight(0.0, Unit.PCT, 100.0, Unit.PCT);
      oldLayer.setLeftWidth(0.0, Unit.PCT, 100.0, Unit.PCT);
      setWidgetVisible(lastVisibleWidget, oldLayer, true);
    }
    if (newLayer != null) {
      // The new layer starts off to one side.
      newLayer.setTopHeight(vertDirection, Unit.PCT, 100.0, Unit.PCT);
      newLayer.setLeftWidth(horizDirection, Unit.PCT, 100.0, Unit.PCT);
      setWidgetVisible(visibleWidget, newLayer, true);
    }
    layout.layout();
    hidingWidget = lastVisibleWidget;
  }

  // Set the end positions of the layers.
  if (oldLayer != null) {
    // The old layer ends off to one side.
    oldLayer.setTopHeight(-vertDirection, Unit.PCT, 100.0, Unit.PCT);
    oldLayer.setLeftWidth(-horizDirection, Unit.PCT, 100.0, Unit.PCT);
    setWidgetVisible(lastVisibleWidget, oldLayer, true);
  }
  if (newLayer != null) {
    // The new layer ends centered in the panel.
    newLayer.setTopHeight(0.0, Unit.PCT, 100.0, Unit.PCT);
    newLayer.setLeftWidth(0.0, Unit.PCT, 100.0, Unit.PCT);
    /*
     * The call to layout() above could have canceled an existing layout
     * animation, which could cause this widget to be hidden if the user
     * toggles between two visible widgets. We set it visible again to ensure
     * that it ends up visible.
     */
    setWidgetVisible(visibleWidget, newLayer, true);
  }

  lastVisibleWidget = visibleWidget;
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:64,代码来源:CustomDeckLayoutPanel.java


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