All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ingenias.editor.Preferences Maven / Gradle / Ivy

There is a newer version: 1.0.9
Show newest version

/** 
 * Copyright (C) 2010  Jorge J. Gomez-Sanz
 * 
 * This file is part of the INGENME tool. INGENME is an open source meta-editor
 * which produces customized editors for user-defined modeling languages
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation version 3 of the License
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see 
 **/

package ingenias.editor;

import ingenias.exception.InvalidProjectProperty;

import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Preferences {
	public String getSelectedFilter() {
		return selectedFilter;
	}

	public void setSelectedFilter(String selectedFilter) {
		this.selectedFilter = selectedFilter;
	}

	public boolean isFiltersEnabled() {
		return filtersEnabled;
	}

	public void setFiltersEnabled(boolean filtersEnabled) {
		this.filtersEnabled = filtersEnabled;
	}

	public enum DefaultRelationshipView {INGENIAS,UML};
	public enum EditPropertiesMode {POPUP,PANEL};
	public enum ModelingLanguage {UML,INGENIAS};
	public enum RelationshipLayout {AUTOMATIC_STRAIGHT,AUTOMATIC_RADIAL, MANUAL};
	public enum RelationshipsLookAndFeel {LABELS,NOTHING,FULL};


	private DefaultRelationshipView defaultRelationshipView=DefaultRelationshipView.INGENIAS;
	private EditPropertiesMode editPropertiesMode=EditPropertiesMode.PANEL;
	private RelationshipsLookAndFeel relationshipsLookAndFeel=RelationshipsLookAndFeel.NOTHING;
	private ModelingLanguage modelingLanguage=ModelingLanguage.INGENIAS;
	private RelationshipLayout relationshiplayout=RelationshipLayout.AUTOMATIC_STRAIGHT;	
	private String selectedFilter="";
	private boolean filtersEnabled=false;
	private String workspacePath=System.getProperty("user.dir");



	public String getWorkspacePath() {
		return workspacePath;
	}

	public String toXML(){
		StringBuffer sb=new StringBuffer();
		sb.append("");
		sb.append(defaultRelationshipView);
		sb.append("\n");
		sb.append("".toLowerCase());
		sb.append(editPropertiesMode);
		sb.append("\n".toLowerCase());
		sb.append("");
		sb.append(relationshipsLookAndFeel);
		sb.append("\n");
		sb.append("");
		sb.append(relationshiplayout);
		sb.append("\n");
		sb.append("");
		sb.append(modelingLanguage);
		sb.append("\n");
		sb.append("");
		sb.append(workspacePath);
		sb.append("\n");
		
		if (filtersEnabled){
			sb.append("");
			sb.append(selectedFilter);
			sb.append("\n");
		}
		return sb.toString();
	}

	public static Preferences fromXML(Node n) {
		Preferences prefs=new Preferences();

		NodeList children = n.getChildNodes();
		for (int k=0;k




© 2015 - 2024 Weber Informatics LLC | Privacy Policy