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


Java UndoableEditSupport.postEdit方法代码示例

本文整理汇总了Java中javax.swing.undo.UndoableEditSupport.postEdit方法的典型用法代码示例。如果您正苦于以下问题:Java UndoableEditSupport.postEdit方法的具体用法?Java UndoableEditSupport.postEdit怎么用?Java UndoableEditSupport.postEdit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.undo.UndoableEditSupport的用法示例。


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

示例1: cut

import javax.swing.undo.UndoableEditSupport; //导入方法依赖的package包/类
/**
 * Deletes items and post a cut operation to undo support.
 */
public void cut(List<? extends Selectable> items)
{
	// Start a compound edit that deletes items and changes presentation name
	UndoableEditSupport undoSupport = getUndoableEditSupport();
	undoSupport.beginUpdate();
	getPlanController().deleteItems(items);
	// Add a undoable edit to change presentation name
	undoSupport.postEdit(new AbstractUndoableEdit()
	{
		@Override
		public String getPresentationName()
		{
			return preferences.getLocalizedString(HomeController.class, "undoCutName");
		}
	});
	// End compound edit
	undoSupport.endUpdate();
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:22,代码来源:HomeController.java

示例2: pasteToGroup

import javax.swing.undo.UndoableEditSupport; //导入方法依赖的package包/类
/**
 * Paste the furniture in clipboard to the selected group in home.
 * @since 5.0
 */
public void pasteToGroup()
{
	// Start a compound edit that adds furniture
	UndoableEditSupport undoSupport = getUndoableEditSupport();
	undoSupport.beginUpdate();
	List<HomePieceOfFurniture> addedFurniture = Home.getFurnitureSubList(getView().getClipboardItems());
	adjustFurnitureSizeAndElevation(addedFurniture, true);
	getFurnitureController().addFurnitureToGroup(addedFurniture,
			(HomeFurnitureGroup) this.home.getSelectedItems().get(0));
	undoSupport.postEdit(new AbstractUndoableEdit()
	{
		@Override
		public String getPresentationName()
		{
			return preferences.getLocalizedString(HomeController.class, "undoPasteToGroupName");
		}
	});
	
	// End compound edit
	undoSupport.endUpdate();
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:26,代码来源:HomeController.java

示例3: addPastedItems

import javax.swing.undo.UndoableEditSupport; //导入方法依赖的package包/类
/**
 * Adds items to home.
 */
private void addPastedItems(final List<? extends Selectable> items, float dx, float dy,
		final boolean isDropInPlanView, final String presentationNameKey)
{
	if (items.size() > 1 || (items.size() == 1 && !(items.get(0) instanceof Compass)))
	{
		// Always use selection mode after a drop or a paste operation
		getPlanController().setMode(PlanController.Mode.SELECTION);
		// Start a compound edit that adds walls, furniture, rooms, dimension lines, polylines and labels to home
		UndoableEditSupport undoSupport = getUndoableEditSupport();
		undoSupport.beginUpdate();
		List<HomePieceOfFurniture> addedFurniture = Home.getFurnitureSubList(items);
		adjustFurnitureSizeAndElevation(addedFurniture, dx == 0 && dy == 0);
		getPlanController().moveItems(items, dx, dy);
		if (isDropInPlanView && this.preferences.isMagnetismEnabled() && items.size() == 1
				&& addedFurniture.size() == 1)
		{
			// Adjust piece when it's dropped in plan view  
			getPlanController().adjustMagnetizedPieceOfFurniture((HomePieceOfFurniture) items.get(0), dx, dy);
		}
		getPlanController().addItems(items);
		undoSupport.postEdit(new AbstractUndoableEdit()
		{
			@Override
			public String getPresentationName()
			{
				return preferences.getLocalizedString(HomeController.class, presentationNameKey);
			}
		});
		
		// End compound edit
		undoSupport.endUpdate();
	}
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:37,代码来源:HomeController.java

示例4: register

import javax.swing.undo.UndoableEditSupport; //导入方法依赖的package包/类
public void register(UndoableEditSupport undoSupport) {
    if (prevSelection.equals(nextSelection))
        return;
    undoSupport.postEdit(this);
}
 
开发者ID:radsimu,项目名称:UaicNlpToolkit,代码行数:6,代码来源:SelectNodesCommand.java

示例5: dropFiles

import javax.swing.undo.UndoableEditSupport; //导入方法依赖的package包/类
/**
 * Adds imported models to home, moves them of (dx, dy) 
 * and post a drop operation to undo support.
 */
public void dropFiles(final List<String> importableModels, float dx, float dy)
{
	// Always use selection mode after a drop operation
	getPlanController().setMode(PlanController.Mode.SELECTION);
	// Add to home a listener to track imported furniture 
	final List<HomePieceOfFurniture> importedFurniture = new ArrayList<HomePieceOfFurniture>(
			importableModels.size());
	CollectionListener<HomePieceOfFurniture> addedFurnitureListener = new CollectionListener<HomePieceOfFurniture>()
	{
		public void collectionChanged(CollectionEvent<HomePieceOfFurniture> ev)
		{
			importedFurniture.add(ev.getItem());
		}
	};
	this.home.addFurnitureListener(addedFurnitureListener);
	
	// Start a compound edit that adds furniture to home
	UndoableEditSupport undoSupport = getUndoableEditSupport();
	undoSupport.beginUpdate();
	// Import furniture
	for (String model : importableModels)
	{
		getFurnitureController().importFurniture(model);
	}
	this.home.removeFurnitureListener(addedFurnitureListener);
	
	if (importedFurniture.size() > 0)
	{
		getPlanController().moveItems(importedFurniture, dx, dy);
		this.home.setSelectedItems(importedFurniture);
		
		// Add a undoable edit that will select the imported furniture at redo
		undoSupport.postEdit(new AbstractUndoableEdit()
		{
			@Override
			public void redo() throws CannotRedoException
			{
				super.redo();
				home.setSelectedItems(importedFurniture);
			}
			
			@Override
			public String getPresentationName()
			{
				return preferences.getLocalizedString(HomeController.class, "undoDropName");
			}
		});
	}
	
	// End compound edit
	undoSupport.endUpdate();
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:57,代码来源:HomeController.java


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