I have a callback action called AddAction. When AddAction is pressed I want it to enable all the components on the TopComponent as well as disable several of the other actions on the toolbar. Then when the SaveAction is pressed it saves the data to the database, enables the other actions and disables all the components on the TC.
Right now I have AddAction setup to enable all the components but I can't figure out how to disable the other actions as well.
AddAction
@ActionID(
category = "1",
id = "com.waudware.Actions.AddAction")
@ActionRegistration(
iconBase = "com/waudware/Actions/Icons/add.png",
displayName = "#CTL_AddAction",
key = "AddAction")
@ActionReferences({
@ActionReference(path = "Menu/Record", position = 3333),
@ActionReference(path = "Toolbars/AddEditDelete", position = 100)
})
@Messages("CTL_AddAction=Add")
public final class EditAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
}
}
TopComponent
public RouteTopComponent() {
initComponents();
setName(Bundle.CTL_RouteTopComponent());
setToolTipText(Bundle.HINT_RouteTopComponent());
getActionMap().put("AddAction", new AbstractAction(){
@Override
public void actionPerformed(ActionEvent e) {
addRoute(true);
}
});
}
private void addRoute(boolean add) {
txtRoute.setEnabled(add);
}