Skip to content
Snippets Groups Projects

Rama5

Merged
ginquinrequested to merge
rama5 into master
26 files
+ 1700
824
Compare changes
  • Side-by-side
  • Inline

Files

@@ -27,6 +27,7 @@ import org.zkoss.zul.Button;
@@ -27,6 +27,7 @@ import org.zkoss.zul.Button;
import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Comboitem;
 
import org.zkoss.zul.East;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Intbox;
import org.zkoss.zul.Intbox;
import org.zkoss.zul.Label;
import org.zkoss.zul.Label;
@@ -48,12 +49,17 @@ import es.uva.inf.tfg.ginquin.smellswisdom.domain.Inproceeding;
@@ -48,12 +49,17 @@ import es.uva.inf.tfg.ginquin.smellswisdom.domain.Inproceeding;
import es.uva.inf.tfg.ginquin.smellswisdom.domain.Journalarticle;
import es.uva.inf.tfg.ginquin.smellswisdom.domain.Journalarticle;
import es.uva.inf.tfg.ginquin.smellswisdom.domain.Publication;
import es.uva.inf.tfg.ginquin.smellswisdom.domain.Publication;
import es.uva.inf.tfg.ginquin.smellswisdom.domain.PublicationType;
import es.uva.inf.tfg.ginquin.smellswisdom.domain.PublicationType;
 
import es.uva.inf.tfg.ginquin.smellswisdom.domain.Qfactorsmell;
 
import es.uva.inf.tfg.ginquin.smellswisdom.domain.Smell;
 
import es.uva.inf.tfg.ginquin.smellswisdom.domain.SmellConcept;
 
import es.uva.inf.tfg.ginquin.smellswisdom.domain.SmellScope;
import es.uva.inf.tfg.ginquin.smellswisdom.domain.TypeOfApproach;
import es.uva.inf.tfg.ginquin.smellswisdom.domain.TypeOfApproach;
import es.uva.inf.tfg.ginquin.smellswisdom.domain.TypeOfArtefact;
import es.uva.inf.tfg.ginquin.smellswisdom.domain.TypeOfArtefact;
import es.uva.inf.tfg.ginquin.smellswisdom.services.ArticleService;
import es.uva.inf.tfg.ginquin.smellswisdom.services.ArticleService;
import es.uva.inf.tfg.ginquin.smellswisdom.services.AuthorService;
import es.uva.inf.tfg.ginquin.smellswisdom.services.AuthorService;
import es.uva.inf.tfg.ginquin.smellswisdom.services.InstitutionService;
import es.uva.inf.tfg.ginquin.smellswisdom.services.InstitutionService;
import es.uva.inf.tfg.ginquin.smellswisdom.services.PublicationService;
import es.uva.inf.tfg.ginquin.smellswisdom.services.PublicationService;
 
import es.uva.inf.tfg.ginquin.smellswisdom.services.QfactorsmellService;
@VariableResolver(DelegatingVariableResolver.class)
@VariableResolver(DelegatingVariableResolver.class)
public class AddContributionController extends SelectorComposer<Component> {
public class AddContributionController extends SelectorComposer<Component> {
@@ -62,7 +68,7 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -62,7 +68,7 @@ public class AddContributionController extends SelectorComposer<Component> {
*
*
*/
*/
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
final Logger logger = LoggerFactory.getLogger(this.getClass().getName());
final Logger logger = LoggerFactory.getLogger(this.getClass().getName());
/**
/**
@@ -91,10 +97,10 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -91,10 +97,10 @@ public class AddContributionController extends SelectorComposer<Component> {
@Wire
@Wire
Grid authorShipGrid;
Grid authorShipGrid;
private ListModelList<PublicationType> publicationTypeListModel=null;
private ListModelList<PublicationType> publicationTypeListModel = null;
private ListModelList<Authorinstitution> authorInstitutionListModel=null;
private ListModelList<Authorinstitution> authorInstitutionListModel = null;
private Publication selectedPublication=null;
private Publication selectedPublication = null;
// Evento
// Evento
private EventQueue<?> eq = null;
private EventQueue<?> eq = null;
@@ -114,9 +120,9 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -114,9 +120,9 @@ public class AddContributionController extends SelectorComposer<Component> {
Textbox publisherTextBox;
Textbox publisherTextBox;
@Wire
@Wire
Textbox seriesTextBox;
Textbox seriesTextBox;
private ListModelList<Publication> publicationListModel=null;
private ListModelList<Publication> publicationListModel = null;
private ListModelList<Publication> publicationListModel1=null;
private ListModelList<Publication> publicationListModel1 = null;
/**
/**
* Parte de Approach
* Parte de Approach
@@ -157,6 +163,38 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -157,6 +163,38 @@ public class AddContributionController extends SelectorComposer<Component> {
private ListModelList<DesignSmellRelatedActivity> activityLeftListModel;
private ListModelList<DesignSmellRelatedActivity> activityLeftListModel;
private ListModelList<DesignSmellRelatedActivity> activityRightListModel;
private ListModelList<DesignSmellRelatedActivity> activityRightListModel;
 
/**
 
* Parte de smell
 
*/
 
@Wire
 
Listbox smellsListBox;
 
@Wire
 
East selectedSmellBlock;
 
@Wire
 
Button addQFactorButton;
 
@Wire
 
Grid qFactorSmellsGrid;
 
 
private ListModelList<Smell> smellsListModel = null;
 
private ListModelList<Qfactorsmell> qFactorSmellsListModel = null;
 
 
private Smell selectedSmell = null;
 
 
// Evento
 
private EventQueue<?> eq1 = null;
 
 
// Constantes para añadir smell
 
static private String eqAddSmell = "addSmell";
 
static private String eqAddSmellParam = "addSmellArticle";
 
 
// Evento
 
private EventQueue<?> eq2 = null;
 
 
// Constantes para añadir smell
 
static private String eqAddQFactor = "addQFactor";
 
static private String eqAddQFactorParam = "addQFactorArticle";
 
 
// Servicios de persistencia
@WireVariable
@WireVariable
ArticleService articleService;
ArticleService articleService;
@WireVariable
@WireVariable
@@ -165,6 +203,8 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -165,6 +203,8 @@ public class AddContributionController extends SelectorComposer<Component> {
InstitutionService institutionService;
InstitutionService institutionService;
@WireVariable
@WireVariable
PublicationService publicationService;
PublicationService publicationService;
 
@WireVariable
 
QfactorsmellService qFactorSmellService;
@SuppressWarnings({ "unchecked", "rawtypes" })
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
@Override
@@ -191,13 +231,49 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -191,13 +231,49 @@ public class AddContributionController extends SelectorComposer<Component> {
}
}
});
});
 
// Eliminamos el queue cada vez que inicializamos la vista.
 
EventQueues.remove("interactive1");
 
// Captura de información de la pantalla modal AddAuthorship.
 
eq1 = EventQueues.lookup("interactive1", EventQueues.DESKTOP, true);
 
eq1.subscribe(new EventListener() {
 
@Override
 
public void onEvent(Event event) throws Exception {
 
// Captura de información de la pantalla modal addDocumento
 
if (event.getName().equals(eqAddSmell)) {
 
 
final HashMap<String, Object> map = (HashMap<String, Object>) event.getData();
 
Smell smell = (Smell) map.get(eqAddSmellParam);
 
updateListBoxSmell(smell);
 
}
 
 
}
 
});
 
 
// Eliminamos el queue cada vez que inicializamos la vista.
 
EventQueues.remove("interactive2");
 
// Captura de información de la pantalla modal AddAuthorship.
 
eq2 = EventQueues.lookup("interactive2", EventQueues.DESKTOP, true);
 
eq2.subscribe(new EventListener() {
 
@Override
 
public void onEvent(Event event) throws Exception {
 
// Captura de información de la pantalla modal addDocumento
 
if (event.getName().equals(eqAddQFactor)) {
 
 
final HashMap<String, Object> map = (HashMap<String, Object>) event.getData();
 
Qfactorsmell qFactorSmell = (Qfactorsmell) map.get(eqAddQFactorParam);
 
updateGridQfactorSmell(qFactorSmell);
 
}
 
 
}
 
});
 
}
}
@Listen("onSelect=#acronymComboBox")
@Listen("onSelect=#acronymComboBox")
public void selectAuthor(Event e) {
public void selectAuthor(Event e) {
if(!publicationListModel.isSelectionEmpty()) {
if (!publicationListModel.isSelectionEmpty()) {
selectedPublication = publicationListModel.getSelection().iterator().next();
selectedPublication = publicationListModel.getSelection().iterator().next();
acronymComboBox.setValue(selectedPublication.getAcronym());
acronymComboBox.setValue(selectedPublication.getAcronym());
fullNameComboBox.setValue(selectedPublication.getFullname());
fullNameComboBox.setValue(selectedPublication.getFullname());
publisherTextBox.setValue(selectedPublication.getPublisher());
publisherTextBox.setValue(selectedPublication.getPublisher());
@@ -207,9 +283,9 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -207,9 +283,9 @@ public class AddContributionController extends SelectorComposer<Component> {
@Listen("onSelect=#fullNameComboBox")
@Listen("onSelect=#fullNameComboBox")
public void selectAuthor1(Event e) {
public void selectAuthor1(Event e) {
if(!publicationListModel1.isSelectionEmpty()) {
if (!publicationListModel1.isSelectionEmpty()) {
selectedPublication = publicationListModel1.getSelection().iterator().next();
selectedPublication = publicationListModel1.getSelection().iterator().next();
acronymComboBox.setValue(selectedPublication.getAcronym());
acronymComboBox.setValue(selectedPublication.getAcronym());
fullNameComboBox.setValue(selectedPublication.getFullname());
fullNameComboBox.setValue(selectedPublication.getFullname());
publisherTextBox.setValue(selectedPublication.getPublisher());
publisherTextBox.setValue(selectedPublication.getPublisher());
@@ -219,6 +295,7 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -219,6 +295,7 @@ public class AddContributionController extends SelectorComposer<Component> {
/**
/**
* Según el tipo de publicación seleccionado visuzalizamos ciertos campos.
* Según el tipo de publicación seleccionado visuzalizamos ciertos campos.
 
*
* @param e
* @param e
*/
*/
@Listen("onSelect=#publiTypeComboBox")
@Listen("onSelect=#publiTypeComboBox")
@@ -232,18 +309,18 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -232,18 +309,18 @@ public class AddContributionController extends SelectorComposer<Component> {
publiRow1.setVisible(true);
publiRow1.setVisible(true);
switch (pt) {
switch (pt) {
case BookChapter:
case BookChapter:
publiLabel.setValue(Labels.getLabel("bookorbookchapter.chapter")+":");
publiLabel.setValue(Labels.getLabel("bookorbookchapter.chapter") + ":");
publiLabel1.setValue(Labels.getLabel("bookorbookchapter.editor")+":");
publiLabel1.setValue(Labels.getLabel("bookorbookchapter.editor") + ":");
break;
break;
case Journal:
case Journal:
publiLabel.setValue(Labels.getLabel("journalarticle.number")+":");
publiLabel.setValue(Labels.getLabel("journalarticle.number") + ":");
publiLabel1.setValue(Labels.getLabel("journalarticle.volumen")+":");
publiLabel1.setValue(Labels.getLabel("journalarticle.volumen") + ":");
break;
break;
case Conference:
case Conference:
case Symposium:
case Symposium:
case Workshop:
case Workshop:
publiLabel.setValue(Labels.getLabel("inproceeding.organization")+":");
publiLabel.setValue(Labels.getLabel("inproceeding.organization") + ":");
publiLabel1.setValue(Labels.getLabel("inproceeding.address")+":");
publiLabel1.setValue(Labels.getLabel("inproceeding.address") + ":");
break;
break;
}
}
} else {
} else {
@@ -265,15 +342,16 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -265,15 +342,16 @@ public class AddContributionController extends SelectorComposer<Component> {
Window window = (Window) Executions.createComponents("/pages/user/element/AddAuthorship.zul", null, map);
Window window = (Window) Executions.createComponents("/pages/user/element/AddAuthorship.zul", null, map);
window.doModal();
window.doModal();
}
}
/**
/**
* Añade el authorship al modelo del grid.
* Añade el authorship al modelo del grid.
 
*
* @param authorship authorship recogido de la ventana modal.
* @param authorship authorship recogido de la ventana modal.
*/
*/
private void updateGridAuthorShip(Authorinstitution authorship) {
private void updateGridAuthorShip(Authorinstitution authorship) {
authorInstitutionListModel.add(authorship);
authorInstitutionListModel.add(authorship);
}
}
/**
/**
* Elimina un authorship del grid.
* Elimina un authorship del grid.
*/
*/
@@ -283,7 +361,7 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -283,7 +361,7 @@ public class AddContributionController extends SelectorComposer<Component> {
Row litem = (Row) btn.getParent();
Row litem = (Row) btn.getParent();
authorInstitutionListModel.remove(litem.getIndex());
authorInstitutionListModel.remove(litem.getIndex());
}
}
/**
/**
* type of approach
* type of approach
*/
*/
@@ -300,11 +378,10 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -300,11 +378,10 @@ public class AddContributionController extends SelectorComposer<Component> {
typeOfApproachLeftListModel.addAll(selection);
typeOfApproachLeftListModel.addAll(selection);
typeOfApproachRightListModel.removeAll(selection);
typeOfApproachRightListModel.removeAll(selection);
}
}
/**
/**
* type of artefact
* type of artefact
*/
*/
@Listen("onClick=#addRightTypeOfArtefact")
@Listen("onClick=#addRightTypeOfArtefact")
public void doAddRightTypeArtefact() {
public void doAddRightTypeArtefact() {
Set<TypeOfArtefact> selection = typeOfArtefactLeftListModel.getSelection();
Set<TypeOfArtefact> selection = typeOfArtefactLeftListModel.getSelection();
@@ -318,7 +395,7 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -318,7 +395,7 @@ public class AddContributionController extends SelectorComposer<Component> {
typeOfArtefactLeftListModel.addAll(selection);
typeOfArtefactLeftListModel.addAll(selection);
typeOfArtefactRightListModel.removeAll(selection);
typeOfArtefactRightListModel.removeAll(selection);
}
}
/**
/**
* Activities
* Activities
*/
*/
@@ -336,13 +413,66 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -336,13 +413,66 @@ public class AddContributionController extends SelectorComposer<Component> {
activityRightListModel.removeAll(selection);
activityRightListModel.removeAll(selection);
}
}
 
/**
 
* Abre la ventana modal para añadir nuevos authorship.
 
*/
 
@Listen("onClick=#addSmellButton")
 
public void doAddSmell() {
 
 
final HashMap<String, Object> map = new HashMap<String, Object>();
 
map.put("event", eqAddSmell);
 
map.put("param", eqAddSmellParam);
 
 
Window window = (Window) Executions.createComponents("/pages/user/element/AddSmell.zul", null, map);
 
window.doModal();
 
}
 
 
/**
 
* Añade un smell al modelo del grid.
 
*
 
* @param smell smell recogido de la ventana modal.
 
*/
 
private void updateListBoxSmell(Smell smell) {
 
smellsListModel.add(smell);
 
}
 
 
@Listen("onSelect=#smellsListBox")
 
public void doSelectSmell() {
 
if (smellsListModel.isSelectionEmpty()) {
 
selectedSmell = null;
 
} else {
 
selectedSmell = smellsListModel.getSelection().iterator().next();
 
}
 
refreshSmellsView();
 
}
 
 
@Listen("onClick=#addQFactorButton")
 
public void doQFactor() {
 
final HashMap<String, Object> map = new HashMap<String, Object>();
 
map.put("event", eqAddQFactor);
 
map.put("param", eqAddQFactorParam);
 
 
Window window = (Window) Executions.createComponents("/pages/user/element/AddQFactor.zul", null, map);
 
window.doModal();
 
}
 
 
/**
 
* Añade un Qfactorsmell al modelo del grid.
 
*
 
* @param qFactorSmell Qfactorsmell recogido de la ventana modal.
 
*/
 
private void updateGridQfactorSmell(Qfactorsmell qFactorSmell) {
 
qFactorSmellsListModel.add(qFactorSmell);
 
}
 
/**
/**
* Permite guardar una nueva contribución
* Permite guardar una nueva contribución
*/
*/
@Listen("onClick=#saveElementButton")
@Listen("onClick=#saveElementButton")
public void doSaveContribution() {
public void doSaveContribution() {
//Parte Article
// Falta comprobar que los datos esten todos los requeridos.
 
// Parte Article
String title = titleTextBox.getValue();
String title = titleTextBox.getValue();
Integer year = YearIntBox.getValue();
Integer year = YearIntBox.getValue();
@@ -362,8 +492,8 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -362,8 +492,8 @@ public class AddContributionController extends SelectorComposer<Component> {
publication.setFullname(fullName);
publication.setFullname(fullName);
publication.setPublisher(publisher);
publication.setPublisher(publisher);
publication.setSeries(series);
publication.setSeries(series);
//Parte de authorship
// Parte de authorship
Set<Authorinstitution> authorinstitutions = new HashSet<>();
Set<Authorinstitution> authorinstitutions = new HashSet<>();
for (int i = 0; i < authorInstitutionListModel.size(); i++) {
for (int i = 0; i < authorInstitutionListModel.size(); i++) {
Authorinstitution authorship = authorInstitutionListModel.get(i);
Authorinstitution authorship = authorInstitutionListModel.get(i);
@@ -399,16 +529,16 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -399,16 +529,16 @@ public class AddContributionController extends SelectorComposer<Component> {
approach.setTypeOfArtefact(typesOfArtefact);
approach.setTypeOfArtefact(typesOfArtefact);
approach.setOtherActivities(otherActivities);
approach.setOtherActivities(otherActivities);
//guardamos el article
// guardamos el article
//Factory method
// Factory method
GetArticleFactory articleFactory= new GetArticleFactory();
GetArticleFactory articleFactory = new GetArticleFactory();
Article article=articleFactory.getArticle(type);
Article article = articleFactory.getArticle(type);
article.setTitle(title);
article.setTitle(title);
article.setYear(year);
article.setYear(year);
article.setType(type);
article.setType(type);
article.setPublication(publication);
article.setPublication(publication);
article.setApproach(approach);
article.setApproach(approach);
Iterator<Authorinstitution> iter = authorinstitutions.iterator();
Iterator<Authorinstitution> iter = authorinstitutions.iterator();
while (iter.hasNext()) {
while (iter.hasNext()) {
Authorinstitution authorship = iter.next();
Authorinstitution authorship = iter.next();
@@ -416,24 +546,24 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -416,24 +546,24 @@ public class AddContributionController extends SelectorComposer<Component> {
institutionService.saveInstitution(authorship.getInstitution());
institutionService.saveInstitution(authorship.getInstitution());
authorship.setArticle(article);
authorship.setArticle(article);
}
}
//downcasting for type
// downcasting for type
if(article instanceof Bookorbookchapter) {
if (article instanceof Bookorbookchapter) {
Bookorbookchapter book= (Bookorbookchapter) article;
Bookorbookchapter book = (Bookorbookchapter) article;
book.setChapter(Integer.parseInt(publiData));
book.setChapter(Integer.parseInt(publiData));
book.setEditor(publiData1);
book.setEditor(publiData1);
articleService.saveArticle(book);// Guardamos el nuevo article en la bd.
articleService.saveArticle(book);// Guardamos el nuevo article en la bd.
}else if(article instanceof Journalarticle) {
} else if (article instanceof Journalarticle) {
Journalarticle journal= (Journalarticle) article;
Journalarticle journal = (Journalarticle) article;
journal.setNumber(Integer.parseInt(publiData));
journal.setNumber(Integer.parseInt(publiData));
journal.setVolumen(Integer.parseInt(publiData1));
journal.setVolumen(Integer.parseInt(publiData1));
articleService.saveArticle(journal);// Guardamos el nuevo article en la bd.
articleService.saveArticle(journal);// Guardamos el nuevo article en la bd.
}else if(article instanceof Inproceeding) {
} else if (article instanceof Inproceeding) {
Inproceeding inpro= (Inproceeding) article;
Inproceeding inpro = (Inproceeding) article;
inpro.setOrganization(publiData);
inpro.setOrganization(publiData);
inpro.setAddress(publiData1);
inpro.setAddress(publiData1);
}else {
} else {
logger.error("Error al guardar el article {}",article);
logger.error("Error al guardar el article {}", article);
throw new IllegalStateException("No se ha podido guardar el article!");
throw new IllegalStateException("No se ha podido guardar el article!");
}
}
@@ -442,47 +572,44 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -442,47 +572,44 @@ public class AddContributionController extends SelectorComposer<Component> {
/**
/**
* Permite validar un nuevo elemento.
* Permite validar un nuevo elemento.
*
private void validateAddContribution() {
* private void validateAddContribution() { //General info Comboitem
//General info
* cbiPubliType = publiTypeComboBox.getSelectedItem();
Comboitem cbiPubliType = publiTypeComboBox.getSelectedItem();
*
* String acronymPubli= acronymComboBox.getValue(); String fullnamePubli=
String acronymPubli= acronymComboBox.getValue();
* fullNameComboBox.getValue();
String fullnamePubli= fullNameComboBox.getValue();
*
* boolean addAuthorshipEmpty= authorInstitutionListModel.isEmpty();
boolean addAuthorshipEmpty= authorInstitutionListModel.isEmpty();
*
* //Approach Comboitem cbiAutomation = automationComboBox.getSelectedItem();
//Approach
* Comboitem cbiMainActivity = mainActivityComboBox.getSelectedItem();
Comboitem cbiAutomation = automationComboBox.getSelectedItem();
*
Comboitem cbiMainActivity = mainActivityComboBox.getSelectedItem();
* boolean addTypeApproachEmpty=typeOfApproachRightListModel.isEmpty(); boolean
* addTypeArtefactEmpty= typeOfArtefactRightListModel.isEmpty(); boolean
boolean addTypeApproachEmpty=typeOfApproachRightListModel.isEmpty();
* addActivityEmpty= activityRightListModel.isEmpty();
boolean addTypeArtefactEmpty= typeOfArtefactRightListModel.isEmpty();
*
boolean addActivityEmpty= activityRightListModel.isEmpty();
* publiTypeComboBox.clearErrorMessage(); if (cbiPubliType == null) { throw new
* WrongValueException(publiTypeComboBox,
publiTypeComboBox.clearErrorMessage();
* Labels.getLabel("contribution.message")); }
if (cbiPubliType == null) {
*
throw new WrongValueException(publiTypeComboBox, Labels.getLabel("contribution.message"));
* acronymComboBox.clearErrorMessage(); if(Strings.isBlank(acronymPubli) &&
}
* Strings.isBlank(fullnamePubli)) { throw new
* WrongValueException(acronymComboBox,Labels.getLabel("contribution.message1"));
acronymComboBox.clearErrorMessage();
* }
if(Strings.isBlank(acronymPubli) && Strings.isBlank(fullnamePubli)) {
*
throw new WrongValueException(acronymComboBox,Labels.getLabel("contribution.message1"));
* automationComboBox.clearErrorMessage(); if (cbiAutomation == null) { throw
}
* new WrongValueException(automationComboBox,
* Labels.getLabel("contribution.message3")); }
automationComboBox.clearErrorMessage();
*
if (cbiAutomation == null) {
* mainActivityComboBox.clearErrorMessage(); if(cbiMainActivity == null) { throw
throw new WrongValueException(automationComboBox, Labels.getLabel("contribution.message3"));
* new WrongValueException(mainActivityComboBox,
}
* Labels.getLabel("contribution.message4")); }
*
mainActivityComboBox.clearErrorMessage();
* }
if(cbiMainActivity == null) {
*/
throw new WrongValueException(mainActivityComboBox, Labels.getLabel("contribution.message4"));
}
}
*/
private void refreshAddElementView() {
private void refreshAddElementView() {
 
 
// parte general info
titleTextBox.setValue("");
titleTextBox.setValue("");
YearIntBox.setValue(null);
YearIntBox.setValue(null);
publiTextBox.setValue("");
publiTextBox.setValue("");
@@ -490,36 +617,23 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -490,36 +617,23 @@ public class AddContributionController extends SelectorComposer<Component> {
publiRow.setVisible(false);
publiRow.setVisible(false);
publiRow1.setVisible(false);
publiRow1.setVisible(false);
publicationTypeListModel.clearSelection();
publicationTypeListModel.clearSelection();
authorInstitutionListModel.clear();
authorInstitutionListModel.clear();
acronymComboBox.setValue("");
acronymComboBox.setValue("");
fullNameComboBox.setValue("");
fullNameComboBox.setValue("");
publisherTextBox.setValue("");
publisherTextBox.setValue("");
seriesTextBox.setValue("");
seriesTextBox.setValue("");
 
// parte approach
automationListModel.clearSelection();
automationListModel.clearSelection();
techniquesTextBox.setValue("");
techniquesTextBox.setValue("");
presentExamplesCheckBox.setChecked(false);
presentExamplesCheckBox.setChecked(false);
mainActivityListModel.clearSelection();
mainActivityListModel.clearSelection();
typeOfApproachLeftListModel = new ListModelList<>(TypeOfApproach.values());
refreshRightLeftModels();
typeOfApproachLeftListModel.setMultiple(true);
lefTypeOfApproachListBox.setModel(typeOfApproachLeftListModel);
smellsListModel.clear();
typeOfApproachRightListModel.clear();
typeOfArtefactLeftListModel = new ListModelList<>(TypeOfArtefact.values());
typeOfArtefactLeftListModel.setMultiple(true);
lefTypeOfArtefactListBox.setModel(typeOfArtefactLeftListModel);
typeOfArtefactRightListModel.clear();
activityLeftListModel = new ListModelList<>(DesignSmellRelatedActivity.values());
activityLeftListModel.setMultiple(true);
leftActivityListBox.setModel(activityLeftListModel);
activityRightListModel.clear();
}
}
/**
/**
@@ -533,23 +647,24 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -533,23 +647,24 @@ public class AddContributionController extends SelectorComposer<Component> {
publicationTypeListModel = new ListModelList<>(PublicationType.values());
publicationTypeListModel = new ListModelList<>(PublicationType.values());
publiTypeComboBox.setModel(publicationTypeListModel);
publiTypeComboBox.setModel(publicationTypeListModel);
// recogemos todas las publicaciones.
//recogemos todas las publicaciones.
List<Publication> allPublication = publicationService.getPublications();
List<Publication> allPublication = publicationService.getPublications();
/**
/**
* combobox publication acronym
* combobox publication acronym
*/
*/
publicationListModel = new ListModelList<>(allPublication);
publicationListModel = new ListModelList<>(allPublication);
Comparator myComparator=(Object o1,Object o2)->
Comparator myComparator = (Object o1,
((Publication)o2).getAcronym().toLowerCase().contains(((String)o1).toLowerCase())?0:1;
Object o2) -> ((Publication) o2).getAcronym().toLowerCase().contains(((String) o1).toLowerCase()) ? 0
 
: 1;
acronymComboBox.setModel(ListModels.toListSubModel(publicationListModel, myComparator, 10));
acronymComboBox.setModel(ListModels.toListSubModel(publicationListModel, myComparator, 10));
/**
/**
* combobox publication fullname
* combobox publication fullname
*/
*/
publicationListModel1 = new ListModelList<>(allPublication);
publicationListModel1 = new ListModelList<>(allPublication);
Comparator myComparator1=(Object o1,Object o2)->
Comparator myComparator1 = (Object o1,
((Publication)o2).getFullname().toLowerCase().contains(((String)o1).toLowerCase())?0:1;
Object o2) -> ((Publication) o2).getFullname().toLowerCase().contains(((String) o1).toLowerCase()) ? 0
 
: 1;
fullNameComboBox.setModel(ListModels.toListSubModel(publicationListModel1, myComparator1, 10));
fullNameComboBox.setModel(ListModels.toListSubModel(publicationListModel1, myComparator1, 10));
/**
/**
@@ -559,15 +674,25 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -559,15 +674,25 @@ public class AddContributionController extends SelectorComposer<Component> {
authorShipGrid.setModel(authorInstitutionListModel);
authorShipGrid.setModel(authorInstitutionListModel);
/**
/**
* combobox automation
* Approach
*/
*/
automationListModel = new ListModelList<>(DegreeOfAutomation.values());
automationListModel = new ListModelList<>(DegreeOfAutomation.values());
automationComboBox.setModel(automationListModel);
automationComboBox.setModel(automationListModel);
/**
* combobox main activity
*/
mainActivityListModel = new ListModelList<>(DesignSmellRelatedActivity.values());
mainActivityListModel = new ListModelList<>(DesignSmellRelatedActivity.values());
mainActivityComboBox.setModel(mainActivityListModel);
mainActivityComboBox.setModel(mainActivityListModel);
 
 
refreshRightLeftModels();
 
 
/**
 
* Smells
 
*/
 
smellsListModel = new ListModelList<>();
 
smellsListBox.setModel(smellsListModel);
 
}
 
 
private void refreshRightLeftModels() {
 
/**
/**
* Type of approach
* Type of approach
*/
*/
@@ -600,6 +725,24 @@ public class AddContributionController extends SelectorComposer<Component> {
@@ -600,6 +725,24 @@ public class AddContributionController extends SelectorComposer<Component> {
activityRightListModel = new ListModelList<>();
activityRightListModel = new ListModelList<>();
activityRightListModel.setMultiple(true);
activityRightListModel.setMultiple(true);
rightActivityListBox.setModel(activityRightListModel);
rightActivityListBox.setModel(activityRightListModel);
 
 
}
 
 
/**
 
* Permite refrescar la vista si un smell ha sido seleccionado.
 
*/
 
private void refreshSmellsView() {
 
if (selectedSmell == null) {
 
addQFactorButton.setDisabled(true);
 
qFactorSmellsListModel = null;
 
qFactorSmellsGrid.setModel(qFactorSmellsListModel);
 
 
} else {
 
addQFactorButton.setDisabled(false);
 
qFactorSmellsListModel = new ListModelList<>(selectedSmell.getQfactorsmells());
 
qFactorSmellsGrid.setModel(qFactorSmellsListModel);
 
}
 
}
}
}
}
Loading