Commit fba69dd4 authored by michael.simon's avatar michael.simon
Browse files

Attribute Source front end

parent 158fe5b8
/*******************************************************************************
* Copyright (c) 2014 Michael Simon.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*
* Contributors:
* Michael Simon - initial
******************************************************************************/
package edu.kit.scc.webreg.bean.admin.as;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.event.ComponentSystemEvent;
import javax.inject.Inject;
import edu.kit.scc.webreg.entity.as.AttributeSourceEntity;
import edu.kit.scc.webreg.service.AttributeSourceService;
import edu.kit.scc.webreg.util.ViewIds;
@ManagedBean
@ViewScoped
public class AddAttributeSourceBean implements Serializable {
private static final long serialVersionUID = 1L;
@Inject
private AttributeSourceService service;
private AttributeSourceEntity entity;
public void preRenderView(ComponentSystemEvent ev) {
entity = service.createNew();
}
public String save() {
entity = service.save(entity);
return ViewIds.EDIT_ATTRIBUTE_SOURCE + "?id=" + entity.getId() + "&faces-redirect=true";
}
public AttributeSourceEntity getEntity() {
return entity;
}
public void setEntity(AttributeSourceEntity entity) {
this.entity = entity;
}
}
/*******************************************************************************
* Copyright (c) 2014 Michael Simon.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*
* Contributors:
* Michael Simon - initial
******************************************************************************/
package edu.kit.scc.webreg.bean.admin.as;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.event.ComponentSystemEvent;
import javax.inject.Inject;
import org.primefaces.model.LazyDataModel;
import edu.kit.scc.webreg.entity.as.AttributeSourceEntity;
import edu.kit.scc.webreg.model.GenericLazyDataModelImpl;
import edu.kit.scc.webreg.service.AttributeSourceService;
@ManagedBean
@ViewScoped
public class ListAttributeSourceBean implements Serializable {
private static final long serialVersionUID = 1L;
private LazyDataModel<AttributeSourceEntity> list;
@Inject
private AttributeSourceService service;
public void preRenderView(ComponentSystemEvent ev) {
if (list == null) {
list = new GenericLazyDataModelImpl<AttributeSourceEntity, AttributeSourceService, Long>(service);
}
}
public LazyDataModel<AttributeSourceEntity> getUserEntityList() {
return list;
}
}
......@@ -120,7 +120,13 @@ public class ViewIds {
public static final String SHOW_JOBCLASS = "/admin/timer/show-job-class.xhtml";
public static final String LIST_JOBCLASS = "/admin/timer/list-job-classes.xhtml";
/*
* Attribute Sources
*/
public static final String LIST_ATTRIBUTE_SOURCES = "/admin/as/list-attribute-sources.xhtml";
public static final String ADD_ATTRIBUTE_SOURCE = "/admin/as/add-attribute-source.xhtml";
public static final String EDIT_ATTRIBUTE_SOURCE = "/admin/as/edit-attribute-source.xhtml";
public static final String SHOW_ATTRIBUTE_SOURCE = "/admin/as/show-attribute-source.xhtml";
/*
* Public
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:bw="http://www.scc.kit.edu/bwfacelets"
xmlns:p="http://primefaces.org/ui">
<head>
<title></title>
</head>
<body>
<f:metadata>
<f:event type="javax.faces.event.PreRenderViewEvent"
listener="#{addAttributeSourceBean.preRenderView}" />
</f:metadata>
<ui:composition template="/template/default-admin.xhtml">
<ui:param name="title" value="#{messages.title}"/>
<ui:define name="content">
<h:form id="form">
<h2><h:outputText value="#{messages.add_service}"/></h2>
<div id="panelInline">
<p:panel header="#{messages.service}">
<p:panelGrid id="baseData" columns="2">
<bw:inputText id="nameField" label="#{messages.name}"
value="#{addAttributeSourceBean.entity.name}" required="true" />
<bw:inputText id="asClassField" label="#{messages.class}"
value="#{addAttributeSourceBean.entity.asClass}" required="true" />
</p:panelGrid>
<p:commandButton id="save" action="#{addAttributeSourceBean.save}" value="#{messages.save}"/>
</p:panel>
</div>
</h:form>
</ui:define>
</ui:composition>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:bw="http://www.scc.kit.edu/bwfacelets"
xmlns:p="http://primefaces.org/ui"
xmlns:of="http://omnifaces.org/functions">
<head>
<title></title>
</head>
<body>
<f:view>
<f:metadata>
<f:event type="javax.faces.event.PreRenderViewEvent"
listener="#{listAttributeSourceBean.preRenderView}" />
</f:metadata>
<ui:composition template="/template/default-admin.xhtml">
<ui:param name="title" value="#{messages.title}"/>
<ui:define name="content">
<h:form id="form">
<p:dataTable id="dataTable" var="entity" value="#{listAttributeSourceBean.userEntityList}" paginator="true"
lazy="true" rows="15">
<p:column sortBy="#{entity.id}" style="width:30px;">
<f:facet name="header">
<h:outputText value="#{messages.id}" />
</f:facet>
<h:outputText value="#{user.id}" />
</p:column>
<p:column sortBy="#{entity.name}" filterBy="#{entity.name}">
<f:facet name="header">
<h:outputText value="#{messages.name}" />
</f:facet>
<h:link outcome="show-attribute-source.xhtml" value="#{entity.name != null ? entity.name : 'null'}">
<f:param name="id" value="#{entity.id}"/>
</h:link>
<h:outputText value="#{entity.name}" />
</p:column>
<p:column sortBy="#{entity.asClass}" filterBy="#{entity.asClass}">
<f:facet name="header">
<h:outputText value="#{messages.class}" />
</f:facet>
<h:outputText value="#{entity.asClass}" />
</p:column>
</p:dataTable>
</h:form>
</ui:define>
</ui:composition>
</f:view>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment