Skip to content
Snippets Groups Projects
Commit 458ebbb4 authored by ginquin's avatar ginquin
Browse files

Añadida vista detalle y modificado controlador para hacer visible el detalle

parent 976a6f49
No related branches found
No related tags found
No related merge requests found
......@@ -4,10 +4,12 @@ import java.util.List;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.select.SelectorComposer;
import org.zkoss.zk.ui.select.annotation.Listen;
import org.zkoss.zk.ui.select.annotation.VariableResolver;
import org.zkoss.zk.ui.select.annotation.Wire;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zkplus.spring.DelegatingVariableResolver;
import org.zkoss.zul.East;
import org.zkoss.zul.ListModelList;
import org.zkoss.zul.Listbox;
......@@ -25,11 +27,16 @@ public class BusquedaDesignSmellsController extends SelectorComposer<Component>
@Wire
Listbox articlesListBox;
@Wire
East selectedArticleBlock;
@WireVariable
ArticleService articleService;
ListModelList<Article> articlesListModel;
Article selectedArticle;
@Override
public void doAfterCompose(Component comp) throws Exception {
// TODO Auto-generated method stub
......@@ -39,4 +46,41 @@ public class BusquedaDesignSmellsController extends SelectorComposer<Component>
articlesListModel = new ListModelList<Article>(allArticles);
articlesListBox.setModel(articlesListModel);
}
@Listen("onSelect=#articlesListBox")
public void doSelectPublicacion() {
if (articlesListModel.isSelectionEmpty()) {
selectedArticle = null;
} else {
selectedArticle = articleService
.getArticle(articlesListModel.getSelection()
.iterator().next().getArticleId());
}
refreshArticlesView();
}
@Listen("onClick=#cancelDetail")
public void doCancelarOperacion() {
//articulo seleccionado a null.
selectedArticle = null;
refreshArticlesView();
// Limpia la selección,
articlesListModel.clearSelection();
}
private void refreshArticlesView() {
if (selectedArticle == null) {
// Hace invisible la vista detalle.
selectedArticleBlock.setVisible(false);
} else {
// Hace visible la vista detalle.
selectedArticleBlock.setVisible(true);
}
}
}
......@@ -12,9 +12,9 @@
pagingPosition="bottom" autopaging="true" vflex="1">
<listhead>
<listheader width="30px" />
<listheader label="título"
<listheader label="Título"
width="70%" />
<listheader label="autor"
<listheader label="Autores"
width="20%"/>
<listheader
label="Año" width="10%" />
......@@ -29,4 +29,49 @@
</template>
</listbox>
</center>
<east id="selectedArticleBlock" visible="false" width="65%"
border="none" collapsible="false" splittable="true" autoscroll="true">
<vlayout vflex="1" hflex="1">
<groupbox id="groupBoxSelectedPublicacion" contentStyle="border:0" closable="false" vflex="1" hflex="1">
<caption label="Detalle de artículo"/>
<grid sclass="no-border">
<columns>
<column hflex="15%"/>
<column hflex="40%"/>
<column hflex="15%"/>
<column hflex="30%"/>
</columns>
<rows>
<row>
<cell></cell><cell></cell><cell></cell>
<cell><button id="cancelDetail" label="Cancelar"></button></cell>
</row>
<row>
<cell>Título</cell>
<cell><textbox id="articleTitle" maxlength="255" readonly="true" hflex="1" /></cell>
<cell>Autores</cell>
<cell>
<listbox id="authorListBox" rows="2" checkmark="true" hflex="1" >
<template name="model" >
<listitem
label="${each.fullName}" checkable="false"/>
</template>
</listbox>
</cell>
</row>
<row>
<cell>Institución</cell>
<cell><textbox id="instiName" maxlength="255" readonly="true" hflex="1"/></cell>
<cell>Academico</cell>
<cell><textbox id="instiAcademic" maxlength="255" readonly="true" hflex="1"/></cell>
</row>
</rows>
</grid>
</groupbox>
</vlayout>
</east>
</borderlayout>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment