at.spardat.xma.page.messagebox.LocalizedMessageBox Maven / Gradle / Ivy
The newest version!
/*******************************************************************************
* Copyright (c) 2003, 2010 s IT Solutions AT Spardat GmbH .
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* s IT Solutions AT Spardat GmbH - initial API and implementation
*******************************************************************************/
// @(#) $Id: $
package at.spardat.xma.page.messagebox;
import java.util.Locale;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
/**
* The {@link LocalizedMessageBox} will provide the same features as the default SWT {@link MessageBox}.
* But, the useful Addon to localize the buttons on the Box.
* @author s3945
* @since 2.1.2
*/
public class LocalizedMessageBox extends AbstractMessagebox {
/**
* Creates a LocalizedMessageBox with the following parameters:
* SWT.OK
* SWT.ICON_INFORMATION
* SWT.APPLICATION_MODAL
* Locale = Default
* @param parent the parent shell to use to display
*/
public LocalizedMessageBox(Shell parent) {
super(parent, null, SWT.OK | SWT.ICON_INFORMATION | SWT.APPLICATION_MODAL);
}
/**
* Creates a LocalizedMessageBox with the following parameters:
* SWT.OK
* SWT.ICON_INFORMATION
* SWT.APPLICATION_MODAL
* @param parent the parent shell to use to display
* @param locale the local to use to localize the buttons
*/
public LocalizedMessageBox(Shell parent, Locale locale) {
super(parent, locale, SWT.OK | SWT.ICON_INFORMATION | SWT.APPLICATION_MODAL);
}
/**
* Creates a LocalizedMessageBox with the given parameters.
* @param parent the parent shell to use to display
* @param locale the local to use to localize the buttons
* @param style the style of dialog to construct
*/
public LocalizedMessageBox(Shell parent, Locale locale, int style) {
super(parent, locale, style);
}
/** {@inheritDoc} */
protected void createWidgets() {
super.createWidgets();
}
protected Point getMinSize() {
Point size = getButtonComposite().getSize();
int bottomEnd = getButtonComposite().getLocation().y + size.y;
int minWidth = size.x + 2*scaler.convertXToCurrent(HORIZONTAL_OFFSET) + 2*getShell().getBorderWidth();
int minHeight = bottomEnd + scaler.convertYToCurrent(SHELL_DEFAULT_MIN_HEIGHT);
return new Point(minWidth,minHeight);
}
}