Index: gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/.actionScriptProperties
===================================================================
--- gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/.actionScriptProperties	(revision 17)
+++ gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/.actionScriptProperties	(revision 380)
@@ -19,4 +19,5 @@
   <applications>
     <application path="gssim/gssimstudio/editor/ScheduleViewerTest.mxml"/>
+    <application path="gssim/gssimstudio/editor/GSSimStudioConfig.mxml"/>
     <application path="gssim/gssimstudio/editor/GSSimStudio.mxml"/>
   </applications>
Index: gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/.settings/org.eclipse.core.resources.prefs
===================================================================
--- gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/.settings/org.eclipse.core.resources.prefs	(revision 15)
+++ gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/.settings/org.eclipse.core.resources.prefs	(revision 380)
@@ -1,6 +1,8 @@
-#Tue Jul 05 12:19:45 CEST 2011
+#Sun Aug 12 12:12:30 BST 2012
 eclipse.preferences.version=1
+encoding//locale/en_US/Common.properties=UTF-8
 encoding//locale/en_US/ExperimentEditor.properties=UTF-8
 encoding//locale/pl_PL/ArchiveViewer.properties=UTF-8
+encoding//locale/pl_PL/Charts.properties=UTF-8
 encoding//locale/pl_PL/Common.properties=UTF-8
 encoding//locale/pl_PL/ExperimentEditor.properties=UTF-8
Index: gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/locale/pl_PL/Common.properties
===================================================================
--- gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/locale/pl_PL/Common.properties	(revision 15)
+++ gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/locale/pl_PL/Common.properties	(revision 380)
@@ -6,2 +6,3 @@
 English=English
 Polish=Polski
+Change=ZmieÅ
Index: gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/locale/en_US/Common.properties
===================================================================
--- gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/locale/en_US/Common.properties	(revision 15)
+++ gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/locale/en_US/Common.properties	(revision 380)
@@ -6,2 +6,3 @@
 English=English
 Polish=Polski
+Change=Change
Index: gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/app/gssim/gssimstudio/editor/GSSimStudioConfig.mxml
===================================================================
--- gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/app/gssim/gssimstudio/editor/GSSimStudioConfig.mxml	(revision 380)
+++ gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/app/gssim/gssimstudio/editor/GSSimStudioConfig.mxml	(revision 380)
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<vine:VineApplication
+				xmlns="gssim.gssimstudio.editor.*"
+				xmlns:fx="http://ns.adobe.com/mxml/2009"  
+				xmlns:s="library://ns.adobe.com/flex/spark"
+				xmlns:mx="library://ns.adobe.com/flex/mx"
+				xmlns:vine="org.vinetoolkit.vine.*"
+				creationComplete="initApp();"
+				backgroundColor="#EBE9E1"
+				preloader="gssim.gssimstudio.editor.script.preloader.CustomPreloader"
+				paddingLeft="0" paddingRight="0" xmlns:components="gssim.gssimstudio.editor.gssim.components.*">
+	
+<fx:Metadata>
+[ResourceBundle("Common")]
+[ResourceBundle("Help")]
+</fx:Metadata>
+
+<fx:Declarations>
+<GSSimStudioConfigModel id="model"/> 
+
+</fx:Declarations>
+
+	<fx:Script>
+		<![CDATA[
+			import gssim.gssimstudio.editor.gssim.skins.IconButtonSkin;
+			
+			[Bindable]
+			public var showDebug : Boolean = true;
+			
+			/**
+			 * Sets the current selected language button to the initialized locale.
+			 */
+			private function initApp() : void
+			{
+				//setDebugMode(true);
+				if (resourceManager.localeChain[0] == "pl_PL") languageMenu.selected = plLocale;
+				else if (resourceManager.localeChain[0] == "en_US") languageMenu.selected = enLocale;
+				else languageMenu.selected = enLocale; //default
+				
+				bindModel("model");
+				
+				service.getApplicationPropertyTypesFromDb();
+			}
+				
+			/**
+			 * This function moves the picked locale to the top of locale chain list.
+			 */
+			private function changeLocale(locale : String) : void
+			{
+				var loc : Array = new Array;
+				loc.push(locale);
+				for each (var item : String in resourceManager.localeChain)
+				{
+					if (item != locale) loc.push(item);
+				}
+				resourceManager.localeChain = loc;
+			} 			
+		]]>
+	</fx:Script>
+	
+	<mx:VBox width="100%" height="100%">
+		
+		<mx:ComboBox id="property_combo" dataProvider="{model.propertyList}" change="{service.getPropertyValue(property_combo.text);}"/>
+		<mx:TextInput id="property_value" text="{model.value}" />
+		<mx:Button label="{resourceManager.getString('Common', 'Change')}" click="{service.saveProperty(property_combo.text, property_value.text);}" />
+		<mx:TextArea text="{model.error}" enabled="false" />
+		
+		<components:RollOutMenu width="100%" height="100%" selectable="true" id="languageMenu">
+			<components:IconToggleButton skinClass="gssim.gssimstudio.editor.gssim.skins.IconToggleButtonSkin" click="changeLocale('en_US')" id="enLocale" height="32" width="32" toolTip="{resourceManager.getString('Common', 'English')}" iconUp="assets/icon/en_US.png"/>
+			<components:IconToggleButton skinClass="gssim.gssimstudio.editor.gssim.skins.IconToggleButtonSkin" click="changeLocale('pl_PL')" id="plLocale" height="32" width="32" toolTip="{resourceManager.getString('Common', 'Polish')}" iconUp="assets/icon/pl_PL.png"/>
+		</components:RollOutMenu>
+		
+		<mx:ColorPicker selectedColor="0xEBE9E1" id="backgroundColorPicker"/>
+		
+	</mx:VBox>
+	
+</vine:VineApplication>
Index: gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/app/gssim/gssimstudio/editor/GSSimStudioConfigModel.as
===================================================================
--- gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/app/gssim/gssimstudio/editor/GSSimStudioConfigModel.as	(revision 380)
+++ gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/app/gssim/gssimstudio/editor/GSSimStudioConfigModel.as	(revision 380)
@@ -0,0 +1,20 @@
+package gssim.gssimstudio.editor
+{
+	import flash.events.EventDispatcher;
+	import flash.utils.ByteArray;
+	
+	import mx.collections.ArrayCollection;
+	
+	[Bindable]
+	[RemoteClass(alias = "gssim.gssimstudio.flex.app.editor.GSSimStudioConfigModel")]
+	public class GSSimStudioConfigModel {
+		
+		public function GSSimStudioConfigModel() {
+		}
+		
+		public var value : String;
+		public var error : String;
+		
+		public var propertyList:ArrayCollection;
+	}
+}
Index: gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/java/gssim/gssimstudio/flex/app/editor/GSSimStudioConfig.java
===================================================================
--- gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/java/gssim/gssimstudio/flex/app/editor/GSSimStudioConfig.java	(revision 380)
+++ gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/java/gssim/gssimstudio/flex/app/editor/GSSimStudioConfig.java	(revision 380)
@@ -0,0 +1,210 @@
+package gssim.gssimstudio.flex.app.editor;
+
+import java.io.*;
+import java.util.*;
+
+import org.vinetoolkit.ResourceManager;
+import org.vinetoolkit.ServiceContext;
+import org.vinetoolkit.Session;
+
+import org.vinetoolkit.web.spi.annotation.BlazeDsDestination;
+import org.vinetoolkit.web.spi.annotation.BlazeDsMethod;
+import org.vinetoolkit.web.flex.blazeds.shared.utils.VineFlexUtilClass;
+import org.vinetoolkit.web.portlet.spi.annotation.PortletDisplayName;
+import org.vinetoolkit.role.VineRoleManager;
+import org.vinetoolkit.spi.util.ServiceLog;
+
+import flex.messaging.FlexContext;
+import org.vinetoolkit.web.spi.annotation.BlazeDsDestination;
+import org.vinetoolkit.web.spi.annotation.BlazeDsMethod;
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.disk.DiskFileItem;
+import org.vinetoolkit.io.*;
+import org.vinetoolkit.io.sets.FileLocationSet;
+import org.vinetoolkit.ServiceContext;
+import org.vinetoolkit.Location;
+import org.vinetoolkit.task.TaskMonitor;
+import org.vinetoolkit.task.TaskOptions;
+import org.vinetoolkit.task.TaskException;
+import org.vinetoolkit.localhost.io.FileSystemResource;
+import org.vinetoolkit.localhost.io.FileSystemManager;
+import org.vinetoolkit.spi.util.ServiceLog;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Timestamp;
+
+import java.security.Principal;
+
+import gssim.db.dao.data.ApplicationProperty;
+import gssim.db.find.Finder;
+import gssim.db.mysql.ApplicationPropertyDAO;
+
+import java.net.MalformedURLException;
+
+import javax.servlet.ServletContext;
+
+/**
+ * @author Mateusz Cichenski, Jarek Szymczak
+ */
+@BlazeDsDestination(locales = {"en_US","pl_PL"}, names = {"GSSim Studio Configuration","GSSim Studio - ustawienia"}, descriptions = {"Application for configuring GSSim Studio","Aplikacja konfiguracji GSSim Studio"})
+@PortletDisplayName(locales = {"en", "pl"}, values = {"GSSimStudio Configuration Application", "Aplikacja GSSimStudio - ustawienia"})
+public class GSSimStudioConfig extends DatabaseHelper {
+
+	private Boolean developement = true;
+
+	private static MySQLDAOFactory factory;
+
+	/**
+	 * Logger instance for this class
+	 */
+    private ServiceLog log = ServiceLog.getInstance(GSSimStudioConfig.class);
+	
+	@BlazeDsMethod()
+	public GSSimStudioConfigModel getApplicationPropertyTypesFromDb() {
+		GSSimStudioConfigModel model = (GSSimStudioConfigModel) VineFlexUtilClass.getUIModel();
+		Connection connection = null;
+		try {
+			connection = factory().createDBConnection(dbAddress, dbUser,
+					dbPassword);
+			ApplicationPropertyDAO applicationPropertyDAO = factory.createApplicationProperty();
+			
+			List<String> list = applicationPropertyDAO.getTypes();
+			
+			model.setPropertyList(list);
+			model.setError("");
+
+		} catch (SQLException e) {
+			setSqlError("Text properties", model, e);
+		} catch (InstantiationException e) {
+			setDbConnectionError(model, e);		
+		} catch (IllegalAccessException e) {
+			setDbConnectionError(model, e);	
+		} catch (ClassNotFoundException e) {
+			setDbConnectionError(model, e);	
+		} catch (Exception e) {
+			setError("Unexpected error occured", model, e);	
+		} finally {
+			closeConnection(connection, model);
+		}
+
+		return getPropertyValue(model.getPropertyList().get(0));
+	}
+	
+	@BlazeDsMethod()
+	public GSSimStudioConfigModel getPropertyValue(String property) throws IOException {
+		GSSimStudioConfigModel model = (GSSimStudioConfigModel) VineFlexUtilClass.getUIModel();
+		Connection connection = null;
+		try {
+			connection = factory().createDBConnection(dbAddress, dbUser,
+					dbPassword);
+			ApplicationPropertyDAO applicationPropertyDAO = factory.createApplicationProperty();
+			Finder finder = Finder.getApplicationPropertyFinder(property);
+			List<ApplicationProperty> list = applicationPropertyDAO.find(finder);
+			if (list.isEmpty()) ;
+			else {
+				model.setValue(list.get(0).getValue());
+				model.setError("");
+			}
+			
+		} catch (SQLException e) {
+			setSqlError("Text properties", model, e);
+		} catch (InstantiationException e) {
+			setDbConnectionError(model, e);		
+		} catch (IllegalAccessException e) {
+			setDbConnectionError(model, e);	
+		} catch (ClassNotFoundException e) {
+			setDbConnectionError(model, e);	
+		} catch (Exception e) {
+			setError("Unexpected error occured", model, e);	
+		} finally {
+			closeConnection(connection, model);
+		}
+		
+		return model;
+	}
+	
+	@BlazeDsMethod()
+	public GSSimStudioConfigModel saveProperty(String property, String value) throws IOException {
+		GSSimStudioConfigModel model = (GSSimStudioConfigModel) VineFlexUtilClass.getUIModel();
+		Connection connection = null;
+		try {
+			connection = factory().createDBConnection(dbAddress, dbUser,
+					dbPassword);
+			ApplicationPropertyDAO applicationPropertyDAO = factory.createApplicationProperty();
+			ApplicationProperty ap = new ApplicationProperty();
+			ap.setKey(property);
+			ap.setValue(value);
+			applicationPropertyDAO.insert(ap, true);
+			model.setError("Succesfully added: " + property + "=" + value);
+			
+		} catch (SQLException e) {
+			setSqlError("Text properties", model, e);
+		} catch (InstantiationException e) {
+			setDbConnectionError(model, e);		
+		} catch (IllegalAccessException e) {
+			setDbConnectionError(model, e);	
+		} catch (ClassNotFoundException e) {
+			setDbConnectionError(model, e);	
+		} catch (Exception e) {
+			setError("Unexpected error occured", model, e);	
+		} finally {
+			closeConnection(connection, model);
+		}
+		
+		return model;
+	}
+	
+	private void closeConnection(Connection connection, GSSimStudioConfigModel model) {
+		String error = model.getError();
+		
+		if (connection != null)
+			try {
+				connection.close();
+			} catch (SQLException e) {
+				error = model.getError();
+				if (error == null || error.equals("")) {
+					error = "Error while trying to close the SQL connection";
+				} else {
+					error += System.getProperty("line.separator");
+					error += "Error while trying to close the SQL connection";
+				}
+			}
+
+		model.setError(error);
+	}
+
+	private void setSqlError(String name, GSSimStudioConfigModel model, Exception e) {
+		setError(name + ": an SQL exception occured while trying retrieve data from database", model, e);
+	}
+	
+	private void setDbConnectionError(GSSimStudioConfigModel model, Exception e) {
+		setError("An exception occured while trying to create MySQLDAOFactory", model, e);
+	}
+	
+	private void setError(String messageForUser, GSSimStudioConfigModel model, Exception e) {
+		
+		String error = messageForUser;
+		
+		if(developement)
+		{
+			error += System.getProperty("line.separator");
+			error += "Error details:";
+			error += System.getProperty("line.separator");
+			ByteArrayOutputStream baos = new ByteArrayOutputStream();
+			PrintStream ps = new PrintStream(baos);
+			e.printStackTrace(ps);
+			String stackTrace = baos.toString();		
+			error += stackTrace;
+		}
+		
+		model.setError(error);
+	}			
+	
+	private MySQLDAOFactory factory() throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+		if(factory == null)
+			factory = new MySQLDAOFactory();
+		return factory;
+	}
+	/* END OF DB Methods */
+}
Index: gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/java/gssim/gssimstudio/flex/app/editor/GSSimStudioConfigModel.java
===================================================================
--- gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/java/gssim/gssimstudio/flex/app/editor/GSSimStudioConfigModel.java	(revision 380)
+++ gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/java/gssim/gssimstudio/flex/app/editor/GSSimStudioConfigModel.java	(revision 380)
@@ -0,0 +1,72 @@
+package gssim.gssimstudio.flex.app.editor;
+
+import java.io.Serializable;
+import org.vinetoolkit.grms3client.GRMS3Job;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import gssim.db.dao.data.Allocation;
+import gssim.db.dao.data.AllocationDetails;
+import gssim.db.dao.data.BlobProperty;
+import gssim.db.dao.data.Configuration;
+import gssim.db.dao.data.Metaexperiment;
+import gssim.db.dao.data.Experiment;
+import gssim.db.dao.data.ExperimentStats;
+import gssim.db.dao.data.Queues;
+import gssim.db.dao.data.Plugin;
+import gssim.db.dao.data.Reservation;
+import gssim.db.dao.data.ReservationDetails;
+import gssim.db.dao.data.Resource;
+import gssim.db.dao.data.ResourceAllTimeline;
+import gssim.db.dao.data.ResourceEnTimeline;
+import gssim.db.dao.data.Task;
+import gssim.db.dao.data.TextProperty;
+import gssim.db.dao.data.Unit;
+import gssim.db.dao.data.UnitAllTimeline;
+import gssim.db.dao.data.UnitDetails;
+import gssim.db.dao.data.UnitEnTimeline;
+import gssim.db.dao.data.User;
+
+/*
+ * @author Mateusz CicheÅski
+ */
+public class GSSimStudioConfigModel implements Serializable {
+
+    //    IMPORTANT - please regenerate your serialVersionUID
+    private static final long serialVersionUID = 5436766887635500902L;
+
+    public GSSimStudioConfigModel() {
+    }
+    
+    private List<String> propertyList;
+    
+    public List<String> getPropertyList() {
+		return propertyList;
+	}
+
+	public void setPropertyList(
+			List<String> propertyList) {
+		this.propertyList = propertyList;
+	}
+
+	private String value;
+	
+	public String getValue() {
+		return value;
+	}
+
+	public void setValue(String value) {
+		this.value = value;
+	}
+	
+	private String error;
+	
+	public String getError() {
+		return error;
+	}
+
+	public void setError(String error) {
+		this.error = error;
+	}
+}
