com.ait.lienzo.client.core.shape.Layer.getCanvasElement()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(136)

本文整理了Java中com.ait.lienzo.client.core.shape.Layer.getCanvasElement()方法的一些代码示例,展示了Layer.getCanvasElement()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Layer.getCanvasElement()方法的具体详情如下:
包路径:com.ait.lienzo.client.core.shape.Layer
类名称:Layer
方法名:getCanvasElement

Layer.getCanvasElement介绍

[英]Return the CanvasElement.
[中]返回画布元素。

代码示例

代码示例来源:origin: ahome-it/lienzo-core

@Override
public CanvasElement getCanvasElement()
{
  final CanvasElement element = super.getCanvasElement();
  if (null != element)
  {
    if (null == m_context)
    {
      m_context = new DragContext2D(element);
    }
  }
  return element;
}

代码示例来源:origin: com.ahome-it/lienzo-core

@Override
public CanvasElement getCanvasElement()
{
  final CanvasElement element = super.getCanvasElement();
  if (null != element)
  {
    if (null == m_context)
    {
      m_context = new SelectionContext2D(element);
    }
  }
  return element;
}

代码示例来源:origin: com.ahome-it/lienzo-core

@Override
public CanvasElement getCanvasElement()
{
  final CanvasElement element = super.getCanvasElement();
  if (null != element)
  {
    if (null == m_context)
    {
      m_context = new DragContext2D(element);
    }
  }
  return element;
}

代码示例来源:origin: ahome-it/lienzo-core

@Override
public CanvasElement getCanvasElement()
{
  final CanvasElement element = super.getCanvasElement();
  if (null != element)
  {
    if (null == m_context)
    {
      m_context = new SelectionContext2D(element);
    }
  }
  return element;
}

代码示例来源:origin: ahome-it/lienzo-core

@Override
public CanvasElement getCanvasElement()
{
  final CanvasElement element = super.getCanvasElement();
  if (null != element)
  {
    if (null == m_context)
    {
      m_context = new SelectionContext2D(element);
    }
  }
  return element;
}

代码示例来源:origin: ahome-it/lienzo-core

@Override
public CanvasElement getCanvasElement()
{
  final CanvasElement element = super.getCanvasElement();
  if (null != element)
  {
    if (null == m_context)
    {
      m_context = new DragContext2D(element);
    }
  }
  return element;
}

代码示例来源:origin: org.dashbuilder/dashbuilder-lienzo-core

@Override
public CanvasElement getCanvasElement()
{
  CanvasElement element = null;
  if (LienzoCore.get().isCanvasSupported())
  {
    element = super.getCanvasElement();
    if (null != element)
    {
      if (null == m_context)
      {
        m_context = new SelectionContext2D(getNativeContext2D(element));
      }
    }
  }
  return element;
}

代码示例来源:origin: org.dashbuilder/dashbuilder-lienzo-core

@Override
public final CanvasElement getCanvasElement()
{
  CanvasElement element = null;
  if (LienzoCore.get().isCanvasSupported())
  {
    element = super.getCanvasElement();
    if (null != element)
    {
      if (null == m_context)
      {
        m_context = new DragContext2D(getNativeContext2D(element));
      }
    }
  }
  return element;
}

代码示例来源:origin: kiegroup/appformer

@Override
  public void onNodeMouseDoubleClick(final NodeMouseDoubleClickEvent nodeMouseDoubleClickEvent) {
    editTextBox.setText(text.getText());
    editTextBox.getElement().getStyle().setPosition(Style.Position.FIXED);
    editTextBox.getElement().getStyle().setLeft(getX() + getLayer().getCanvasElement().getAbsoluteLeft(),
                          Style.Unit.PX);
    editTextBox.getElement().getStyle().setTop(getY() + getLayer().getCanvasElement().getAbsoluteTop(),
                          Style.Unit.PX);
    RootPanel.get().add(editTextBox);
    editTextBox.setFocus(true);
  }
});

代码示例来源:origin: org.uberfire/uberfire-wires-core-scratchpad

@Override
  public void onNodeMouseDoubleClick(final NodeMouseDoubleClickEvent nodeMouseDoubleClickEvent) {
    editTextBox.setText(text.getText());
    editTextBox.getElement().getStyle().setPosition(Style.Position.FIXED);
    editTextBox.getElement().getStyle().setLeft(getX() + getLayer().getCanvasElement().getAbsoluteLeft(),
                          Style.Unit.PX);
    editTextBox.getElement().getStyle().setTop(getY() + getLayer().getCanvasElement().getAbsoluteTop(),
                          Style.Unit.PX);
    RootPanel.get().add(editTextBox);
    editTextBox.setFocus(true);
  }
});

代码示例来源:origin: org.dashbuilder/dashbuilder-lienzo-core

/**
 * Removes a {@link Layer}
 */
@Override
public final Scene remove(final Layer layer)
{
  if ((null != layer) && (LienzoCore.get().isCanvasSupported()))
  {
    CanvasElement element = layer.getCanvasElement();
    getElement().removeChild(element);
    super.remove(layer);
  }
  return this;
}

代码示例来源:origin: com.ahome-it/lienzo-core

public final DivElement getElement()
{
  if (null == m_wrapper)
  {
    m_wrapper = Document.get().createDivElement();
    m_wrapper.getStyle().setPosition(Position.ABSOLUTE);
    m_wrapper.getStyle().setDisplay(Display.INLINE_BLOCK);
    final CanvasElement element = getCanvasElement();
    if (null != element)
    {
      if (false == isSelection())
      {
        m_wrapper.appendChild(element);
      }
    }
  }
  return m_wrapper;
}

代码示例来源:origin: ahome-it/lienzo-core

public final DivElement getElement()
{
  if (null == m_wrapper)
  {
    m_wrapper = Document.get().createDivElement();
    m_wrapper.getStyle().setPosition(Position.ABSOLUTE);
    m_wrapper.getStyle().setDisplay(Display.INLINE_BLOCK);
    final CanvasElement element = getCanvasElement();
    if (null != element)
    {
      if (false == isSelection())
      {
        m_wrapper.appendChild(element);
      }
    }
  }
  return m_wrapper;
}

代码示例来源:origin: ahome-it/lienzo-core

public final DivElement getElement()
{
  if (null == m_wrapper)
  {
    m_wrapper = Document.get().createDivElement();
    m_wrapper.getStyle().setPosition(Position.ABSOLUTE);
    m_wrapper.getStyle().setDisplay(Display.INLINE_BLOCK);
    final CanvasElement element = getCanvasElement();
    if (null != element)
    {
      if (false == isSelection())
      {
        m_wrapper.appendChild(element);
      }
    }
  }
  return m_wrapper;
}

代码示例来源:origin: org.dashbuilder/dashbuilder-lienzo-core

/**
 * Adds a {@link Layer} to the Scene.
 * A draw will be invoked after the layer is added.
 */
@Override
public final Scene add(final Layer layer)
{
  if ((null != layer) && (LienzoCore.get().isCanvasSupported()))
  {
    CanvasElement element = layer.getCanvasElement();
    layer.setPixelSize(m_wide, m_high);
    element.getStyle().setPosition(Position.ABSOLUTE);
    element.getStyle().setDisplay(Display.INLINE_BLOCK);
    getElement().appendChild(element);
    super.add(layer);
    layer.batch();
  }
  return this;
}

代码示例来源:origin: org.dashbuilder/dashbuilder-lienzo-core

/**
 * Moves the layer to the bottom of the layers stack in this scene.
 * 
 * @param layer
 */
@Override
public final Scene moveToBottom(Layer layer)
{
  if ((null != layer) && (LienzoCore.get().isCanvasSupported()))
  {
    final int size = getElement().getChildCount();
    if (size < 2)
    {
      return this;
    }
    CanvasElement element = layer.getCanvasElement();
    getElement().removeChild(element);
    getElement().insertFirst(element);
    NFastArrayList<Layer> layers = getChildNodes();
    if (null != layers)
    {
      layers.moveToBottom(layer);
    }
  }
  return this;
}

代码示例来源:origin: org.dashbuilder/dashbuilder-lienzo-core

/**
 * Moves the layer to the top of the layers stack in this scene.
 * 
 * @param layer
 */
@Override
public final Scene moveToTop(Layer layer)
{
  if ((null != layer) && (LienzoCore.get().isCanvasSupported()))
  {
    final int size = getElement().getChildCount();
    if (size < 2)
    {
      return this;
    }
    CanvasElement element = layer.getCanvasElement();
    getElement().removeChild(element);
    getElement().appendChild(element);
    NFastArrayList<Layer> layers = getChildNodes();
    if (null != layers)
    {
      layers.moveToTop(layer);
    }
  }
  return this;
}

代码示例来源:origin: com.ahome-it/lienzo-core

private final Layer doShowSelectionLayer(final boolean shower)
{
  if (false == isSelection())
  {
    if (null != m_select)
    {
      while (getElement().getChildCount() > 0)
      {
        getElement().removeChild(getElement().getChild(0));
      }
      CanvasElement element = getCanvasElement();
      if (null != element)
      {
        getElement().appendChild(element);
      }
      if (shower)
      {
        element = m_select.getCanvasElement();
        if (null != element)
        {
          getElement().appendChild(element);
        }
      }
    }
  }
  return this;
}

代码示例来源:origin: ahome-it/lienzo-core

/**
 * Sets this layer's pixel size.
 *
 * @param wide
 * @param high
 */
void setPixelSize(final int wide, final int high)
{
  m_wide = wide;
  m_high = high;
  if (LienzoCore.IS_CANVAS_SUPPORTED)
  {
    if (false == isSelection())
    {
      getElement().getStyle().setWidth(wide, Unit.PX);
      getElement().getStyle().setHeight(high, Unit.PX);
    }
    final CanvasElement element = getCanvasElement();
    element.setWidth(wide);
    element.setHeight(high);
    if (false == isSelection())
    {
      getContext().getNativeContext().initDeviceRatio();
    }
    if ((false == isSelection()) && (null != m_select))
    {
      m_select.setPixelSize(wide, high);
    }
  }
}

代码示例来源:origin: ahome-it/lienzo-core

/**
 * Sets this layer's pixel size.
 *
 * @param wide
 * @param high
 */
void setPixelSize(final int wide, final int high)
{
  m_wide = wide;
  m_high = high;
  if (LienzoCore.IS_CANVAS_SUPPORTED)
  {
    if (false == isSelection())
    {
      getElement().getStyle().setWidth(wide, Unit.PX);
      getElement().getStyle().setHeight(high, Unit.PX);
    }
    final CanvasElement element = getCanvasElement();
    element.setWidth(wide);
    element.setHeight(high);
    if (false == isSelection())
    {
      getContext().getNativeContext().initDeviceRatio();
    }
    if ((false == isSelection()) && (null != m_select))
    {
      m_select.setPixelSize(wide, high);
    }
  }
}

相关文章