src/authoring/forms/PropertiesComponentForm.java
public Component buildComponent() {
		if (!validComponent()) {
			System.out.println();
			return null;
		}
		String fullName =  COMPONENT_PREFIX + this.name;
		Object[] params = new Object[2];
		// first argument is always the entity ID
		params[0] = this.entity;
		try {
			Component comp = null;
			Class<?> clazz = Class.forName(fullName);
			Constructor<?> cons = clazz.getDeclaredConstructors()[0];
			if (SingleDataComponent.class.isAssignableFrom(clazz) && this.numFields > 0) {
				params[1] = Double.valueOf(this.field.getText());
				comp = (Component) cons.newInstance(params);
			} else if (SingleStringComponent.class.isAssignableFrom(clazz) && this.numFields > 0) {
				params[1] = this.field.getText();
				comp = (Component) cons.newInstance(params);
			} else {
				comp = (Component) cons.newInstance(this.entity);
			}
			
			return comp;
		} catch (Exception e) {
			LOGGER.log(java.util.logging.Level.SEVERE, e.toString(), e);
			return null;
		}
	}
/**
	 * Builds the necessary component based upon the data that is inside of the text fields.
	 * Should be performed only when the user clicks the submit button.
	 * @return a component that accurately represents the data in this wrapper class
	 */
Builds the necessary component based upon the data that is inside of the text fields.
Should be performed only when the user clicks the submit button.
@return a component that accurately represents the data in this wrapper class
Builds the necessary component based upon the data that is inside of the text fields . Should be performed only when the user clicks the submit button . @return a component that accurately represents the data in this wrapper class
public Component buildComponent() {
		if (!validComponent()) {
			System.out.println();
			return null;
		}
		String fullName =  COMPONENT_PREFIX + this.name;
		Object[] params = new Object[2];
		params[0] = this.entity;
		try {
			Component comp = null;
			Class<?> clazz = Class.forName(fullName);
			Constructor<?> cons = clazz.getDeclaredConstructors()[0];
			if (SingleDataComponent.class.isAssignableFrom(clazz) && this.numFields > 0) {
				params[1] = Double.valueOf(this.field.getText());
				comp = (Component) cons.newInstance(params);
			} else if (SingleStringComponent.class.isAssignableFrom(clazz) && this.numFields > 0) {
				params[1] = this.field.getText();
				comp = (Component) cons.newInstance(params);
			} else {
				comp = (Component) cons.newInstance(this.entity);
			}
			return comp;
		} catch (Exception e) {
			LOGGER.log(java.util.logging.Level.SEVERE, e.toString(), e);
			return null;
		}
	}
public Component buildComponent ( ) { if ( ! validComponent ( ) ) { System . out . println ( ) ; return null ; } String fullName = COMPONENT_PREFIX + this . name ; Object [ ] params = new Object [ 2 ] ; params [ 0 ] = this . entity ; try { Component comp = null ; Class < ? > clazz = Class . forName ( fullName ) ; Constructor < ? > cons = clazz . getDeclaredConstructors ( ) [ 0 ] ; if ( SingleDataComponent . class . isAssignableFrom ( clazz ) && this . numFields > 0 ) { params [ 1 ] = Double . valueOf ( this . field . getText ( ) ) ; comp = ( Component ) cons . newInstance ( params ) ; } else if ( SingleStringComponent . class . isAssignableFrom ( clazz ) && this . numFields > 0 ) { params [ 1 ] = this . field . getText ( ) ; comp = ( Component ) cons . newInstance ( params ) ; } else { comp = ( Component ) cons . newInstance ( this . entity ) ; } return comp ; } catch ( Exception e ) { LOGGER . log ( java . util . logging . Level . SEVERE , e . toString ( ) , e ) ; return null ; } }
Builds the necessary component based upon the data that is inside of the text fields.
Builds the necessary component based upon the data that is inside of the text fields .
// first argument is always the entity ID