Add select None action
This commit is contained in:
		
							parent
							
								
									daf6189c8f
								
							
						
					
					
						commit
						84689df283
					
				@ -42,6 +42,8 @@ RocketActions.EditAct.ttip.Edit = Edit the selected component.
 | 
				
			|||||||
RocketActions.Select = Select
 | 
					RocketActions.Select = Select
 | 
				
			||||||
RocketActions.Select.SelectSameColorAct = Components with same color
 | 
					RocketActions.Select.SelectSameColorAct = Components with same color
 | 
				
			||||||
RocketActions.Select.SelectSameColorAct.ttip = Select all components with the same color as this component.
 | 
					RocketActions.Select.SelectSameColorAct.ttip = Select all components with the same color as this component.
 | 
				
			||||||
 | 
					RocketActions.Select.SelectNoneAct = None
 | 
				
			||||||
 | 
					RocketActions.Select.SelectNoneAct.ttip = Deselect all components.
 | 
				
			||||||
RocketActions.ScaleAct.Scale = Scale
 | 
					RocketActions.ScaleAct.Scale = Scale
 | 
				
			||||||
RocketActions.ScaleAct.ttip.Scale = Scale parts of the rocket design
 | 
					RocketActions.ScaleAct.ttip.Scale = Scale parts of the rocket design
 | 
				
			||||||
RocketActions.NewStageAct.Newstage = New stage
 | 
					RocketActions.NewStageAct.Newstage = New stage
 | 
				
			||||||
 | 
				
			|||||||
@ -240,6 +240,7 @@ public class BasicFrame extends JFrame {
 | 
				
			|||||||
			popupMenu.addSeparator();
 | 
								popupMenu.addSeparator();
 | 
				
			||||||
			JMenu selectMenu = new JMenu(trans.get("RocketActions.Select"));
 | 
								JMenu selectMenu = new JMenu(trans.get("RocketActions.Select"));
 | 
				
			||||||
			selectMenu.add(actions.getSelectSameColorAction());
 | 
								selectMenu.add(actions.getSelectSameColorAction());
 | 
				
			||||||
 | 
								selectMenu.add(actions.getSelectNoneAction());
 | 
				
			||||||
			popupMenu.add(selectMenu);
 | 
								popupMenu.add(selectMenu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			popupMenu.addSeparator();
 | 
								popupMenu.addSeparator();
 | 
				
			||||||
@ -663,9 +664,11 @@ public class BasicFrame extends JFrame {
 | 
				
			|||||||
		menu.addSeparator();
 | 
							menu.addSeparator();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		JMenu subMenu = new JMenu(trans.get("RocketActions.Select"));
 | 
							JMenu subMenu = new JMenu(trans.get("RocketActions.Select"));
 | 
				
			||||||
 | 
							menu.add(subMenu);
 | 
				
			||||||
		item = new JMenuItem(actions.getSelectSameColorAction());
 | 
							item = new JMenuItem(actions.getSelectSameColorAction());
 | 
				
			||||||
		subMenu.add(item);
 | 
							subMenu.add(item);
 | 
				
			||||||
		menu.add(subMenu);
 | 
							item = new JMenuItem(actions.getSelectNoneAction());
 | 
				
			||||||
 | 
							subMenu.add(item);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		menu.addSeparator();
 | 
							menu.addSeparator();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -76,6 +76,7 @@ public class RocketActions {
 | 
				
			|||||||
	private final RocketAction duplicateAction;
 | 
						private final RocketAction duplicateAction;
 | 
				
			||||||
	private final RocketAction editAction;
 | 
						private final RocketAction editAction;
 | 
				
			||||||
	private final RocketAction selectSameColorAction;
 | 
						private final RocketAction selectSameColorAction;
 | 
				
			||||||
 | 
						private final RocketAction selectNoneAction;
 | 
				
			||||||
	private final RocketAction scaleAction;
 | 
						private final RocketAction scaleAction;
 | 
				
			||||||
	private final RocketAction moveUpAction;
 | 
						private final RocketAction moveUpAction;
 | 
				
			||||||
	private final RocketAction moveDownAction;
 | 
						private final RocketAction moveDownAction;
 | 
				
			||||||
@ -100,7 +101,8 @@ public class RocketActions {
 | 
				
			|||||||
		this.pasteAction = new PasteAction();
 | 
							this.pasteAction = new PasteAction();
 | 
				
			||||||
		this.duplicateAction = new DuplicateAction();
 | 
							this.duplicateAction = new DuplicateAction();
 | 
				
			||||||
		this.editAction = new EditAction();
 | 
							this.editAction = new EditAction();
 | 
				
			||||||
		this.selectSameColorAction = new SelectSameColor();
 | 
							this.selectSameColorAction = new SelectSameColorAction();
 | 
				
			||||||
 | 
							this.selectNoneAction = new SelectNoneAction();
 | 
				
			||||||
		this.scaleAction = new ScaleAction();
 | 
							this.scaleAction = new ScaleAction();
 | 
				
			||||||
		this.moveUpAction = new MoveUpAction();
 | 
							this.moveUpAction = new MoveUpAction();
 | 
				
			||||||
		this.moveDownAction = new MoveDownAction();
 | 
							this.moveDownAction = new MoveDownAction();
 | 
				
			||||||
@ -135,6 +137,7 @@ public class RocketActions {
 | 
				
			|||||||
		duplicateAction.clipboardChanged();
 | 
							duplicateAction.clipboardChanged();
 | 
				
			||||||
		editAction.clipboardChanged();
 | 
							editAction.clipboardChanged();
 | 
				
			||||||
		selectSameColorAction.clipboardChanged();
 | 
							selectSameColorAction.clipboardChanged();
 | 
				
			||||||
 | 
							selectNoneAction.clipboardChanged();
 | 
				
			||||||
		scaleAction.clipboardChanged();
 | 
							scaleAction.clipboardChanged();
 | 
				
			||||||
		moveUpAction.clipboardChanged();
 | 
							moveUpAction.clipboardChanged();
 | 
				
			||||||
		moveDownAction.clipboardChanged();
 | 
							moveDownAction.clipboardChanged();
 | 
				
			||||||
@ -179,6 +182,10 @@ public class RocketActions {
 | 
				
			|||||||
		return selectSameColorAction;
 | 
							return selectSameColorAction;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public Action getSelectNoneAction() {
 | 
				
			||||||
 | 
							return selectNoneAction;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public Action getScaleAction() {
 | 
						public Action getScaleAction() {
 | 
				
			||||||
		return scaleAction;
 | 
							return scaleAction;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -1014,13 +1021,14 @@ public class RocketActions {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Action to select all components with the same color as the currently selected component.
 | 
						 * Action to select all components with the same color as the currently selected component.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	private class SelectSameColor extends RocketAction {
 | 
						private class SelectSameColorAction extends RocketAction {
 | 
				
			||||||
		private static final long serialVersionUID = 1L;
 | 
							private static final long serialVersionUID = 1L;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public SelectSameColor() {
 | 
							public SelectSameColorAction() {
 | 
				
			||||||
			//// Select same color
 | 
								//// Select same color
 | 
				
			||||||
			this.putValue(NAME, trans.get("RocketActions.Select.SelectSameColorAct"));
 | 
								this.putValue(NAME, trans.get("RocketActions.Select.SelectSameColorAct"));
 | 
				
			||||||
			this.putValue(SHORT_DESCRIPTION, trans.get("RocketActions.Select.SelectSameColorAct.ttip"));
 | 
								this.putValue(SHORT_DESCRIPTION, trans.get("RocketActions.Select.SelectSameColorAct.ttip"));
 | 
				
			||||||
@ -1095,6 +1103,30 @@ public class RocketActions {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Action to select all components with the same color as the currently selected component.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						private class SelectNoneAction extends RocketAction {
 | 
				
			||||||
 | 
							private static final long serialVersionUID = 1L;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public SelectNoneAction() {
 | 
				
			||||||
 | 
								//// Select none
 | 
				
			||||||
 | 
								this.putValue(NAME, trans.get("RocketActions.Select.SelectNoneAct"));
 | 
				
			||||||
 | 
								this.putValue(SHORT_DESCRIPTION, trans.get("RocketActions.Select.SelectNoneAct.ttip"));
 | 
				
			||||||
 | 
								clipboardChanged();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							@Override
 | 
				
			||||||
 | 
							public void actionPerformed(ActionEvent e) {
 | 
				
			||||||
 | 
								selectionModel.clearComponentSelection();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							@Override
 | 
				
			||||||
 | 
							public void clipboardChanged() {
 | 
				
			||||||
 | 
								List<RocketComponent> components = selectionModel.getSelectedComponents();
 | 
				
			||||||
 | 
								this.setEnabled(components.size() > 0);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user