public code v1

This commit is contained in:
Francisco Jesús Martínez Mimbrera
2026-05-23 00:32:57 +02:00
commit 759a8968a2
4357 changed files with 163763 additions and 0 deletions
@@ -0,0 +1,7 @@
<?flintstones.helper.data.xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>flintstones.group</groupId>
<artifactId>flintstones.bundles</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>flintstones.application.perspective.gathering.ui</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>[bundle] Gathering UI</name>
</project>
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>flintstones.application.perspective.gathering.ui</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<filteredResources>
<filter>
<id>1779484362528</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
@@ -0,0 +1,20 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: flintstones.application.perspective.gathering.ui;singleton:=true
Bundle-Version: 1.0.0.qualifier
Export-Package: flintstones.application.perspective.gathering.ui.parts
Require-Bundle: flintstones.element.common.ui,
org.eclipse.e4.core.services,
javax.inject,
org.eclipse.e4.core.contexts,
org.eclipse.e4.core.di,
flintstones.model.valuation.service,
flintstones.entity.valuation,
javax.annotation,
flintstones.helper.data,
flintstones.model.problemelement.service,
org.eclipse.nebula.widgets.opal.notifier,
flintstones.helper.faq
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Automatic-Module-Name: flintstones.gathering.ui
@@ -0,0 +1,7 @@
#Properties file for flintstones.gathering.ui
Bundle-Name = Gathering UI
flintstones.application.perspective.gathering.label = Gathering
flintstones.gathering.ui.part.filterpart.label = Element | Expert
flintstones.gathering.ui.part.domainpart.label = Domain Index
flintstones.gathering.ui.part.selectorpart.label = Valuations | Expert
flintstones.gathering.ui.part.ratingpart.label = Valuation panel
@@ -0,0 +1,7 @@
#Properties file for flintstones.gathering.ui
Bundle-Name = Gathering UI
flintstones.application.perspective.gathering.label = Gathering
flintstones.gathering.ui.part.filterpart.label = Elemento | Experto
flintstones.gathering.ui.part.domainpart.label = Dominios
flintstones.gathering.ui.part.selectorpart.label = Valoraciones | Experto
flintstones.gathering.ui.part.ratingpart.label = Panel de valoración
@@ -0,0 +1,8 @@
output.. = bin/
bin.includes = META-INF/,\
.,\
fragment.e4xmi,\
plugin.xml,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
source.. = src/
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:advanced="http://www.eclipse.org/ui/2010/UIModel/application/ui/advanced" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmi:id="_UPgnMP0KEeeFa7tsq_d_Rg">
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_gkvSADlkEeiRAZAz6MpOhg" featurename="commands" parentElementId="flintstones.application.application">
<elements xsi:type="commands:Command" xmi:id="_GUol0DllEeiRAZAz6MpOhg" elementId="flintstones.gathering.ui.command.transpose" commandName="Transpose"/>
<elements xsi:type="commands:Command" xmi:id="_2KCVAEV6Eems14nuCAO_MA" elementId="flintstones.application.perspective.gathering.ui.command.paste.valuation" commandName="Paste Valuation" description="Allow to paste on the valuation part"/>
<elements xsi:type="commands:Command" xmi:id="_2XFyIEZBEemsJ_mtXL85YQ" elementId="flintstones.application.perspective.gathering.ui.command.cleartable" commandName="Clear Table" description="Clear the current table from valuations"/>
<elements xsi:type="commands:Command" xmi:id="_RK8c4EZHEemsJ_mtXL85YQ" elementId="flintstones.application.perspective.gathering.ui.command.showhelp" commandName="Show Help"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_LNUMADllEeiRAZAz6MpOhg" featurename="handlers" parentElementId="flintstones.application.application">
<elements xsi:type="commands:Handler" xmi:id="_OE7SUDllEeiRAZAz6MpOhg" elementId="flintstones.gathering.ui.handler.transpose" contributionURI="bundleclass://flintstones.application.perspective.gathering.ui/flintstones.application.perspective.gathering.ui.handlers.TransposeHandler" command="_GUol0DllEeiRAZAz6MpOhg"/>
<elements xsi:type="commands:Handler" xmi:id="_7ew-AEV6Eems14nuCAO_MA" elementId="flintstones.application.perspective.gathering.ui.handler.paste.valuation" contributionURI="bundleclass://flintstones.application.perspective.gathering.ui/flintstones.application.perspective.gathering.ui.handlers.PasteValuationHandler" command="_2KCVAEV6Eems14nuCAO_MA"/>
<elements xsi:type="commands:Handler" xmi:id="_64vYYEZBEemsJ_mtXL85YQ" elementId="flintstones.application.perspective.gathering.ui.handler.cleartable" contributionURI="bundleclass://flintstones.application.perspective.gathering.ui/flintstones.application.perspective.gathering.ui.handlers.ClearTableHandler" command="_2XFyIEZBEemsJ_mtXL85YQ"/>
<elements xsi:type="commands:Handler" xmi:id="_NLIYYEZHEemsJ_mtXL85YQ" elementId="flintstones.application.perspective.gathering.ui.handler.showhelp" contributionURI="bundleclass://flintstones.application.perspective.gathering.ui/flintstones.application.perspective.gathering.ui.handlers.SelectorFaqHandler" command="_RK8c4EZHEemsJ_mtXL85YQ"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_fhDoULAREeihksCysMAItw" featurename="children" parentElementId="flintstones.application.perspectivestack.modes">
<elements xsi:type="advanced:Perspective" xmi:id="_fhDoUbAREeihksCysMAItw" elementId="flintstones.application.perspective.gathering" label="%flintstones.application.perspective.gathering.label">
<children xsi:type="basic:PartSashContainer" xmi:id="_UPgnMv0KEeeFa7tsq_d_Rg" elementId="flintstones.application.partsashcontainer.gathering" containerData="" horizontal="true">
<children xsi:type="basic:PartSashContainer" xmi:id="_UPgnM_0KEeeFa7tsq_d_Rg" elementId="flintstones.application.partsashcontainer.gathering.left" containerData="2000">
<children xsi:type="basic:Part" xmi:id="_8rJ9sHfEEemHI7uE3cdyIA" elementId="flintstones.frameworkstructuring.ui.part.elements" contributionURI="bundleclass://flintstones.application.perspective.frameworkstructuring.ui/flintstones.application.perspective.frameworkstructuring.ui.parts.ElementPart" label="%flintstones.frameworkstructuring.ui.part.elements" iconURI="platform:/plugin/flintstones.model.ui.service/icons/element.png">
<properties key="Type" value="Expert"/>
</children>
<children xsi:type="basic:Part" xmi:id="_8rbDcHfEEemHI7uE3cdyIA" elementId="flintstones.frameworkstructuring.ui.part.elements" contributionURI="bundleclass://flintstones.application.perspective.frameworkstructuring.ui/flintstones.application.perspective.frameworkstructuring.ui.parts.ElementPart" label="%flintstones.frameworkstructuring.ui.part.elements" iconURI="platform:/plugin/flintstones.model.ui.service/icons/element.png">
<properties key="Type" value="Criterion"/>
</children>
<children xsi:type="basic:Part" xmi:id="_8rjmUHfEEemHI7uE3cdyIA" elementId="flintstones.frameworkstructuring.ui.part.elements" contributionURI="bundleclass://flintstones.application.perspective.frameworkstructuring.ui/flintstones.application.perspective.frameworkstructuring.ui.parts.ElementPart" label="%flintstones.frameworkstructuring.ui.part.elements" iconURI="platform:/plugin/flintstones.model.ui.service/icons/element.png">
<properties key="Type" value="Alternative"/>
</children>
</children>
<children xsi:type="basic:PartSashContainer" xmi:id="_UPgnOP0KEeeFa7tsq_d_Rg" elementId="flintstones.application.partsashcontainer.gathering.right" containerData="8000">
<children xsi:type="basic:PartStack" xmi:id="_UPgnOf0KEeeFa7tsq_d_Rg" elementId="flintstones.application.partstack.right" containerData="6000" accessibilityPhrase="">
<children xsi:type="basic:Part" xmi:id="_UPgnOv0KEeeFa7tsq_d_Rg" elementId="flintstones.gathering.ui.part.selectorpart" contributionURI="bundleclass://flintstones.element.common.ui/flintstones.element.common.ui.parts.SelectorPart" label="%flintstones.gathering.ui.part.selectorpart.label" iconURI="platform:/plugin/flintstones.model.ui.service/icons/element.png" bindingContexts="_n218MUV6Eems14nuCAO_MA">
<persistedState key="perspective" value="gt"/>
<toolbar xmi:id="_LrzwwDljEeiRAZAz6MpOhg" elementId="flintstones.gathering.ui.toolbar.valuation">
<children xsi:type="menu:HandledToolItem" xmi:id="_EH4PMEZHEemsJ_mtXL85YQ" elementId="flintstones.gathering.ui.handledtoolitem.valuation.clear" accessibilityPhrase="Clear Table" label="Clear Table" iconURI="platform:/plugin/flintstones.model.ui.service/icons/action_clear.png" tooltip="Clear Table" command="_2XFyIEZBEemsJ_mtXL85YQ"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_UHAbcDljEeiRAZAz6MpOhg" elementId="flintstones.gathering.ui.handledtoolitem.valuation.clear" accessibilityPhrase="Show Help" label="Show Help" iconURI="platform:/plugin/flintstones.model.ui.service/icons/action_help.png" tooltip="Show Help" command="_RK8c4EZHEemsJ_mtXL85YQ"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_3bENEEZAEemsJ_mtXL85YQ" elementId="flintstones.gathering.ui.handledtoolitem.valuation.transpose" accessibilityPhrase="Transpose" label="Transpose" iconURI="platform:/plugin/flintstones.model.ui.service/icons/action_transpose.png" tooltip="Transpose" command="_GUol0DllEeiRAZAz6MpOhg"/>
</toolbar>
</children>
</children>
<children xsi:type="basic:PartStack" xmi:id="_UPgnO_0KEeeFa7tsq_d_Rg" elementId="flintstones.application.partstack.1" containerData="4000">
<children xsi:type="basic:Part" xmi:id="_UPgnPP0KEeeFa7tsq_d_Rg" elementId="flintstones.gathering.ui.part.ratingpart" contributionURI="bundleclass://flintstones.application.perspective.gathering.ui/flintstones.application.perspective.gathering.ui.parts.RatingPart" label="%flintstones.gathering.ui.part.ratingpart.label" iconURI="platform:/plugin/flintstones.model.ui.service/icons/valuation-panel.png"/>
</children>
</children>
</children>
</elements>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_n218MEV6Eems14nuCAO_MA" featurename="rootContext" parentElementId="flintstones.application.application">
<elements xsi:type="commands:BindingContext" xmi:id="_n218MUV6Eems14nuCAO_MA" elementId="flintstones.application.bindingcontext.paste.valuation" name="Valuation Table Context" description="Allows to paste on Valuation Part"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_pcE0oEV6Eems14nuCAO_MA" featurename="bindingTables" parentElementId="flintstones.application.application">
<elements xsi:type="commands:BindingTable" xmi:id="_pcE0oUV6Eems14nuCAO_MA" elementId="flintstones.application.bindingtable.paste.valuation" bindingContext="_n218MUV6Eems14nuCAO_MA">
<bindings xmi:id="_z0c9sEV6Eems14nuCAO_MA" elementId="flintstones.application.perspective.gathering.ui.keybinding.paste.valuation" keySequence="M1+V" command="_2KCVAEV6Eems14nuCAO_MA"/>
</elements>
</fragments>
</fragment:ModelFragments>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<plugin>
<extension
id="flintstones.gathering.ui.fragment"
point="org.eclipse.e4.workbench.model">
<fragment
uri="fragment.e4xmi">
</fragment>
</extension>
</plugin>
@@ -0,0 +1,85 @@
package flintstones.application.perspective.gathering.ui.handlers;
import javax.inject.Inject;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import flintstones.application.constants.ApplicationContants;
import flintstones.application.constants.FrameworkConstants;
import flintstones.element.common.ui.parts.SelectorPart;
import flintstones.entity.problemelement.ProblemElementKey;
import flintstones.entity.problemelement.entities.Alternative;
import flintstones.entity.problemelement.entities.Criterion;
import flintstones.entity.problemelement.entities.Expert;
import flintstones.entity.problemelement.entities.ProblemElement;
import flintstones.model.problemelement.service.IProblemElementService;
import flintstones.model.valuation.service.IValuationService;
public class ClearTableHandler {
@Inject
EPartService partService;
@Inject
IProblemElementService problemService;
@Inject
IValuationService valuationService;
@Inject
IEventBroker broker;
@Execute
public void execute() {
MPart part = partService.findPart(ApplicationContants.MPart_Gatehring_Selector);
SelectorPart instance = (SelectorPart) part.getObject();
ProblemElement current = instance.getCurrentProblemElement();
String hHeaderType = getType(current.getType(), true, false);
String vHeaderType = getType(current.getType(), true, true);
ProblemElement[] hHeaders = problemService.getAll(hHeaderType);
ProblemElement[] vHeaders = problemService.getAll(vHeaderType);
for (ProblemElement item1 : vHeaders) {
for (ProblemElement item2 : hHeaders) {
ProblemElementKey pek = new ProblemElementKey(current, item2, item1);
valuationService.removeValuation(pek);
}
}
broker.send(FrameworkConstants.TOPIC_VALUATION_CREATED, null);
}
private String getType(String type, boolean next, boolean nextnext) {
int x = 0;
if (Alternative.Type.equals(type))
x = 0;
else if (Expert.Type.equals(type))
x = 1;
else if (Criterion.Type.equals(type))
x = 2;
if (next)
x++;
if (nextnext)
x++;
x = x % 3;
if (x == 0)
return Alternative.Type;
else if (x == 1)
return Expert.Type;
else if (x == 2)
return Criterion.Type;
return null;
}
}
@@ -0,0 +1,143 @@
package flintstones.application.perspective.gathering.ui.handlers;
import javax.inject.Inject;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.e4.core.services.nls.Translation;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.nebula.widgets.opal.notifier.NotifierColorsFactory.NotifierTheme;
import org.eclipse.nebula.widgets.opal.notifier.WNotifier;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.widgets.Display;
import flintstones.application.constants.ApplicationContants;
import flintstones.application.constants.FrameworkConstants;
import flintstones.application.perspective.gathering.ui.messages.Messages;
import flintstones.element.common.ui.parts.SelectorPart;
import flintstones.entity.problemelement.ProblemElementKey;
import flintstones.entity.problemelement.entities.Alternative;
import flintstones.entity.problemelement.entities.Criterion;
import flintstones.entity.problemelement.entities.Expert;
import flintstones.entity.problemelement.entities.ProblemElement;
import flintstones.entity.valuation.Valuation;
import flintstones.entity.valuation.exception.InvalidValueException;
import flintstones.helper.MatrixHelper;
import flintstones.helper.StringHelper;
import flintstones.helper.data.HashMatrix;
import flintstones.model.problemelement.service.IProblemElementService;
import flintstones.model.valuation.service.IValuationService;
public class PasteValuationHandler {
@Inject
EPartService partService;
@Inject
IProblemElementService problemService;
@Inject
IValuationService valuationService;
@Inject
@Translation
Messages messages;
@Inject
IEventBroker broker;
@Execute
public void execute() {
Clipboard clipboard = new Clipboard(Display.getCurrent());
String plainText = (String) clipboard.getContents(TextTransfer.getInstance());
HashMatrix<String, String, String> data = MatrixHelper.toHashMatrix(plainText, true);
MPart part = partService.findPart(ApplicationContants.MPart_Gatehring_Selector);
SelectorPart instance = (SelectorPart) part.getObject();
ProblemElement current = instance.getCurrentProblemElement();
String hHeaderType = getType(current.getType(), true, false);
String vHeaderType = getType(current.getType(), true, true);
ProblemElement[] hHeaders = problemService.getSubElements(hHeaderType);
ProblemElement[] vHeaders = problemService.getSubElements(vHeaderType);
// DH.out(hHeaders);
// DH.out(vHeaders);
boolean error = false;
for (ProblemElement item1 : vHeaders) {
for (ProblemElement item2 : hHeaders) {
ProblemElementKey pek = new ProblemElementKey(current, item2, item1);
String sValue = data.get(StringHelper.Draw(item1.getName()), StringHelper.Draw(item2.getName()));
Valuation v = valuationService.getValuationFor(pek);
try {
v.setValueFromString(sValue);
v.setEvaluated(true);
valuationService.addOrUpdate(pek, v);
} catch(InvalidValueException e) {
new WNotifier("Error", e.getMessage() + "\n" + pek.toString() + messages.Fix_error) //$NON-NLS-1$
.withCloseOnClick(true)
.withTimeout(60)
.send();
error = true;
}
if(error)
break;
}
if(error)
break;
}
if(!error)
new WNotifier(messages.Successfully_completed, messages.Valuations_successfully_added, NotifierTheme.BLUE_THEME)
.send();
broker.send(FrameworkConstants.TOPIC_VALUATION_CREATED, null);
// System.out.println(data);
}
private String getType(String type, boolean next, boolean nextnext) {
int x = 0;
if (Alternative.Type.equals(type))
x = 0;
else if (Expert.Type.equals(type))
x = 1;
else if (Criterion.Type.equals(type))
x = 2;
if (next)
x++;
if (nextnext)
x++;
x = x % 3;
if (x == 0)
return Alternative.Type;
else if (x == 1)
return Expert.Type;
else if (x == 2)
return Criterion.Type;
return null;
}
}
@@ -0,0 +1,31 @@
package flintstones.application.perspective.gathering.ui.handlers;
import javax.inject.Inject;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import flintstones.application.constants.ApplicationContants;
import flintstones.element.common.ui.parts.SelectorPart;
import flintstones.helper.faq.FaqHelper;
public class SelectorFaqHandler {
@Inject
EPartService partService;
@Inject
IEclipseContext context;
@Execute
public void execute() {
MPart part = partService.findPart(ApplicationContants.MPart_Gatehring_Selector);
SelectorPart instance = (SelectorPart) part.getObject();
ContextInjectionFactory.make(FaqHelper.class, context).showFAQ(instance);
}
}
@@ -0,0 +1,28 @@
package flintstones.application.perspective.gathering.ui.handlers;
import javax.inject.Inject;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.services.events.IEventBroker;
/**
* The Class TransposeHandler. Handle transpose when button is pushed
*/
public class TransposeHandler {
/** The event broker. */
@Inject
IEventBroker eventBroker;
/** The Constant BUS_ID. */
private static final String BUS_ID = "TOPIC/COMMAND/TRANSPOSE"; //$NON-NLS-1$
/**
* Execute.
*/
@Execute
public void execute() {
this.eventBroker.post(TransposeHandler.BUS_ID, null);
}
}
@@ -0,0 +1,16 @@
// This file has been auto-generated
package flintstones.application.perspective.gathering.ui.messages;
import org.eclipse.e4.core.services.nls.Message;
@Message
@SuppressWarnings("javadoc")
public class Messages {
public String RatingPart_label;
public String Fix_error;
public String Successfully_completed;
public String Valuations_successfully_added;
}
@@ -0,0 +1,4 @@
Fix_error=\n Fix the error and remove the data to try again
Successfully_completed=Successfully completed
Valuations_successfully_added=Valuations successfully added
RatingPart_label=Valuation Panel - Evaluating {0} with {1} with {2}
@@ -0,0 +1,4 @@
Fix_error=\n Corrige el error y elimina los datos para volver a intenarlo
Successfully_completed=Completado con éxito
Valuations_successfully_added=Se han añadido los valoraciones correctamente
RatingPart_label=Panel de valoración - Valorando {0} con {1} con {2}
@@ -0,0 +1,56 @@
package flintstones.application.perspective.gathering.ui.parts;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.di.UIEventTopic;
import org.eclipse.swt.widgets.Composite;
import flintstones.application.constants.FrameworkConstants;
import flintstones.element.common.ui.views.DomainViewer;
/**
* The Class DomainPart.
*
* @author Sinbad2
* The gathering UI domain list part
*/
public class DomainPart {
/** The context. */
@Inject
IEclipseContext context;
/** The domain viewer. */
DomainViewer viewer;
/** The Constant SUB_ID. */
private static final String SUB_ID = FrameworkConstants.TOPIC_FRAMEWORK_DOMAIN_ALLTOPICS;
/**
* Inits the part.
*
* @param parent the parent
*/
@PostConstruct
public void init(Composite parent) {
this.viewer = ContextInjectionFactory.make(DomainViewer.class, this.context);
this.viewer.createControls(parent, false, false);
}
/**
* Subscribe.
*
* @param event the event
*/
@Inject
@Optional
private void subscribe(@UIEventTopic(DomainPart.SUB_ID) Map<String, String> event) {
this.viewer.updateViewer();
}
}
@@ -0,0 +1,193 @@
package flintstones.application.perspective.gathering.ui.parts;
import java.text.MessageFormat;
import java.util.Locale;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.e4.core.services.nls.ILocaleChangeService;
import org.eclipse.e4.core.services.nls.Translation;
import org.eclipse.e4.ui.di.UIEventTopic;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import flintstones.application.constants.FrameworkConstants;
import flintstones.application.perspective.gathering.ui.messages.Messages;
import flintstones.entity.problemelement.ProblemElementKey;
import flintstones.entity.valuation.Valuation;
import flintstones.model.valuation.service.IValuationService;
import flintstones.valuation.cell.ValuationTableCell;
import flintstones.valuation.ui.ValuationPanel;
import flintstones.valuation.ui.listener.EValuationPanelEvent;
import flintstones.valuation.ui.listener.IValuationPanelListener;
import flintstones.valuation.ui.listener.ValuationPanelEvent;
import flintstones.valuation.ui.service.IValuationUIService;
/**
* The Class RatingPart.
*
* @author Sinbad 2 The gathering ui rating part.
*/
public class RatingPart implements IValuationPanelListener {
/** The base composite. */
private Composite baseComposite;
/** The valuation UI service. */
@Inject
IValuationUIService valuationUIService;
/** The valuation service. */
@Inject
IValuationService valuationService;
/** The broker. */
@Inject
IEventBroker broker;
/** The part. */
@Inject
MPart part;
@Inject
@Translation
Messages messages;
/** The Constant SUB_ID_VALUATION_SELECTED. */
private static final String SUB_ID_VALUATION_SELECTED = FrameworkConstants.TOPIC_SELECTION_VALUATION;
/** The Constant BUS_ID_VALUATION_CREATED. */
private static final String BUS_ID_VALUATION_CREATED = FrameworkConstants.TOPIC_VALUATION_CREATED;
/** The Constant BUS_ID_VALUATION_MODIFIED. */
private static final String BUS_ID_VALUATION_MODIFIED = FrameworkConstants.TOPIC_VALUATION_MODIFIED;
/** The current pek. */
private ProblemElementKey currentPek;
/**
* Constructor real.
*/
RatingPart() {
}
/**
* Creates the ui after constructor is called.
*
* @param parent The parent composite
*/
@PostConstruct
public void createControls(Composite parent) {
this.baseComposite = parent;
this.part.getParent().setVisible(false);
}
/**
* Draw the part.
*
* @param vtc the vtc
* @param pek the pek
*/
public void draw(ValuationTableCell vtc, ProblemElementKey pek) {
String template = messages.RatingPart_label;
this.part.setLabel(MessageFormat.format(template, pek.getExpert().getName(),
pek.getAlternative().getName(),
pek.getCriterion().getName()).toString());
this.part.getParent().setVisible(true);
String domainId = vtc.getValuation().getDomain().getType();
String valuationId = valuationService.getExtensionIdFor(domainId);
String valuationUiId = valuationUIService.getExtensionIdFor(valuationId);
ValuationPanel vp = valuationUIService.newValuationPanel(valuationUiId);
this.currentPek = pek;
vp.registerValuationPanelListener(this);
Composite ratingComposite = this.getEmptyBaseComposite();
// Patch for the old Valuation Panel code to work with the new data model.
Valuation v = vtc.getValuation();
if (!v.isEvaluated())
v = null;
vp.initialize(ratingComposite, vtc.getValuation().getDomain(), v);
ratingComposite.layout();
}
/**
* Gets the base composite after removing all its children.
*
* @return Returns an empty base composite
*/
public Composite getEmptyBaseComposite() {
for (Control c : this.baseComposite.getChildren())
c.dispose();
return this.baseComposite;
}
/**
* Subscribe selected.
*
* @param event the event
*/
@Inject
@Optional
private void subscribeSelected(@UIEventTopic(RatingPart.SUB_ID_VALUATION_SELECTED) Map<String, Object> event) {
ValuationTableCell vtc = (ValuationTableCell) event.get("cell"); //$NON-NLS-1$
ProblemElementKey pek = (ProblemElementKey) event.get("pek"); //$NON-NLS-1$
this.draw(vtc, pek);
}
/*
* (non-Javadoc)
*
* @see flintstones.valuation.ui.listener.IValuationPanelListener#
* notifyValuationPanelChange(flintstones.valuation.ui.listener.
* ValuationPanelEvent)
*/
@Override
public void notifyValuationPanelChange(ValuationPanelEvent event) {
// Valuation oldValuation = event.getOldValuation();
Valuation newValuation = event.getNewValuation();
if(newValuation == null)
return ;
EValuationPanelEvent e = event.getEvent();
switch (e) {
case NEW_VALUATION:
this.valuationService.addOrUpdate(this.currentPek, newValuation);
this.broker.post(RatingPart.BUS_ID_VALUATION_CREATED, null);
break;
case MODIFY_VALUATION:
this.valuationService.addOrUpdate(this.currentPek, newValuation);
this.broker.post(RatingPart.BUS_ID_VALUATION_MODIFIED, null);
break;
default: break;
}
}
@Inject
@Optional
private void getNotified(@UIEventTopic(ILocaleChangeService.LOCALE_CHANGE) Locale s) {
this.part.getParent().setVisible(false);
}
@Inject
@Optional
private void subscribe(@UIEventTopic(FrameworkConstants.TOPIC_FRAMEWORK_PROBLEMELEMENT_ALLTOPICS) Object o) {
this.part.getParent().setVisible(false);
}
}