package org.sagebionetworks.web.client.widget;

import org.sagebionetworks.repo.model.EntityType;
import org.sagebionetworks.web.client.jsinterop.EntityTypeIconProps;
import org.sagebionetworks.web.client.jsinterop.React;
import org.sagebionetworks.web.client.jsinterop.ReactDOM;
import org.sagebionetworks.web.client.jsinterop.ReactElement;
import org.sagebionetworks.web.client.jsinterop.SRC;

public class EntityTypeIcon extends ReactComponentSpan {

	public EntityTypeIcon(EntityType type) {
		configure(type);
	}

	public void configure(EntityType type) {
		EntityTypeIconProps props = EntityTypeIconProps.create(type);
		ReactElement component = React.createElement(SRC.SynapseComponents.EntityTypeIcon, props);
		ReactDOM.render(component, getElement());
	}

	public void setType(EntityType type) {
		configure(type);
	}


	/**
	 * This is required for XML setters to work. If you want to call this from Java, prefer {@link #EntityTypeIcon(EntityType)} for strong typing.
	 * @param type
	 */
	public EntityTypeIcon(String type) {
		setType(type);
	}

	/**
	 * This is required for XML setters to work. If you want to call this from Java, prefer {@link #setType(EntityType)} for strong typing.
	 * @param type
	 */
	public void setType(String type) throws IllegalArgumentException {
		EntityType enumValue = EntityType.valueOf(type);
		setType(enumValue);
	}

}

@@ -1253,92 +1253,145 @@
 pe) 
-throws IllegalArgumentException %7B%0A%09%09EntityType enumValue = EntityType.valueOf(type);
+%7B%0A%09%09EntityType enumValue = EntityType.file;%0A%09%09try %7B%0A%09%09%09enumValue = EntityType.valueOf(type);%0A%09%09%7D catch (IllegalArgumentException e) %7B%0A%09%09%7D
 %0A%09%09s

Handle empty instantiation