use of com.haulmont.cuba.desktop.sys.validation.ValidationAwareActionListener in project cuba by cuba-platform.
the class App method createStartContentPane.
protected Container createStartContentPane() {
JPanel pane = new JPanel(new BorderLayout());
menuBar = new JMenuBar();
pane.add(menuBar, BorderLayout.NORTH);
Locale loc = Locale.getDefault();
JMenu menu = new JMenu(messages.getMainMessage("mainMenu.file", loc));
menuBar.add(menu);
JMenuItem item;
item = new JMenuItem(messages.getMainMessage("mainMenu.connect", loc));
item.addActionListener(e -> showLoginDialog());
menu.add(item);
item = new JMenuItem(messages.getMainMessage("mainMenu.exit", loc));
item.addActionListener(new ValidationAwareActionListener() {
@Override
public void actionPerformedAfterValidation(ActionEvent e) {
exit();
}
});
menu.add(item);
if (isTestMode()) {
menuBar.setName("startMenu");
}
return pane;
}
use of com.haulmont.cuba.desktop.sys.validation.ValidationAwareActionListener in project cuba by cuba-platform.
the class WindowBreadCrumbs method update.
public void update() {
removeAll();
btn2win.clear();
for (Iterator<Window> it = windows.iterator(); it.hasNext(); ) {
Window window = it.next();
JButton button = new JXHyperlink();
button.setFocusable(false);
button.setText(StringUtils.trimToEmpty(window.getCaption()));
button.addActionListener(new ValidationAwareActionListener() {
@Override
public void actionPerformedAfterValidation(ActionEvent e) {
JButton btn = (JButton) e.getSource();
Window win = btn2win.get(btn);
if (win != null) {
fireListeners(win);
}
}
});
btn2win.put(button, window);
if (it.hasNext()) {
add(button);
JLabel separatorLab = new JLabel(">");
add(separatorLab);
} else {
add(new JLabel(window.getCaption()));
}
}
}
use of com.haulmont.cuba.desktop.sys.validation.ValidationAwareActionListener in project cuba by cuba-platform.
the class App method createMenuBar.
protected JComponent createMenuBar() {
menuBar = new JMenuBar();
JMenu menu = new JMenu(messages.getMessage(AppConfig.getMessagesPack(), "mainMenu.file"));
menuBar.add(menu);
JMenuItem item;
item = new JMenuItem(messages.getMessage(AppConfig.getMessagesPack(), "mainMenu.disconnect"));
item.addActionListener(new ValidationAwareActionListener() {
@Override
public void actionPerformedAfterValidation(ActionEvent e) {
logout();
}
});
menu.add(item);
item = new JMenuItem(messages.getMessage(AppConfig.getMessagesPack(), "mainMenu.exit"));
item.addActionListener(new ValidationAwareActionListener() {
@Override
public void actionPerformedAfterValidation(ActionEvent e) {
exit();
}
});
menu.add(item);
MenuBuilder builder = new MenuBuilder(connection.getSession(), menuBar);
builder.build();
if (isTestMode()) {
menuBar.setName("menuBar");
}
return menuBar;
}
use of com.haulmont.cuba.desktop.sys.validation.ValidationAwareActionListener in project cuba by cuba-platform.
the class MenuBuilder method assignCommand.
private void assignCommand(JMenuItem jMenuItem, MenuItem item) {
MenuCommand command = new MenuCommand(item);
jMenuItem.addActionListener(new ValidationAwareActionListener() {
@Override
public void actionPerformedAfterValidation(ActionEvent e) {
command.execute();
StringBuilder menuPath = new StringBuilder();
formatMenuPath(item, menuPath);
userActionsLog.trace("Action \"{}\" was performed using menu item {}", command.getCommandDescription(), menuPath.toString());
}
});
}
Aggregations