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 @@
<?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.entity.problemelement.ui</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>[bundle] Ui</name>
</project>
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>flintstones.entity.problemelement.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>1779484362573</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,14 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Ui
Bundle-SymbolicName: flintstones.entity.problemelement.ui
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: flintstones.entity.problemelement.ui
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: flintstones.helper.ui,
flintstones.entity.problemelement;visibility:=reexport,
org.eclipse.nebula.widgets.tablecombo,
org.eclipse.e4.core.contexts,
flintstones.helper.data
Export-Package: flintstones.entity.problemelement.ui.widget,
flintstones.entity.problemelement.ui.widget.listener
@@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
@@ -0,0 +1,140 @@
package flintstones.entity.problemelement.ui.widget;
import org.eclipse.swt.widgets.Composite;
import flintstones.entity.problemelement.entities.ProblemElement;
import flintstones.entity.problemelement.ui.widget.listener.IProblemElementChangedListener;
import flintstones.entity.problemelement.ui.widget.listener.IProblemElementPairChangedListener;
import flintstones.helper.data.HashMatrix;
import flintstones.helper.ui.components.TableComboStatus.Status;
import flintstones.helper.ui.components.listeners.IStatusProvider;
public class ProblemElementPairSelector {
// Component
ProblemElementSelector mainSelector;
ProblemElementSelector otherSelector;
// Data
HashMatrix<ProblemElement, ProblemElement, Boolean> statusMatrix = new HashMatrix<>();
ProblemElement[] mainPes;
ProblemElement[] otherPes;
// Control
IProblemElementPairChangedListener listener;
public ProblemElementPairSelector(Composite base, ProblemElement[] mainElements, ProblemElement[] otherElements) {
mainSelector = new ProblemElementSelector(base, mainElements);
otherSelector = new ProblemElementSelector(base, otherElements);
mainPes = mainElements;
otherPes = otherElements;
for(ProblemElement main : mainPes) {
for(ProblemElement other : otherPes) {
statusMatrix.put(main, other, false);
}
}
setStatusProvider();
}
private void setStatusProvider() {
otherSelector.setStatusProvider(new IStatusProvider() {
@Override
public Status getStatusFor(String name) {
ProblemElement main = mainSelector.getSelectedElement();
ProblemElement other = otherSelector.getByName(name);
return statusMatrix.get(main, other) ? Status.Right : Status.Wrong;
}
});
mainSelector.setStatusProvider(new IStatusProvider() {
@Override
public Status getStatusFor(String name) {
ProblemElement main = mainSelector.getByName(name);
boolean ok = true;
for(ProblemElement other : otherPes) {
Boolean status = statusMatrix.get(main, other);
ok = ok && status;
}
return ok ? Status.Right : Status.Wrong;
}
});
refresh();
}
public void setListener(IProblemElementPairChangedListener lis) {
listener = lis;
mainSelector.setListener(new IProblemElementChangedListener() {
@Override
public void problemElementChanged(ProblemElement pe) {
listener.mainProblemElementChanged(pe);
}
});
otherSelector.setListener(new IProblemElementChangedListener() {
@Override
public void problemElementChanged(ProblemElement pe) {
listener.otherProblemElementChanged(pe);
}
});
}
public void setText(String main, String other) {
mainSelector.setText(main);
otherSelector.setText(other);
}
public void setStatus(ProblemElement main, ProblemElement other, Boolean status, Boolean refresh) {
statusMatrix.put(main, other, status);
if(refresh)
refresh();
}
public void setStatus(ProblemElement main, ProblemElement other, Boolean status) {
setStatus(main, other, status,true);
}
public ProblemElement getSelectedMain() {
return mainSelector.getSelectedElement();
}
public ProblemElement getSelectedOther() {
return otherSelector.getSelectedElement();
}
public void refresh() {
otherSelector.refresh();
mainSelector.refresh();
}
// public void refresh() {
//
// ProblemElement mainPe = mainSelector.getSelectedElement();
//
// boolean ok = true;
// for(ProblemElement other : otherPes) {
// boolean status = statusMatrix.get(mainPe, other);
// otherSelector.setStatus(other, status);
// ok = ok && status;
//
// }
//
// mainSelector.setStatus(mainPe, ok);
//
// }
}
@@ -0,0 +1,109 @@
package flintstones.entity.problemelement.ui.widget;
import java.util.Arrays;
import java.util.LinkedHashMap;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import flintstones.entity.problemelement.entities.ProblemElement;
import flintstones.entity.problemelement.ui.widget.listener.IProblemElementChangedListener;
import flintstones.helper.ui.components.TableComboStatus;
import flintstones.helper.ui.components.TableComboStatus.Status;
import flintstones.helper.ui.components.listeners.IStatusProvider;
public class ProblemElementSelector {
// Component
TableComboStatus combo;
Label titleLabel;
// Data
LinkedHashMap<String,ProblemElement> elements = new LinkedHashMap<String, ProblemElement>();
ProblemElement lastProblemElementSelected = null;
// Control
IProblemElementChangedListener changeListener;
IStatusProvider statusProvider;
public ProblemElementSelector(Composite base, ProblemElement[] problemElements) {
titleLabel = new Label(base, 0);
combo = new TableComboStatus(base, SWT.BORDER | SWT.READ_ONLY );
Arrays.stream(problemElements).forEach(k -> elements.put(k.getName(), k));
combo.setItems(elements.keySet().toArray(new String[elements.size()]));
combo.select(0);
combo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ProblemElement pe = getSelectedElement();
if(!pe.equals(lastProblemElementSelected)) {
// The element has changed
lastProblemElementSelected = pe;
// Elevate the change
changeListener.problemElementChanged(pe);
}
}
});
lastProblemElementSelected = problemElements[0];
}
public void setListener(IProblemElementChangedListener lis) {
changeListener = lis;
}
public void setStatusProvider(IStatusProvider sta) {
statusProvider = sta;
}
public void setText(String text) {
titleLabel.setText(text);
titleLabel.getParent().layout();
}
public void setStatus(ProblemElement pe, boolean status) {
combo.setStatus(pe.getName(), status ? TableComboStatus.Status.Right : TableComboStatus.Status.Wrong);
}
public boolean getStatus() {
return combo.getStatus();
}
public boolean getStatus(ProblemElement pe) {
return combo.getStatus(pe.getName());
}
public ProblemElement getSelectedElement() {
String peS = combo.getText();
ProblemElement pe = elements.get(peS);
return pe;
}
public ProblemElement getByName(String name) {
return elements.get(name);
}
public void refresh() {
if(statusProvider == null)
return ;
if(statusProvider == null)
throw new RuntimeException("Provider de status sin definir");
for(String element : elements.keySet()) {
Status status = statusProvider.getStatusFor(element);
combo.setStatus(element, status);
}
}
}
@@ -0,0 +1,9 @@
package flintstones.entity.problemelement.ui.widget.listener;
import flintstones.entity.problemelement.entities.ProblemElement;
public interface IProblemElementChangedListener {
void problemElementChanged(ProblemElement pe);
}
@@ -0,0 +1,11 @@
package flintstones.entity.problemelement.ui.widget.listener;
import flintstones.entity.problemelement.entities.ProblemElement;
public interface IProblemElementPairChangedListener {
void mainProblemElementChanged(ProblemElement pe);
void otherProblemElementChanged(ProblemElement pe);
}