public code v1
This commit is contained in:
@@ -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-11"/>
|
||||
<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.sort.fuzzy.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.sort.fuzzy.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>1779484362624</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>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=11
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
||||
@@ -0,0 +1,24 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Ui
|
||||
Bundle-SymbolicName: flintstones.method.ahp.sort.fuzzy.ranking.ui;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Automatic-Module-Name: flintstones.method.ahp.sort.fuzzy.ranking.ui
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Require-Bundle: flintstones.entity.method.phase.ui,
|
||||
org.eclipse.swt,
|
||||
flintstones.model.ui.service,
|
||||
javax.inject,
|
||||
flintstones.model.problemelement.service,
|
||||
flintstones.helper.html,
|
||||
flintstones.entity.problemelement.ui,
|
||||
flintstones.method.ahp.sortii.phase.ranking,
|
||||
flintstones.method.ahp.sort.fuzzy.ranking,
|
||||
flintstones.entity.method.phase,
|
||||
flintstones.operator,
|
||||
flintstones.entity.operator,
|
||||
flintstones.valuation.proportionaltwotuple,
|
||||
org.eclipse.e4.core.services,
|
||||
flintstones.domain.fuzzyset.ui.chart,
|
||||
flintstones.entity.domain,
|
||||
org.jfree.chart.jfreechart
|
||||
@@ -0,0 +1,5 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="flintstones.phasemethod.ui">
|
||||
<phasemethod_ui
|
||||
implementation="flintstones.method.ahp.sort.fuzzy.ranking.ui.FuzzyAHPSortRankingUI"
|
||||
phasemethod="flintstones.method.ahp.sort.fuzzy.ranking"
|
||||
uid="flintstones.method.ahp.sort.fuzzy.ranking.ui.FuzzyAHPSortRankingUI">
|
||||
</phasemethod_ui>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
+294
@@ -0,0 +1,294 @@
|
||||
package flintstones.method.ahp.sort.fuzzy.ranking.ui;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.core.services.nls.Translation;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.CLabel;
|
||||
import org.eclipse.swt.events.ControlAdapter;
|
||||
import org.eclipse.swt.events.ControlEvent;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Spinner;
|
||||
|
||||
import flintstones.domain.fuzzyset.ui.chart.LinguisticDomainChart;
|
||||
import flintstones.entity.method.phase.ui.PhaseMethodUI;
|
||||
import flintstones.entity.operator.AggregationOperator;
|
||||
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.DoubleHelper;
|
||||
import flintstones.helper.data.adapter.TableAdapter;
|
||||
import flintstones.helper.html.table.HtmlTextTable;
|
||||
import flintstones.method.ahp.sort.fuzzy.ranking.FuzzyAHPSortRanking;
|
||||
import flintstones.method.ahp.sort.fuzzy.ranking.ui.messages.Messages;
|
||||
import flintstones.model.problemelement.service.IProblemElementService;
|
||||
import flintstones.model.ui.service.UiService;
|
||||
import flintstones.operator.service.IOperatorService;
|
||||
|
||||
public class FuzzyAHPSortRankingUI extends PhaseMethodUI {
|
||||
|
||||
@Inject
|
||||
IProblemElementService problemService;
|
||||
|
||||
@Inject
|
||||
IOperatorService operatorService;
|
||||
|
||||
@Inject
|
||||
@Translation
|
||||
private Messages messages;
|
||||
|
||||
Expert selectedExpert;
|
||||
AggregationOperator operator;
|
||||
LinguisticDomainChart chart;
|
||||
Composite compositeChart;
|
||||
|
||||
private ControlAdapter _controlListener;
|
||||
|
||||
FuzzyAHPSortRanking model;
|
||||
|
||||
HtmlTextTable profileGlobalTable;
|
||||
HtmlTextTable alternativeGlobalTable;
|
||||
HtmlTextTable alternativeAggregatedTable;
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
model = (FuzzyAHPSortRanking) this.getModel();
|
||||
model.execute();
|
||||
|
||||
createPartControls(this.baseComposite);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
updateTables();
|
||||
updateChart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isForwardEnabled() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
private void createPartControls(Composite base) {
|
||||
|
||||
selectedExpert = (Expert) problemService.getAll(Expert.Type)[0];
|
||||
|
||||
UiService.setGridLayout(base, 1);
|
||||
UiService.setGridDataAuto(base);
|
||||
|
||||
Composite comboComposite = new Composite(base, SWT.NONE);
|
||||
UiService.setGridData(comboComposite, 0, 9, false, false);
|
||||
UiService.setGridLayout(comboComposite, 5);
|
||||
ProblemElementSelector selectorExpert = new ProblemElementSelector(comboComposite, problemService.getAll(Expert.Type));
|
||||
selectorExpert.setListener(new IProblemElementChangedListener() {
|
||||
@Override
|
||||
public void problemElementChanged(ProblemElement pe) {
|
||||
selectedExpert = (Expert) pe;
|
||||
updateTables();
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
||||
Combo typeSelector = new Combo(comboComposite, SWT.NONE);
|
||||
typeSelector.add("Triangular"); //$NON-NLS-1$
|
||||
if (!model.central)
|
||||
typeSelector.add("Trapezoidal"); //$NON-NLS-1$
|
||||
typeSelector.select(0);
|
||||
|
||||
Label label = new Label(comboComposite, SWT.NONE);
|
||||
label.setText("Alfa: ");
|
||||
label.setVisible(false);
|
||||
Spinner alfaValue = new Spinner(comboComposite, SWT.NONE);
|
||||
alfaValue.setDigits(3);
|
||||
alfaValue.setMinimum(0);
|
||||
alfaValue.setMaximum(1000);
|
||||
alfaValue.setValues(ChangeDoubleToInt(model.getAlfaValue(selectedExpert), alfaValue), 0, 1000, 3, 1, 1);
|
||||
alfaValue.setVisible(false);
|
||||
alfaValue.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
// Al modificar el valor Q, recalcula la solucion
|
||||
model.setAlfaValue(selectedExpert, DoubleHelper.ParseDouble(alfaValue.getText()));
|
||||
model.recalculate();
|
||||
updateTables();
|
||||
updateChart();
|
||||
sendRefresh();
|
||||
}
|
||||
});
|
||||
|
||||
typeSelector.addModifyListener(new ModifyListener() {
|
||||
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
// Al modificar el ranking a usar, recalcula la solucion
|
||||
switch (typeSelector.getSelectionIndex()) {
|
||||
case 0:
|
||||
model.triangular = true;
|
||||
alfaValue.setVisible(false);
|
||||
label.setVisible(false);
|
||||
model.recalculate();
|
||||
updateTables();
|
||||
updateChart();
|
||||
break;
|
||||
case 1:
|
||||
model.triangular = false;
|
||||
alfaValue.setValues(ChangeDoubleToInt(model.getAlfaValue(selectedExpert), alfaValue), 0, 1000, 3, 1, 1);
|
||||
alfaValue.setVisible(true);
|
||||
label.setVisible(true);
|
||||
model.recalculate();
|
||||
break;
|
||||
default:
|
||||
model.triangular = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
Composite compositeSuperior = new Composite(base, 0);
|
||||
UiService.setGridData(compositeSuperior, 9, 9, true, true);
|
||||
UiService.setGridLayout(compositeSuperior, 2);
|
||||
|
||||
Composite classesPrioritiesComposite = createBlock(compositeSuperior, messages.profileGlobalPriorities); // $NON-NLS-1$
|
||||
UiService.setGridData(classesPrioritiesComposite, 9, 9, false, true);
|
||||
createProfileGlobalPrioritiesTable(classesPrioritiesComposite);
|
||||
|
||||
Composite alternativesPrioritiesComposite = createBlock(compositeSuperior, messages.alternativeGlobalPriorities); // $NON-NLS-1$
|
||||
createAlternativeGlobalPrioritiesTable(alternativesPrioritiesComposite);
|
||||
|
||||
compositeChart = new Composite(base, SWT.NONE);
|
||||
compositeChart.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
|
||||
updateChart();
|
||||
|
||||
// aggregationPart(compositeSuperior);
|
||||
|
||||
}
|
||||
|
||||
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.getClassesGlobalTable(selectedExpert);
|
||||
profileGlobalTable = new HtmlTextTable(tableBase, adapter.getDataRow(), adapter.getHorizontalHeaders(), true);
|
||||
profileGlobalTable.render();
|
||||
|
||||
}
|
||||
|
||||
private void updateChart() {
|
||||
removeChart();
|
||||
|
||||
Point size = compositeChart.getSize();
|
||||
chart = new LinguisticDomainChart();
|
||||
System.out.println(model.getMaxPriorityValue(selectedExpert));
|
||||
chart.initialize(model.getDomain(selectedExpert), compositeChart, size.x, size.y, 0, model.getMaxPriorityValue(selectedExpert) * 1.1, SWT.BORDER);
|
||||
|
||||
if (_controlListener == null) {
|
||||
_controlListener = new ControlAdapter() {
|
||||
|
||||
@Override
|
||||
public void controlResized(ControlEvent e) {
|
||||
updateChart();
|
||||
}
|
||||
};
|
||||
compositeChart.addControlListener(_controlListener);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeChart() {
|
||||
if (chart != null) {
|
||||
chart.getChartComposite().dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private Composite createBlock(Composite parent, String name) {
|
||||
|
||||
Composite base = new Composite(parent, SWT.NONE);
|
||||
UiService.setGridData(base, 9, 9, true, true);
|
||||
UiService.setGridLayout(base, 1);
|
||||
|
||||
CLabel title = new CLabel(base, SWT.NONE);
|
||||
title.setText(name);
|
||||
|
||||
UiService.setFont(title, UiService.FONT_SECTION_TITLE);
|
||||
|
||||
Composite tableBase = new Composite(base, SWT.NONE);
|
||||
UiService.setGridData(tableBase, 9, 9, true, true);
|
||||
UiService.setGridLayout(tableBase, 1);
|
||||
|
||||
return tableBase;
|
||||
|
||||
}
|
||||
|
||||
private void updateTables() {
|
||||
|
||||
TableAdapter adapter1 = model.getAlternativeGlobalTable(selectedExpert);
|
||||
TableAdapter adapter2 = model.getClassesGlobalTable(selectedExpert);
|
||||
|
||||
profileGlobalTable.refresh(adapter2.getDataRow());
|
||||
alternativeGlobalTable.refresh(adapter1.getData());
|
||||
|
||||
profileGlobalTable.render();
|
||||
alternativeGlobalTable.render();
|
||||
}
|
||||
|
||||
// Parte agregación
|
||||
|
||||
/*private void aggregationPart(Composite compositeSuperior) {
|
||||
Composite aggregatedPrioritiesComposite = createBlock(compositeSuperior, messages.aggregatedGlobalPriorities); // $NON-NLS-1$
|
||||
UiService.setGridData(aggregatedPrioritiesComposite, 9, 9, false, true);
|
||||
UiService.setGridLayout(aggregatedPrioritiesComposite, 2);
|
||||
Label operatorLabel = new Label(aggregatedPrioritiesComposite, SWT.NONE);
|
||||
operatorLabel.setText(messages.operatorSelection); // $NON-NLS-1$
|
||||
Combo operatorSelector = new Combo(aggregatedPrioritiesComposite, SWT.NONE);
|
||||
AggregationOperator[] operators = operatorService.getAggregationOperatorsFor(ProportionalTwoTuple.ID, false);
|
||||
String[] operatorsName = new String[operators.length];
|
||||
|
||||
for (int i = 0; i < operators.length; ++i)
|
||||
operatorsName[i] = operators[i].getName();
|
||||
|
||||
operatorSelector.setItems(operatorsName);
|
||||
operatorSelector.addModifyListener(new ModifyListener() {
|
||||
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
operator = operators[operatorSelector.getSelectionIndex()];
|
||||
}
|
||||
|
||||
});
|
||||
operatorSelector.select(0);
|
||||
// operatorId = operators[0].getId();
|
||||
|
||||
Composite aggregatedTableComposite = new Composite(aggregatedPrioritiesComposite, SWT.NONE);
|
||||
UiService.setGridData(aggregatedTableComposite, 9, 9, true, true);
|
||||
UiService.setGridLayout(aggregatedTableComposite, 1);
|
||||
|
||||
createAlternativeAggregatedTable(aggregatedTableComposite);
|
||||
}*/
|
||||
|
||||
/*private void createAlternativeAggregatedTable(Composite tableBase) {
|
||||
TableAdapter adapter = model.getAggregatedTable(operator);
|
||||
profileGlobalTable = new HtmlTextTable(tableBase, adapter.getDataRow(), adapter.getHorizontalHeaders(), true);
|
||||
profileGlobalTable.render();
|
||||
}*/
|
||||
|
||||
private int ChangeDoubleToInt(double number, Spinner spinner) {
|
||||
double newNumber = number;
|
||||
newNumber *= Math.pow(10, spinner.getDigits());
|
||||
return (int) newNumber;
|
||||
}
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package flintstones.method.ahp.sort.fuzzy.ranking.ui.messages;
|
||||
|
||||
import org.eclipse.e4.core.services.nls.Message;
|
||||
|
||||
@Message
|
||||
@SuppressWarnings("javadoc")
|
||||
public class Messages {
|
||||
public String profileGlobalPriorities;
|
||||
public String alternativeGlobalPriorities;
|
||||
public String aggregatedGlobalPriorities;
|
||||
public String operatorSelection;
|
||||
public String classesChart;
|
||||
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
profileGlobalPriorities=Classes global priorities
|
||||
alternativeGlobalPriorities=Alternatives global priorities
|
||||
aggregatedGlobalPriorities=Aggregated global priorities
|
||||
operatorSelection=Select operator for aggregation:
|
||||
classesChart=Classes chart
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
profileGlobalPriorities=Prioridades globales de las clases
|
||||
alternativeGlobalPriorities=Prioridades globales de las alternativas
|
||||
aggregatedGlobalPriorities=Prioridades globales agregadas
|
||||
operatorSelection=Seleccione un operador para la agregación:
|
||||
classesChart=Gráfico de clases
|
||||
Reference in New Issue
Block a user