Icons for toolbar with several sizes

Bugzilla Id: 57518

git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1656219 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bruno Demion 2015-01-31 17:43:54 +00:00
parent e1fcdb6ecd
commit c28a908cf3
13 changed files with 63 additions and 34 deletions

View File

@ -150,6 +150,8 @@ jmeter.laf.mac=System
#jmeter.toolbar.icons=org/apache/jmeter/images/toolbar/icons-toolbar.properties
# Toolbar list
#jmeter.toolbar=new,open,close,save,save_as_testplan,|,cut,copy,paste,|,expand,collapse,toggle,|,test_start,test_stop,test_shutdown,|,test_start_remote_all,test_stop_remote_all,test_shutdown_remote_all,|,test_clear,test_clear_all,|,search,search_reset,|,function_helper,help
# Toolbar icons default size: 22x22. Available sizes are: 22x22, 32x33, 48x48
#jmeter.toolbar.icons.size=22x22
# Icon definitions
# default:

View File

@ -965,7 +965,7 @@ run JMeter unless all the JMeter jars are added.
<fileset dir="${build.core}" includes="**/*.class"
excludes="**/BeanShellClient*.class,**/NewDriver*,**/DynamicClassLoader*"/>
<fileset dir="${src.core}" includes="org/apache/jmeter/images/**"
excludes="**/*.properties"/>
excludes="**/*.properties,org/apache/jmeter/images/toolbar/icons-custom/**"/>
<fileset dir="${src.core}" includes="**/*.properties">
<exclude name="*eucJP*"/>
</fileset>

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -42,7 +42,7 @@ public final class IconToolbarBean {
* @param strToSplit - the line value (i18n key, ActionNames ID, icon path, optional icon pressed path)
* @throws JMeterException if error in parsing.
*/
IconToolbarBean(final String strToSplit) throws IllegalArgumentException {
IconToolbarBean(final String strToSplit, final String iconSize) throws IllegalArgumentException {
if (strToSplit == null) {
throw new IllegalArgumentException("Icon definition must not be null"); //$NON-NLS-1$
}
@ -50,8 +50,8 @@ public final class IconToolbarBean {
if (tmp.length > 2) {
this.i18nKey = tmp[0];
this.actionName = tmp[1];
this.iconPath = tmp[2];
this.iconPathPressed = (tmp.length > 3) ? tmp[3] : tmp[2];
this.iconPath = tmp[2].replace("<SIZE>", iconSize); //$NON-NLS-1$
this.iconPathPressed = (tmp.length > 3) ? tmp[3].replace("<SIZE>", iconSize) : this.iconPath; //$NON-NLS-1$
} else {
throw new IllegalArgumentException("Incorrect argument format - expected at least 2 fields separated by " + ICON_FIELD_SEP);
}

View File

@ -61,6 +61,10 @@ public class JMeterToolBar extends JToolBar implements LocaleChangeListener {
protected static final String DEFAULT_TOOLBAR_PROPERTY_FILE = "org/apache/jmeter/images/toolbar/icons-toolbar.properties"; //$NON-NLS-1$
protected static final String USER_DEFINED_TOOLBAR_PROPERTY_FILE = "jmeter.toolbar.icons"; //$NON-NLS-1$
protected static final String TOOLBAR_ICON_SIZE = "jmeter.toolbar.icons.size"; //$NON-NLS-1$
protected static final String DEFAULT_TOOLBAR_ICON_SIZE = "22x22"; //$NON-NLS-1$
private static final String TOOLBAR_LIST = "jmeter.toolbar";
@ -93,7 +97,11 @@ public class JMeterToolBar extends JToolBar implements LocaleChangeListener {
if (iconToolbarBean == null) {
toolBar.addSeparator();
} else {
toolBar.add(makeButtonItemRes(iconToolbarBean));
try {
toolBar.add(makeButtonItemRes(iconToolbarBean));
} catch (Exception e) {
log.warn(e.getMessage());
}
}
}
toolBar.initButtonsState();
@ -105,8 +113,11 @@ public class JMeterToolBar extends JToolBar implements LocaleChangeListener {
* @param iconBean contains I18N key, ActionNames, icon path, optional icon path pressed
* @return a button for toolbar
*/
private static JButton makeButtonItemRes(IconToolbarBean iconBean) {
private static JButton makeButtonItemRes(IconToolbarBean iconBean) throws Exception {
final URL imageURL = JMeterUtils.class.getClassLoader().getResource(iconBean.getIconPath());
if (imageURL == null) {
throw new Exception("No icon for: " + iconBean.getActionName());
}
JButton button = new JButton(new ImageIcon(imageURL));
button.setToolTipText(JMeterUtils.getResString(iconBean.getI18nKey()));
final URL imageURLPressed = JMeterUtils.class.getClassLoader().getResource(iconBean.getIconPathPressed());
@ -150,6 +161,8 @@ public class JMeterToolBar extends JToolBar implements LocaleChangeListener {
}
String[] oList = order.split(TOOLBAR_ENTRY_SEP);
String iconSize = JMeterUtils.getPropDefault(TOOLBAR_ICON_SIZE, DEFAULT_TOOLBAR_ICON_SIZE);
List<IconToolbarBean> listIcons = new ArrayList<IconToolbarBean>();
for (String key : oList) {
@ -163,7 +176,7 @@ public class JMeterToolBar extends JToolBar implements LocaleChangeListener {
log.warn("No definition for toolbar entry: " + key);
} else {
try {
IconToolbarBean itb = new IconToolbarBean(property);
IconToolbarBean itb = new IconToolbarBean(property, iconSize);
listIcons.add(itb);
} catch (IllegalArgumentException e) {
// already reported by IconToolbarBean

View File

@ -19,30 +19,31 @@ toolbar=new,templates,open,close,save,save_as_testplan,|,undo,redo,cut,copy,past
# Icon / action definition file.
# Key: button names
# Value: I18N key in messages.properties, ActionNames key field, icon path, optionally followed by comma and then the pressed icon name
new=new,CLOSE,org/apache/jmeter/images/toolbar/new.png
templates=template_menu,TEMPLATES,org/apache/jmeter/images/toolbar/templates.png
open=menu_open,OPEN,org/apache/jmeter/images/toolbar/open.png
close=menu_close,CLOSE,org/apache/jmeter/images/toolbar/close.png
save=save,SAVE,org/apache/jmeter/images/toolbar/save.png
save_as_testplan=save_as,SAVE_AS,org/apache/jmeter/images/toolbar/saveastp.png
cut=cut,CUT,org/apache/jmeter/images/toolbar/cut.png
copy=copy,COPY,org/apache/jmeter/images/toolbar/copy.png
paste=paste,PASTE,org/apache/jmeter/images/toolbar/paste.png
test_start=start,ACTION_START,org/apache/jmeter/images/toolbar/start.png
test_start_notimers=start_no_timers,ACTION_START_NO_TIMERS,org/apache/jmeter/images/toolbar/startnotimers.png
test_stop=stop,ACTION_STOP,org/apache/jmeter/images/toolbar/stop.png
test_shutdown=shutdown,ACTION_SHUTDOWN,org/apache/jmeter/images/toolbar/shutdown.png
test_start_remote_all=remote_start_all,REMOTE_START_ALL,org/apache/jmeter/images/toolbar/startremoteall.png
test_stop_remote_all=remote_stop_all,REMOTE_STOP_ALL,org/apache/jmeter/images/toolbar/stopremoteall.png
test_shutdown_remote_all=remote_shut_all,REMOTE_SHUT_ALL,org/apache/jmeter/images/toolbar/shutdownremoteall.png
test_clear=clear,CLEAR,org/apache/jmeter/images/toolbar/clear.png
test_clear_all=clear_all,CLEAR_ALL,org/apache/jmeter/images/toolbar/clearall.png
toggle=toggle,TOGGLE,org/apache/jmeter/images/toolbar/toggle.png
expand=menu_expand_all,EXPAND_ALL,org/apache/jmeter/images/toolbar/expand.png
collapse=menu_collapse_all,COLLAPSE_ALL,org/apache/jmeter/images/toolbar/collapse.png
search=menu_search,SEARCH_TREE,org/apache/jmeter/images/toolbar/search.png
search_reset=menu_search_reset,SEARCH_RESET,org/apache/jmeter/images/toolbar/searchreset.png
function_helper=function_dialog_menu_item,FUNCTIONS,org/apache/jmeter/images/toolbar/function.png
help=help,HELP,org/apache/jmeter/images/toolbar/help.png
undo=undo,UNDO,org/apache/jmeter/images/toolbar/undo.png
redo=redo,REDO,org/apache/jmeter/images/toolbar/redo.png
# Special keyword "<SIZE>" for the different size of the same icon (Available sizes are: 22x22, 32x32, 48x48)
new=new,CLOSE,org/apache/jmeter/images/toolbar/<SIZE>/document-new-4.png
templates=template_menu,TEMPLATES,org/apache/jmeter/images/toolbar/<SIZE>/applications-office.png
open=menu_open,OPEN,org/apache/jmeter/images/toolbar/<SIZE>/document-open-2.png
close=menu_close,CLOSE,org/apache/jmeter/images/toolbar/<SIZE>/document-close-4.png
save=save,SAVE,org/apache/jmeter/images/toolbar/<SIZE>/document-save-5.png
save_as_testplan=save_as,SAVE_AS,org/apache/jmeter/images/toolbar/<SIZE>/document-save-as-5.png
cut=cut,CUT,org/apache/jmeter/images/toolbar/<SIZE>/edit-cut-4.png
copy=copy,COPY,org/apache/jmeter/images/toolbar/<SIZE>/edit-copy-4.png
paste=paste,PASTE,org/apache/jmeter/images/toolbar/<SIZE>/edit-paste-4.png
test_start=start,ACTION_START,org/apache/jmeter/images/toolbar/<SIZE>/arrow-right-3.png
test_start_notimers=start_no_timers,ACTION_START_NO_TIMERS,org/apache/jmeter/images/toolbar/<SIZE>/arrow-right-3-notimer.png
test_stop=stop,ACTION_STOP,org/apache/jmeter/images/toolbar/<SIZE>/road-sign-us-stop.png
test_shutdown=shutdown,ACTION_SHUTDOWN,org/apache/jmeter/images/toolbar/<SIZE>/process-stop-7.png
test_start_remote_all=remote_start_all,REMOTE_START_ALL,org/apache/jmeter/images/toolbar/<SIZE>/arrow-right-3-startremoteall.png
test_stop_remote_all=remote_stop_all,REMOTE_STOP_ALL,org/apache/jmeter/images/toolbar/<SIZE>/road-sign-us-stop-stopremoteall.png
test_shutdown_remote_all=remote_shut_all,REMOTE_SHUT_ALL,org/apache/jmeter/images/toolbar/<SIZE>/process-stop-7-shutdownremoteall.png
test_clear=clear,CLEAR,org/apache/jmeter/images/toolbar/<SIZE>/run-build-clean.png
test_clear_all=clear_all,CLEAR_ALL,org/apache/jmeter/images/toolbar/<SIZE>/run-build-prune.png
toggle=toggle,TOGGLE,org/apache/jmeter/images/toolbar/<SIZE>/color-picker-toggle.png
expand=menu_expand_all,EXPAND_ALL,org/apache/jmeter/images/toolbar/<SIZE>/list-add-3.png
collapse=menu_collapse_all,COLLAPSE_ALL,org/apache/jmeter/images/toolbar/<SIZE>/list-remove-3.png
search=menu_search,SEARCH_TREE,org/apache/jmeter/images/toolbar/<SIZE>/edit-find-7.png
search_reset=menu_search_reset,SEARCH_RESET,org/apache/jmeter/images/toolbar/<SIZE>/edit-clear-3.png
function_helper=function_dialog_menu_item,FUNCTIONS,org/apache/jmeter/images/toolbar/<SIZE>/documentation.png
help=help,HELP,org/apache/jmeter/images/toolbar/<SIZE>/help-contents-5.png
undo=undo,UNDO,org/apache/jmeter/images/toolbar/<SIZE>/edit-undo-7.png
redo=redo,REDO,org/apache/jmeter/images/toolbar/<SIZE>/edit-redo-7.png

View File

@ -223,6 +223,7 @@ See <bugzilla>56357</bugzilla> for details.
<h3>General</h3>
<ul>
<li><bug>57518</bug>Icons for toolbar with several sizes</li>
</ul>
<ch_section>Non-functional changes</ch_section>
<ul>

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -99,8 +99,20 @@ It provides search with following options:
<figure width="642" height="307" image="searching/regexp-search.png">Figure 3 - Search Regexp in TreeView (in this example we search whole word)</figure>
<figure width="596" height="328" image="searching/regexp-search-result.png">Figure 4 - Result in TreeView</figure>
</subsection>
<subsection name="&sect-num;.4 Toolbar icons size" anchor="toolbar">
<description>
<p>
You can change the size of icons in the toolbar using the property <pre>jmeter.toolbar.icons.size</pre> with these values: 22x22 (default size), 32x32 or 48x48.
</p>
</description>
<figure width="296" height="95" image="icons-22x22.jpg">Icons with the size 22x22.</figure>
<figure width="300" height="106" image="icons-32x32.jpg">Icons with the size 32x32.</figure>
<figure width="365" height="120" image="icons-48x48.jpg">Icons with the size 48x48.</figure>
</subsection>
</section>
</body>
</document>