public code v1
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<?flintstones.helper.data.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,17 @@
|
||||
<?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.valuation.numeric.real.ui</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<name>[bundle] Ui</name>
|
||||
<organization>
|
||||
<name>Sinbad2</name>
|
||||
</organization>
|
||||
</project>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>flintstones.valuation.numeric.real.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>1779484362752</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
|
||||
@@ -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,19 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Ui
|
||||
Bundle-SymbolicName: flintstones.valuation.numeric.real.ui;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: Sinbad2
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Automatic-Module-Name: flintstones.valuation.real.ui
|
||||
Require-Bundle: flintstones.valuation.ui,
|
||||
flintstones.valuation.numeric.real,
|
||||
flintstones.domain.numeric.real,
|
||||
org.eclipse.wb.swt,
|
||||
org.eclipse.swt,
|
||||
javax.inject,
|
||||
flintstones.entity.domain,
|
||||
flintstones.model.valuation.service,
|
||||
flintstones.entity.valuation,
|
||||
org.eclipse.nebula.widgets.opal.notifier,
|
||||
flintstones.model.ui.service
|
||||
@@ -0,0 +1,5 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE xml>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="flintstones.valuation.ui.extensionpoint">
|
||||
<valuation_ui
|
||||
uid="flintstones.valuation.real.ui"
|
||||
valuation="flintstones.valuation.real"
|
||||
valuation_panel="flintstones.valuation.numeric.real.ui.ValuationPanelReal">
|
||||
</valuation_ui>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
package flintstones.valuation.numeric.real.ui;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.core.services.nls.Translation;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Spinner;
|
||||
import org.eclipse.wb.swt.SWTResourceManager;
|
||||
|
||||
import flintstones.domain.numeric.NumericDomain;
|
||||
import flintstones.domain.numeric.real.NumericRealDomain;
|
||||
import flintstones.entity.valuation.Valuation;
|
||||
import flintstones.model.ui.service.UiService;
|
||||
import flintstones.model.valuation.service.IValuationService;
|
||||
import flintstones.valuation.numeric.real.RealValuation;
|
||||
import flintstones.valuation.numeric.real.ui.messages.Messages;
|
||||
import flintstones.valuation.ui.ValuationPanel;
|
||||
|
||||
@SuppressWarnings("javadoc")
|
||||
public class ValuationPanelReal extends ValuationPanel {
|
||||
|
||||
@Inject
|
||||
IValuationService valuationService;
|
||||
|
||||
@Inject
|
||||
@Translation
|
||||
private Messages messages;
|
||||
|
||||
private Spinner valueSpinner;
|
||||
private double value;
|
||||
|
||||
@Override
|
||||
protected void createControls() {
|
||||
UiService.setGridLayout(this.valuationPart, 1);
|
||||
|
||||
createBlock1Title();
|
||||
createBlock2Spinner();
|
||||
}
|
||||
|
||||
private void createBlock1Title() {
|
||||
Label titleLabel = new Label(this.valuationPart, SWT.NONE);
|
||||
titleLabel.setFont(SWTResourceManager.getFont("Cantarell", 11, SWT.BOLD)); //$NON-NLS-1$
|
||||
GridData gd = UiService.setGridData(titleLabel, 0, 0, true, false);
|
||||
gd.verticalIndent = 15;
|
||||
titleLabel.setText(this.messages.Real_evaluation);
|
||||
titleLabel.setBackground(new Color(Display.getCurrent(), 255, 255, 255));
|
||||
}
|
||||
|
||||
private void createBlock2Spinner() {
|
||||
this.valueSpinner = new Spinner(this.valuationPart, SWT.BORDER);
|
||||
GridData gd = UiService.setGridData(this.valueSpinner, 9, 1, true, false);
|
||||
gd.verticalIndent = 10;
|
||||
|
||||
double min = ((NumericRealDomain) this.domain).getMin();
|
||||
double max = ((NumericRealDomain) this.domain).getMax();
|
||||
this.value = ((NumericRealDomain) this.domain).midpoint();
|
||||
|
||||
if (this.valuation != null)
|
||||
this.value = (((RealValuation) this.valuation).getValue());
|
||||
|
||||
this.valueSpinner.setDigits(6);
|
||||
this.valueSpinner.setMinimum((int) (min * 1000000d));
|
||||
this.valueSpinner.setMaximum((int) (max * 1000000d));
|
||||
this.valueSpinner.setSelection((int) (this.value * 1000000d));
|
||||
|
||||
this.valueSpinner.addModifyListener(e -> {
|
||||
ValuationPanelReal.this.value = ValuationPanelReal.this.valueSpinner.getSelection() / 1000000d;
|
||||
ValuationPanelReal.this.selectionChange();
|
||||
});
|
||||
|
||||
ValuationPanelReal.this.selectionChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSelection() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Valuation createNewValuation() {
|
||||
|
||||
RealValuation result = null;
|
||||
|
||||
if (this.valuation == null) {
|
||||
result = (RealValuation) this.valuationService.create(this.domain);
|
||||
result.setDomain(this.domain);
|
||||
} else
|
||||
result = (RealValuation) this.valuation.clone();
|
||||
|
||||
if(this.value >= ((NumericDomain) this.domain).getMin()
|
||||
&& this.value <= ((NumericDomain) this.domain).getMax())
|
||||
result.setValue(this.value);
|
||||
|
||||
result.setEvaluated(true);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// This file has been auto-generated
|
||||
package flintstones.valuation.numeric.real.ui.messages;
|
||||
|
||||
import org.eclipse.e4.core.services.nls.Message;
|
||||
|
||||
@Message
|
||||
@SuppressWarnings("javadoc")
|
||||
public class Messages {
|
||||
|
||||
public String Real_evaluation;
|
||||
public String Value;
|
||||
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Real_evaluation=Real evaluation
|
||||
Value=Value
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Real_evaluation=Evaluación real
|
||||
Value=Valor
|
||||
Reference in New Issue
Block a user