Hello. I have been reading some stuff on the action command pattern. ever heard of it?
More inportantly, Do you understand it?
Because I do not. although I would like to ask if the following
class could use the command pattern as aposed to 'if" or "switch" statements.
I understand the action command pattern uses a interface. I do not understand that either.
is this class a potential canidate to use the action command pattern? if so Could I get
some insight as in how to implement it?
Thanks
NotesAction implements AbstractAction
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package view.menuActions;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.SwingUtilities;
/**
*
* @author Steve's
*/
public class NotesAction extends AbstractAction {
private String name;
public NotesAction(String name) {
super();
}
public void actionPerformed(ActionEvent e) {
String M =(" --> in actionPerformed("+e.getActionCommand()+") var: e.getActionCommand() : xxxxxxxx<-- \n");
System.out.println(M);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
closeSelectedTab();
}
private void closeSelectedTab() {
String M =(" --> in closeSelectedTab() var: xxxxxxxxx : xxxxxxxx<-- \n");
System.out.println(M);
}
});
SwingUtilities.invokeLater(new Runnable() {
public void run() {
insertSelectedTab();
}
private void insertSelectedTab() {
String M =(" --> in insertSelectedTab() var: xxxxxxxxx : xxxxxxxx<-- \n");
System.out.println(M);
}
});
SwingUtilities.invokeLater(new Runnable() {
public void run() {
deleteSelectedTab();
}
private void deleteSelectedTab() {
String M =(" --> in deleteSelectedTab() var: xxxxxxxxx : xxxxxxxx<-- \n");
System.out.println(M);
}
});
SwingUtilities.invokeLater(new Runnable() {
public void run() {
renameSelectedTab();
}
private void renameSelectedTab() {
String M =(" --> in renameSelectedTab() var: xxxxxxxxx : xxxxxxxx<-- \n");
System.out.println(M);
}
});
SwingUtilities.invokeLater(new Runnable() {
public void run() {
moveOrCopySelectedTab();
}
private void moveOrCopySelectedTab() {
String M =(" --> in moveOrCopySelectedTab() var: xxxxxxxxx : xxxxxxxx<-- \n");
System.out.println(M);
}
});
SwingUtilities.invokeLater(new Runnable() {
public void run() {
selectAllSheetsSelectedTab();
}
private void selectAllSheetsSelectedTab() {
String M =(" --> in selectAllSheetsSelectedTab() var: xxxxxxxxx : xxxxxxxx<-- \n");
System.out.println(M);
}
});
SwingUtilities.invokeLater(new Runnable() {
public void run() {
targetFoldersSelectedTab();
}
private void targetFoldersSelectedTab() {
String M =(" --> in targetFoldersSelectedTab() var: xxxxxxxxx : xxxxxxxx<-- \n");
System.out.println(M);
}
});
/*
SwingUtilities.invokeLater(new Runnable() {
public void run() {
closeTab();
}
private void closeTab() {
String M =(" --> in xxxxxxxxxxxxxxxxx("+xxxxxx+") var: xxxxxxxxx : xxxxxxxx<-- \n"); System.out.println(M);
}
});
*
*/
}
}
output
What is the profile: admin_
--> in actionPerformed(insertBtn) var: e.getActionCommand() : xxxxxxxx<--
--> in closeSelectedTab() var: xxxxxxxxx : xxxxxxxx<--
--> in insertSelectedTab() var: xxxxxxxxx : xxxxxxxx<--
--> in deleteSelectedTab() var: xxxxxxxxx : xxxxxxxx<--
--> in renameSelectedTab() var: xxxxxxxxx : xxxxxxxx<--
--> in moveOrCopySelectedTab() var: xxxxxxxxx : xxxxxxxx<--
--> in selectAllSheetsSelectedTab() var: xxxxxxxxx : xxxxxxxx<--
--> in targetFoldersSelectedTab() var: xxxxxxxxx : xxxxxxxx<--