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.method.ahp.sortii.phase.ranking.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.method.ahp.sortii.phase.ranking.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>1779484362634</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: Ui
Bundle-SymbolicName: flintstones.method.ahp.sortii.phase.ranking.ui;singleton:=true
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: flintstones.method.ahp.sortii.phase.ranking.ui
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: flintstones.entity.method.phase.ui,
flintstones.method.ahp.sortii.phase.ranking,
flintstones.entity.method.phase,
org.eclipse.swt,
flintstones.model.ui.service,
flintstones.helper.data,
flintstones.helper.html,
flintstones.entity.problemelement,
flintstones.entity.problemelement.ui,
flintstones.model.problemelement.service,
javax.inject,
org.eclipse.jface,
org.jfree.chart.jfreechart
@@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="flintstones.phasemethod.ui">
<phasemethod_ui
uid="flintstones.method.ahp.sortii.phase.ranking.ui"
implementation="flintstones.method.ahp.sortii.phase.ranking.ui.AHPSortIIRankingAgglomerativeUI"
phasemethod="flintstones.method.ahp.sortii.phase.ranking">
</phasemethod_ui>
</extension>
<extension
point="flintstones.phasemethod.ui">
<phasemethod_ui
uid="flintstones.method.ahp.sortii.phase.ranking2.ui"
implementation="flintstones.method.ahp.sortii.phase.ranking.ui.AHPSortIIRanking2AgglomerativeUI"
phasemethod="flintstones.method.ahp.sortii.phase.ranking2">
</phasemethod_ui>
</extension>
</plugin>
@@ -0,0 +1,174 @@
package flintstones.method.ahp.sortii.phase.ranking.ui;
import java.util.ArrayList;
import java.util.HashMap;
import javax.inject.Inject;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
import flintstones.entity.method.phase.ui.PhaseMethodUI;
import flintstones.entity.problemelement.entities.Expert;
import flintstones.entity.problemelement.entities.ProblemElement;
import flintstones.entity.problemelement.entities.SortingClass;
import flintstones.entity.problemelement.ui.widget.ProblemElementSelector;
import flintstones.entity.problemelement.ui.widget.listener.IProblemElementChangedListener;
import flintstones.helper.data.adapter.TableAdapter;
import flintstones.helper.html.table.HtmlTextTable;
import flintstones.method.ahp.sortii.phase.ranking.AHPSortIIRanking2ModelAgglomerative;
import flintstones.model.problemelement.service.IProblemElementService;
import flintstones.model.ui.service.UiService;
public class AHPSortIIRanking2AgglomerativeUI extends PhaseMethodUI {
@Inject
IProblemElementService problemService;
AHPSortIIRanking2ModelAgglomerative model;
Expert selectedExpert;
HtmlTextTable criterionWeightsTable;
HtmlTextTable clustersTable;
HtmlTextTable alternativeLocalTable;
HtmlTextTable profileGlobalTable;
HtmlTextTable alternativeGlobalTable;
HtmlTextTable globalClassificationTable;
HashMap<String, Boolean> visibleComposite = new HashMap<>();
@Override
public void init() {
model = (AHPSortIIRanking2ModelAgglomerative) this.getModel();
model.execute();
createPartControls(this.getBaseComposite());
}
@Override
public void refresh() {
// TODO Auto-generated method stub
}
@Override
protected boolean isForwardEnabled() {
return true;
}
private void createPartControls(Composite base) {
selectedExpert = (Expert) problemService.getAll(Expert.Type)[0];
UiService.setGridLayout(base, 1);
UiService.setGridDataAuto(base);
Composite c3 = createBlock(base, "Alternative local priorities");
createAlternativeLocalPrioritiesTable(c3);
Composite comboComposite = new Composite(base, SWT.NONE);
UiService.setGridData(comboComposite, 9, 9, false, false);
UiService.setGridLayout(comboComposite, 1);
ProblemElementSelector selectorExpert = new ProblemElementSelector(comboComposite, problemService.getAll(Expert.Type));
selectorExpert.setListener(new IProblemElementChangedListener() {
@Override
public void problemElementChanged(ProblemElement pe) {
selectedExpert = (Expert) pe;
updateTables();
}
});
Composite divide45 = new Composite(base, 0);
UiService.setGridData(divide45, 9, 9, true, true);
UiService.setGridLayout(divide45, 3);
Composite c4 = createBlock(divide45, "Profile global priorities");
createProfileGlobalPrioritiesTable(c4);
Composite c5 = createBlock(divide45, "Individual classification");
createAlternativeGlobalPrioritiesTable(c5);
Composite c6 = createBlock(divide45, "Group classification");
createGlobalClassificationTable(c6);
}
private Composite createBlock(Composite parent, String name) {
Composite base = new Composite(parent, 0);
UiService.setGridData(base, 9, 9, true, true);
UiService.setGridLayout(base, 1);
CLabel title = new CLabel(base, 0);
title.setText(name);
UiService.setFont(title, UiService.FONT_SECTION_TITLE);
Composite tableBase = new Composite(base, 0);
UiService.setGridData(tableBase, 9, 9, true, true);
UiService.setGridLayout(tableBase, 1);
return tableBase;
}
private void createAlternativeGlobalPrioritiesTable(Composite tableBase) {
TableAdapter adapter = model.getAlternativeGlobalTable(selectedExpert);
alternativeGlobalTable = new HtmlTextTable(tableBase, adapter.getData(), adapter.getHorizontalHeaders(), adapter.getVerticalHeaders());
alternativeGlobalTable.render();
}
private void createProfileGlobalPrioritiesTable(Composite tableBase) {
TableAdapter adapter = model.getProfilesGlobalTable(selectedExpert);
profileGlobalTable = new HtmlTextTable(tableBase, adapter.getDataRow(), adapter.getHorizontalHeaders(), true);
profileGlobalTable.render();
}
private void createAlternativeLocalPrioritiesTable(Composite tableBase) { // X
TableAdapter adapter = model.getAlternativeLocalTable(selectedExpert);
alternativeLocalTable = new HtmlTextTable(tableBase, adapter.getData(), adapter.getHorizontalHeaders(),
adapter.getVerticalHeaders());
alternativeLocalTable.render();
}
private void createGlobalClassificationTable(Composite tableBase) {
TableAdapter adapter = model.getGlobalClassificationTable();
globalClassificationTable = new HtmlTextTable(tableBase, adapter.getDataRow(), adapter.getHorizontalHeaders(), true);
ArrayList<SortingClass> classes = model.getClasses();
Color[] colors = UiService.getColorScale(classes.size(), false);
for(int i = 0; i < classes.size(); i++) {
SortingClass cl = classes.get(i);
globalClassificationTable.setCss(".value_"+cl.getName(), "background-color", UiService.toHEX(colors[i]) );
}
globalClassificationTable.render();
}
private void updateTables() {
TableAdapter adapter1 = model.getAlternativeGlobalTable(selectedExpert);
TableAdapter adapter2 = model.getProfilesGlobalTable(selectedExpert);
TableAdapter adapter3 = model.getAlternativeLocalTable(selectedExpert);
alternativeLocalTable.refresh(adapter3.getData());
profileGlobalTable.refresh(adapter2.getDataRow());
alternativeGlobalTable.refresh(adapter1.getData());
alternativeLocalTable.render();
profileGlobalTable.render();
alternativeGlobalTable.render();
}
}
@@ -0,0 +1,177 @@
package flintstones.method.ahp.sortii.phase.ranking.ui;
import java.util.ArrayList;
import java.util.HashMap;
import javax.inject.Inject;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
import flintstones.entity.problemelement.entities.Expert;
import flintstones.entity.problemelement.entities.ProblemElement;
import flintstones.entity.problemelement.entities.SortingClass;
import flintstones.entity.problemelement.ui.widget.ProblemElementSelector;
import flintstones.entity.problemelement.ui.widget.listener.IProblemElementChangedListener;
import flintstones.entity.method.phase.ui.PhaseMethodUI;
import flintstones.helper.data.adapter.TableAdapter;
import flintstones.helper.html.table.HtmlTextTable;
import flintstones.method.ahp.sortii.phase.ranking.AHPSortIIRanking2Model;
import flintstones.model.problemelement.service.IProblemElementService;
import flintstones.model.ui.service.UiService;
public class AHPSortIIRanking2UI extends PhaseMethodUI {
@Inject
IProblemElementService problemService;
AHPSortIIRanking2Model model;
Expert selectedExpert;
HtmlTextTable criterionWeightsTable;
HtmlTextTable clustersTable;
HtmlTextTable alternativeLocalTable;
HtmlTextTable profileGlobalTable;
HtmlTextTable alternativeGlobalTable;
HtmlTextTable globalClassificationTable;
HashMap<String, Boolean> visibleComposite = new HashMap<>();
@Override
public void init() {
model = (AHPSortIIRanking2Model) this.getModel();
model.execute();
createPartControls(this.getBaseComposite());
}
@Override
public void refresh() {
// TODO Auto-generated method stub
}
@Override
protected boolean isForwardEnabled() {
return true;
}
private void createPartControls(Composite base) {
selectedExpert = (Expert) problemService.getAll(Expert.Type)[0];
UiService.setGridLayout(base, 1);
UiService.setGridDataAuto(base);
Composite c3 = createBlock(base, "Alternative local priorities");
createAlternativeLocalPrioritiesTable(c3);
Composite comboComposite = new Composite(base, SWT.NONE);
UiService.setGridData(comboComposite, 9, 9, false, false);
UiService.setGridLayout(comboComposite, 1);
ProblemElementSelector selectorExpert = new ProblemElementSelector(comboComposite, problemService.getAll(Expert.Type));
selectorExpert.setListener(new IProblemElementChangedListener() {
@Override
public void problemElementChanged(ProblemElement pe) {
selectedExpert = (Expert) pe;
updateTables();
}
});
Composite divide45 = new Composite(base, 0);
UiService.setGridData(divide45, 9, 9, true, true);
UiService.setGridLayout(divide45, 3);
Composite c4 = createBlock(divide45, "Profile global priorities");
createProfileGlobalPrioritiesTable(c4);
Composite c5 = createBlock(divide45, "Alternative global priorities");
createAlternativeGlobalPrioritiesTable(c5);
Composite c6 = createBlock(divide45, "Group classification");
createGlobalClassificationTable(c6);
}
private Composite createBlock(Composite parent, String name) {
Composite base = new Composite(parent, 0);
UiService.setGridData(base, 9, 9, true, true);
UiService.setGridLayout(base, 1);
CLabel title = new CLabel(base, 0);
title.setText(name);
UiService.setFont(title, UiService.FONT_SECTION_TITLE);
Composite tableBase = new Composite(base, 0);
UiService.setGridData(tableBase, 9, 9, true, true);
UiService.setGridLayout(tableBase, 1);
return tableBase;
}
private void createAlternativeGlobalPrioritiesTable(Composite tableBase) {
TableAdapter adapter = model.getAlternativeGlobalTable(selectedExpert);
alternativeGlobalTable = new HtmlTextTable(tableBase, adapter.getData(), adapter.getHorizontalHeaders(), adapter.getVerticalHeaders());
alternativeGlobalTable.render();
}
private void createProfileGlobalPrioritiesTable(Composite tableBase) {
TableAdapter adapter = model.getProfilesGlobalTable(selectedExpert);
profileGlobalTable = new HtmlTextTable(tableBase, adapter.getDataRow(), adapter.getHorizontalHeaders(), true);
profileGlobalTable.render();
}
private void createAlternativeLocalPrioritiesTable(Composite tableBase) { // X
TableAdapter adapter = model.getAlternativeLocalTable(selectedExpert);
alternativeLocalTable = new HtmlTextTable(tableBase, adapter.getData(), adapter.getHorizontalHeaders(),
adapter.getVerticalHeaders());
alternativeLocalTable.render();
}
private void createGlobalClassificationTable(Composite tableBase) {
TableAdapter adapter = model.getGlobalClassificationTable();
globalClassificationTable = new HtmlTextTable(tableBase, adapter.getDataRow(), adapter.getHorizontalHeaders(), true);
ArrayList<SortingClass> classes = model.getClasses();
Color[] colors = UiService.getColorScale(classes.size(), false);
for(int i = 0; i < classes.size(); i++) {
SortingClass cl = classes.get(i);
globalClassificationTable.setCss(".value_"+cl.getName(), "background-color", UiService.toHEX(colors[i]) );
}
globalClassificationTable.render();
}
private void updateTables() {
TableAdapter adapter1 = model.getAlternativeGlobalTable(selectedExpert);
TableAdapter adapter2 = model.getProfilesGlobalTable(selectedExpert);
TableAdapter adapter3 = model.getAlternativeLocalTable(selectedExpert);
alternativeLocalTable.refresh(adapter3.getData());
profileGlobalTable.refresh(adapter2.getDataRow());
alternativeGlobalTable.refresh(adapter1.getData());
alternativeLocalTable.render();
profileGlobalTable.render();
alternativeGlobalTable.setCss(".value_High", "background-color", "green");
alternativeGlobalTable.setCss(".value_Moderate", "background-color", "blue");
alternativeGlobalTable.setCss(".value_Low", "background-color", "red");
alternativeGlobalTable.render();
}
}
@@ -0,0 +1,190 @@
package flintstones.method.ahp.sortii.phase.ranking.ui;
import java.awt.BasicStroke;
import java.awt.Color;
import java.util.HashMap;
import javax.inject.Inject;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.chart.swt.ChartComposite;
import flintstones.entity.method.phase.ui.PhaseMethodUI;
import flintstones.entity.problemelement.entities.Criterion;
import flintstones.entity.problemelement.entities.Expert;
import flintstones.entity.problemelement.entities.ProblemElement;
import flintstones.entity.problemelement.ui.widget.ProblemElementSelector;
import flintstones.entity.problemelement.ui.widget.listener.IProblemElementChangedListener;
import flintstones.helper.data.adapter.TableAdapter;
import flintstones.helper.html.table.HtmlTextTable;
import flintstones.method.ahp.sortii.phase.ranking.AHPSortIIRankingModelAgglomerative;
import flintstones.model.problemelement.service.IProblemElementService;
import flintstones.model.ui.service.UiService;
public class AHPSortIIRankingAgglomerativeUI extends PhaseMethodUI {
@Inject
IProblemElementService problemService;
Expert selectedExpert;
Criterion selectedCriterion;
AHPSortIIRankingModelAgglomerative model;
HtmlTextTable criterionWeightsTable;
HtmlTextTable clustersTable;
HtmlTextTable alternativeLocalTable;
HtmlTextTable profileGlobalTable;
HtmlTextTable alternativeGlobalTable;
HashMap<String, Boolean> visibleComposite = new HashMap<>();
@Override
public void init() {
model = (AHPSortIIRankingModelAgglomerative) this.getModel();
model.execute();
createPartControls(this.getBaseComposite());
}
@Override
public void refresh() {
// TODO Auto-generated method stub
}
@Override
protected boolean isForwardEnabled() {
return true;
}
private void createPartControls(Composite base) {
UiService.setGridLayout(base, 1);
UiService.setGridDataAuto(base);
Composite chartC = createBlock(base, "Chart");
createChart(chartC);
Composite chartOptionsC = new Composite(chartC, SWT.NONE);
UiService.setGridData(chartOptionsC, 9, 9, false, false);
UiService.setGridLayout(chartOptionsC, 9, false);
createChartOptions(chartOptionsC);
Composite c2 = createBlock(base, "Profile/ReferencePoint local priorities");
createClutersTable(c2);
}
JFreeChart chart;
ChartComposite chartBase;
private void createChartOptions(Composite parent) {
ProblemElementSelector selectorExpert = new ProblemElementSelector(parent, problemService.getAll(Expert.Type));
selectorExpert.setListener(new IProblemElementChangedListener() {
@Override
public void problemElementChanged(ProblemElement pe) {
selectedExpert = (Expert) pe;
drawChart();
drawTable();
}
});
ProblemElementSelector selectorCriterion = new ProblemElementSelector(parent, problemService.getAll(Criterion.Type));
selectorCriterion.setListener(new IProblemElementChangedListener() {
@Override
public void problemElementChanged(ProblemElement pe) {
selectedCriterion = (Criterion) pe;
drawChart();
drawTable();
}
});
}
private void drawChart() {
if (selectedCriterion == null)
selectedCriterion = (Criterion) problemService.getAll(Criterion.Type)[0];
if (selectedExpert == null)
selectedExpert = (Expert) problemService.getAll(Expert.Type)[0];
chart = ChartFactory.createXYLineChart("Local priorities for " + selectedExpert.getName() + " - " + selectedCriterion.getName(), "Reference Points/Profiles",
"Value", model.getDataset(selectedExpert, selectedCriterion), PlotOrientation.VERTICAL, false, true, false);
if (chartBase != null) {
chartBase.setChart(chart);
chart.fireChartChanged();
}
addChartDecorations();
}
private void addChartDecorations() {
XYPlot plot = chart.getXYPlot();
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setSeriesStroke(0, new BasicStroke(2.0f));
plot.setRenderer(renderer);
plot.setBackgroundPaint(Color.WHITE);
}
private void createChart(Composite parent) {
drawChart();
chartBase = new ChartComposite(parent, 0, chart);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.heightHint = 160;
chartBase.setLayoutData(gd);
//UiService.setGridData(chartBase, 9, 9, true, true);
}
private Composite createBlock(Composite parent, String name) {
Composite base = new Composite(parent, 0);
UiService.setGridData(base, 9, 9, true, true);
UiService.setGridLayout(base, 1);
CLabel title = new CLabel(base, 0);
title.setText(name);
UiService.setFont(title, UiService.FONT_SECTION_TITLE);
Composite tableBase = new Composite(base, 0);
UiService.setGridData(tableBase, 9, 9, true, true);
UiService.setGridLayout(tableBase, 1);
return tableBase;
}
private void drawTable() {
TableAdapter adapter = model.getClustersTable(selectedExpert);
clustersTable.refresh(adapter.getData());
clustersTable.render();
}
private void createClutersTable(Composite tableBase) { // X
TableAdapter adapter = model.getClustersTable(selectedExpert);
clustersTable = new HtmlTextTable(tableBase, adapter.getData(), adapter.getHorizontalHeaders(),
adapter.getVerticalHeaders());
clustersTable.render();
}
}
@@ -0,0 +1,190 @@
package flintstones.method.ahp.sortii.phase.ranking.ui;
import java.awt.BasicStroke;
import java.awt.Color;
import java.util.HashMap;
import javax.inject.Inject;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.chart.swt.ChartComposite;
import flintstones.entity.method.phase.ui.PhaseMethodUI;
import flintstones.entity.problemelement.entities.Criterion;
import flintstones.entity.problemelement.entities.Expert;
import flintstones.entity.problemelement.entities.ProblemElement;
import flintstones.entity.problemelement.ui.widget.ProblemElementSelector;
import flintstones.entity.problemelement.ui.widget.listener.IProblemElementChangedListener;
import flintstones.helper.data.adapter.TableAdapter;
import flintstones.helper.html.table.HtmlTextTable;
import flintstones.method.ahp.sortii.phase.ranking.AHPSortIIRankingModel;
import flintstones.model.problemelement.service.IProblemElementService;
import flintstones.model.ui.service.UiService;
public class AHPSortIIRankingUI extends PhaseMethodUI {
@Inject
IProblemElementService problemService;
Expert selectedExpert;
Criterion selectedCriterion;
AHPSortIIRankingModel model;
HtmlTextTable criterionWeightsTable;
HtmlTextTable clustersTable;
HtmlTextTable alternativeLocalTable;
HtmlTextTable profileGlobalTable;
HtmlTextTable alternativeGlobalTable;
HashMap<String, Boolean> visibleComposite = new HashMap<>();
@Override
public void init() {
model = (AHPSortIIRankingModel) this.getModel();
model.execute();
createPartControls(this.getBaseComposite());
}
@Override
public void refresh() {
// TODO Auto-generated method stub
}
@Override
protected boolean isForwardEnabled() {
return true;
}
private void createPartControls(Composite base) {
UiService.setGridLayout(base, 1);
UiService.setGridDataAuto(base);
Composite chartC = createBlock(base, "Chart");
createChart(chartC);
Composite chartOptionsC = new Composite(chartC, SWT.NONE);
UiService.setGridData(chartOptionsC, 9, 9, false, false);
UiService.setGridLayout(chartOptionsC, 9, false);
createChartOptions(chartOptionsC);
Composite c2 = createBlock(base, "Profile/ReferencePoint local priorities");
createClutersTable(c2);
}
JFreeChart chart;
ChartComposite chartBase;
private void createChartOptions(Composite parent) {
ProblemElementSelector selectorExpert = new ProblemElementSelector(parent, problemService.getAll(Expert.Type));
selectorExpert.setListener(new IProblemElementChangedListener() {
@Override
public void problemElementChanged(ProblemElement pe) {
selectedExpert = (Expert) pe;
drawChart();
drawTable();
}
});
ProblemElementSelector selectorCriterion = new ProblemElementSelector(parent, problemService.getAll(Criterion.Type));
selectorCriterion.setListener(new IProblemElementChangedListener() {
@Override
public void problemElementChanged(ProblemElement pe) {
selectedCriterion = (Criterion) pe;
drawChart();
drawTable();
}
});
}
private void drawChart() {
if (selectedCriterion == null)
selectedCriterion = (Criterion) problemService.getAll(Criterion.Type)[0];
if (selectedExpert == null)
selectedExpert = (Expert) problemService.getAll(Expert.Type)[0];
chart = ChartFactory.createXYLineChart("Local priorities for " + selectedExpert.getName() + " - " + selectedCriterion.getName(), "Reference Points/Profiles",
"Value", model.getDataset(selectedExpert, selectedCriterion), PlotOrientation.VERTICAL, false, true, false);
if (chartBase != null) {
chartBase.setChart(chart);
chart.fireChartChanged();
}
addChartDecorations();
}
private void addChartDecorations() {
XYPlot plot = chart.getXYPlot();
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setSeriesStroke(0, new BasicStroke(2.0f));
plot.setRenderer(renderer);
plot.setBackgroundPaint(Color.WHITE);
}
private void createChart(Composite parent) {
drawChart();
chartBase = new ChartComposite(parent, 0, chart);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.heightHint = 160;
chartBase.setLayoutData(gd);
//UiService.setGridData(chartBase, 9, 9, true, true);
}
private Composite createBlock(Composite parent, String name) {
Composite base = new Composite(parent, 0);
UiService.setGridData(base, 9, 9, true, true);
UiService.setGridLayout(base, 1);
CLabel title = new CLabel(base, 0);
title.setText(name);
UiService.setFont(title, UiService.FONT_SECTION_TITLE);
Composite tableBase = new Composite(base, 0);
UiService.setGridData(tableBase, 9, 9, true, true);
UiService.setGridLayout(tableBase, 1);
return tableBase;
}
private void drawTable() {
TableAdapter adapter = model.getClustersTable(selectedExpert);
clustersTable.refresh(adapter.getData());
clustersTable.render();
}
private void createClutersTable(Composite tableBase) { // X
TableAdapter adapter = model.getClustersTable(selectedExpert);
clustersTable = new HtmlTextTable(tableBase, adapter.getData(), adapter.getHorizontalHeaders(),
adapter.getVerticalHeaders());
clustersTable.render();
}
}