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-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.common.phase.collectweights.ahp.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.common.phase.collectweights.ahp.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>1779484362640</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
|
||||
+7
@@ -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
|
||||
+4
@@ -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.common.phase.collectweights.ahp.ui;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Automatic-Module-Name: flintstones.method.common.phase.collectweights.ahp.ui
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Require-Bundle: flintstones.entity.method.phase.ui,
|
||||
org.eclipse.swt,
|
||||
flintstones.model.ui.service,
|
||||
flintstones.valuation.ahp.ui,
|
||||
flintstones.method.common.phase.collectweights.ahp,
|
||||
flintstones.entity.problemelement,
|
||||
flintstones.entity.method.phase,
|
||||
flintstones.entity.ahppreferences,
|
||||
flintstones.entity.problemelement.ui,
|
||||
flintstones.helper.html,
|
||||
org.eclipse.e4.core.contexts,
|
||||
javax.inject,
|
||||
org.eclipse.e4.core.di
|
||||
@@ -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
|
||||
uid="flintstones.method.common.phase.collectweights.ahp.ui"
|
||||
implementation="flintstones.method.common.phase.collectweights.ahp.ui.CollectWeightsAHPUI"
|
||||
phasemethod="flintstones.method.common.phase.collectweights.ahp">
|
||||
</phasemethod_ui>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
package flintstones.method.common.phase.collectweights.ahp.ui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.ScrolledComposite;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
|
||||
import flintstones.entity.ahppreferences.PreferenceMatrix;
|
||||
import flintstones.entity.method.phase.ui.PhaseMethodUI;
|
||||
import flintstones.entity.problemelement.entities.ProblemElement;
|
||||
import flintstones.entity.problemelement.ui.widget.ProblemElementSelector;
|
||||
import flintstones.entity.problemelement.ui.widget.listener.IProblemElementChangedListener;
|
||||
import flintstones.helper.html.table.HtmlTextTable;
|
||||
import flintstones.method.common.phase.collectweights.ahp.CollectWeightsAHPModel;
|
||||
import flintstones.model.ui.service.UiService;
|
||||
import flintstones.valuation.ahp.ui.AHPValuationPanel;
|
||||
import flintstones.valuation.ahp.ui.IAHPValuationPanelClickListener;
|
||||
|
||||
public class CollectWeightsAHPUI extends PhaseMethodUI implements IAHPValuationPanelClickListener {
|
||||
|
||||
ProblemElementSelector selector;
|
||||
|
||||
CollectWeightsAHPModel model;
|
||||
AHPValuationPanel panel;
|
||||
|
||||
HtmlTextTable table;
|
||||
|
||||
@Inject
|
||||
IEclipseContext context;
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
|
||||
model = (CollectWeightsAHPModel) this.getModel();
|
||||
|
||||
Composite base = new Composite(this.getBaseComposite(), 0);
|
||||
UiService.setGridLayout(base, 1);
|
||||
UiService.setGridDataAuto(base);
|
||||
|
||||
ProblemElement[] criterions = model.getCriterions();
|
||||
ProblemElement[] experts = model.getExperts();
|
||||
|
||||
Composite row1 = new Composite(base, 0);
|
||||
UiService.setGridLayout(row1, 1);
|
||||
UiService.setGridData(row1, 9, 0, true, false);
|
||||
|
||||
Label expertLabel = new Label(row1, 0);
|
||||
expertLabel.setText("Experto: ");
|
||||
UiService.setFont(expertLabel, UiService.FONT_SECTION_TITLE);
|
||||
|
||||
selector = new ProblemElementSelector(row1, experts);
|
||||
selector.setListener(new IProblemElementChangedListener() {
|
||||
|
||||
@Override
|
||||
public void problemElementChanged(ProblemElement pe) {
|
||||
panel.clear();
|
||||
panel.base1( model.getCriterions(), model.getCriterions(),getCurrentPreferenceMatrix().getMatrix());
|
||||
refreshWeights();
|
||||
}
|
||||
});
|
||||
|
||||
ScrolledComposite c1 = new ScrolledComposite(base, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
|
||||
UiService.setGridLayout(c1, 1);
|
||||
UiService.setGridData(c1, 9, 9, true, true);
|
||||
|
||||
c1.setExpandHorizontal(true);
|
||||
c1.setExpandVertical(true);
|
||||
c1.addListener(SWT.Resize, event -> {
|
||||
int width = c1.getClientArea().width;
|
||||
c1.setMinSize(base.computeSize(width, SWT.DEFAULT));
|
||||
});
|
||||
|
||||
Composite row2 = new Composite(c1, 0);
|
||||
UiService.setGridLayout(row2, 1);
|
||||
UiService.setGridData(row2, 9, 0, true, false);
|
||||
|
||||
c1.setContent(row2);
|
||||
|
||||
panel = new AHPValuationPanel(row2);
|
||||
panel.show(false);
|
||||
ContextInjectionFactory.inject(panel, context);
|
||||
panel.setButtonOnClickListener(this);
|
||||
panel.base1(criterions, criterions, getCurrentPreferenceMatrix().getMatrix());
|
||||
|
||||
Composite htmlrow = new Composite(base,0);
|
||||
UiService.setGridLayout(htmlrow, 1);
|
||||
UiService.setGridData(htmlrow, 9, 1, true, false);
|
||||
|
||||
String[] headers = Arrays.stream(model.getCriterions()).map(k -> k.getName()).toArray(String[]::new);
|
||||
String[] values = new String[headers.length];
|
||||
Arrays.fill(values, " ");
|
||||
table = new HtmlTextTable(htmlrow, values, headers, false);
|
||||
table.render();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isForwardEnabled() {
|
||||
model.getWeights(getCurrentExpert());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(ProblemElement a, ProblemElement b, int position) {
|
||||
getCurrentPreferenceMatrix().setDiagonal(a, b, position);
|
||||
panel.select(a, b, position);
|
||||
|
||||
refreshWeights();
|
||||
|
||||
sendRefresh();
|
||||
}
|
||||
|
||||
private void refreshWeights() {
|
||||
ArrayList<Double> arr = model.getWeights(getCurrentExpert());
|
||||
String[] values = arr.stream().map(k -> k+"").toArray(String[]::new);
|
||||
|
||||
String[] headers = Arrays.stream(model.getCriterions()).map(k -> k.getName()).toArray(String[]::new);
|
||||
table = new HtmlTextTable(table.getParent(), values, headers, false);
|
||||
table.render();
|
||||
}
|
||||
|
||||
private ProblemElement getCurrentExpert() {
|
||||
return selector.getSelectedElement();
|
||||
}
|
||||
|
||||
private PreferenceMatrix getCurrentPreferenceMatrix() {
|
||||
return model.getMatrix(getCurrentExpert());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user