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.topsisFuzzy.phase.results.ui</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<name>[bundle] Bundle-Name</name>
|
||||
</project>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>flintstones.method.topsisFuzzy.phase.results.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>1779484362705</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,17 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name
|
||||
Bundle-SymbolicName: flintstones.method.topsisFuzzy.phase.results.ui;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Automatic-Module-Name: flintstones.method.topsisFuzzy.phase.results.ui
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Require-Bundle: flintstones.entity.method.phase.ui,
|
||||
flintstones.method.topsisFuzzy.phase.results,
|
||||
flintstones.entity.method.phase,
|
||||
org.eclipse.swt,
|
||||
flintstones.model.ui.service,
|
||||
org.eclipse.e4.core.services,
|
||||
javax.inject,
|
||||
flintstones.helper.html,
|
||||
flintstones.engine.R,
|
||||
flintstones.entity.problemelement
|
||||
@@ -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.topsisFuzzy.phase.results.ui.TOPSISFuzzyResultsUI"
|
||||
phasemethod="flintstones.method.topsisFuzzy.phase.results"
|
||||
uid="flintstones.method.topsisFuzzy.phase.results.ui">
|
||||
</phasemethod_ui>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
package flintstones.method.topsisFuzzy.phase.results.ui;
|
||||
|
||||
import org.eclipse.e4.core.services.nls.Translation;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.rosuda.JRI.REXP;
|
||||
import org.rosuda.JRI.RVector;
|
||||
|
||||
import flintstones.entity.method.phase.ui.PhaseMethodUI;
|
||||
import flintstones.helper.html.table.HtmlTextTable;
|
||||
import flintstones.method.topsisFuzzy.phase.results.TOPSISFuzzyResults;
|
||||
import flintstones.method.topsisFuzzy.phase.results.ui.messages.Messages;
|
||||
import flintstones.model.ui.service.UiService;
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* User interface for FuzzyTOPSIS results phase
|
||||
*
|
||||
* @author jcfer
|
||||
*
|
||||
*/
|
||||
public class TOPSISFuzzyResultsUI extends PhaseMethodUI {
|
||||
|
||||
@Inject
|
||||
@Translation
|
||||
Messages msg;
|
||||
|
||||
/**
|
||||
* Phase model implementation
|
||||
*/
|
||||
TOPSISFuzzyResults model;
|
||||
|
||||
/**
|
||||
* Results table
|
||||
*/
|
||||
HtmlTextTable results;
|
||||
|
||||
/**
|
||||
* Type selector
|
||||
*/
|
||||
Combo topSelector;
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
model = (TOPSISFuzzyResults) this.getModel();
|
||||
model.loadData();
|
||||
|
||||
Composite base = this.getBaseComposite();
|
||||
UiService.setGridData(base, 0, 0, true, true);
|
||||
UiService.setGridLayout(base, 1);
|
||||
|
||||
//<---- TOP ROW COMPOSITE ---->
|
||||
Composite topRow = new Composite(base, SWT.BORDER);
|
||||
UiService.setGridData(topRow, 0, 1, true, true);
|
||||
UiService.setGridLayout(topRow, 2);
|
||||
|
||||
Label infoTopSelector = new Label(topRow, SWT.NONE);
|
||||
infoTopSelector.setText(msg.selector_info);
|
||||
|
||||
topSelector = new Combo(topRow, SWT.NONE);
|
||||
for (String norm : msg.norm_types.split(",")) {
|
||||
topSelector.add(norm);
|
||||
}
|
||||
|
||||
//<---- LOWER ROW COMPOSITE ---->
|
||||
Composite lowRow = new Composite(base, SWT.NONE);
|
||||
UiService.setGridData(lowRow, 9, 9, true, true);
|
||||
UiService.setGridLayout(lowRow, 1);
|
||||
|
||||
topSelector.addModifyListener(new ModifyListener() {
|
||||
/**
|
||||
* On type selection
|
||||
*/
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
createResultTable(lowRow);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates method results table
|
||||
*
|
||||
* @param base Composite
|
||||
*/
|
||||
private void createResultTable(Composite base) {
|
||||
REXP rexp = model.executeR(topSelector.getSelectionIndex() == 0);
|
||||
|
||||
int[] alts = (int[]) ((REXP) ((RVector) rexp.getContent()).get(0)).getContent();
|
||||
String[] rHeaders = new String[alts.length];
|
||||
for (int a = 0; a < alts.length; a++) {
|
||||
rHeaders[a] = model.allAlternatives()[alts[a] - 1].getName();
|
||||
}
|
||||
|
||||
String[] cHeaders;
|
||||
String[][] values;
|
||||
// Makes table data based on type selected (same as R-gui result table)
|
||||
if (topSelector.getSelectionIndex() == 0) {
|
||||
double[] r_vals = (double[]) ((REXP) ((RVector) rexp.getContent()).get(1)).getContent();
|
||||
int[] ranks = (int[]) ((REXP) ((RVector) rexp.getContent()).get(2)).getContent();
|
||||
|
||||
cHeaders = msg.headers_linear.split(",");
|
||||
|
||||
values = new String[alts.length][cHeaders.length];
|
||||
for (int r = 0; r < alts.length; r++) {
|
||||
values[r][0] = Double.toString(r_vals[r]);
|
||||
values[r][1] = Integer.toString(ranks[r]);
|
||||
}
|
||||
} else {
|
||||
double[] r1 = (double[]) ((REXP) ((RVector) rexp.getContent()).get(1)).getContent();
|
||||
double[] r2 = (double[]) ((REXP) ((RVector) rexp.getContent()).get(2)).getContent();
|
||||
double[] r3 = (double[]) ((REXP) ((RVector) rexp.getContent()).get(3)).getContent();
|
||||
double[] defR = (double[]) ((REXP) ((RVector) rexp.getContent()).get(4)).getContent();
|
||||
int[] ranks = (int[]) ((REXP) ((RVector) rexp.getContent()).get(5)).getContent();
|
||||
|
||||
cHeaders = msg.headers_vector.split(",");
|
||||
|
||||
values = new String[alts.length][cHeaders.length];
|
||||
for (int r = 0; r < alts.length; r++) {
|
||||
values[r][0] = Double.toString(r1[r]);
|
||||
values[r][1] = Double.toString(r2[r]);
|
||||
values[r][2] = Double.toString(r3[r]);
|
||||
values[r][3] = Double.toString(defR[r]);
|
||||
values[r][4] = Double.toString(ranks[r]);
|
||||
}
|
||||
}
|
||||
|
||||
if (results != null) {
|
||||
results.dispose();
|
||||
}
|
||||
results = new HtmlTextTable(base, values, cHeaders, rHeaders);
|
||||
results.render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads phase view
|
||||
*/
|
||||
@Override
|
||||
public void refresh() {
|
||||
sendRefresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return false, last phase
|
||||
*/
|
||||
@Override
|
||||
protected boolean isForwardEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package flintstones.method.topsisFuzzy.phase.results.ui.messages;
|
||||
|
||||
import org.eclipse.e4.core.services.nls.Message;
|
||||
|
||||
@Message
|
||||
public class Messages {
|
||||
public String selector_info;
|
||||
public String norm_types;
|
||||
public String headers_linear;
|
||||
public String headers_vector;
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
selector_info=Select normalization method:
|
||||
norm_types=Linear,Vector
|
||||
headers_linear=R, Ranking
|
||||
headers_vector=R.1, R.2, R.3, Def_R, Ranking
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
selector_info=Seleccionar método de normalización:
|
||||
norm_types=Lineal,Vector
|
||||
headers_linear=R, Clasificación
|
||||
headers_vector=R.1, R.2, R.3, Def_R, Clasificación
|
||||
Reference in New Issue
Block a user