display some of paper
parent
779f286988
commit
6c220355ee
@ -0,0 +1,21 @@
|
|||||||
|
package ru.ulstu.paper.controller;
|
||||||
|
|
||||||
|
import ru.ulstu.paper.model.Paper;
|
||||||
|
|
||||||
|
import javax.faces.component.UIComponent;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.faces.convert.Converter;
|
||||||
|
import javax.faces.convert.FacesConverter;
|
||||||
|
|
||||||
|
@FacesConverter(value = "paperStatusConverter")
|
||||||
|
public class PaperStatusConverter implements Converter {
|
||||||
|
@Override
|
||||||
|
public Object getAsObject(FacesContext context, UIComponent component, String value) {
|
||||||
|
return Paper.PaperStatus.valueOf(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAsString(FacesContext context, UIComponent component, Object value) {
|
||||||
|
return ((Paper.PaperStatus) value).getStatusName();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package ru.ulstu.paper.controller;
|
||||||
|
|
||||||
|
import ru.ulstu.paper.model.Paper;
|
||||||
|
import ru.ulstu.paper.service.PaperService;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.faces.view.ViewScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Named
|
||||||
|
@ViewScoped
|
||||||
|
public class PapersView {
|
||||||
|
@Inject
|
||||||
|
private PaperService paperService;
|
||||||
|
|
||||||
|
private List<Paper> papers;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
papers = paperService.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Paper> getPapers() {
|
||||||
|
return papers;
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,31 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:p="http://primefaces.org/ui"
|
||||||
>
|
xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://java.sun.com/jsf/core">
|
||||||
<ui:composition template="/basicTemplate.xhtml">
|
<ui:composition template="/basicTemplate.xhtml">
|
||||||
|
<ui:define name="header">
|
||||||
|
Редактироваие статьи
|
||||||
|
</ui:define>
|
||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
|
<p:panel id="panel" header="Статья" style="margin-bottom:10px;">
|
||||||
|
<h:panelGrid columns="2" cellpadding="5">
|
||||||
|
<h:outputLabel for="name" value="Название:"/>
|
||||||
|
<p:inputText id="name" required="true" value="#{paperView.paper.title}"/>
|
||||||
|
|
||||||
|
<p:outputLabel for="status" value="Статус:"/>
|
||||||
|
<p:selectOneMenu id="status" required="true" value="#{paperView.paper.status}"
|
||||||
|
converter="paperStatusConverter">
|
||||||
|
<f:selectItems value="#{paperView.paperStatuses}"
|
||||||
|
var="status"
|
||||||
|
itemLabel="#{status.statusName}"
|
||||||
|
itemValue="#{status}"/>
|
||||||
|
</p:selectOneMenu>
|
||||||
|
|
||||||
|
<p:outputLabel for="@next" value="Number:"/>
|
||||||
|
<p:spinner id="number" value="0"/>
|
||||||
|
</h:panelGrid>
|
||||||
|
</p:panel>
|
||||||
</ui:define>
|
</ui:define>
|
||||||
</ui:composition>
|
</ui:composition>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue