This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<artifactId>youbrew-parent</artifactId> | |
<packaging>pom</packaging> | |
<name>Youbrew-ExtJS Parent Application</name> | |
<modules> | |
<module>youbrew-domain</module> | |
<module>youbrew-service</module> | |
<module>youbrew-persist</module> | |
<module>youbrew-webapp</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<artifactId>youbrew-webapp</artifactId> | |
<packaging>war</packaging> | |
<name>Youbrew Web Application</name> | |
<dependencies> | |
<dependency> | |
<groupId>com.jacobheric.youbrew-extjs</groupId> | |
<artifactId>youbrew-service</artifactId> | |
<version>0.1-SNAPSHOT</version> | |
</dependency> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class Recipe implements Serializable { | |
@Id | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
private Long id; | |
private String name; | |
@Column(name = "brew_notes") | |
private String brewNotes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Repository("baseDAO") | |
public abstract class BaseDAOImpl<T, ID extends Serializable> implements IBaseDAO<T, ID> { | |
@Autowired | |
protected SessionFactory sessionFactory; //injected by Spring container | |
@SuppressWarnings("unchecked") | |
private Class<T> clazz; | |
@SuppressWarnings("unchecked") | |
public BaseDAOImpl() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Jackson ObjectMapper that can serialize and deserialize to and from JSON. --> | |
<bean id="jacksonObjectMapper" class="com.jacobheric.youbrew.utils.json.JsonObjectMapper" /> | |
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/> | |
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> | |
<property name="webBindingInitializer"> | |
<bean class="com.jacobheric.youbrew.utils.json.GlobalBindingInitializer"/> | |
</property> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> | |
<title><fmt:message key="app.title"/></title> | |
<link rel="stylesheet" type="text/css" href="<c:url value="/ext-3.3.0/resources/css/ext-all.css" />" media="screen, projection"/> | |
<link rel="stylesheet" type="text/css" href="<c:url value="/styles/youbrew.css" />" media="screen, projection"/> | |
<script type="text/javascript" language="JavaScript" src="<c:url value="/ext-3.3.0/adapter/ext/ext-base-debug.js"/>"></script> | |
<script type="text/javascript" language="JavaScript" src="<c:url value="/ext-3.3.0/ext-all-debug.js"/>"></script> | |
<script type="text/javascript" src="<c:url value="/scripts/utils/App.js"/>"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.ns("youbrew"); | |
// Application instance for showing user-feedback messages. | |
var App = new Ext.App({}); | |
// HttpProxy instance, utilizes parameter "api" object here constructing url manually. | |
var proxy = new Ext.data.HttpProxy({ | |
api: { | |
read : {url: 'recipe', method: 'GET'}, | |
create : {url: 'recipe', method: 'POST'}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Controller | |
@RequestMapping(value="/recipe") | |
public class RecipeController extends BaseController implements Serializable { | |
private static final long serialVersionUID = 1L; | |
private static final Logger log = LoggerFactory.getLogger(RecipeController.class); | |
@Autowired | |
private IRecipeService recipeService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var textField = new Ext.form.TextField(); | |
// Grid-columns with meta-data from backend. | |
var recipeColumns = [ | |
{header: "ID", width: 40, sortable: true, dataIndex: 'id'}, | |
{header: "Name", width: 100, sortable: true, dataIndex: 'name', editor: textField}, | |
{header: "Brew Notes", width: 180, sortable: true, dataIndex: 'brewNotes', editor: textField}, | |
{header: "Taste Notes", width: 180, sortable: true, dataIndex: 'tasteNotes', editor: textField}, | |
{ | |
header: 'Yeast', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.ns('youbrew', 'youbrew.recipe'); | |
/** | |
* youbrew.recipe.Grid | |
* A recipe EditorGridPanel, clearly derived from the extjs examples. | |
*/ | |
youbrew.recipe.Grid = Ext.extend(Ext.grid.EditorGridPanel, { | |
renderTo: 'recipe-grid', | |
iconCls: 'silk-grid', | |
frame: true, | |
title: 'YouBrew Recipe Grid', |
OlderNewer