improve plugin config api

This commit is contained in:
Sebastian Sdorra
2010-09-17 15:31:19 +02:00
parent 08442924f4
commit 797b6b281a
5 changed files with 83 additions and 51 deletions

View File

@@ -62,7 +62,14 @@ public class HgConfigResource
@GET
public HgConfig getConfig()
{
return handler.getConfig();
HgConfig config = handler.getConfig();
if (config == null)
{
config = new HgConfig();
}
return config;
}
//~--- set methods ----------------------------------------------------------

View File

@@ -35,9 +35,9 @@ public class HgConfig
*
* @return
*/
public File getConfigDirectory()
public String getBaseUrl()
{
return configDirectory;
return baseUrl;
}
/**
@@ -68,11 +68,11 @@ public class HgConfig
* Method description
*
*
* @param configDirectory
* @param baseUrl
*/
public void setConfigDirectory(File configDirectory)
public void setBaseUrl(String baseUrl)
{
this.configDirectory = configDirectory;
this.baseUrl = baseUrl;
}
/**
@@ -100,7 +100,7 @@ public class HgConfig
//~--- fields ---------------------------------------------------------------
/** Field description */
private File configDirectory;
private String baseUrl;
/** Field description */
private String hgBinary = "hg";

View File

@@ -2,49 +2,23 @@
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
repositoryConfigPanels.push({
style: 'margin: 10px',
trackResetOnLoad : true,
autoScroll : true,
border : false,
frame : false,
collapsible : false,
collapsed : false,
layoutConfig : {
labelSeparator : ''
},
registerConfigPanel({
xtype : 'configForm',
title : 'Mercurial Settings',
items : [{
xtype : 'fieldset',
checkboxToggle : false,
title : 'Mercurial Settings',
collapsible : true,
autoHeight : true,
labelWidth : 140,
buttonAlign: 'left',
layoutConfig : {
labelSeparator : ''
},
items : [{
xtype : 'textfield',
fieldLabel : 'HG Binary',
name : 'hgBinary',
allowBlank : false
},{
xtype: 'textfield',
name: 'hgRepoDirectroy',
fieldLabel: 'Repository directory',
allowBlank : false
},{
xtype: 'textfield',
name: 'hgBaseUrl',
fieldLabel: 'Base URL',
allowBlank : false
}],
buttons: [{
text: 'Save'
},{
text: 'Cancel'
}]
xtype : 'textfield',
fieldLabel : 'HG Binary',
name : 'hgBinary',
allowBlank : false
},{
xtype: 'textfield',
name: 'repositoryDirectory',
fieldLabel: 'Repository directory',
allowBlank : false
},{
xtype: 'textfield',
name: 'baseUrl',
fieldLabel: 'Base URL',
allowBlank : false
}]
});

View File

@@ -12,6 +12,10 @@ var authCallbacks = [];
// config form panels
var repositoryConfigPanels = [];
function registerConfigPanel(panel){
repositoryConfigPanels.push( panel );
}
var repositoryTypeStore = new Ext.data.JsonStore({
id: 1,
fields: [ 'displayName', 'name' ]

View File

@@ -27,4 +27,51 @@ Sonia.config.ConfigPanel = Ext.extend(Ext.Panel, {
});
Ext.reg("configPanel", Sonia.config.ConfigPanel);
Ext.reg("configPanel", Sonia.config.ConfigPanel);
Sonia.config.ConfigForm = Ext.extend(Ext.form.FormPanel, {
title: 'Config Form',
items: null,
initComponent: function(){
var config = {
title: null,
style: 'margin: 10px',
trackResetOnLoad : true,
autoScroll : true,
border : false,
frame : false,
collapsible : false,
collapsed : false,
layoutConfig : {
labelSeparator : ''
},
items : [{
xtype : 'fieldset',
checkboxToggle : false,
title : this.title,
collapsible : true,
autoHeight : true,
labelWidth : 140,
buttonAlign: 'left',
layoutConfig : {
labelSeparator : ''
},
items: this.items,
buttons: [{
text: 'Save'
},{
text: 'Cancel'
}]
}]
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.config.ConfigForm.superclass.initComponent.apply(this, arguments);
}
});
Ext.reg("configForm", Sonia.config.ConfigForm);