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


Java AbstractUndoableEdit类代码示例

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


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

示例1: cut

import javax.swing.undo.AbstractUndoableEdit; //导入依赖的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.AbstractUndoableEdit; //导入依赖的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: addUndoableEdit

import javax.swing.undo.AbstractUndoableEdit; //导入依赖的package包/类
public static void addUndoableEdit(AbstractUndoableEdit aUndoableEdit)
{
    getDefault().getUndoRedoManager().addEdit(aUndoableEdit);
    TopComponent tc = ViewDB.getCurrentModelWindow();
    if (tc==null){ // No gfx window
        tc = getDefault();
    } 
    if (tc==null) return;   // No tc to piggyback on
    final TopComponent tcf = tc;
    if (java.awt.EventQueue.isDispatchThread()) {
        tcf.requestActive();
    }
    else {
        SwingUtilities.invokeLater(new Runnable(){

        @Override
        public void run() {
            tcf.requestActive();
        }
    });
    }
 }
 
开发者ID:opensim-org,项目名称:opensim-gui,代码行数:23,代码来源:ExplorerTopComponent.java

示例4: setColorUI

import javax.swing.undo.AbstractUndoableEdit; //导入依赖的package包/类
void setColorUI(final Color color, boolean allowUndo) {
    final Color oldColor = getColor();
    if (allowUndo){
        AbstractUndoableEdit auEdit = new AbstractUndoableEdit(){
            @Override
           public void undo() throws CannotUndoException {
               super.undo();
               setColorUI(oldColor, false);
           }
            @Override
           public void redo() throws CannotRedoException {
               super.redo();
               setColorUI(color, true);
           }
        };
        ExplorerTopComponent.addUndoableEdit(auEdit);
    }
    motionDisplayer.setDefaultForceColor(color);
    ViewDB.repaintAll();
    refreshNode();
}
 
开发者ID:opensim-org,项目名称:opensim-gui,代码行数:22,代码来源:ExperimentalForceSetNode.java

示例5: setForceScaleFactorUI

import javax.swing.undo.AbstractUndoableEdit; //导入依赖的package包/类
void setForceScaleFactorUI(final double newFactor, boolean allowUndo)
{
    final double oldForceScaleFactor = getForceScaleFactor();
    if (allowUndo){
        AbstractUndoableEdit auEdit = new AbstractUndoableEdit(){
           @Override
           public void undo() throws CannotUndoException {
               super.undo();
               setForceScaleFactorUI(oldForceScaleFactor, false);
           }
           @Override
           public void redo() throws CannotRedoException {
               super.redo();
               setForceScaleFactorUI(newFactor, true);
           }
        };
        ExplorerTopComponent.addUndoableEdit(auEdit);
    }       
    ///motionDisplayer.setScaleFactor(newFactor);
    ViewDB.repaintAll();
    refreshNode();
}
 
开发者ID:opensim-org,项目名称:opensim-gui,代码行数:23,代码来源:ExperimentalForceSetNode.java

示例6: setColorUI

import javax.swing.undo.AbstractUndoableEdit; //导入依赖的package包/类
void setColorUI(final Color color, boolean allowUndo) {
    final Color oldColor = getColor();
    if (allowUndo){
        AbstractUndoableEdit auEdit = new AbstractUndoableEdit(){
            @Override
           public void undo() throws CannotUndoException {
               super.undo();
               setColorUI(oldColor, false);
           }
            @Override
           public void redo() throws CannotRedoException {
               super.redo();
               setColorUI(color, true);
           }
        };
        ExplorerTopComponent.addUndoableEdit(auEdit);
    }
    motionDisplayer.setDefaultExperimentalMarkerColor(color);
    ViewDB.repaintAll();
    refreshNode();
}
 
开发者ID:opensim-org,项目名称:opensim-gui,代码行数:22,代码来源:ExperimentalMarkerSetNode.java

示例7: setMarkerScaleFactorUI

import javax.swing.undo.AbstractUndoableEdit; //导入依赖的package包/类
void setMarkerScaleFactorUI(final double newFactor, boolean allowUndo)
{
    final double oldMarkerScaleFactor = getMarkerScaleFactor();
    if (allowUndo){
        AbstractUndoableEdit auEdit = new AbstractUndoableEdit(){
           @Override
           public void undo() throws CannotUndoException {
               super.undo();
               setMarkerScaleFactorUI(oldMarkerScaleFactor, false);
           }
           @Override
           public void redo() throws CannotRedoException {
               super.redo();
               setMarkerScaleFactorUI(newFactor, true);
           }
        };
        ExplorerTopComponent.addUndoableEdit(auEdit);
    }       
    motionDisplayer.setExperimentalMarkerScaleFactor(newFactor);
    ViewDB.repaintAll();
    refreshNode();
}
 
开发者ID:opensim-org,项目名称:opensim-gui,代码行数:23,代码来源:ExperimentalMarkerSetNode.java

示例8: setBodyName

import javax.swing.undo.AbstractUndoableEdit; //导入依赖的package包/类
private void setBodyName(final String bodyName, boolean enableUndo) {
    final String oldName = getBodyName();
    if (bodyName.equals(oldName)) return; // Nothing to do
    //marker.setParentFrameName(bodyName); 
    // The following line calls setParentFrame
    context.setBody(marker, model.getBodySet().get(bodyName), true);
    updateDisplay();
    if (enableUndo){
        AbstractUndoableEdit auEdit = new AbstractUndoableEdit(){
           public void undo() throws CannotUndoException {
               super.undo();
               setBodyName(oldName, false);
           }
           public void redo() throws CannotRedoException {
               super.redo();
               setBodyName(bodyName, true);
           }
        };
        ExplorerTopComponent.addUndoableEdit(auEdit);
    }
}
 
开发者ID:opensim-org,项目名称:opensim-gui,代码行数:22,代码来源:MarkerAdapter.java

示例9: setOffset

import javax.swing.undo.AbstractUndoableEdit; //导入依赖的package包/类
private void setOffset(final ArrayDouble newOffset, boolean enableUndo) {
    Vec3 rOffest = marker.get_location();
    final ArrayDouble oldOffset = new ArrayDouble(3);
    for(int i=0; i<3; i++) oldOffset.set(i, rOffest.get(i));
     marker.set_location(newOffset.getAsVec3());
    updateDisplay(); 
    if (enableUndo){
         AbstractUndoableEdit auEdit = new AbstractUndoableEdit(){
           public void undo() throws CannotUndoException {
               super.undo();
               setOffset(oldOffset, false);
           }
           public void redo() throws CannotRedoException {
               super.redo();
               setOffset(newOffset, true);
           }
        };
        ExplorerTopComponent.addUndoableEdit(auEdit);            
    }
}
 
开发者ID:opensim-org,项目名称:opensim-gui,代码行数:21,代码来源:MarkerAdapter.java

示例10: addPastedItems

import javax.swing.undo.AbstractUndoableEdit; //导入依赖的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

示例11: toggleBackgroundImageVisibility

import javax.swing.undo.AbstractUndoableEdit; //导入依赖的package包/类
/**
 * Toggles visibility of the background image and posts an undoable operation.
 */
private void toggleBackgroundImageVisibility(final String presentationName)
{
	final Level selectedLevel = this.home.getSelectedLevel();
	doToggleBackgroundImageVisibility();
	UndoableEdit undoableEdit = new AbstractUndoableEdit()
	{
		@Override
		public void undo() throws CannotUndoException
		{
			super.undo();
			home.setSelectedLevel(selectedLevel);
			doToggleBackgroundImageVisibility();
		}
		
		@Override
		public void redo() throws CannotRedoException
		{
			super.redo();
			home.setSelectedLevel(selectedLevel);
			doToggleBackgroundImageVisibility();
		}
		
		@Override
		public String getPresentationName()
		{
			return preferences.getLocalizedString(HomeController.class, presentationName);
		}
	};
	getUndoableEditSupport().postEdit(undoableEdit);
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:34,代码来源:HomeController.java

示例12: unlockBasePlan

import javax.swing.undo.AbstractUndoableEdit; //导入依赖的package包/类
/**
 * Unlocks home base plan.
 */
public void unlockBasePlan()
{
	if (this.home.isBasePlanLocked())
	{
		final boolean allLevelsSelection = this.home.isAllLevelsSelection();
		List<Selectable> selection = this.home.getSelectedItems();
		final Selectable[] selectedItems = selection.toArray(new Selectable[selection.size()]);
		
		this.home.setBasePlanLocked(false);
		this.home.setAllLevelsSelection(false);
		UndoableEdit undoableEdit = new AbstractUndoableEdit()
		{
			@Override
			public void undo() throws CannotUndoException
			{
				super.undo();
				home.setBasePlanLocked(true);
				selectAndShowItems(Arrays.asList(selectedItems), allLevelsSelection);
			}
			
			@Override
			public void redo() throws CannotRedoException
			{
				super.redo();
				home.setBasePlanLocked(false);
				selectAndShowItems(Arrays.asList(selectedItems), false);
			}
			
			@Override
			public String getPresentationName()
			{
				return preferences.getLocalizedString(PlanController.class, "undoUnlockBasePlan");
			}
		};
		this.undoSupport.postEdit(undoableEdit);
	}
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:41,代码来源:PlanController.java

示例13: postReverseSelectedWallsDirection

import javax.swing.undo.AbstractUndoableEdit; //导入依赖的package包/类
/**
 * Posts an undoable reverse wall operation, about <code>walls</code>.
 */
private void postReverseSelectedWallsDirection(final Wall[] walls, List<Selectable> oldSelection)
{
	final boolean allLevelsSelection = home.isAllLevelsSelection();
	final Selectable[] oldSelectedItems = oldSelection.toArray(new Selectable[oldSelection.size()]);
	UndoableEdit undoableEdit = new AbstractUndoableEdit()
	{
		@Override
		public void undo() throws CannotUndoException
		{
			super.undo();
			doReverseWallsDirection(walls);
			selectAndShowItems(Arrays.asList(oldSelectedItems), allLevelsSelection);
		}
		
		@Override
		public void redo() throws CannotRedoException
		{
			super.redo();
			doReverseWallsDirection(walls);
			selectAndShowItems(Arrays.asList(oldSelectedItems), allLevelsSelection);
		}
		
		@Override
		public String getPresentationName()
		{
			return preferences.getLocalizedString(PlanController.class, "undoReverseWallsDirectionName");
		}
	};
	this.undoSupport.postEdit(undoableEdit);
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:34,代码来源:PlanController.java

示例14: postSplitSelectedWall

import javax.swing.undo.AbstractUndoableEdit; //导入依赖的package包/类
/**
 * Posts an undoable split wall operation.
 */
private void postSplitSelectedWall(final JoinedWall splitJoinedWall, final JoinedWall firstJoinedWall,
		final JoinedWall secondJoinedWall, List<Selectable> oldSelection, final boolean oldBasePlanLocked,
		final boolean oldAllLevelsSelection)
{
	final Selectable[] oldSelectedItems = oldSelection.toArray(new Selectable[oldSelection.size()]);
	final boolean newBasePlanLocked = this.home.isBasePlanLocked();
	UndoableEdit undoableEdit = new AbstractUndoableEdit()
	{
		@Override
		public void undo() throws CannotUndoException
		{
			super.undo();
			doDeleteWalls(new JoinedWall[] { firstJoinedWall, secondJoinedWall }, oldBasePlanLocked);
			doAddWalls(new JoinedWall[] { splitJoinedWall }, oldBasePlanLocked);
			selectAndShowItems(Arrays.asList(oldSelectedItems), oldAllLevelsSelection);
		}
		
		@Override
		public void redo() throws CannotRedoException
		{
			super.redo();
			doDeleteWalls(new JoinedWall[] { splitJoinedWall }, newBasePlanLocked);
			doAddWalls(new JoinedWall[] { firstJoinedWall, secondJoinedWall }, newBasePlanLocked);
			selectAndShowItems(Arrays.asList(new Wall[] { firstJoinedWall.getWall() }), false);
		}
		
		@Override
		public String getPresentationName()
		{
			return preferences.getLocalizedString(PlanController.class, "undoSplitWallName");
		}
	};
	this.undoSupport.postEdit(undoableEdit);
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:38,代码来源:PlanController.java

示例15: modifyTextStyle

import javax.swing.undo.AbstractUndoableEdit; //导入依赖的package包/类
/**
 * Changes the style of items and posts an undoable change style operation.
 */
private void modifyTextStyle(final Selectable[] items, final TextStyle[] oldStyles, final TextStyle[] styles)
{
	final boolean allLevelsSelection = home.isAllLevelsSelection();
	List<Selectable> oldSelection = this.home.getSelectedItems();
	final Selectable[] oldSelectedItems = oldSelection.toArray(new Selectable[oldSelection.size()]);
	
	doModifyTextStyle(items, styles);
	UndoableEdit undoableEdit = new AbstractUndoableEdit()
	{
		@Override
		public void undo() throws CannotUndoException
		{
			super.undo();
			doModifyTextStyle(items, oldStyles);
			selectAndShowItems(Arrays.asList(oldSelectedItems), allLevelsSelection);
		}
		
		@Override
		public void redo() throws CannotRedoException
		{
			super.redo();
			doModifyTextStyle(items, styles);
			selectAndShowItems(Arrays.asList(oldSelectedItems), allLevelsSelection);
		}
		
		@Override
		public String getPresentationName()
		{
			return preferences.getLocalizedString(PlanController.class, "undoModifyTextStyleName");
		}
	};
	this.undoSupport.postEdit(undoableEdit);
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:37,代码来源:PlanController.java


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