/** * Callback after a failed login. * * @param dialog * the login dialog if any. */ protected void loginFailed(JDialog dialog) { if (dialog != null) { JOptionPane.showMessageDialog(dialog, getTranslation(LoginUtils.LOGIN_FAILED, getLocale()), getTranslation("error", getLocale()), JOptionPane.ERROR_MESSAGE); } }
private void updateFrameTitle() { String workspaceName = getSelectedWorkspaceName(); if (workspaceName != null) { controllerFrame.setTitle(getSelectedWorkspace() .getViewDescriptor().getI18nDescription(this, getLocale()) + " - " + getI18nName(this, getLocale())); } else { controllerFrame.setTitle(getI18nName(this, getLocale())); } }
private JMenuItem createMenuItem(IDisplayableAction action) { return new JMenuItem(getViewFactory().getActionFactory().createAction( action, this, null, getLocale())); }
private void updateFrameTitle() { String workspaceName = getSelectedWorkspaceName(); if (workspaceName != null) { controllerFrame.setTitle(getWorkspace(getSelectedWorkspaceName()) .getViewDescriptor().getI18nDescription(getTranslationProvider(), getLocale()) + " - " + getI18nName(getTranslationProvider(), getLocale())); } else { controllerFrame.setTitle(getI18nName(getTranslationProvider(), getLocale())); } }
private JMenu createActionMenu(ActionList actionList) { JMenu menu = new JMenu(actionList.getI18nName(getTranslationProvider(), getLocale())); if (actionList.getDescription() != null) { menu.setToolTipText(actionList.getI18nDescription( getTranslationProvider(), getLocale()) + IActionFactory.TOOLTIP_ELLIPSIS); } menu.setIcon(getIconFactory().getIcon(actionList.getIconImageURL(), IIconFactory.SMALL_ICON_SIZE)); for (IDisplayableAction action : actionList.getActions()) { menu.add(new JMenuItem(getViewFactory().getActionFactory().createAction( action, this, menu, null, null, getLocale()))); } return menu; }
loginDialog = new JDialog(controllerFrame, loginViewDescriptor.getI18nName(this, getLocale()), true); loginDialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); for (IDisplayableAction action : actionList.getActions()) { JButton button = new JButton(getViewFactory().getActionFactory().createAction(action, getViewFactory().getIconFactory().getSmallIconSize(), this, loginView, getLocale())); buttonBox.add(button); if (i == 0) { exitButton.setAction(getViewFactory().getActionFactory().createAction(getExitAction(), this, null, getLocale())); exitButton.setIcon(getIconFactory().getCancelIcon(getIconFactory().getSmallIconSize())); buttonBox.add(exitButton); mainPanel.add(new JLabel(loginViewDescriptor.getI18nDescription(this, getLocale())), BorderLayout.NORTH); mainPanel.add(loginView.getPeer(), BorderLayout.CENTER);
actionList.getActions().get(0), this, null, getLocale()); button.setAction(action); if (actions.size() > 1) {
private JMenu createWorkspacesMenu() { JMenu workspacesMenu = new JMenu(getTranslationProvider().getTranslation( "workspaces", getLocale())); workspacesMenu.setIcon(getIconFactory().getIcon( getWorkspacesMenuIconImageUrl(), IIconFactory.SMALL_ICON_SIZE)); for (String workspaceName : getWorkspaceNames()) { IViewDescriptor workspaceViewDescriptor = getWorkspace(workspaceName) .getViewDescriptor(); JMenuItem workspaceMenuItem = new JMenuItem(new WorkspaceSelectionAction( workspaceName, workspaceViewDescriptor)); workspacesMenu.add(workspaceMenuItem); } workspacesMenu.addSeparator(); workspacesMenu.add(new JMenuItem(new QuitAction())); return workspacesMenu; }
/** * Constructs a new <code>WorkspaceSelectionAction</code> instance. * * @param workspaceName * @param workspaceViewDescriptor */ public WorkspaceSelectionAction(String workspaceName, IViewDescriptor workspaceViewDescriptor) { this.workspaceName = workspaceName; putValue(Action.NAME, workspaceViewDescriptor.getI18nName( getTranslationProvider(), getLocale())); putValue(Action.SHORT_DESCRIPTION, workspaceViewDescriptor .getI18nDescription(getTranslationProvider(), getLocale()) + IViewFactory.TOOLTIP_ELLIPSIS); putValue(Action.SMALL_ICON, getIconFactory().getIcon( workspaceViewDescriptor.getIconImageURL(), IIconFactory.TINY_ICON_SIZE)); }
/** * {@inheritDoc} */ @Override protected CallbackHandler createLoginCallbackHandler() { DialogCallbackHandler callbackHandler = new DialogCallbackHandler(); callbackHandler.setLocale(getLocale()); callbackHandler.setTranslationProvider(getTranslationProvider()); callbackHandler.setIconFactory(getIconFactory()); return callbackHandler; }
JOptionPane.showMessageDialog(sourceComponent, HtmlHelper.emphasis(ex .getMessage()), getTranslationProvider().getTranslation("error", getLocale()), JOptionPane.ERROR_MESSAGE, getIconFactory() .getErrorIcon(IIconFactory.LARGE_ICON_SIZE)); } else if (ex instanceof BusinessException) { JOptionPane.showMessageDialog(sourceComponent, HtmlHelper .emphasis(((BusinessException) ex).getI18nMessage( getTranslationProvider(), getLocale())), getTranslationProvider() .getTranslation("error", getLocale()), JOptionPane.ERROR_MESSAGE, getIconFactory().getErrorIcon(IIconFactory.LARGE_ICON_SIZE)); } else if (ex instanceof ConcurrencyFailureException) { JOptionPane.showMessageDialog(sourceComponent, HtmlHelper .emphasis(getTranslationProvider().getTranslation( "concurrency.error.description", getLocale())), getTranslationProvider().getTranslation("error", getLocale()), JOptionPane.ERROR_MESSAGE, getIconFactory().getErrorIcon( IIconFactory.LARGE_ICON_SIZE)); ex.printStackTrace(); JErrorDialog dialog = JErrorDialog.createInstance(sourceComponent, getTranslationProvider(), getLocale()); dialog.setMessageIcon(getIconFactory().getErrorIcon( IIconFactory.MEDIUM_ICON_SIZE)); dialog.setTitle(getTranslationProvider().getTranslation("error", getLocale())); dialog.setMessage(HtmlHelper.emphasis(ex.getLocalizedMessage())); dialog.setDetails(ex);
private void completeApplicationToolBar(JToolBar applicationToolBar, ActionList actionList) { if (isAccessGranted(actionList)) { try { pushToSecurityContext(actionList); if (actionList.isCollapsable()) { applicationToolBar.add(createComboButton(actionList)); } else { for (IDisplayableAction da : actionList.getActions()) { if (isAccessGranted(da)) { JButton b = new JButton(); b.setAction(getViewFactory().getActionFactory().createAction(da, this, null, getLocale())); applicationToolBar.add(b); } } } applicationToolBar.addSeparator(); } finally { restoreLastSecurityContextSnapshot(); } } }
.toHtml(HtmlHelper.emphasis(HtmlHelper .escapeForHTML(userFriendlyExceptionMessage))), getTranslation("error", getLocale()), JOptionPane.ERROR_MESSAGE, getIconFactory().getErrorIcon(getIconFactory().getLargeIconSize())); } else { traceUnexpectedException(ex); JErrorDialog dialog = JErrorDialog.createInstance(sourceComponent, this, getLocale()); dialog.setMessageIcon(getIconFactory().getErrorIcon( getIconFactory().getMediumIconSize())); dialog.setTitle(getTranslation("error", getLocale())); dialog.setMessage(HtmlHelper.toHtml(HtmlHelper.emphasis(HtmlHelper .escapeForHTML(ex.getLocalizedMessage()))));
getExitAction(), this, null, getLocale())); applicationToolBar.add(exitButton); return applicationToolBar;
/** * Creates a new JInternalFrame and populates it with a view. * * @param view * the view to be set into the internal frame. * @return the constructed internal frame. */ private JInternalFrame createJInternalFrame(IView<JComponent> view) { JInternalFrame internalFrame = new JInternalFrame(view.getDescriptor() .getI18nName(getTranslationProvider(), getLocale())); internalFrame.setFrameIcon(getIconFactory().getIcon( view.getDescriptor().getIconImageURL(), IIconFactory.SMALL_ICON_SIZE)); internalFrame.setResizable(true); internalFrame.setClosable(false); internalFrame.setMaximizable(true); internalFrame.setIconifiable(true); internalFrame.getContentPane().add(view.getPeer(), BorderLayout.CENTER); internalFrame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); internalFrame.setGlassPane(createHermeticGlassPane()); return internalFrame; }
workspaceInternalFrame = createJInternalFrame( workspaceView, workspaceNavigatorViewDescriptor.getI18nName(this, getLocale()), getIconFactory().getIcon( workspaceNavigatorViewDescriptor.getIcon(),