Click here to Skip to main content
Click here to Skip to main content

Dynamic UI Creation: Extend R2build: Add New Tool Support, Create Plugin Config

By , 24 Oct 2008
 
Screenshot - dashboard_600.jpg

Screenshot - mainui_600.jpg

Abstract

In this article, we will describe how to support a new tool (new application) in R2build system. R2build uses plugin mechanism and config XML to make it easy to support new tools.

About R2build

R2build is a tool/Framework for desktop application developers to establish your daily build (or nightly build, or build automation, or continuous integration system) in a very easy manner. It includes, but is not limited to, plug-ins for VB/VC++/.NET/Delphi/Ant/Nant/C++ Builder, email notification, FTP, various Installer packaging tools, and various source control tools such as vss, clearcase, cvs, perfoce….

Introduction

R2build uses XML file to describe the Node UI dialog and the related parameter. To support a new tool/application in R2build, you should check the command console parameter of this new application, then create a new XML file in the $R2buildInstallDir/plugins, When R2build starts, it will scan all the plugin config XML file, and build the corresponding nodes in the toolbox. This XML describes the console parameter, it's also called application description XML.

A Simple Example

Let's start from a very simple example. You get a new application, simple.exe, by calling simple.exe –h, you know simple.exe has two parameters:

Simple.exe –f filename –x text 
-f filename: file to open 
-x text: text to delete from file. 

To add simple.exe into R2build toolbox, you need create a simple.xml into the $R2BuildInstallDir/Plugins, you can create your own folder, and put simple.xml into that folder. The following is the XML file:

<?xml version='1.0' encoding='utf-8'?>
<Plugin version='1' group="" name="Simple" appName="Simple" description=""> 

<Type>command</Type> - a command console application 
<Executor>simple.exe</Executor> - the application's executable file name 
<FixedParameter></FixedParameter> -Fixed parameter 
<SubExecutor></SubExecutor> -the sub executor of this application 
<Icon>simple.png</Icon> -the icon file of this application 
<ParameterConfigUI> - the main config section 
<FileBrowser display="File to open" BrowseDir="FALSE" 
Filter="" type="Parameter" relatedParameter="-f "></FileBrowser> -first parameter 
<LineEdit display="Text to delete" type="Parameter" relatedParameter="-x">
</LineEdit> -the second parameter 
</ParameterConfigUI> 
<ReturnValues> -enum return values of this application 
<ReturnValue name="Yes" Condition="$RETURN!=0"></ReturnValue> 
<ReturnValue name="No" Condition="$RETURN==0"></ReturnValue> 
</ReturnValues> 
</Plugin> 

Will show in R2build as the following screenshot:

Screenshot - image_createpluginxml.jpg

Structure of the XML File

<Plugin> 
<Type>command</Type> 
//Type is the plugin type, values are : command/plugin 
<Executor>cleartool.exe</Executor> 
//provide the executor file name, for command plugin, 
//it's command's executable file, for plugin, it's plugin's .dll file name 
//in the same dir of this file 
<FixedParameter></FixedParameter> 
//provide the required and non-configurable parameters 
<SubExecutor>update</SubExecutor> 
//The sub-command of this plugin, some of the tool support sub-command, 
//for example cleartool.exe has a sub-command update 
<Icon>Update Snapshot View.png</Icon> 
//The icon of this plugin 
<ParameterConfigUI> 
//The section for describing the plugin parameter dialog 
//and the related plugin parameterA list of Config items… 
<ComboBox display="this is a combox sample" relatedParameter="-d">
availableValue="selectionA;selectionB;selectionC" value="selectionA">

Supported ParameterConfigUI Items

The following table lists all the supported ParameterConfigUI Items. The XML attributes of any item is composed by "Common Attribute" + "Specific Attribute".

Config UI item Description Specific attribute for this UI Item (see "common attribute" for attribute that's applicable for all items)
ComboBox Show many items in ComboBox, and let user select one availableValue: list all the available values in the listbox, separated by ; availableValue List all the available displayed values in the listbox, separated by ; between values
InternalValue The internal value is the real value that will apply in the command, separated by ; between values
ListBox Show multiple items, and let user select more availableValue List all the available values in the listbox, separated by ; between values
selectionMode :single,multi,extended
InputBox: Show input box, and let user input the parameter directly
RadioGroupBox Show radio groups checkable If checkable is TRUE, put a check box in the group box to enable /disable the whole group
layout The layout for the child of this RadioGroupBox. If it's 1, means we have one column, 2 means 2 columns
value The default value for checkable
RadioBox Show selection item in radio button groups, and let user select one of them
LineEdit Show multiple line editor, let user input multiple lines as parameter isPasswordBox If this lineedit is a password edit, the value is TRUE or FALSE, if it's a password box, will show mask while inputting
CheckBox Show check box, and let user check/uncheck some parameter
FileBrowser Show the open file/dir dialog to let user select a file or dir, have the following attrs BrowserDir If this file browser is a Dir Broswer(TRUE) or File browser(FALSE), all upper case
Filter The filter for this filebrowser, correct format "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)""
VarViewBox Show all the defined variables
TabView Show the tab view CurrentPage The current page of the tab
TabViewItem Show one tab

ParameterConfigUI Item Common Attributes

Each Config UI Item has the following common attributes:

  • display: This label(display) for this item
  • type: See "Supported ParameterConfigUI Item Type"
  • relatedParameter: The related parameter for this config item
  • ParaSeperator: Parameter separator for this config item, will add separator between the relatedParameter and the value, if not config there is no separator between para flag and values. For example -i"c:\aaa.txt" the paraSeperator is comma , -i c:\aaa.txt , the paraSeparator is one space
  • Required: If this field is a required parameter, values are : TRUE or FALSE (all upper case), TRUE means this parameter is required. Default value is TRUE if not setting.

Supported ParameterConfigUI Item Type

For each Config UI Item, they should belong to the following types:

  • Group: This config UI item is used to hold other config UI items
  • ExecutorParameter: The parameter for the main executor, this config UI item is used to get the values for command parameter, the relatedParameter field show its related parameter
  • Parameter: The parameter for the sub executor, this config UI item is used to get the values for command parameter, the relatedParameter field show its related parameter
  • Env: This config UI item is used to set the values for environment variable, the relatedParameter field is the env variable name. NOTE: Env variable will be passed to the command as working environment variables.
  • Property: This config UI item is used to get the other property of the command, the relatedParameter field is the property name. The supported property is WorkingFolder (the folder where this command is working)

More Examples

See $R2buildInstallDir/Plugins for more examples.

Share your Plugins

Send your plugin to R2build@gmail.com to be able to be included in R2build official release or posted on R2build website, your feedback is so important.

R2Build 2.0 Build 416 - SOFTPEDIA "100% CLEAN" AWARD

This product was last tested in the Softpedia Labs on 12 September 2008 by Alexandra Anton Softpedia guarantees that R2Build 2.0 Build 416 is 100% Clean, which means it does not contain any form of malware, including but not limited to: spyware, viruses, trojans and backdoors.
URL: http://www.softpedia.com/progClean/R2Build-Clean-89119.html.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)

About the Author

r2build
Unknown
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Questiontemplate for buildsmemberAndrew Tyapuhin31 Oct '08 - 4:31 
AnswerRe: template for buildsmemberr2build1 Nov '08 - 3:39 
Questiondifferent licensesmemberAndrew Tyapuhin30 Oct '08 - 6:17 
You specified different types of licenses, what kind of license is correct Confused | :confused: ?
here you wrote:
This article, along with any associated source code and files, is licensed under The Code Project Open License
but after setup online Help says another:
R2Build is licensed under the terms of the GNU General Public License for Non-commercial software product build, For Commercial software build, please contact with R2build@gmail.com to get approval.
 
I would like to use this soft for building commercial programs, could I do it?
AnswerRe: different licensesmemberr2build30 Oct '08 - 14:49 
GeneralCannot open include file: 'Writer/XMLWriter.h'memberMember 425712124 Oct '08 - 0:22 
GeneralRe: Cannot open include file: 'Writer/XMLWriter.h'memberr2build24 Oct '08 - 4:31 
GeneralRe: Cannot open include file: 'Writer/XMLWriter.h'memberMember 425712124 Oct '08 - 20:25 
GeneralRe: Cannot open include file: 'Writer/XMLWriter.h'memberr2build25 Oct '08 - 5:35 
GeneralRe: Cannot open include file: 'Writer/XMLWriter.h'memberr2build26 Oct '08 - 21:45 
Generaltrojaner warning when downling from your pagememberHigh200617 Oct '08 - 7:52 
GeneralRe: trojaner warning when downling from your pagememberr2build18 Oct '08 - 4:34 
GeneralThe r2build website is hosted by sourceforge, and it's just a static pure html page without any script, i doubt your reportmemberr2build18 Oct '08 - 4:36 
GeneralR2Build 2.0 Build 416 - SOFTPEDIA "100% CLEAN" AWARDmemberr2build18 Oct '08 - 4:56 
GeneralI scaned myself using Mcafee and kaspersky again, it's ok, i doubt if avast can give a correct /exact scan report, maybe this is the reason why avast is free ;)memberr2build18 Oct '08 - 5:51 
Generaltwo things...membereXplodus10 Dec '07 - 20:39 
GeneralRe: two things...memberr2build12 Dec '07 - 3:38 
GeneralRe: two things...membereXplodus12 Dec '07 - 20:41 
AnswerRe: two things...memberr2build28 Feb '08 - 20:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 24 Oct 2008
Article Copyright 2007 by r2build
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid