Skip to content
Snippets Groups Projects
Commit 943ef736 authored by Nils Christian Ehmke's avatar Nils Christian Ehmke
Browse files

Added comments; Imported the clean-up and formatter from Kieker; Modified the...

Added comments; Imported the clean-up and formatter from Kieker; Modified the structure of a project.
parent 450f3471
No related branches found
No related tags found
No related merge requests found
Showing
with 575 additions and 164 deletions
This diff is collapsed.
#Sun Jan 22 11:49:37 CET 2012
cleanup.add_default_serial_version_id=true
cleanup.add_generated_serial_version_id=false
cleanup.add_missing_annotations=true
cleanup.add_missing_deprecated_annotations=true
cleanup.add_missing_methods=false
cleanup.add_missing_nls_tags=false
cleanup.add_missing_override_annotations=true
cleanup.add_missing_override_annotations_interface_methods=true
cleanup.add_serial_version_id=true
cleanup.always_use_blocks=true
cleanup.always_use_parentheses_in_expressions=true
cleanup.always_use_this_for_non_static_field_access=true
cleanup.always_use_this_for_non_static_method_access=true
cleanup.convert_to_enhanced_for_loop=true
cleanup.correct_indentation=true
cleanup.format_source_code=true
cleanup.format_source_code_changes_only=false
cleanup.make_local_variable_final=true
cleanup.make_parameters_final=true
cleanup.make_private_fields_final=true
cleanup.make_type_abstract_if_missing_method=false
cleanup.make_variable_declarations_final=true
cleanup.never_use_blocks=false
cleanup.never_use_parentheses_in_expressions=false
cleanup.organize_imports=true
cleanup.qualify_static_field_accesses_with_declaring_class=true
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
cleanup.qualify_static_member_accesses_with_declaring_class=true
cleanup.qualify_static_method_accesses_with_declaring_class=true
cleanup.remove_private_constructors=true
cleanup.remove_trailing_whitespaces=true
cleanup.remove_trailing_whitespaces_all=true
cleanup.remove_trailing_whitespaces_ignore_empty=false
cleanup.remove_unnecessary_casts=true
cleanup.remove_unnecessary_nls_tags=true
cleanup.remove_unused_imports=true
cleanup.remove_unused_local_variables=false
cleanup.remove_unused_private_fields=true
cleanup.remove_unused_private_members=false
cleanup.remove_unused_private_methods=true
cleanup.remove_unused_private_types=true
cleanup.sort_members=false
cleanup.sort_members_all=false
cleanup.use_blocks=true
cleanup.use_blocks_only_for_return_and_throw=false
cleanup.use_parentheses_in_expressions=true
cleanup.use_this_for_non_static_field_access=true
cleanup.use_this_for_non_static_field_access_only_if_necessary=false
cleanup.use_this_for_non_static_method_access=true
cleanup.use_this_for_non_static_method_access_only_if_necessary=false
cleanup_profile=_Kieker - Clean Up
cleanup_settings_version=2
eclipse.preferences.version=1
formatter_profile=_Kieker - Profile
formatter_settings_version=12
package kieker.webgui.beans;
import javax.enterprise.context.SessionScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import org.primefaces.model.DefaultTreeNode;
import org.primefaces.model.TreeNode;
/**
* This bean can be used to store and read the currently available plugins for
* the current main project.
*
* This bean can be used to store and read the currently available plugins for the current main project.
*
* @author Nils Christian Ehmke
*/
@ManagedBean
@RequestScoped
@SessionScoped
public class AvailablePluginsBean {
public synchronized TreeNode getAvailablePluginsRoot() {
TreeNode root = new DefaultTreeNode("Root", null);
/**
* Delivers the available plugins.
*
* @return A tree with the available plugins.
*/
@SuppressWarnings(value = { "unused" })
public TreeNode getAvailablePluginsRoot() {
TreeNode root = new DefaultTreeNode("Root", null);
final TreeNode readerNode = new DefaultTreeNode("Reader", root);
final TreeNode analysisPluginsNode = new DefaultTreeNode("AnalysisPlugins", root);
final TreeNode readerNode = new DefaultTreeNode("Reader", root);
final TreeNode analysisPluginsNode = new DefaultTreeNode("AnalysisPlugins", root);
return root;
}
return root;
}
}
......@@ -2,15 +2,16 @@ package kieker.webgui.beans;
import java.io.File;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;
import kieker.analysis.AnalysisController;
import kieker.analysis.model.analysisMetaModel.MIProject;
import kieker.analysis.model.analysisMetaModel.impl.MAnalysisMetaModelFactory;
import org.primefaces.model.DefaultTreeNode;
import org.primefaces.model.TreeNode;
......@@ -37,9 +38,12 @@ public class AvailableProjectsBean {
project.setName(projectName);
try {
File dir = new File(PROJECT_DIR);
File dir = new File(PROJECT_DIR + "/" + projectName);
if (!dir.exists()) {
dir.mkdir();
} else {
/* The project exists already. */
return false;
}
File f = new File(dir + "/" + projectName + ".xml");
new AnalysisController(project).saveToFile(f, projectName);
......@@ -56,6 +60,7 @@ public class AvailableProjectsBean {
return projects.add(project);
}
@SuppressWarnings(value = { "unused" })
public synchronized TreeNode getProjectsRoot() {
TreeNode root = new DefaultTreeNode("Root", null);
......
......@@ -6,28 +6,51 @@ import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
/**
*
* This bean can be used for a single session of a user and stores the currently used theme (look and feel) for this user. Currently the default value being used is
* the "glass-x"-theme, if none is find within the parameters of the faces context.
*
* @author Nils Christian Ehmke
*
* @see ThemeSwitcherBean
*/
@ManagedBean
@SessionScoped
public class CurrentThemeBean {
private String theme;
private static final String DEFAULT_THEME = "glass-x";
private String theme;
public CurrentThemeBean() {
theme = "glass-x";
Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
if (params.containsKey("theme")) {
theme = params.get("theme");
}
}
/**
* Creates a new instance of this class.
*/
public CurrentThemeBean() {
/* Get the parameters within the current context. */
Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
/* Try to find the default theme. */
if (params.containsKey("theme")) {
theme = params.get("theme");
} else {
/* Use the default theme. */
theme = DEFAULT_THEME;
}
}
public String getTheme() {
return theme;
}
/**
* Delivers the current theme.
*
* @return The currently used theme.
*/
public String getTheme() {
return theme;
}
public void setTheme(String theme) {
this.theme = theme;
}
/**
* Sets the value of this bean.
*
* @param theme
* The new theme to be stored within this instance.
*/
public void setTheme(String theme) {
this.theme = theme;
}
}
package kieker.webgui.beans;
import org.primefaces.model.UploadedFile;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import kieker.analysis.model.analysisMetaModel.MIProject;
import org.primefaces.model.UploadedFile;
/**
*
*
* @author Nils Christian Ehmke
*/
@ManagedBean
@ApplicationScoped
@SessionScoped
public class DependencyUploadController {
private UploadedFile file;
public UploadedFile getFile() {
return file;
}
public void setFile(UploadedFile file) {
this.file = file;
}
public void upload() {
}
private UploadedFile file;
private MIProject project;
public MIProject getProject() {
return project;
}
public void setProject(MIProject project) {
this.project = project;
}
public UploadedFile getFile() {
return file;
}
public void setFile(UploadedFile file) {
this.file = file;
}
public void upload() {
}
}
......@@ -10,49 +10,48 @@ import kieker.analysis.model.analysisMetaModel.MIProject;
import org.primefaces.model.TreeNode;
/**
* This bean can be used to store the currently selected project and the current
* main project for the user.
*
* This bean can be used to store the currently selected project and the current main project for the user within a session.
*
* @author Nils Christian Ehmke
*/
@ManagedBean
@SessionScoped
public class SelectedProjectBean {
private TreeNode selectedNode;
private MIProject selectedProject;
private MIProject mainProject;
public MIProject getMainProject() {
return mainProject;
}
public void setMainProject(MIProject mainProject) {
this.mainProject = mainProject;
}
public MIProject getSelectedProject() {
return selectedProject;
}
public void setSelectedProject(MIProject selectedProject) {
this.selectedProject = selectedProject;
}
public TreeNode getSelectedNode() {
return selectedNode;
}
public void setSelectedNode(TreeNode selectedNode) {
this.selectedNode = selectedNode;
if (selectedNode != null && selectedNode.getData() instanceof MIProject) {
setSelectedProject((MIProject) selectedNode.getData());
} else {
setSelectedProject(null);
}
}
public String getFontWeight(MIProject project) {
return (project == mainProject) ? "bold" : "normal";
}
private TreeNode selectedNode;
private MIProject selectedProject;
private MIProject mainProject;
public MIProject getMainProject() {
return mainProject;
}
public void setMainProject(MIProject mainProject) {
this.mainProject = mainProject;
}
public MIProject getSelectedProject() {
return selectedProject;
}
public void setSelectedProject(MIProject selectedProject) {
this.selectedProject = selectedProject;
}
public TreeNode getSelectedNode() {
return selectedNode;
}
public void setSelectedNode(TreeNode selectedNode) {
this.selectedNode = selectedNode;
if (selectedNode != null && selectedNode.getData() instanceof MIProject) {
setSelectedProject((MIProject) selectedNode.getData());
} else {
setSelectedProject(null);
}
}
public String getFontWeight(MIProject project) {
return (project == mainProject) ? "bold" : "normal";
}
}
......@@ -4,29 +4,46 @@ import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
/**
* This bean can be used to store a simple string.
*
* This simple bean can be used to store a string. It can be used for a single request.
*
* @author Nils Christian Ehmke
*/
@ManagedBean
@RequestScoped
public class StringBean {
private String string;
private String string;
public StringBean() {
this.string = "";
}
/**
* Creates a new instance of this bean and initializes it with an empty string.
*/
public StringBean() {
this.string = "";
}
public String getString() {
return string;
}
/**
* Delivers the value of this bean.
*
* @return The current string stored within this bean.
*/
public String getString() {
return string;
}
public void setString(String string) {
this.string = string;
}
/**
* Sets the value of this bean.
*
* @param string
* The new string to be stored within this bean.
*/
public void setString(String string) {
this.string = string;
}
public void clear() {
this.string = "";
}
/**
* Clears the bean; in other words: Sets the value of this bean to an empty string.
*/
public void clear() {
this.string = "";
}
}
......@@ -5,55 +5,65 @@ import java.util.TreeMap;
import javax.annotation.PostConstruct;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;
/**
*
* This bean is an application-wide bean, responsible for storing the possible themes (look and feels) available within the program. It is not possible to import new
* themes during runtime.
*
* @author Nils Christian Ehmke
*/
@ManagedBean
@ApplicationScoped
public class ThemeSwitcherBean {
private Map<String, String> themes;
private Map<String, String> themes;
public Map<String, String> getThemes() {
return themes;
}
/**
* Returns the available themes.
*
* @return A map containing the user readable names of the themes as a key and the actual theme-names as the corresponding value.
*/
public Map<String, String> getThemes() {
return themes;
}
@PostConstruct
public void init() {
themes = new TreeMap<String, String>();
themes.put("Aristo", "aristo");
themes.put("Black-Tie", "black-tie");
themes.put("Blitzer", "blitzer");
themes.put("Bluesky", "bluesky");
themes.put("Casablanca", "casablanca");
themes.put("Cupertino", "cupertino");
themes.put("Dark-Hive", "dark-hive");
themes.put("Dot-Luv", "dot-luv");
themes.put("Eggplant", "eggplant");
themes.put("Excite-Bike", "excite-bike");
themes.put("Flick", "flick");
themes.put("Glass-X", "glass-x");
themes.put("Hot-Sneaks", "hot-sneaks");
themes.put("Humanity", "humanity");
themes.put("Le-Frog", "le-frog");
themes.put("Midnight", "midnight");
themes.put("Mint-Choc", "mint-choc");
themes.put("Overcast", "overcast");
themes.put("Pepper-Grinder", "pepper-grinder");
themes.put("Redmond", "redmond");
themes.put("Rocket", "rocket");
themes.put("Sam", "sam");
themes.put("Smoothness", "smoothness");
themes.put("South-Street", "south-street");
themes.put("Start", "start");
themes.put("Sunny", "sunny");
themes.put("Swanky-Purse", "swanky-purse");
themes.put("Trontastic", "trontastic");
themes.put("UI-Darkness", "ui-darkness");
themes.put("UI-Lightness", "ui-lightness");
themes.put("Vader", "vader");
}
/**
* Initializes the bean. If one wants to add new themes to the program, this is the right place.
*/
@PostConstruct
public void init() {
themes = new TreeMap<String, String>();
themes.put("Aristo", "aristo");
themes.put("Black-Tie", "black-tie");
themes.put("Blitzer", "blitzer");
themes.put("Bluesky", "bluesky");
themes.put("Casablanca", "casablanca");
themes.put("Cupertino", "cupertino");
themes.put("Dark-Hive", "dark-hive");
themes.put("Dot-Luv", "dot-luv");
themes.put("Eggplant", "eggplant");
themes.put("Excite-Bike", "excite-bike");
themes.put("Flick", "flick");
themes.put("Glass-X", "glass-x");
themes.put("Hot-Sneaks", "hot-sneaks");
themes.put("Humanity", "humanity");
themes.put("Le-Frog", "le-frog");
themes.put("Midnight", "midnight");
themes.put("Mint-Choc", "mint-choc");
themes.put("Overcast", "overcast");
themes.put("Pepper-Grinder", "pepper-grinder");
themes.put("Redmond", "redmond");
themes.put("Rocket", "rocket");
themes.put("Sam", "sam");
themes.put("Smoothness", "smoothness");
themes.put("South-Street", "south-street");
themes.put("Start", "start");
themes.put("Sunny", "sunny");
themes.put("Swanky-Purse", "swanky-purse");
themes.put("Trontastic", "trontastic");
themes.put("UI-Darkness", "ui-darkness");
themes.put("UI-Lightness", "ui-lightness");
themes.put("Vader", "vader");
}
}
......@@ -7,21 +7,24 @@ import javax.faces.convert.FacesConverter;
import kieker.analysis.model.analysisMetaModel.MIProject;
/**
* This converter can be used to convert an instance of <i>MIProject</i> to a
* human readle string, but <b>not</b> vice versa.
*
* This converter can be used to convert an instance of <i>MIProject</i> to a human readable string, but <b>not</b> vice versa.
*
* @author Nils Christian Ehmke
*/
@FacesConverter(value = "kieker.webgui.converter.MIProjectToStringConverter")
@FacesConverter(value = MIProjectToStringConverter.NAME)
public class MIProjectToStringConverter implements Converter {
@Override
public Object getAsObject(FacesContext fc, UIComponent uic, String string) {
return null;
}
public static final String NAME = "kieker.webgui.converter.MIProjectToStringConverter";
/**
* Delivers always null
*/
@Override
public Object getAsObject(FacesContext fc, UIComponent uic, String string) {
return null;
}
@Override
public String getAsString(FacesContext fc, UIComponent uic, Object o) {
return (o == null || !(o instanceof MIProject)) ? null : ((MIProject) o).getName();
}
@Override
public String getAsString(FacesContext fc, UIComponent uic, Object o) {
return (o == null || !(o instanceof MIProject)) ? null : ((MIProject) o).getName();
}
}
......@@ -59,7 +59,7 @@
</p:treeNode>
</p:tree>
<p:contextMenu for="ProjectsListTree">
<p:contextMenu for="ProjectsListTree" nodeType="project">
<p:menuitem value="New Project" onclick="NewProjectDialog.show();" ajax="true" update="ProjectsList"/>
<p:menuitem value="Save Project" ajax="true" />
<p:menuitem value="Set as Main Project" ajax="true" action="#{selectedProjectBean.setMainProject(selectedProjectBean.getSelectedProject())}" update="ProjectsListTree"/>
......@@ -67,15 +67,13 @@
<p:menuitem value="Delete Project" ajax="true" />
<p:menuitem value="Reset Project" ajax="true" />
</p:contextMenu>
<p:contextMenu for="ProjectsListTree" >
<p:menuitem value="New Project" onclick="NewProjectDialog.show();" ajax="true" update="ProjectsList"/>
<p:menuitem value="Save Project" ajax="true" />
<p:menuitem value="Set as Main Project" ajax="true" action="#{selectedProjectBean.setMainProject(selectedProjectBean.getSelectedProject())}" update="ProjectsListTree"/>
<p:separator/>
<p:menuitem value="Delete Project" ajax="true" />
<p:menuitem value="Reset Project" ajax="true" />
<p:contextMenu for="ProjectsListTree" nodeType="dependencies">
<p:menuitem value="Add Dependency" ajax="true" onclick="DependenciesUploadDialog.show();"/>
<p:menuitem value="Delete Dependency" ajax="true" />
</p:contextMenu>
<p:contextMenu for="ProjectsListTree" nodeType="usedPlugins">
</p:contextMenu>
</h:form>
</p:layoutUnit>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment