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,17 @@
<?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.valuation.ui</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>[bundle] Ui</name>
<organization>
<name>Sinbad2</name>
</organization>
</project>
+50
View File
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>flintstones.valuation.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.pde.ds.core.builder</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>1779484362753</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,28 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Ui
Bundle-SymbolicName: flintstones.valuation.ui;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Sinbad2
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Automatic-Module-Name: flintstones.valuation.ui
Require-Bundle: flintstones.valuation;visibility:=reexport,
org.eclipse.e4.core.services,
org.eclipse.swt,
flintstones.helper.ui,
flintstones.helper.extensionpoint,
org.eclipse.e4.core.contexts,
flintstones.entity.domain,
org.eclipse.e4.ui.model.workbench,
flintstones.entity.valuation,
flintstones.model.valuation.service,
flintstones.model.domain.ui.service,
flintstones.entity.domain.ui.chart,
javax.annotation,
flintstones.model.ui.service,
javax.inject
Export-Package: flintstones.valuation.ui,
flintstones.valuation.ui.listener,
flintstones.valuation.ui.service
Service-Component: component.xml
Bundle-ActivationPolicy: lazy
@@ -0,0 +1,6 @@
output.. = bin/
bin.includes = META-INF/,\
.,\
component.xml,\
plugin.xml
source.. = src/
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="flintstones.valuation.ui">
<implementation class="flintstones.valuation.ui.provider.ValuationUIServiceContextFunction" />
<property name="service.context.key" type="String" value="flintstones.valuation.ui.service.IValuationUIService" />
<service>
<provide interface="org.eclipse.e4.core.contexts.IContextFunction" />
</service>
</scr:component>
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<?eclipse version="3.4"?>
<plugin>
<extension-point id="flintstones.valuation.ui.extensionpoint" name="Valuation UI Extension Point" schema="schema/flintstones.valuation.ui.extensionpoint.exsd"/>
</plugin>
@@ -0,0 +1,123 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="flintstones.valuation.ui.ex" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="flintstones.valuation.ui.ex" id="valuationui" name="Valuation UI Extension Point"/>
</appinfo>
<documentation>
Este punto de extensión permite definir las interfaces gráficas que nos permiten asignarle a un dominio una valoración. Se mostrara en la fase de gathering al pulsar sobre los elementos de la tabla.
==============================================================================================================================================
This extension point allows you to define the graphical interfaces that allow you to assign a domain a rating. It will be shown in the gathering phase when you click on the elements of the table.
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<choice minOccurs="1" maxOccurs="unbounded">
<element ref="valuation_ui"/>
</choice>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="xid" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="valuation_ui">
<complexType>
<attribute name="uid" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="valuation" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute kind="identifier" basedOn="flintstones.valuation/valuation/@uid"/>
</appinfo>
</annotation>
</attribute>
<attribute name="valuation_panel" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn="flintstones.valuation.ui.ValuationPanel:"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="apiinfo"/>
</appinfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>
@@ -0,0 +1,146 @@
package flintstones.valuation.ui;
import java.util.LinkedList;
import java.util.List;
import javax.inject.Inject;
import org.eclipse.e4.core.services.nls.Translation;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import flintstones.entity.domain.Domain;
import flintstones.entity.domain.ui.chart.DomainChart;
import flintstones.entity.valuation.Valuation;
import flintstones.model.domain.ui.service.IDomainUIService;
import flintstones.model.ui.service.UiService;
import flintstones.model.valuation.service.IValuationService;
import flintstones.valuation.ui.listener.EValuationPanelEvent;
import flintstones.valuation.ui.listener.IValuationPanelListener;
import flintstones.valuation.ui.listener.ValuationPanelEvent;
import flintstones.valuation.ui.messages.Messages;
@SuppressWarnings("javadoc")
public abstract class ValuationPanel {
private Composite container;
protected Composite valuationPart;
private Composite domainPart;
protected Button valuateButton;
protected Valuation valuation;
protected Domain domain;
private DomainChart chart;
private final List<IValuationPanelListener> listeners;
@Inject
IValuationService valuationService;
@Inject
IDomainUIService uiDomainService;
@Inject
@Translation
private Messages messages;
public ValuationPanel() {
this.chart = null;
this.listeners = new LinkedList<>();
}
public void initialize(Composite parent, Domain domain, Valuation valuation) {
this.container = new Composite(parent, SWT.NONE);
this.container.setBackground(new Color(Display.getCurrent(), 255, 255, 255));
UiService.setGridLayout(this.container, 2);
this.domain = domain;
this.valuation = valuation;
this.createValuationPart();
this.createDomainPart();
this.createControls();
}
public void dispose() {
this.listeners.clear();
}
public void selectionChange() {
Valuation result = this.createNewValuation();
this.notifyValuationChanges(result);
if (this.chart != null)
this.chart.setSelection(this.getSelection());
}
private void notifyValuationChanges(Valuation valuation) {
EValuationPanelEvent type = (ValuationPanel.this.valuation == null) ? EValuationPanelEvent.NEW_VALUATION : EValuationPanelEvent.MODIFY_VALUATION;
ValuationPanel.this.notifyValuationPanelChange(new ValuationPanelEvent(type, ValuationPanel.this.valuation, valuation));
ValuationPanel.this.valuation = valuation;
}
public void registerValuationPanelListener(IValuationPanelListener listener) {
this.listeners.add(listener);
}
public void unregisterValuationPanelListener(IValuationPanelListener listener) {
this.listeners.remove(listener);
}
public void notifyValuationPanelChange(ValuationPanelEvent event) {
for (IValuationPanelListener listener : this.listeners)
listener.notifyValuationPanelChange(event);
}
protected abstract void createControls();
public abstract Valuation createNewValuation();
public abstract Object getSelection();
private void createValuationPart() {
this.valuationPart = new Composite(this.container, SWT.NONE);
UiService.setGridData(this.valuationPart, 9, 9, false, true);
this.valuationPart.setBackground(new Color(Display.getCurrent(), 255, 255, 255));
}
private void createDomainPart() {
this.domainPart = new Composite(this.container, SWT.BORDER);
UiService.setGridData(this.domainPart, 9, 9, true, true);
this.domainPart.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
ValuationPanel.this.refreshChart();
}
});
}
private void refreshChart() {
if (this.chart != null)
for (Control control : this.domainPart.getChildren())
if (!control.isDisposed())
control.dispose();
if (this.domain != null) {
Point size = this.domainPart.getSize();
this.chart = this.uiDomainService.createChart(domain.getType());
this.chart.initialize(this.domain, this.domainPart, size.x, size.y, SWT.NONE);
this.chart.setSelection(this.getSelection());
}
}
}
@@ -0,0 +1,72 @@
package flintstones.valuation.ui;
import javax.inject.Inject;
import org.eclipse.e4.core.services.nls.Translation;
import flintstones.entity.extensionenum.ExtensionEnum;
import flintstones.valuation.ui.messages.Messages;
/**
* The Class ValuationUI.
*/
public class ValuationUI {
/** The messages. */
@Inject
@Translation
private Messages messages;
/** The Constant EXTENSION_POINT. */
public final static String EXTENSION_POINT = Messages.ValuationUI_extension;
/** The valuation. */
private String _valuation;
/**
* Instantiates a new valuation UI.
*/
public ValuationUI() {
this._valuation = null;
}
/**
* Sets the valuation.
*
* @param valuation the new valuation
*/
public void setValuation(String valuation) {
this._valuation = valuation;
}
/**
* Gets the valuation.
*
* @return the valuation
*/
public String getValuation() {
return this._valuation;
}
/**
* The Enum Fields.
*/
public enum Fields implements ExtensionEnum {
/** The id. */
uid,
/** The valuation. */
valuation,
/** The new domain dialog. */
new_domain_dialog,
/** The modify domain dialog. */
modify_domain_dialog,
/** The dialog. */
dialog,
/** The valuation panel. */
valuation_panel,
/** The panel. */
panel;
}
}
@@ -0,0 +1,6 @@
package flintstones.valuation.ui.listener;
@SuppressWarnings("javadoc")
public enum EValuationPanelEvent {
NEW_VALUATION, MODIFY_VALUATION, REMOVE_VALUATION;
}
@@ -0,0 +1,8 @@
package flintstones.valuation.ui.listener;
@SuppressWarnings("javadoc")
public interface IValuationPanelListener {
public void notifyValuationPanelChange(ValuationPanelEvent event);
}
@@ -0,0 +1,67 @@
package flintstones.valuation.ui.listener;
import flintstones.entity.valuation.Valuation;
/**
* The Class ValuationPanelEvent.
*/
public class ValuationPanelEvent {
/** The event. */
private EValuationPanelEvent _event;
/** The old valuation. */
private Valuation _oldValuation;
/** The new valuation. */
private Valuation _newValuation;
/**
* Instantiates a new valuation panel event.
*/
private ValuationPanelEvent() {
}
/**
* Instantiates a new valuation panel event.
*
* @param event the event
* @param oldValuation the old valuation
* @param newValuation the new valuation
*/
public ValuationPanelEvent(EValuationPanelEvent event, Valuation oldValuation, Valuation newValuation) {
this();
this._event = event;
this._oldValuation = oldValuation;
this._newValuation = newValuation;
}
/**
* Gets the event.
*
* @return the event
*/
public EValuationPanelEvent getEvent() {
return this._event;
}
/**
* Gets the old valuation.
*
* @return the old valuation
*/
public Valuation getOldValuation() {
return this._oldValuation;
}
/**
* Gets the new valuation.
*
* @return the new valuation
*/
public Valuation getNewValuation() {
return this._newValuation;
}
}
@@ -0,0 +1,13 @@
// This file has been auto-generated
package flintstones.valuation.ui.messages;
import org.eclipse.e4.core.services.nls.Message;
@Message
@SuppressWarnings("javadoc")
public class Messages {
public static String ValuationUI_extension;
public String ValuationPanel_Evaluate;
}
@@ -0,0 +1,2 @@
ValuationPanel_Evaluate=Evaluate
ValuationUI_extension=flintstones.valuation.ui.extensionpoint
@@ -0,0 +1,2 @@
ValuationPanel_Evaluate=Evaluar
ValuationUI_extension=flintstones.valuation.ui.extensionpoint
@@ -0,0 +1,24 @@
package flintstones.valuation.ui.provider;
import org.eclipse.e4.core.contexts.ContextFunction;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.model.application.MApplication;
import flintstones.valuation.ui.service.IValuationUIService;
/**
* The Class ValuationServiceContextFunction add the Valuation Service instance to global context.
*/
public class ValuationUIServiceContextFunction extends ContextFunction {
@Override
public Object compute(IEclipseContext context, String contextKey) {
IValuationUIService service = ContextInjectionFactory.make(ValuationUIServiceProvider.class, context);
MApplication application = context.get(MApplication.class);
IEclipseContext applicationContext = application.getContext();
applicationContext.set(IValuationUIService.class, service);
return service;
}
}
@@ -0,0 +1,88 @@
package flintstones.valuation.ui.provider;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.eclipse.e4.core.contexts.IEclipseContext;
import flintstones.helper.extensionpoint.BaseRegistry;
import flintstones.valuation.ui.ValuationPanel;
import flintstones.valuation.ui.ValuationUI;
import flintstones.valuation.ui.service.IValuationUIService;
/**
* The Class ValuationUIServiceProvider.
*/
public class ValuationUIServiceProvider implements IValuationUIService {
/** The reg. */
BaseRegistry reg;
/** The valuation U is. */
private Map<String, ValuationUI> valuationUIs;
/** The context. */
@Inject
IEclipseContext context;
/**
* Instantiates a new valuation UI service provider.
*/
public ValuationUIServiceProvider() {
}
/**
* Inits the.
*/
@PostConstruct
public void init() {
this.reg = new BaseRegistry("flintstones.valuation.ui.extensionpoint"); //$NON-NLS-1$
this.reg.setLabel_implementation(ValuationUI.Fields.valuation_panel);
this.valuationUIs = new HashMap<>();
}
/* (non-Javadoc)
*
* @see
* flintstones.valuation.ui.service.IValuationUIService#newValuationPanel(java.
* lang.String) */
@Override
public ValuationPanel newValuationPanel(String valuationUiId) {
return (ValuationPanel) this.reg.instantiate(valuationUiId, this.context);
}
/* (non-Javadoc)
*
* @see
* flintstones.valuation.ui.service.IValuationUIService#getValuationUI(java.lang
* .String) */
@Override
public ValuationUI getValuationUI(String valuation) {
return this.valuationUIs.get(valuation);
}
/* (non-Javadoc)
*
* @see
* flintstones.valuation.ui.service.IValuationUIService#getExtensionIdFor(java.
* lang.String) */
@Override
public String getExtensionIdFor(String valuationId) {
return this.reg.getFirstRegistryWhere(ValuationUI.Fields.valuation, valuationId)
.getAttribute(ValuationUI.Fields.uid);
}
/* (non-Javadoc)
*
* @see
* flintstones.valuation.ui.service.IValuationUIService#getRegistersIDs() */
@Override
public String[] getRegistersIDs() {
return this.reg.getAllAttributes(ValuationUI.Fields.uid);
}
}
@@ -0,0 +1,41 @@
package flintstones.valuation.ui.service;
import flintstones.valuation.ui.ValuationPanel;
import flintstones.valuation.ui.ValuationUI;
/**
* The Interface IValuationUIService.
*/
public interface IValuationUIService {
/**
* Creates a new valuation panel.
*
* @param valuation the valuation
* @return the valuation panel
*/
ValuationPanel newValuationPanel(String valuation);
/**
* Gets the valuation UI.
*
* @param valuation the valuation
* @return the valuation UI
*/
ValuationUI getValuationUI(String valuation);
/**
* Gets the registers Ids.
*
* @return the registers Ids
*/
public String[] getRegistersIDs();
/**
* Gets the extension id for a given valuationId.
*
* @param valuationId the valuation id
* @return the extension id for
*/
String getExtensionIdFor(String valuationId);
}