本文整理了Java中com.mxgraph.view.mxGraph.getSelectionCells()
方法的一些代码示例,展示了mxGraph.getSelectionCells()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。mxGraph.getSelectionCells()
方法的具体详情如下:
包路径:com.mxgraph.view.mxGraph
类名称:mxGraph
方法名:getSelectionCells
暂无
代码示例来源:origin: sc.fiji/TrackMate_
private static List< mxCell > getSelectionVertices( final mxGraph graph )
{
// Build selection categories
final Object[] selection = graph.getSelectionCells();
final ArrayList< mxCell > vertices = new ArrayList< >();
for ( final Object obj : selection )
{
final mxCell cell = ( mxCell ) obj;
if ( cell.isVertex() )
vertices.add( cell );
}
return vertices;
}
代码示例来源:origin: fiji/TrackMate
private static List< mxCell > getSelectionVertices( final mxGraph graph )
{
// Build selection categories
final Object[] selection = graph.getSelectionCells();
final ArrayList< mxCell > vertices = new ArrayList< >();
for ( final Object obj : selection )
{
final mxCell cell = ( mxCell ) obj;
if ( cell.isVertex() )
vertices.add( cell );
}
return vertices;
}
代码示例来源:origin: sc.fiji/TrackMate_
private static List< mxCell > getSelectionEdges( final mxGraph graph )
{
// Build selection categories
final Object[] selection = graph.getSelectionCells();
final ArrayList< mxCell > edges = new ArrayList< >();
for ( final Object obj : selection )
{
final mxCell cell = ( mxCell ) obj;
if ( cell.isEdge() )
edges.add( cell );
}
return edges;
}
}
代码示例来源:origin: fiji/TrackMate
private static List< mxCell > getSelectionEdges( final mxGraph graph )
{
// Build selection categories
final Object[] selection = graph.getSelectionCells();
final ArrayList< mxCell > edges = new ArrayList< >();
for ( final Object obj : selection )
{
final mxCell cell = ( mxCell ) obj;
if ( cell.isEdge() )
edges.add( cell );
}
return edges;
}
}
代码示例来源:origin: org.tinyjee.jgraphx/jgraphx
/**
* Sets the key to value in the styles of the given cells. This will modify
* the existing cell styles in-place and override any existing assignment
* for the given key. If no cells are specified, then the selection cells
* are changed. If no value is specified, then the respective key is
* removed from the styles.
*
* @param key String representing the key to be assigned.
* @param value String representing the new value for the key.
* @param cells Array of cells to change the style for.
*/
public Object[] setCellStyles(String key, String value, Object[] cells)
{
if (cells == null)
{
cells = getSelectionCells();
}
mxStyleUtils.setCellStyles(model, cells, key, value);
return cells;
}
代码示例来源:origin: com.github.vlsi.mxgraph/jgraphx
/**
* Sets the key to value in the styles of the given cells. This will modify
* the existing cell styles in-place and override any existing assignment
* for the given key. If no cells are specified, then the selection cells
* are changed. If no value is specified, then the respective key is
* removed from the styles.
*
* @param key String representing the key to be assigned.
* @param value String representing the new value for the key.
* @param cells Array of cells to change the style for.
*/
public Object[] setCellStyles(String key, String value, Object[] cells)
{
if (cells == null)
{
cells = getSelectionCells();
}
mxStyleUtils.setCellStyles(model, cells, key, value);
return cells;
}
代码示例来源:origin: org.tinyjee.jgraphx/jgraphx
/**
*
*/
public Object[] getCells(mxCellState initialState)
{
mxGraph graph = graphComponent.getGraph();
return graph.getMovableCells(graph.getSelectionCells());
}
代码示例来源:origin: com.github.vlsi.mxgraph/jgraphx
/**
*
*/
public Object[] getCells(Object initialCell)
{
mxGraph graph = graphComponent.getGraph();
return graph.getMovableCells(graph.getSelectionCells());
}
代码示例来源:origin: com.github.vlsi.mxgraph/jgraphx
/**
*
*/
public Object[] getCells(mxCellState initialState)
{
mxGraph graph = graphComponent.getGraph();
return graph.getMovableCells(graph.getSelectionCells());
}
代码示例来源:origin: org.tinyjee.jgraphx/jgraphx
/**
*
*/
public Object[] getCells(Object initialCell)
{
mxGraph graph = graphComponent.getGraph();
return graph.getMovableCells(graph.getSelectionCells());
}
代码示例来源:origin: com.github.vlsi.mxgraph/jgraphx
/**
*
*/
protected mxRectangle getPlaceholderBounds(mxCellState startState)
{
mxGraph graph = graphComponent.getGraph();
return graph.getView().getBounds(graph.getSelectionCells());
}
代码示例来源:origin: org.tinyjee.jgraphx/jgraphx
/**
*
*/
protected mxRectangle getPlaceholderBounds(mxCellState startState)
{
mxGraph graph = graphComponent.getGraph();
return graph.getView().getBounds(graph.getSelectionCells());
}
代码示例来源:origin: org.tinyjee.jgraphx/jgraphx
/**
* (non-Javadoc)
*
* @see javax.swing.TransferHandler#createTransferable(javax.swing.JComponent)
*/
public Transferable createTransferable(JComponent c)
{
if (c instanceof mxGraphComponent)
{
mxGraphComponent graphComponent = (mxGraphComponent) c;
mxGraph graph = graphComponent.getGraph();
if (!graph.isSelectionEmpty())
{
originalCells = graphComponent.getExportableCells(graph
.getSelectionCells());
if (originalCells.length > 0)
{
ImageIcon icon = (transferImageEnabled) ? createTransferableImage(
graphComponent, originalCells) : null;
return createGraphTransferable(graphComponent,
originalCells, icon);
}
}
}
return null;
}
代码示例来源:origin: com.github.vlsi.mxgraph/jgraphx
/**
* (non-Javadoc)
*
* @see javax.swing.TransferHandler#createTransferable(javax.swing.JComponent)
*/
public Transferable createTransferable(JComponent c)
{
if (c instanceof mxGraphComponent)
{
mxGraphComponent graphComponent = (mxGraphComponent) c;
mxGraph graph = graphComponent.getGraph();
if (!graph.isSelectionEmpty())
{
originalCells = graphComponent.getExportableCells(graph
.getSelectionCells());
if (originalCells.length > 0)
{
ImageIcon icon = (transferImageEnabled) ? createTransferableImage(
graphComponent, originalCells) : null;
return createGraphTransferable(graphComponent,
originalCells, icon);
}
}
}
return null;
}
代码示例来源:origin: org.tinyjee.jgraphx/jgraphx
/**
* Moves the given cells to the front or back. The change is carried out
* using cellsOrdered. This method fires mxEvent.ORDER_CELLS while the
* transaction is in progress.
*
* @param back Specifies if the cells should be moved to back.
* @param cells Array of cells whose order should be changed. If null is
* specified then the selection cells are used.
*/
public Object[] orderCells(boolean back, Object[] cells)
{
if (cells == null)
{
cells = mxUtils.sortCells(getSelectionCells(), true);
}
model.beginUpdate();
try
{
cellsOrdered(cells, back);
fireEvent(new mxEventObject(mxEvent.ORDER_CELLS, "cells", cells,
"back", back));
}
finally
{
model.endUpdate();
}
return cells;
}
代码示例来源:origin: com.github.vlsi.mxgraph/jgraphx
/**
* Removes the specified cells from their parents and adds them to the
* default parent.
*
* @param cells Array of cells to be removed from their parents.
* @return Returns the cells that were removed from their parents.
*/
public Object[] removeCellsFromParent(Object[] cells)
{
if (cells == null)
{
cells = getSelectionCells();
}
model.beginUpdate();
try
{
Object parent = getDefaultParent();
int index = model.getChildCount(parent);
cellsAdded(cells, parent, index, null, null, true);
fireEvent(new mxEventObject(mxEvent.REMOVE_CELLS_FROM_PARENT,
"cells", cells));
}
finally
{
model.endUpdate();
}
return cells;
}
代码示例来源:origin: sc.fiji/TrackMate_
@Override
public void zoomTo( final double newScale, final boolean center )
{
final mxGraphView view = graph.getView();
final double scale = view.getScale();
final mxPoint translate = ( pageVisible && centerPage ) ? getPageTranslate( newScale ) : new mxPoint();
graph.getView().scaleAndTranslate( newScale, translate.getX(), translate.getY() );
if ( keepSelectionVisibleOnZoom && !graph.isSelectionEmpty() )
{
getGraphControl().scrollRectToVisible( view.getBoundingBox( graph.getSelectionCells() ).getRectangle() );
}
else
{
maintainScrollBar( true, newScale / scale, center );
maintainScrollBar( false, newScale / scale, center );
}
}
代码示例来源:origin: fiji/TrackMate
@Override
public void zoomTo( final double newScale, final boolean center )
{
final mxGraphView view = graph.getView();
final double scale = view.getScale();
final mxPoint translate = ( pageVisible && centerPage ) ? getPageTranslate( newScale ) : new mxPoint();
graph.getView().scaleAndTranslate( newScale, translate.getX(), translate.getY() );
if ( keepSelectionVisibleOnZoom && !graph.isSelectionEmpty() )
{
getGraphControl().scrollRectToVisible( view.getBoundingBox( graph.getSelectionCells() ).getRectangle() );
}
else
{
maintainScrollBar( true, newScale / scale, center );
maintainScrollBar( false, newScale / scale, center );
}
}
代码示例来源:origin: org.tinyjee.jgraphx/jgraphx
/**
*
*/
public void zoom(double factor)
{
mxGraphView view = graph.getView();
double newScale = (double) ((int) (view.getScale() * 100 * factor)) / 100;
if (newScale != view.getScale() && newScale > 0.04)
{
mxPoint translate = (pageVisible && centerPage) ? getPageTranslate(newScale)
: new mxPoint();
graph.getView().scaleAndTranslate(newScale, translate.getX(),
translate.getY());
if (keepSelectionVisibleOnZoom && !graph.isSelectionEmpty())
{
getGraphControl().scrollRectToVisible(
view.getBoundingBox(graph.getSelectionCells())
.getRectangle());
}
else
{
maintainScrollBar(true, factor, centerZoom);
maintainScrollBar(false, factor, centerZoom);
}
}
}
代码示例来源:origin: com.github.vlsi.mxgraph/jgraphx
/**
*
*/
public void zoom(double factor)
{
mxGraphView view = graph.getView();
double newScale = (double) ((int) (view.getScale() * 100 * factor)) / 100;
if (newScale != view.getScale() && newScale > 0.04)
{
mxPoint translate = (pageVisible && centerPage) ? getPageTranslate(newScale)
: new mxPoint();
graph.getView().scaleAndTranslate(newScale, translate.getX(),
translate.getY());
if (keepSelectionVisibleOnZoom && !graph.isSelectionEmpty())
{
getGraphControl().scrollRectToVisible(
view.getBoundingBox(graph.getSelectionCells())
.getRectangle());
}
else
{
maintainScrollBar(true, factor, centerZoom);
maintainScrollBar(false, factor, centerZoom);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!