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>
|
||||
+14
@@ -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.decision.common.phase.calculatesolutions.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.decision.common.phase.calculatesolutions.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>1779484362656</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
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Ui
|
||||
Bundle-SymbolicName: flintstones.method.decision.common.phase.calculatesolutions.ui;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Automatic-Module-Name: flintstones.method.decision.common.phase.calculatesolutions.ui
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Require-Bundle: flintstones.entity.ahp.decisionmatrix,
|
||||
flintstones.method.decision.common.phase.calculatesolutions,
|
||||
org.eclipse.swt,
|
||||
flintstones.helper.ui,
|
||||
javax.inject,
|
||||
flintstones.helper.wtable,
|
||||
flintstones.helper.data,
|
||||
flintstones.valuation.twoTuple,
|
||||
flintstones.entity.wvaluation,
|
||||
flintstones.entity.problemelement,
|
||||
flintstones.entity.valuation,
|
||||
flintstones.model.ui.service,
|
||||
flintstones.entity.method.phase,
|
||||
flintstones.entity.method.phase.ui
|
||||
+5
@@ -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.decision.common.phase.calculatesolutions.ui"
|
||||
implementation="flintstones.method.decision.common.phase.calculatesolutions.ui.CalculateSolutionsUI"
|
||||
phasemethod="flintstones.method.decision.common.phase.calculatesolutions">
|
||||
</phasemethod_ui>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
+176
@@ -0,0 +1,176 @@
|
||||
package flintstones.method.decision.common.phase.calculatesolutions.ui;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.eclipse.jface.viewers.ArrayContentProvider;
|
||||
import org.eclipse.jface.viewers.ColumnLabelProvider;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.jface.viewers.TableViewerColumn;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
|
||||
import flintstones.entity.ahp.decisionmatrix.DecisionMatrix;
|
||||
import flintstones.entity.method.phase.ui.PhaseMethodUI;
|
||||
import flintstones.entity.wvaluation.WValuation;
|
||||
import flintstones.helper.MatrixHelper;
|
||||
import flintstones.helper.wtable.WTable;
|
||||
import flintstones.helper.wtable.WTableModel;
|
||||
import flintstones.method.decision.common.phase.calculatesolutions.CalculateSolutionsModel;
|
||||
import flintstones.model.ui.service.UiService;
|
||||
|
||||
public class CalculateSolutionsUI extends PhaseMethodUI {
|
||||
|
||||
CalculateSolutionsModel model;
|
||||
|
||||
WTableModel decisionMatrixModel;
|
||||
WTable decisionMatrixTable;
|
||||
|
||||
boolean transposed = true;
|
||||
|
||||
private TableViewer idealSolutionTV;
|
||||
private TableViewer negativeSolutionTV;
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
model = (CalculateSolutionsModel)this.getModel();
|
||||
createControls(this.getBaseComposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isForwardEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void createControls(Composite parent) {
|
||||
|
||||
UiService.setGridData(parent, 9, 9, true, true);
|
||||
UiService.setGridLayout(parent, 1);
|
||||
|
||||
Composite topRow = new Composite(parent,0);
|
||||
UiService.setGridData(topRow, 9, 9, true, true);
|
||||
UiService.setGridLayout(topRow, 1);
|
||||
|
||||
createDecisionMatrixTable(topRow);
|
||||
|
||||
Composite bottomRow = new Composite(parent,0);
|
||||
UiService.setGridData(bottomRow, 9, 9, true, false);
|
||||
UiService.setGridLayout(bottomRow, 2);
|
||||
|
||||
idealSolutionTV = createIdealSolutionTable(bottomRow, idealSolutionTV, true );
|
||||
idealSolutionTV.setInput( model.getPositiveIdealSolution() );
|
||||
Arrays.stream(idealSolutionTV.getTable().getColumns()).forEach(k -> k.pack());
|
||||
|
||||
negativeSolutionTV = createIdealSolutionTable(bottomRow, negativeSolutionTV, false );
|
||||
negativeSolutionTV.setInput( model.getNegativeIdealSolution() );
|
||||
Arrays.stream(negativeSolutionTV.getTable().getColumns()).forEach(k -> k.pack());
|
||||
|
||||
}
|
||||
|
||||
private TableViewer createIdealSolutionTable(Composite bottomRow, TableViewer solutionTV, boolean positive) {
|
||||
|
||||
Composite base = new Composite(bottomRow, SWT.NONE);
|
||||
UiService.setGridData(base, 9, 9, true, true);
|
||||
UiService.setGridLayout(base, 1);
|
||||
|
||||
Label titleLabel = new Label(base, SWT.NONE);
|
||||
String title = positive ? "Positive" : "Negative";
|
||||
titleLabel.setText(title + " Ideal Solution");
|
||||
|
||||
UiService.setFont(titleLabel, UiService.FONT_SECTION_TITLE);
|
||||
UiService.setGridData(titleLabel, 0, -1, true, false);
|
||||
|
||||
solutionTV = new TableViewer(base, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
|
||||
solutionTV.getTable()
|
||||
.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
|
||||
solutionTV.getTable()
|
||||
.setHeaderVisible(true);
|
||||
|
||||
solutionTV.setContentProvider(new ArrayContentProvider());
|
||||
|
||||
TableViewerColumn criterionColumn = new TableViewerColumn(solutionTV, SWT.NONE);
|
||||
criterionColumn.getColumn().setText("Criterion");
|
||||
criterionColumn.getColumn().setResizable(false);
|
||||
criterionColumn.getColumn().setMoveable(false);
|
||||
|
||||
criterionColumn.setLabelProvider(new ColumnLabelProvider() {
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
WValuation item = (WValuation)element;
|
||||
return item.getPEK().getCriterion().getCanonicalName();
|
||||
}
|
||||
});
|
||||
|
||||
TableViewerColumn typeColumn = new TableViewerColumn(solutionTV, SWT.NONE);
|
||||
typeColumn.getColumn().setText("Type");
|
||||
typeColumn.getColumn().setResizable(false);
|
||||
typeColumn.getColumn().setMoveable(false);
|
||||
|
||||
typeColumn.setLabelProvider(new ColumnLabelProvider() {
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getImage(Object element) {
|
||||
WValuation item = (WValuation)element;
|
||||
|
||||
if( item.getPEK().getCriterion().isCost())
|
||||
return UiService.getIcon("cost.png").createImage();
|
||||
return UiService.getIcon("benefit.png").createImage();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
TableViewerColumn valuationColumn = new TableViewerColumn(solutionTV, SWT.NONE);
|
||||
valuationColumn.getColumn().setText("Valuation");
|
||||
valuationColumn.getColumn().setResizable(true);
|
||||
valuationColumn.getColumn().setMoveable(true);
|
||||
valuationColumn.setLabelProvider(new ColumnLabelProvider() {
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
WValuation item = (WValuation)element;
|
||||
return item.getValuation().changeFormatValuationToString();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return solutionTV;
|
||||
|
||||
}
|
||||
|
||||
private void createDecisionMatrixTable(Composite parent) {
|
||||
Composite base = new Composite(parent, SWT.BORDER);
|
||||
UiService.setGridData(base, 9, 9, true, true);
|
||||
UiService.setGridLayout(base, 1);
|
||||
|
||||
base.setLayout(new FillLayout());
|
||||
decisionMatrixTable = new WTable(base,SWT.V_SCROLL);
|
||||
decisionMatrixModel = new WTableModel(decisionMatrixTable);
|
||||
|
||||
DecisionMatrix dm = model.getDecisionMatrix();
|
||||
|
||||
if(transposed) {
|
||||
decisionMatrixModel.addContent(MatrixHelper.transpose(dm.getValues()));
|
||||
decisionMatrixModel.setHorizontalHeaders(dm.getAlternativeHeader().toArray(new String[0]));
|
||||
decisionMatrixModel.setVerticalHeaders(dm.getCriterionHeader().toArray(new String[0]));
|
||||
} else {
|
||||
decisionMatrixModel.addContent(dm.getValues());
|
||||
decisionMatrixModel.setHorizontalHeaders(dm.getCriterionHeader().toArray(new String[0]));
|
||||
decisionMatrixModel.setVerticalHeaders(dm.getAlternativeHeader().toArray(new String[0]));
|
||||
}
|
||||
|
||||
decisionMatrixTable.setModel(decisionMatrixModel);
|
||||
decisionMatrixModel.init();
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user