initialize

This commit is contained in:
Pruefer
2025-06-06 09:15:13 +02:00
commit fa7c2730f1
5817 changed files with 1339670 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>data-interface-remote-gui</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,5 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8

View File

@@ -0,0 +1,8 @@
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.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8

View File

@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="data-interface-remote-gui">
<wb-resource deploy-path="/" source-path="/src/main/java"/>
<wb-resource deploy-path="/" source-path="/src/main/resources"/>
</wb-module>
</project-modules>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="java" version="1.8"/>
<installed facet="jst.utility" version="1.0"/>
</faceted-project>

View File

@@ -0,0 +1,2 @@
disabled=06target
eclipse.preferences.version=1

125
interface/remotegui/pom.xml Normal file
View File

@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-remote-gui</artifactId>
<packaging>jar</packaging>
<name>data-interface-remote-gui</name>
<version>${mes.interface.version}</version>
<parent>
<groupId>com.itac.interface</groupId>
<artifactId>data-interface</artifactId>
<version>${mes.interface.version}</version>
</parent>
<dependencies>
<dependency>
<groupId>com.itac.product</groupId>
<artifactId>artes-client</artifactId>
</dependency>
<dependency>
<groupId>com.itac.product</groupId>
<artifactId>resource-common</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface</groupId>
<artifactId>imsinterfaces-resources-export</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-basic</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-mesutil</artifactId>
</dependency>
<dependency>
<groupId>com.jgoodies</groupId>
<artifactId>jgoodies-forms</artifactId>
</dependency>
<dependency>
<groupId>com.jgoodies</groupId>
<artifactId>jgoodies-looks</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-core</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-remote-gui-definition</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-fuji</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-fuji-definition</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-cogiscan-interface</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>imsinterfaces-commonsmt-interface</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-asm-interface</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-panasonic</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-yamaha-interface</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-line-dashboard-interface</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-machine</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>imsinterfaces-samsung</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>imsinterfaces-molding</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.itac.tools</groupId>
<artifactId>webstart-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>itacWebstartClient</goal>
</goals>
</execution>
</executions>
<configuration>
<applicationName>DataInterface.jnlp</applicationName>
<title>iTAC.MES.DataInterface without GUI</title>
<description>iTAC.MES.DataInterface</description>
<category>standard</category>
<mainClass>com.itac.mes.datainterface.DataInterface</mainClass>
<offlineAllowed>true</offlineAllowed>
<!-- optional params -->
<shortdescription>iTAC.MES.Suite without Gui</shortdescription>
<tooltip>iTAC.MES.DataInterface</tooltip>
<icon>com/itac/resource/binaries/companyIcon.png</icon>
</configuration>
</plugin>
</plugins>
</build>
</project>

Binary file not shown.

View File

@@ -0,0 +1,38 @@
/*
* Copyright (c) 2013 iTAC Software AG, Germany. All Rights Reserved.
*
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
* without the written permission of iTAC Software AG.
*/
package com.itac.mes.datainterface;
import java.awt.Color;
import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.table.DefaultTableCellRenderer;
/**
* @author frankp
*
*/
public class ColorCellRenderer extends DefaultTableCellRenderer {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row,
int column) {
if (value instanceof JLabel) {
if (isSelected) {
((JLabel) value).setBackground((Color) UIManager.getColor("Table.selectionBackground"));
} else {
((JLabel) value).setBackground((Color) UIManager.getColor("Table.background"));
}
return (JLabel) value;
} else {
return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
}
}
}

View File

@@ -0,0 +1,86 @@
package com.itac.mes.datainterface;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import com.itac.mes.datainterface.data.InterfaceStartType;
import com.itac.mes.datainterface.ihap.IRemoteInterface;
import com.itac.mes.datainterface.ihap.IhapRemoteInterfaceHandler;
import com.itac.mes.datainterface.ihap.InstanceInfo;
import com.itac.mes.datainterface.ihap.InstanceState;
public class RemoteInterfaceInfo {
public String host; // auf welchem host läuft das interface
public int port; // auf welchem Port kann man das Interface erreichen
public String appid; // unter welcher appid ist das interface konfiguriert
public String title; // der Titel des früheren Dialogs
public InterfaceStartType type; // was ist das für ein Type(WAR/webstart)
public Date lastUpdated = new Date(0); // wann diese Info zuletzt upgedated wurde, 0, wenn nicht aktualisiert wurde
public List<InstanceInfo> instanceInfos;
public boolean hasValidConnectionProperties() {
boolean connPropValid = host != null && !host.isEmpty() && port >= 0;
return connPropValid;
}
public IRemoteInterface getConnection() throws IOException {
if (!hasValidConnectionProperties()) {
return null;
}
return IhapRemoteInterfaceHandler.connect(host, port, "", null);
}
public String getStatus() {
if (instanceInfos == null || instanceInfos.size() == 0) {
return "no instances";
}
String s = "";
for (InstanceInfo info : instanceInfos) {
if (s.length() > 0) {
s = s + ", ";
}
s = s + info.getInfoText();
}
return s;
}
public boolean allInstancesState(InstanceState state) {
if (instanceInfos == null || instanceInfos.size() == 0) {
return false;
}
boolean allRunning = true;
for (InstanceInfo instanceInfo : instanceInfos) {
if (instanceInfo.getInstanceState() != state) {
allRunning = false;
}
}
return allRunning;
}
public boolean anyInstancesRunning() {
if (instanceInfos == null || instanceInfos.size() == 0) {
return false;
}
boolean anyRunning = false;
for (InstanceInfo instanceInfo : instanceInfos) {
if (instanceInfo.getInstanceState() == InstanceState.RUNNING) {
anyRunning = true;
}
}
return anyRunning;
}
@Override
public String toString() {
String s = "";
if (appid != null) {
s = s + appid;
}
if (host != null) {
s = s + ", host:" + host;
}
return s;
}
}

View File

@@ -0,0 +1,219 @@
/*
* Copyright (c) 2013 iTAC Software AG, Germany. All Rights Reserved.
*
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
* without the written permission of iTAC Software AG.
*/
package com.itac.mes.datainterface;
import java.util.List;
import javax.swing.JLabel;
import javax.swing.table.AbstractTableModel;
import com.itac.mes.datainterface.ihap.InstanceInfo;
import com.itac.mes.datainterface.ihap.InstanceState;
import com.itac.resource.ResourcePool;
import com.itac.resource.Resources;
import com.itac.resource.ResourcesIMSInterfaces;
public class RemoteInterfaceTableModel extends AbstractTableModel {
private String[] columnNames = new String[] { ResourcePool.getInstance().getString(ResourcesIMSInterfaces.APPID),//
ResourcePool.getInstance().getString(ResourcesIMSInterfaces.TITLE),//
ResourcePool.getInstance().getString(ResourcesIMSInterfaces.HOST),//
ResourcePool.getInstance().getString(ResourcesIMSInterfaces.PORT),//
ResourcePool.getInstance().getString(ResourcesIMSInterfaces.STATUS),//
ResourcePool.getInstance().getString(ResourcesIMSInterfaces.TYPE),//
ResourcePool.getInstance().getString(ResourcesIMSInterfaces.LAST_UPDATED) };
private List<RemoteInterfaceInfo> remoteInterfaceInfos;
private boolean isShowValidconfigurationsOnly;
@Override
public int getColumnCount() {
return columnNames.length;
}
public String getColumnName(int col) {
if (col < 0 || col > columnNames.length) {
return "";
}
return columnNames[col];
}
public Class<?> getColumnClass(int c) {
return JLabel.class;
}
@Override
public int getRowCount() {
if (remoteInterfaceInfos == null) {
return 0;
}
if (!isShowValidconfigurationsOnly) {
return remoteInterfaceInfos.size();
}
int i = 0;
for (RemoteInterfaceInfo intfInfo : remoteInterfaceInfos) {
if (intfInfo.hasValidConnectionProperties()) {
i++;
}
}
return i;
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
RemoteInterfaceInfo remoteInterfaceInfo = remoteInterfaceInfos.get(rowIndex);
if (isShowValidconfigurationsOnly) {
int i = 0;
for (RemoteInterfaceInfo intfInfo : remoteInterfaceInfos) {
if (intfInfo.hasValidConnectionProperties()) {
if (i == rowIndex) {
remoteInterfaceInfo = intfInfo;
break;
} else {
i++;
}
}
}
}
JLabel cellValue = new JLabel();
cellValue.setOpaque(true);
switch (columnIndex) {
case 0:
cellValue.setText(remoteInterfaceInfo.appid);
if (remoteInterfaceInfo.lastUpdated == null || remoteInterfaceInfo.lastUpdated.getTime() < 1) {
cellValue.setIcon(ResourcePool.getInstance().getImageIcon(Resources.Images.FamFamFam.Silk.BULLET_BLACK));
cellValue.setToolTipText(ResourcePool.getInstance().getMessage(ResourcesIMSInterfaces.INVALID_CONFIGURATION,
remoteInterfaceInfo.appid));
} else if (remoteInterfaceInfo.allInstancesState(InstanceState.RUNNING)) {
cellValue.setIcon(ResourcePool.getInstance().getImageIcon(Resources.Images.FamFamFam.Silk.BULLET_GREEN));
cellValue.setToolTipText(ResourcePool.getInstance().getMessage(ResourcesIMSInterfaces.ALL_RUNNING,
remoteInterfaceInfo.appid));
} else if (remoteInterfaceInfo.anyInstancesRunning()) {
cellValue.setIcon(ResourcePool.getInstance().getImageIcon(Resources.Images.FamFamFam.Silk.BULLET_ORANGE));
cellValue.setToolTipText(ResourcePool.getInstance().getMessage(ResourcesIMSInterfaces.AT_LEAST_ONE_RUNNING,
remoteInterfaceInfo.appid));
} else if (remoteInterfaceInfo.allInstancesState(InstanceState.STOPPED)) {
cellValue.setIcon(ResourcePool.getInstance().getImageIcon(Resources.Images.FamFamFam.Silk.BULLET_YELLOW));
cellValue.setToolTipText(ResourcePool.getInstance().getMessage(ResourcesIMSInterfaces.ALL_STOPPED,
remoteInterfaceInfo.appid));
} else if (remoteInterfaceInfo.allInstancesState(InstanceState.LICENSE_BLOCKED)) {
cellValue.setIcon(ResourcePool.getInstance().getImageIcon(Resources.Images.FamFamFam.Silk.BULLET_BLUE));
cellValue.setToolTipText(ResourcePool.getInstance().getMessage(ResourcesIMSInterfaces.INSTANCE_LICENSE_BLOCKED,
remoteInterfaceInfo.appid));
} else {
cellValue.setIcon(ResourcePool.getInstance().getImageIcon(Resources.Images.FamFamFam.Silk.BULLET_RED));
cellValue.setToolTipText(ResourcePool.getInstance().getMessage(ResourcesIMSInterfaces.NOT_RUNNING,
remoteInterfaceInfo.appid));
}
break;
case 1:
cellValue.setText(remoteInterfaceInfo.title);
break;
case 2:
cellValue.setText(remoteInterfaceInfo.host);
break;
case 3:
if (remoteInterfaceInfo.port <= 0) {
cellValue.setText("");
} else {
cellValue.setText(String.valueOf(remoteInterfaceInfo.port));
}
break;
case 4: // Status
if (remoteInterfaceInfo.lastUpdated == null || remoteInterfaceInfo.lastUpdated.getTime() < 1) {
} else {
cellValue.setText(remoteInterfaceInfo.getStatus());
if (remoteInterfaceInfo.instanceInfos == null || remoteInterfaceInfo.instanceInfos.size() == 0) {
cellValue.setToolTipText("");
} else {
String s = "<html>";
for (InstanceInfo item : remoteInterfaceInfo.instanceInfos) {
s = s + item.getInfoText()+ "<br>";
}
s = s + "</html>";
cellValue.setToolTipText(s);
}
}
break;
case 5:
if (remoteInterfaceInfo == null || remoteInterfaceInfo.type == null) {
return "";
}
try {
cellValue.setText(remoteInterfaceInfo.type.getLocalizedText());
if (cellValue.getText().equals("")) {
cellValue.setText(remoteInterfaceInfo.type.name());
}
} catch (Exception e) {
cellValue.setText(remoteInterfaceInfo.type.name());
}
break;
case 6:
if (remoteInterfaceInfo.lastUpdated == null || remoteInterfaceInfo.lastUpdated.getTime() < 1) {
cellValue.setText(ResourcePool.getInstance().getString(ResourcesIMSInterfaces.INVALID_CONFIGURATION));
} else {
cellValue.setText(remoteInterfaceInfo.lastUpdated.toString());
}
break;
default:
return "";
}
return cellValue;
}
public boolean isCellEditable(int row, int col) {
return false;
}
public void setData(List<RemoteInterfaceInfo> remoteInterfaceInfos) {
this.remoteInterfaceInfos = remoteInterfaceInfos;
fireTableDataChanged();
}
public RemoteInterfaceInfo getData(int row) {
if (row >= 0 && row < remoteInterfaceInfos.size()) {
if (isShowValidconfigurationsOnly) {
int i = 0;
for (RemoteInterfaceInfo intfInfo : remoteInterfaceInfos) {
if (intfInfo.hasValidConnectionProperties()) {
if (i == row) {
return intfInfo;
} else {
i++;
}
}
}
}
return remoteInterfaceInfos.get(row);
}
return null;
}
public void setShowValidConfigurationsOnly(boolean b) {
this.isShowValidconfigurationsOnly = b;
}
public void updateRemoteInterfaceInfo(RemoteInterfaceInfo remoteIntfInfo) {
int index = -1;
for (int i = 0; i < remoteInterfaceInfos.size(); i++) {
if (remoteInterfaceInfos.get(i).appid.equals(remoteIntfInfo.appid)) {
index = i;
break;
}
}
if (index > 0) {
remoteInterfaceInfos.set(index, remoteIntfInfo);
}
fireTableDataChanged();
}
}

View File

@@ -0,0 +1,359 @@
/*
* Copyright (c) 2014 iTAC Software AG, Germany. All Rights Reserved.
*
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
* without the written permission of iTAC Software AG.
*/
package com.itac.mes.datainterface.config;
import static com.itac.util.PropertyNames.PROP_ITAC_APPID;
import static com.itac.util.constants.imsapi.ImsApiKey.CONFIG_APPID;
import static com.itac.util.constants.imsapi.ImsApiKey.CONFIG_APPTYPE;
import static com.itac.util.constants.imsapi.ImsApiKey.CONFIG_CLUSTER;
import static com.itac.util.logging.LogLevel.ERROR;
import static com.itac.util.logging.LogLevel.INFO;
import static com.itac.util.logging.LogLevel.TRACE;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import com.itac.artes.ihap.LocatorFactory;
import com.itac.artes.ihas.LookupException;
import com.itac.mes.config.domain.ConfigDimension;
import com.itac.mes.config.domain.DimensionPath;
import com.itac.mes.config.domain.DimensionSet;
import com.itac.mes.config.domain.ImsApiConfigService;
import com.itac.mes.config.domain.ItacConfigException;
import com.itac.mes.config.domain.Parameter;
import com.itac.mes.config.domain.ParameterValue;
import com.itac.mes.datainterface.ConfigurationException;
import com.itac.mes.datainterface.data.Rectangle;
import com.itac.mes.imsapi.domain.container.KeyValue;
import com.itac.util.constants.imsapi.ImsApiKey;
import com.itac.util.logging.LogHandler;
import com.itac.util.logging.LogLevel;
public class AdminConsoleConfig extends ImsApiConfigService {
private static final String LOGGER = AdminConsoleConfig.class.getSimpleName();
public static DimensionSet poolAppTypeAppIdIdentity = new DimensionSet(ConfigDimension.POOL, ConfigDimension.APPTYPE,
ConfigDimension.APPID, ConfigDimension.IDENTITY);
public static DimensionPath handlerDimPath = new DimensionPath(poolAppTypeAppIdIdentity);
public static DimensionSet poolAppTypeAppId = new DimensionSet(ConfigDimension.POOL, ConfigDimension.APPTYPE,
ConfigDimension.APPID);
public static DimensionPath defaultDimPath = new DimensionPath(poolAppTypeAppId);
protected Hashtable<String, Parameter> paramTable = new Hashtable<String, Parameter>();
protected Hashtable<String, ParameterValue<?>> paramValueTable = new Hashtable<String, ParameterValue<?>>();
private String appType;
private KeyValue scope;
private Parameter declaredRootParameter;
// Umstellung von configContext auf KeyValue
protected Hashtable<String, KeyValue> configContextMap = new Hashtable<String, KeyValue>();
private Hashtable<String, ParameterValue<?>> valueTable = new Hashtable<String, ParameterValue<?>>();
private Hashtable<String, Object> declaredDefaultValues = new Hashtable<String, Object>();
public AdminConsoleConfig(String apptype) {
this.appType = apptype;
scope = new KeyValue(ImsApiKey.PARAMETER_SCOPE.name(), appType);
configContextMap.put(CONFIG_APPTYPE.name(), new KeyValue(CONFIG_APPTYPE.name(), apptype));
configContextMap.put(CONFIG_APPID.name(), new KeyValue(CONFIG_APPID.name(), System.getProperty(PROP_ITAC_APPID)));
configContextMap.put(CONFIG_CLUSTER.name(), new KeyValue(CONFIG_CLUSTER.name(), LocatorFactory.getLocator().getClusterName()));
}
public void declareParameter(Parameter parameter, Parameter parent, Object defaultValue) {
if (parent == null) {
declaredRootParameter = parameter;
paramTable.put(parameter.getName(), parameter);
parameter.setScope(scope);
return;
}
parameter.setParent(parent);
parameter.setScope(scope);
parent.addChild(parameter);
paramTable.put(parameter.getName(), parameter);
if (defaultValue != null) {
declaredDefaultValues.put(parameter.getName(), defaultValue);
}
}
private void updateParamTable(Parameter parameter) {
// alle Referenzen auf den alten Parameter durch den neuen ersetzen.
Parameter prevParam = paramTable.get(parameter.getName());
if (prevParam != null) {
prevParam.setScope(parameter.getScope());
prevParam.setId(parameter.getId());
prevParam.setParentId(parameter.getParentId());
prevParam.setTypeId(parameter.getTypeId());
// for (Parameter tmpParam : paramTable.values()) {
// if (tmpParam.getParent() == prevParam) {
// tmpParam.setParent(parameter);
// tmpParam.setParentId(parameter.getId());
// }
// }
paramTable.put(parameter.getName(), prevParam);
}
}
private KeyValue[] getConfigContext(Hashtable<String, KeyValue> configContextMap) {
KeyValue[] resultKeyValue = new KeyValue[configContextMap.size()];
configContextMap.values().toArray(resultKeyValue);
return resultKeyValue;
}
private void getValues(boolean createValues) throws ConfigurationException, LookupException {
// context.setValue(ConfigDimension.IDENTITY, identity);
// try to read values for scope
List<ParameterValue<?>> paramValueList = null;
paramValueList = selectValues(getConfigContext(configContextMap), scope, paramTable);
if (paramValueList == null) {
// String errText = "Unable to read configuration values for scope " + scope;
// throw new ConfigurationException(errText);
paramValueList = new ArrayList<ParameterValue<?>>();
}
// Tabelle mit allen Parametern bauen
for (ParameterValue<?> parameterValue : paramValueList) {
LogHandler.log(LOGGER, TRACE, "parameter " + parameterValue.getParameter().getName() + ", value" + parameterValue.toString());
paramValueTable.put(parameterValue.getParameter().getName(), parameterValue);
}
// für alle Parameter, die keinen Wert haben den deklarierten Default-Wert eintragen
if (createValues) {
boolean readAgain = false;
for (Parameter parameter : paramTable.values()) {
if (!paramValueTable.containsKey(parameter.getName())) {
//
readAgain = true;
// deklarierten Default-Wert holen
if (parameter.getId() == 0) {
LogHandler.log(LOGGER, ERROR, "Parameter " + parameter + " ID is 0, no value updated");
return;
}
// einen passenden ParameterValue bauen
Object value = declaredDefaultValues.get(parameter.getName());
// je nach Parametertype den Wert ermitteln
try {
ParameterValue<?> pv = ParameterValue.create(parameter, value);
updateValue(getConfigContext(configContextMap), pv);
} catch (ItacConfigException e) {
LogHandler.log(LOGGER, ERROR, "updating parameter value for parameter '" + parameter.getName() + "' failed", e);
}
}
}
if (readAgain) {
getValues(false);
}
}
}
// Wert in der Konfiguration speichern
public void updateParameterValue(String parameterName, Object value) {
Parameter parameter = paramTable.get(parameterName);
if (paramValueTable.containsKey(parameter.getName())) {
// deklarierten Default-Wert holen
if (parameter.getId() == 0) {
LogHandler.log(LOGGER, ERROR, "Parameter " + parameter + " ID is 0, no value updated");
return;
}
// je nach Parametertype den Wert ermitteln
try {
ParameterValue<?> pv = ParameterValue.create(parameter, value);
updateValue(getConfigContext(configContextMap), pv);
} catch (ItacConfigException e) {
LogHandler.log(LOGGER, ERROR, "updating parameter value for parameter '" + parameter.getName() + "' failed", e);
}
}
}
public void readAndUpdateConfiguration() {
// wenn es keinen IMS-API-Service gibt kann man aufhören
List<Parameter> savedParameters = getScopeParameters(scope);
Hashtable<String, Parameter> savedParametersTable = new Hashtable<String, Parameter>();
// root Parameter geholt
if (savedParameters == null) {
savedParameters = new ArrayList<Parameter>();
}
// alle Parameter in eine Tabelle einfuegen
for (Parameter parameter : savedParameters) {
updateParamTable(parameter);
savedParametersTable.put(parameter.getName(), parameter);
}
if (savedParameters.size() == 0) {
// nicht einmal der root Parameter vorhanden--> anlegen
declaredRootParameter = insertRootParameter(declaredRootParameter);
savedParametersTable.put(declaredRootParameter.getName(), declaredRootParameter);
}
declaredRootParameter = paramTable.get("DataInterfaceAdminConsole");
// moeglicherweise neue Parameter hinzufuegen
declaredRootParameter.setScope(scope);
// alle nicht existierenden Parameter erzeugen
createParametersWithHierarchy(scope, savedParametersTable);
// declaredClassNames setzen???
// verfügbare Werte laden, evtl Werte erzeugen und im Framework speichern
try {
getValues(true);
} catch (LookupException e) {
LogHandler.log(getClass().getSimpleName(), LogLevel.ERROR, "lookup imsapi service failed", e);
} catch (ConfigurationException e) {
LogHandler.log(getClass().getSimpleName(), LogLevel.ERROR, "configuration exception", e);
}
}
private void createParametersWithHierarchy(KeyValue scope, Hashtable<String, Parameter> savedParametersTable) {
// über die paramtable iterieren.
// solange alle Parameter anlegen und in die Table eintragen, solange es noch Parameter gibt,
// die KEINE ID aber eine parent-ID haben
boolean hasMoreParams;
do {
hasMoreParams = false;
for (Parameter p : paramTable.values()) {
// wenn e
if (savedParametersTable.containsKey(p.getName())) {
// diesen Parameter gibt es bereits in der DB
continue;
}
if (p.getParent() != null) {
// es gibt einen Vater!!
// wenn der Parent nicht in der DB ist, dann weiteren Durchlauf starten
if (!savedParametersTable.containsKey(p.getParent().getName())) {
// der Parent hat noch keine eigene Id
// dieser Parameter kann erst in einem späteren Durchlauf hinzugefügt werden
hasMoreParams = true;
continue;
}
Parameter parent = savedParametersTable.get(p.getParent().getName());
p.setParentId(parent.getId());
p.setScope(scope);
Parameter added = insertParameter(p);
if (added == null || added.getId() == 0) {
LogHandler.log(LOGGER, ERROR, "parameter '" + p.getName() + "' NOT inserted");
} else {
LogHandler.log(LOGGER, INFO, "parameter '" + p.getName() + "' inserted");
updateParamTable(added);
savedParametersTable.put(added.getName(), added);
// insertCount++;
}
} else {
LogHandler.log(LOGGER, ERROR, "missing parent for parameter " + p);
}
}
} while (hasMoreParams);
}
@SuppressWarnings("unchecked")
public <T> T getValue(String parameterName, Class<T> aClass) {
ParameterValue<?> pv = paramValueTable.get(parameterName);
if (pv == null) {
return null;
}
try {
if (pv.getValue(aClass) != null) {
return pv.getValue(aClass);
}
LogHandler.log(LOGGER, TRACE, "parameter " + pv.getParameter().getName());
LogHandler.log(LOGGER, TRACE, "parametertype " + pv.getParameter().getType().getName());
// LogHandler.log(LOGGER, TRACE, "parametermetatype " + pv.getParameter().getMetaType().getName());
Object o = pv.getValue();
if (o.getClass() == aClass) {
return (T) o;
}
return null;
} catch (NullPointerException npe) {
LogHandler.log(LOGGER, ERROR, "unable to get value for parameter " + parameterName, npe);
return null;
} catch (ItacConfigException ex) {
LogHandler.log(LOGGER, ERROR, "", ex);
return null;
}
}
// Wert in der Konfiguration speichern
public void updateParameterValue(Parameter parameter, String apptype, String appid, Object value) {
Hashtable<String, KeyValue> tempConfigContextMap = new Hashtable<String, KeyValue>();
tempConfigContextMap.put(CONFIG_APPTYPE.name(), new KeyValue(CONFIG_APPTYPE.name(), apptype));
tempConfigContextMap.put(CONFIG_APPID.name(), new KeyValue(CONFIG_APPID.name(), appid));
tempConfigContextMap.put(CONFIG_CLUSTER.name(), new KeyValue(CONFIG_CLUSTER.name(), LocatorFactory.getLocator()
.getClusterName()));
// deklarierten Default-Wert holen
if (parameter.getId() == 0) {
LogHandler.log(LOGGER, ERROR, "Parameter " + parameter + " ID is 0, no value updated");
return;
}
// je nach Parametertype den Wert ermitteln
try {
ParameterValue<?> pv = ParameterValue.create(parameter, value);
updateValue(getConfigContext(tempConfigContextMap), pv);
} catch (ItacConfigException e) {
LogHandler.log(LOGGER, ERROR, "updating parameter value for parameter '" + parameter.getName() + "' failed", e);
}
}
public Rectangle getParameterValue(Parameter windowPositionParameter, KeyValue scope, String apptype, String appid) {
Hashtable<String, KeyValue> tempConfigContextMap = new Hashtable<String, KeyValue>();
tempConfigContextMap.put(CONFIG_APPTYPE.name(), new KeyValue(CONFIG_APPTYPE.name(), apptype));
tempConfigContextMap.put(CONFIG_APPID.name(), new KeyValue(CONFIG_APPID.name(), appid));
tempConfigContextMap.put(CONFIG_CLUSTER.name(), new KeyValue(CONFIG_CLUSTER.name(), LocatorFactory.getLocator()
.getClusterName()));
List<ParameterValue<?>> paramValueList = null;
Hashtable<String, Parameter> pTable = new Hashtable<String, Parameter>();
pTable.put(windowPositionParameter.getName(), windowPositionParameter);
paramValueList = selectValues(getConfigContext(tempConfigContextMap), scope, pTable);
if (paramValueList == null) {
// String errText = "Unable to read configuration values for scope " + scope;
// throw new ConfigurationException(errText);
paramValueList = new ArrayList<ParameterValue<?>>();
}
// einen passenden ParameterValue bauen
ParameterValue<?> pv = paramValueList.get(0);
if (pv == null) {
return null;
}
try {
Object o = pv.getValue();
if (o != null) {
return (Rectangle) o;
}
return null;
} catch (NullPointerException npe) {
// LogHandler.log(LOGGER, ERROR, "unable to get value for parameter " + parameterName, npe);
return null;
} catch (ItacConfigException ex) {
LogHandler.log(LOGGER, ERROR, "", ex);
return null;
}
}
public Parameter getDataInterfaceParameter(KeyValue diScope, String windowParam) {
List<Parameter> savedParameters = getScopeParameters(diScope);
for (Parameter parameter : savedParameters) {
if (parameter.getName().equals(windowParam)) {
return parameter;
}
}
return null;
}
}

View File

@@ -0,0 +1,306 @@
package com.itac.mes.datainterface.gui;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextPane;
import javax.swing.KeyStroke;
import com.itac.util.logging.LogHandler;
import com.jgoodies.layout.layout.ColumnSpec;
import com.jgoodies.layout.layout.FormLayout;
import com.jgoodies.layout.layout.FormSpecs;
import com.jgoodies.layout.layout.RowSpec;
public abstract class BasicMessageVisualizePanel extends DataInterfaceDefaultPanel implements IDataInterfaceView, IWorkerPane {
private static final long serialVersionUID = 1L;
private JPanel pnlMessagesIn;
private JPanel pnlMessagesOut;
private JTextPane jTextPane;
private JTextPane jTextPane1;
private JSplitPane jSplitPane;
private JButton btnClear;
private JScrollPane spMessagesIn;
private JScrollPane spMessagesOut;
private JLabel lblServerStatus;
private JCheckBox cbTransportLayer;
private JCheckBox cbProtocolLayer;
private JCheckBox cbMessageLayer;
private AbstractAction clearAction = new AbstractAction("clear") {
private static final long serialVersionUID = 5530547863046098937L;
@Override
public void actionPerformed(ActionEvent e) {
clear();
}
};
private JLabel lblConnectStatus;
private JLabel lblMessagesIn;
private JLabel lblMessagesOut;
/**
* This is the default constructor
*/
public BasicMessageVisualizePanel(String title) {
super(title);
setBackground(SystemColor.window);
setOpaque(true);
initialize();
clearAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK + InputEvent.ALT_MASK));
setSimulation(true);
}
/**
* This method initializes jTextPane
*
* @return javax.swing.JTextPane
*/
public JTextPane getJTextPane() {
if (jTextPane == null) {
jTextPane = new JTextPane();
jTextPane.setBorder(null);
}
return jTextPane;
}
/**
* This method initializes jTextPane1
*
* @return javax.swing.JTextPane
*/
public JTextPane getJTextPane1() {
if (jTextPane1 == null) {
jTextPane1 = new JTextPane();
jTextPane1.setBorder(null);
}
return jTextPane1;
}
@Override
public void clear() {
LogHandler.debug("clear action");
getJTextPane().setText("");
getJTextPane1().setText("");
}
/**
* This method initializes pnlMessagesIn
*
* @return javax.swing.JPanel
*/
protected JPanel getPnlMessagesIn() {
if (pnlMessagesIn == null) {
pnlMessagesIn = new JPanel();
pnlMessagesIn.setBorder(null);
pnlMessagesIn.setPreferredSize(new Dimension(200, 200));
pnlMessagesIn.setLayout(new BoxLayout(pnlMessagesIn, BoxLayout.X_AXIS));
pnlMessagesIn.add(getMsgInScrollPane());
}
return pnlMessagesIn;
}
/**
* This method initializes pnlMessagesOut
*
* @return javax.swing.JPanel
*/
protected JPanel getPnlMessagesOut() {
if (pnlMessagesOut == null) {
pnlMessagesOut = new JPanel();
pnlMessagesOut.setBorder(null);
pnlMessagesOut.setPreferredSize(new Dimension(200, 200));
pnlMessagesOut.setLayout(new BoxLayout(pnlMessagesOut, BoxLayout.X_AXIS));
pnlMessagesOut.add(getMsgOutScrollPane());
}
return pnlMessagesOut;
}
/**
* This method initializes this
*
*/
@Override
public void initialize() {
this.setSize(632, 543);
setBorder(null);
setLayout(new FormLayout(
new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC, },
new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
RowSpec.decode("473px:grow"), FormSpecs.RELATED_GAP_ROWSPEC, }));
this.add(getCbMessageLayer(), "2, 2, center, center");
this.add(getCbProtocolLayer(), "4, 2, center, center");
this.add(getCbTransportLayer(), "6, 2, center, center");
lblConnectStatus = new JLabel();
lblConnectStatus.setText("conn. State");
this.add(lblConnectStatus, "8, 2, center, center");
lblServerStatus = new JLabel();
lblServerStatus.setText("serverStatus");
this.add(lblServerStatus, "10, 2, center, center");
this.add(getClearButton(), "12, 2, right, center");
this.add(getJSplitPane(), "2, 4, 12, 1, fill, fill");
}
/**
* This method initializes cbTransportLayer
*
* @return javax.swing.JCheckBox
*/
public JCheckBox getCbTransportLayer() {
if (cbTransportLayer == null) {
cbTransportLayer = new JCheckBox();
cbTransportLayer.setOpaque(false);
cbTransportLayer.setText("Transport Layer");
cbTransportLayer.setSelected(false);
}
return cbTransportLayer;
}
/**
* This method initializes cbProtocolLayer
*
* @return javax.swing.JCheckBox
*/
public JCheckBox getCbProtocolLayer() {
if (cbProtocolLayer == null) {
cbProtocolLayer = new JCheckBox();
cbProtocolLayer.setOpaque(false);
cbProtocolLayer.setText("Protocol Layer");
cbProtocolLayer.setSelected(false);
}
return cbProtocolLayer;
}
/**
* This method initializes cbMessageLayer
*
* @return javax.swing.JCheckBox
*/
public JCheckBox getCbMessageLayer() {
if (cbMessageLayer == null) {
cbMessageLayer = new JCheckBox();
cbMessageLayer.setOpaque(false);
cbMessageLayer.setText("Messages ");
cbMessageLayer.setSelected(true);
}
return cbMessageLayer;
}
/**
* This method initializes jSplitPane
*
* @return javax.swing.JSplitPane
*/
protected JSplitPane getJSplitPane() {
if (jSplitPane == null) {
jSplitPane = new JSplitPane();
jSplitPane.setBorder(null);
jSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
jSplitPane.setResizeWeight(0.5D);
jSplitPane.setBottomComponent(getPnlMessagesOut());
jSplitPane.setTopComponent(getPnlMessagesIn());
}
return jSplitPane;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
public JButton getClearButton() {
if (btnClear == null) {
btnClear = new JButton();
btnClear.setAction(clearAction);
}
return btnClear;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
protected JScrollPane getMsgInScrollPane() {
if (spMessagesIn == null) {
spMessagesIn = new JScrollPane();
spMessagesIn.setBorder(null);
spMessagesIn.setViewportView(getJTextPane());
spMessagesIn.setColumnHeaderView(getLblMessagesIn());
}
return spMessagesIn;
}
/**
* This method initializes jScrollPane1
*
* @return javax.swing.JScrollPane
*/
protected JScrollPane getMsgOutScrollPane() {
if (spMessagesOut == null) {
spMessagesOut = new JScrollPane();
spMessagesOut.setBorder(null);
spMessagesOut.setViewportView(getJTextPane1());
spMessagesOut.setColumnHeaderView(getLblMessagesOut());
}
return spMessagesOut;
}
protected void setServerStatus(String text, Color color) {
lblServerStatus.setText(text);
lblServerStatus.setBackground(color);
}
protected void setClientConnectStatus(boolean connected) {
if (connected) {
lblConnectStatus.setText("client connected");
lblConnectStatus.setBackground(Color.GREEN);
} else {
lblConnectStatus.setText("no client connected");
lblConnectStatus.setBackground(Color.RED);
}
}
public void enableClientConnectStatus(boolean enable) {
lblConnectStatus.setVisible(enable);
}
@Override
public void beforeClosing() {
}
protected JLabel getLblMessagesIn() {
if (lblMessagesIn == null) {
lblMessagesIn = new JLabel("Messages in");
lblMessagesIn.setBounds(new Rectangle(5, 3, 3, 3));
}
return lblMessagesIn;
}
protected JLabel getLblMessagesOut() {
if (lblMessagesOut == null) {
lblMessagesOut = new JLabel("Messages out");
lblMessagesOut.setBounds(new Rectangle(5, 3, 3, 3));
}
return lblMessagesOut;
}
}

View File

@@ -0,0 +1,123 @@
package com.itac.mes.datainterface.gui;
import static com.jgoodies.layout.layout.FormSpecs.DEFAULT_COLSPEC;
import static com.jgoodies.layout.layout.FormSpecs.DEFAULT_ROWSPEC;
import static com.jgoodies.layout.layout.FormSpecs.GROWING_BUTTON_COLSPEC;
import static com.jgoodies.layout.layout.FormSpecs.RELATED_GAP_COLSPEC;
import static com.jgoodies.layout.layout.FormSpecs.RELATED_GAP_ROWSPEC;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.ScrollPaneConstants;
import com.itac.mes.datainterface.annotaion.SimulationClass;
import com.itac.mes.datainterface.simulation.CogiscanSimulation;
import com.itac.util.logging.LogLevel;
import com.jgoodies.layout.layout.ColumnSpec;
import com.jgoodies.layout.layout.FormLayout;
import com.jgoodies.layout.layout.RowSpec;
@SimulationClass(name = "CogiscanSimulation")
public class CogiscanPanel extends DataInterfaceDefaultPanel implements IDataInterfaceView, PropertyChangeListener {
protected static final String LOGGER = null;
private MessageScrollPane messageScrollPane = null;
private JButton btnStart;
private JButton btnStop;
public CogiscanPanel() {
this("");
}
public CogiscanPanel(String title) {
super(title);
initialize();
setSimulation(true);
}
@Override
public void initialize() {
setLayout(new FormLayout(
new ColumnSpec[] { RELATED_GAP_COLSPEC, GROWING_BUTTON_COLSPEC,
RELATED_GAP_COLSPEC, DEFAULT_COLSPEC, RELATED_GAP_COLSPEC, DEFAULT_COLSPEC,
RELATED_GAP_COLSPEC },
new RowSpec[] { RELATED_GAP_ROWSPEC, DEFAULT_ROWSPEC,
RELATED_GAP_ROWSPEC, RowSpec.decode("max(50dlu;pref):grow"), RELATED_GAP_ROWSPEC }));
JLabel lblTitle = new JLabel("Cogiscan Simulation");
add(lblTitle, "2, 2, left, center");
btnStart = new JButton(new AbstractAction("start") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(CogiscanSimulation.ID_START);
}
});
add(btnStart, "4, 2");
btnStop = new JButton(new AbstractAction("stop") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(CogiscanSimulation.ID_STOP);
}
});
add(btnStop, "6, 2");
add(getTfInterfaceInfo(), "2, 4, 5, 1, fill, fill");
}
@Override
public void propertyChange(PropertyChangeEvent evt) {
String text = "Connections: \n";
getTfInterfaceInfo().addMessage("", LogLevel.INFO, text);
}
/**
* This method initializes tfInterfaceInfo
*
* @return javax.swing.JTextField
*/
private MessageScrollPane getTfInterfaceInfo() {
if (messageScrollPane == null) {
messageScrollPane = new MessageScrollPane();
messageScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
messageScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
messageScrollPane.setOpaque(false);
messageScrollPane.setViewportBorder(null);
messageScrollPane.setBorder(null);
}
return messageScrollPane;
}
@Override
public synchronized void addMessage(String instance, LogLevel level, boolean append, String text) {
getTfInterfaceInfo().addMessage(instance, level, append, text);
}
@Override
public void addMessage(String instance, LogLevel level, String text) {
getTfInterfaceInfo().addMessage(instance, level, text);
}
@Override
public void notifyActionPropertiesChanged(DataInterfaceMenuAction action) {
if (action.getId().equalsIgnoreCase(CogiscanSimulation.ID_START)) {
btnStart.getAction().setEnabled(action.isEnabled());
} else if (action.getId().equalsIgnoreCase(CogiscanSimulation.ID_STOP)) {
btnStop.getAction().setEnabled(action.isEnabled());
}
}
@Override
public void clear() {
getTfInterfaceInfo().clear();
}
}

View File

@@ -0,0 +1,221 @@
/*
* Copyright (c) 2016 iTAC Software AG, Germany. All Rights Reserved.
*
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
* without the written permission of iTAC Software AG.
*/
package com.itac.mes.datainterface.gui;
import static com.jgoodies.layout.layout.FormSpecs.RELATED_GAP_COLSPEC;
import static com.jgoodies.layout.layout.FormSpecs.RELATED_GAP_ROWSPEC;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;
import com.itac.mes.datainterface.annotaion.SimulationClass;
import com.itac.mes.datainterface.simulation.CogiscanSimulation;
import com.itac.mes.datainterface.simulation.CommonSmtSimulation;
import com.itac.mes.datainterface.simulation.ICommonSmtSimPane;
import com.itac.util.logging.LogLevel;
import com.jgoodies.layout.builder.FormBuilder;
import com.jgoodies.layout.layout.ColumnSpec;
import com.jgoodies.layout.layout.FormLayout;
import com.jgoodies.layout.layout.RowSpec;
@SimulationClass(name = "CommonSmtSimulation")
public class CommonSmtPanel extends DataInterfaceDefaultPanel
implements IDataInterfaceView, PropertyChangeListener, ICommonSmtSimPane {
protected static final String LOGGER = null;
private MessageScrollPane messageScrollPane = null;
private JButton btnStart;
private JButton btnStop;
private JTextArea taTraceabilityData;
public CommonSmtPanel() {
this("");
}
public CommonSmtPanel(String title) {
super(title);
initialize();
setSimulation(true);
}
@Override
public void initialize() {
setLayout(new FormLayout(
new ColumnSpec[] { RELATED_GAP_COLSPEC, ColumnSpec.decode("fill:0:grow"), RELATED_GAP_COLSPEC,
ColumnSpec.decode("70dlu"), RELATED_GAP_COLSPEC, ColumnSpec.decode("70dlu"), RELATED_GAP_COLSPEC, },
new RowSpec[] { RELATED_GAP_ROWSPEC, RowSpec.decode("23px"), RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), }));
JLabel lblTitle = new JLabel("CommonSmt Simulation");
add(lblTitle, "2, 2, left, center");
btnStart = new JButton(new AbstractAction("start") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(CogiscanSimulation.ID_START);
}
});
add(btnStart, "4, 2,fill,top");
btnStop = new JButton(new AbstractAction("stop") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(CogiscanSimulation.ID_STOP);
}
});
add(btnStop, "6, 2,fill,top");
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
add(new JTabbedPane(JTabbedPane.TOP), "2, 4, 5, 1, fill, fill");
tabbedPane.addTab("Messages", null, getTfInterfaceInfo(), null);
// Tracedata
taTraceabilityData = new JTextArea();
taTraceabilityData.setText(getTraceabilityDataText());
JButton btnSendTraceabilityData = new JButton("senden");
btnSendTraceabilityData.addActionListener(this::sendTraceabilityDataClicked);
JPanel pnlTraceabilityData = new FormBuilder()
.columns("pref,$lcgap, pref:grow,$rg,70dlu")
.rows("pref,$rg,default:grow")
.padding("8,5,8,5")
.add(new JLabel("Content")).xy(1, 1)
.add(taTraceabilityData).xywh(3, 1, 1, 3)
.add(btnSendTraceabilityData).xy(5, 1)
.build();
tabbedPane.addTab("TraceabilityData", null, pnlTraceabilityData, null);
}
/**
* @return
*/
private String getTraceabilityDataText() {
return "<ItemProducedRequest endProduction=\"$TIME(yyyy-MM-dd'T'HH:mm:ss'.'SSS Z,-00:00:02)\" startProduction=\"$TIME(yyyy-MM-dd'T'HH:mm:ss'.'SSS Z,-00:00:05)\" \r\n"
+ "state=\"PASS\" orderId=\"\" placementRecipeName=\"ClusterXXX#Top\" serialnumber=\"$nextSN.serialNumberArray[0].serialNumber\" \r\n"
+ "eventDate=\"$TIME(yyyy-MM-dd'T'hh:mm:ss'.'SSS Z)\" requestId=\"123\">\r\n"
+ " <panelInfo panelNumber=\"1\" serialNumber=\"$nextSN.serialNumberArray[0].serialNumber\" panelName=\"p1\"/>\r\n"
+ " <machinePlacement>\r\n"
+ " <handlerInfo placed=\"10\" pickAttempts=\"10\" verifiedDate=\"$TIME(yyyy-MM-dd'T'HH:mm:ss'.'SSS Z,-00:01:00)\" division=\"1\" track=\"3\" feederId=\"feederId\" table=\"2\">\r\n"
+ " <placement panelNumber=\"1\" designator=\"R10\"/>\r\n"
+ " <placement panelNumber=\"1\" designator=\"R11\"/>\r\n"
+ " <placement panelNumber=\"1\" designator=\"R12\"/>\r\n"
+ " <placement panelNumber=\"1\" designator=\"R13\"/>\r\n"
+ " <placement panelNumber=\"1\" designator=\"R14\"/>\r\n"
+ " <placement panelNumber=\"2\" designator=\"R10\"/>\r\n"
+ " <placement panelNumber=\"2\" designator=\"R11\"/>\r\n"
+ " <placement panelNumber=\"2\" designator=\"R12\"/>\r\n"
+ " <placement panelNumber=\"2\" designator=\"R13\"/>\r\n"
+ " <placement panelNumber=\"2\" designator=\"R14\"/>\r\n\r\n"
+ " <placement panelNumber=\"3\" designator=\"R10\"/>\r\n"
+ " <placement panelNumber=\"3\" designator=\"R11\"/>\r\n"
+ " <placement panelNumber=\"3\" designator=\"R12\"/>\r\n"
+ " <placement panelNumber=\"3\" designator=\"R13\"/>\r\n"
+ " <placement panelNumber=\"3\" designator=\"R14\"/>\r\n"
+ " <placement panelNumber=\"4\" designator=\"R10\"/>\r\n"
+ " <placement panelNumber=\"4\" designator=\"R11\"/>\r\n"
+ " <placement panelNumber=\"4\" designator=\"R12\"/>\r\n"
+ " <placement panelNumber=\"4\" designator=\"R13\"/>\r\n"
+ " <placement panelNumber=\"4\" designator=\"R14\"/> \r\n"
+ " <container errorText=\"\" componentId=\"0603R\" containerId=\"$reel0603R\"/>\r\n"
+ " </handlerInfo>\r\n"
+ " <handlerInfo placed=\"10\" pickAttempts=\"10\" verifiedDate=\"$TIME(yyyy-MM-dd'T'HH:mm:ss'.'SSS Z,-00:01:00)\" \r\n"
+ "division=\"1\" track=\"4\" feederId=\"feederId\" table=\"2\">\r\n"
+ " <placement panelNumber=\"1\" designator=\"R170\"/>\r\n"
+ " <placement panelNumber=\"1\" designator=\"R171\"/>\r\n"
+ " <placement panelNumber=\"1\" designator=\"R172\"/>\r\n"
+ " <placement panelNumber=\"1\" designator=\"R176\"/>\r\n"
+ " <placement panelNumber=\"1\" designator=\"R177\"/> \r\n"
+ " <placement panelNumber=\"2\" designator=\"R170\"/>\r\n"
+ " <placement panelNumber=\"2\" designator=\"R171\"/>\r\n"
+ " <placement panelNumber=\"2\" designator=\"R172\"/>\r\n"
+ " <placement panelNumber=\"2\" designator=\"R176\"/>\r\n"
+ " <placement panelNumber=\"2\" designator=\"R177\"/>\r\n"
+ " <placement panelNumber=\"3\" designator=\"R170\"/>\r\n"
+ " <placement panelNumber=\"3\" designator=\"R171\"/>\r\n"
+ " <placement panelNumber=\"3\" designator=\"R172\"/>\r\n"
+ " <placement panelNumber=\"4\" designator=\"R170\"/>\r\n"
+ " <placement panelNumber=\"4\" designator=\"R171\"/>\r\n"
+ " <placement panelNumber=\"4\" designator=\"R172\"/>\r\n"
+ " <container errorText=\"\" componentId=\"0402R\" containerId=\"$reel0402R\"/>\r\n"
+ " </handlerInfo>\r\n\r\n"
+ " <machine lastMachineInLine=\"false\" stageName=\"\" machineName=\"tr_machine1\" lineName=\"$line\" lane=\"1\"/>\r\n"
+ " </machinePlacement>\r\n"
+ " </ItemProducedRequest>";
}
public void sendTraceabilityDataClicked(ActionEvent e) {
executeAction(CommonSmtSimulation.ID_SEND_MES_ITEM_PRODUCED);
}
@Override
public void propertyChange(PropertyChangeEvent evt) {
String text = "Connections: \n";
getTfInterfaceInfo().addMessage("", LogLevel.INFO, text);
}
/**
* This method initializes tfInterfaceInfo
*
* @return javax.swing.JTextField
*/
private MessageScrollPane getTfInterfaceInfo() {
if (messageScrollPane == null) {
messageScrollPane = new MessageScrollPane();
messageScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
messageScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
messageScrollPane.setOpaque(false);
messageScrollPane.setViewportBorder(null);
messageScrollPane.setBorder(null);
}
return messageScrollPane;
}
@Override
public synchronized void addMessage(String instance, LogLevel level, boolean append, String text) {
getTfInterfaceInfo().addMessage(instance, level, append, text);
}
@Override
public void addMessage(String instance, LogLevel level, String text) {
getTfInterfaceInfo().addMessage(instance, level, text);
}
@Override
public void notifyActionPropertiesChanged(DataInterfaceMenuAction action) {
if (action.getId().equalsIgnoreCase(CogiscanSimulation.ID_START)) {
btnStart.getAction().setEnabled(action.isEnabled());
} else if (action.getId().equalsIgnoreCase(CogiscanSimulation.ID_STOP)) {
btnStop.getAction().setEnabled(action.isEnabled());
}
}
@Override
public void clear() {
getTfInterfaceInfo().clear();
}
/*
* (non-Javadoc)
* @see com.itac.mes.datainterface.simulation.ICommonSmtSimPane#getMesItemProducedContent()
*/
@Override
public String getMesItemProducedContent() {
return taTraceabilityData.getText();
}
}

View File

@@ -0,0 +1,155 @@
/*
* Copyright (c) 2013 iTAC Software AG, Germany. All Rights Reserved.
*
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
* without the written permission of iTAC Software AG.
*/
package com.itac.mes.datainterface.gui;
import static com.itac.util.logging.LogLevel.DEBUG;
import static com.itac.util.logging.LogLevel.INFO;
import static com.itac.util.logging.LogLevel.TRACE;
import java.awt.SystemColor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import javax.swing.JPanel;
import com.itac.mes.datainterface.data.MessageListener;
import com.itac.util.logging.LogHandler;
import com.itac.util.logging.LogLevel;
import com.jgoodies.layout.layout.ColumnSpec;
import com.jgoodies.layout.layout.FormLayout;
import com.jgoodies.layout.layout.RowSpec;
@SuppressWarnings("serial")
public abstract class DataInterfaceDefaultPanel extends JPanel implements IDataInterfaceView, MessageListener, IWorkerPane {
private static final String LOGGER = DataInterfaceDefaultPanel.class.getSimpleName();
private String title;
private boolean isSimulation;
private ISimulationMessageReceiver simulationMessageReceiver;
private IMachineSimulation machineSimulation;
private HashMap<String, DataInterfaceMenuAction> menuMap = new HashMap<String, DataInterfaceMenuAction>();
/** MessageListener Interface, buffered */
private List<InstanceMessage> instanceMessages = new ArrayList<InstanceMessage>();
/**
*
* @param aTitle
*/
public DataInterfaceDefaultPanel(String aTitle) {
setOpaque(true);
setName(aTitle);
setTitle(aTitle);
setBorder(null);
setBackground(SystemColor.window);
setLayout(new FormLayout(new ColumnSpec[] {}, new RowSpec[] {}));
instanceMessages = new ArrayList<InstanceMessage>();
}
@Override
public void setTitle(String title) {
this.title = title;
}
@Override
public String getTitle() {
return title;
}
public boolean isSimulation() {
return isSimulation;
}
public void setSimulation(boolean isSimulation) {
this.isSimulation = isSimulation;
}
@Override
public void initialize() {
LogHandler.log(LOGGER, TRACE, "initialize called");
}
@Override
public void executeAction(String actionID) {
LogHandler.log(LOGGER, INFO, "executeAction " + actionID + " on instance '" + getName() + "'");
DataInterfaceMenuAction menuAction = getMenuActionById(actionID);
menuAction.execute();
}
@Override
public void setDescription(String description) {
LogHandler.log(LOGGER, TRACE, "setDescription called");
}
@Override
public void setMachineSimulation(IMachineSimulation machineSimulation) {
this.machineSimulation = machineSimulation;
}
public IMachineSimulation getMachineSimulation() {
return machineSimulation;
}
@Override
public void setMenuItems(Collection<DataInterfaceMenuAction> mnuItems) {
LogHandler.log(LOGGER, DEBUG, "setting menu Actions to Database Sim Panel");
for (DataInterfaceMenuAction dataInterfaceMenuAction : mnuItems) {
menuMap.put(dataInterfaceMenuAction.getId(), dataInterfaceMenuAction);
}
}
public final DataInterfaceMenuAction getMenuActionById(String id) {
return menuMap.get(id);
}
@Override
public void beforeClosing() {
LogHandler.log(LOGGER, DEBUG, "beforeClosing " + getName());
}
public List<InstanceMessage> getInstanceMessages(String instance) {
return instanceMessages;
}
@Override
synchronized public void addMessage(final String instance, final LogLevel level, final boolean append, final String message) {
if (instanceMessages.size() > MAX_MESSAGE_COUNT) {
// aelteste (erste Nachricht) loeschen
instanceMessages.remove(0);
}
if (append) {
// wenn es keine Msg bisher gibt eine neue erzeugen
if (instanceMessages.size() == 0) {
instanceMessages.add(new InstanceMessage(level, System.currentTimeMillis(), message));
} else {
// an die letzte Meldung anhaengen
InstanceMessage instMsg = instanceMessages.get(instanceMessages.size() - 1);
instMsg.setMessage(instMsg.getMessage() + message);
}
} else {
instanceMessages.add(new InstanceMessage(level, System.currentTimeMillis(), message));
}
}
@Override
public void addMessage(final String instance, LogLevel level, String text) {
addMessage(instance, level, false, text);
}
@Override
public void clear() {
instanceMessages.clear();
}
@Override
public void propertiesChanged(DataInterfaceMenuAction dima) {
LogHandler.log(LOGGER, TRACE, "received properties changed event " + dima);
}
}

View File

@@ -0,0 +1,513 @@
/*
* ui * Copyright (c) 2013 iTAC Software AG, Germany. All Rights Reserved.
*
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
* without the written permission of iTAC Software AG.
*/
package com.itac.mes.datainterface.gui;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Collection;
import java.util.Hashtable;
import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.border.EmptyBorder;
import com.itac.mes.clientframe.presentation.JTopPanel;
import com.itac.mes.datainterface.DataInterface;
import com.itac.mes.datainterface.VersionInfo;
import com.itac.mes.datainterface.ihap.IRemoteGui;
import com.itac.resource.ResourcePool;
import com.itac.resource.ResourcesImages;
import com.itac.resource.ResourcesInterfaceFramework;
import com.itac.util.logging.LogHandler;
import com.itac.util.logging.LogLevel;
import com.jgoodies.layout.builder.FormBuilder;
/**
*
* Das ist die Klasse, die remote per GUI aufgerufen wird. Diese Klasse besitzt einen IHAP Endpunkt
*
* @author frankp
*
*/
public class DataInterfaceDlg extends JFrame implements IMainDlg {
public static final String INTERFACE_TAB_NAME = "Interface";
private static final long serialVersionUID = -7081052036265722600L;
private static final String LOGGER = DataInterfaceDlg.class.getSimpleName();
// Fenster Position und Groesse
protected Rectangle extents = new Rectangle(0, 0, 100, 100);
@SuppressWarnings("serial")
private AbstractAction startAllAction = new AbstractAction("startAll") {
@Override
public void actionPerformed(ActionEvent e) {
worker.startAll();
}
};
@SuppressWarnings("serial")
private AbstractAction stopAllAction = new AbstractAction("stopAll") {
@Override
public void actionPerformed(ActionEvent e) {
worker.stopAll();
}
};
private Hashtable<String, IWorkerPane> availableViews = new Hashtable<String, IWorkerPane>();
private JPanel jContentPane;
private JTopPanel pnlTop;
private JMenuBar menubar;
private JMenu mnuFile;
private JMenuItem mniExit;
private JMenu mniWindow;
private JMenu mnuSimulations;
private JMenuItem mntmStartall;
private JMenuItem mntmStopall;
private String mainPaneName;
private IWorker worker;
private IWorker simulation;
private JTabbedPane mainTabPane;
private JTabbedPane simulationTabPane;
/**
* This is the default constructor
*/
public DataInterfaceDlg() {
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
setJMenuBar(getMenubar());
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
try {
setIconImage(ResourcePool.getInstance().getImage(ResourcesImages.ICON_ITAC_LOGO));
} catch (NullPointerException npe) {}
setTitle("Data Interface");
setContentPane(getJContentPane());
this.setSize(600, 300);
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
mainTabPane = new JTabbedPane(JTabbedPane.TOP);
mainTabPane.setBackground(SystemColor.window);
mainTabPane.setOpaque(true);
mainTabPane.setBorder(new EmptyBorder(0, 0, 0, 0));
simulationTabPane = new JTabbedPane(JTabbedPane.TOP);
simulationTabPane.setBackground(SystemColor.window);
simulationTabPane.setOpaque(true);
simulationTabPane.setBorder(new EmptyBorder(0, 0, 0, 0));
simulationTabPane.setVisible(false);
simulationTabPane.setMinimumSize(new Dimension(0, 0));
// @formatter:off
jContentPane = new FormBuilder()
.columns("F:0:G, min(600dlu;P)")
.rows("P, F:P:G")
.add(getPnlTop()) .xyw(1, 1, 2)
.add(mainTabPane) .xy (1, 2)
.add(simulationTabPane).xy (2, 2)
.build();
// @formatter:on
jContentPane.setBackground(SystemColor.window);
jContentPane.setForeground(SystemColor.window);
jContentPane.setOpaque(true);
jContentPane.setBorder(new EmptyBorder(0, 0, 0, 0));
}
return jContentPane;
}
/**
* (non-Javadoc) if the level is less than 0 text is appended to the last line!
*
* @param level
* @param message
* @see com.itac.mes.datainterface.data.MessageListener#addMessage(int, java.lang.String)
*/
@Override
public void addMessage(String instance, LogLevel level, String message) {
for (int i = 0; i < mainTabPane.getTabCount(); i++) {
Component component = mainTabPane.getTabComponentAt(i);
if (component instanceof WorkerPane) {
((WorkerPane) component).addMessage(instance, level, false, message);
}
}
}
/**
* This method initializes jTopPanel
*
* @return com.itac.oem.client.gui.JTopPanel
*/
private JTopPanel getPnlTop() {
if (pnlTop == null) {
pnlTop = new JTopPanel();
// fester Title, zumindest so,lange bis das Interface gestartet ist und ein neuer Titel gesetzt wird...
pnlTop.setTitle("Data Interface");
try {
pnlTop.setIcon(ResourcePool.getInstance().getImageIcon(ResourcesImages.ITAC_RGB_NOINTERLACED));
} catch (NullPointerException npe) {}
pnlTop.setSubTitle(VersionInfo.getVersion());
LogHandler.log(LOGGER, LogLevel.INFO, VersionInfo.getCompleteVersion());
}
return pnlTop;
}
@Override
public void setTitle(String title) {
super.setTitle(title);
getPnlTop().setTitle(title);
}
/**
* This method initializes menubar
*
* @return javax.swing.JMenuBar
*/
private JMenuBar getMenubar() {
if (menubar == null) {
menubar = new JMenuBar();
menubar.add(getMnuFile());
menubar.add(getMniWindow());
menubar.add(getMnuSimulations());
}
return menubar;
}
/**
* This method initializes mnuFile
*
* @return javax.swing.JMenu
*/
private JMenu getMnuFile() {
if (mnuFile == null) {
mnuFile = new JMenu();
mnuFile.setText(ResourcePool.getInstance().getString(ResourcesInterfaceFramework.INTERFACEFRAMEWORK_MENU_FILE));
mnuFile.add(getMntmStartall());
mnuFile.add(getMntmStopall());
mnuFile.add(getMniExit()); // eingefuegt mit index 2
}
return mnuFile;
}
/**
* This method initializes mniExit
*
* @return javax.swing.JMenuItem
*/
public JMenuItem getMniExit() {
if (mniExit == null) {
mniExit = new JMenuItem();
}
return mniExit;
}
/**
* Fehler beim Initialisieren der Worker, also Tab mit den Initialisierungsmeldungen anzeigen
*/
@Override
public void initFailure() {
IDataInterfaceView view = getViewForTitle(INTERFACE_TAB_NAME);
if (view != null) {
((JComponent) view).setVisible(true);
return;
}
}
@Override
public void addMessage(String instance, LogLevel level, boolean append, String text) {
addMessage(instance, level, text);
}
/**
* This method initializes mniWindow
*
* @return javax.swing.JMenu
*/
private JMenu getMniWindow() {
if (mniWindow == null) {
mniWindow = new JMenu();
mniWindow.setText(ResourcePool.getInstance().getString(ResourcesInterfaceFramework.WINDOW));
mniWindow.setVisible(false);
}
return mniWindow;
}
/**
* This method initializes mnuSimulations
*
* @return javax.swing.JMenu
*/
private JMenu getMnuSimulations() {
if (mnuSimulations == null) {
mnuSimulations = new JMenu();
mnuSimulations.setText(ResourcePool.getInstance().getString(ResourcesInterfaceFramework.SIMULATIONS));
mnuSimulations.setVisible(false);
}
return mnuSimulations;
}
@Override
/**
* Es wird eine Seite erzeugt, die den entsprechenden Title hat. Die graph. Repräsentation ist mit der Annotation definiert. Es werden auch die
* entsprechenden Menues definiert !!!!
*/
public IWorkerPane createMachineView(IMachineSimulation machineSimulation, String simulationClass,
Collection<DataInterfaceMenuAction> mnuItemString) {
IWorkerPane machineSimPane = machineSimulation.getWorkerPane();
try {
if (machineSimulation.getWorkerPane() == null) {
machineSimPane = GuiFactory.getMachineSimulationPane(Class.forName(simulationClass), machineSimulation.getInstanceName());
machineSimulation.setSimulationPane(machineSimPane);
}
if (machineSimPane != null) {
if (machineSimPane instanceof IDataInterfaceView) {
simulationTabPane.setVisible(true);
simulationTabPane.addTab(machineSimPane.getTitle(), (JComponent) machineSimPane);
}
availableViews.put(machineSimPane.getTitle(), machineSimPane);
}
} catch (ClassNotFoundException e1) {
LogHandler.log(getClass().getSimpleName(), LogLevel.ERROR, "can't get class for name '" + simulationClass + "'", e1);
}
JMenuItem mi = new JMenuItem(machineSimulation.getInstanceName());
mi.addActionListener(new ActionListener() {
private static final long serialVersionUID = -8501211859624525707L;
@Override
public void actionPerformed(ActionEvent e) {
String title = ((JMenuItem) e.getSource()).getText();
IDataInterfaceView view = getViewForTitle(title);
if (view != null) {
((JComponent) view).setVisible(true);
return;
}
}
});
mniWindow.add(mi);
mniWindow.setVisible(true);
if (machineSimPane != null) {
machineSimPane.setMenuItems(machineSimulation.getMenuItems());
machineSimPane.setMachineSimulation(machineSimulation);
}
JMenu mnuSim = new JMenu(machineSimulation.getInstanceName());
mnuSimulations.add(mnuSim);
mnuSimulations.setVisible(true);
if (mnuItemString != null && mnuItemString.size() > 0) {
for (DataInterfaceMenuAction string : mnuItemString) {
mnuSim.add(new JMenuItem(new WorkerAction(string, simulation, machineSimPane)));
}
}
return machineSimPane;
}
/**
* @param title
* @return
*/
protected IDataInterfaceView getViewForTitle(String title) {
for (int i = 0; i < mainTabPane.getTabCount(); i++) {
Component component = mainTabPane.getTabComponentAt(i);
if (component instanceof WorkerPane) {
WorkerPane wp = ((WorkerPane) component);
if (wp.getTitle().equals(title)) {
return (IDataInterfaceView) wp;
}
}
}
if (simulationTabPane != null) {
for (int i = 0; i < simulationTabPane.getTabCount(); i++) {
Component component = simulationTabPane.getTabComponentAt(i);
if (component instanceof WorkerPane) {
WorkerPane wp = ((WorkerPane) component);
if (wp.getTitle().equals(title)) {
return (IDataInterfaceView) wp;
}
}
}
}
return null;
}
@Override
public void createWorkerView(IWorkerPane workerPane, List<DataInterfaceMenuAction> menuItems) {
if (workerPane instanceof IDataInterfaceView) {
mainTabPane.addTab(workerPane.getTitle(), (JComponent) workerPane);
}
// für jeden Worker wird ein Submenu erzeugt, und unterhalb dessen jeweils ein Menu für jedes MenuItem
if (menuItems != null) {
if (workerPane.getTitle().startsWith(DataInterface.MAIN_PANE_NAME)) {
int i = 0;
for (DataInterfaceMenuAction simMenuItem : menuItems) {
JMenuItem mnItem = new JMenuItem();
mnItem.setAction(new WorkerAction(simMenuItem, worker, workerPane));
mnuFile.insert(mnItem, i++);
mnItem.setEnabled(simMenuItem.isEnabled());
}
} else {
JMenu mniWorker = new JMenu(workerPane.getTitle());
for (DataInterfaceMenuAction simMenuItem : menuItems) {
JMenuItem mnItem = new JMenuItem();
mnItem.setAction(new WorkerAction(simMenuItem, worker, workerPane));
mniWorker.add(mnItem);
mnItem.setEnabled(simMenuItem.isEnabled());
}
mnuFile.insert(mniWorker, 2);
}
}
availableViews.put(workerPane.getTitle(), workerPane);
}
@Override
public IWorkerPane getOrCreateWorkerPane(String instance) {
return GuiFactory.getWorkerPane(instance);
}
@Override
public void setMainPaneName(String mainPaneName) {
this.mainPaneName = mainPaneName;
}
@Override
public String getMainPaneName() {
return mainPaneName;
}
private JMenuItem getMntmStartall() {
if (mntmStartall == null) {
mntmStartall = new JMenuItem("startAll");
mntmStartall.setAction(startAllAction);
}
return mntmStartall;
}
private JMenuItem getMntmStopall() {
if (mntmStopall == null) {
mntmStopall = new JMenuItem("stopAll");
mntmStopall.setAction(stopAllAction);
}
return mntmStopall;
}
@Override
public void setWorker(IWorker worker) {
this.worker = worker;
}
@Override
public void setSimulation(IWorker simulation) {
this.simulation = simulation;
}
@Override
public void setActionProperties(DataInterfaceMenuAction action, String instance) {
// dieses Event an die entsprechende View weiter leiten
IWorkerPane view = availableViews.get(instance);
view.notifyActionPropertiesChanged(action);
// alle MenuItems durchforsten
// das menu-item suchen das so heisst wie die instance, darunter liegende actions mit exakt diesem Namen finden
// File Menu durchsuchen
for (int i = 0; i < getMnuFile().getItemCount(); i++) {
JMenuItem menuItem = getMnuFile().getItem(i);
if (menuItem.getText().equals(instance)) {
// Übergeordnetes Menu gefunden
if (menuItem instanceof JMenu) {
JMenu parent = (JMenu) menuItem;
for (int j = 0; j < parent.getItemCount(); j++) {
if (parent.getItem(j).getText().equals(action.getMenuText())) {
LogHandler.log(LOGGER, LogLevel.INFO,
"updating menu item enabled flag for " + action.getMenuText() + " to " + action.isEnabled());
parent.getItem(j).setEnabled(action.isEnabled());
}
}
}
}
}
// auch noch in den Simulationen suchen...
for (int i = 0; i < getMnuSimulations().getItemCount(); i++) {
JMenuItem menuItem = getMnuSimulations().getItem(i);
if (menuItem.getText().equals(instance)) {
// Übergeordnetes Menu gefunden
if (menuItem instanceof JMenu) {
JMenu parent = (JMenu) menuItem;
for (int j = 0; j < parent.getItemCount(); j++) {
if (parent.getItem(j).getText().equals(action.getMenuText())) {
LogHandler.log(LOGGER, LogLevel.INFO,
"updating menu item enabled flag for " + action.getMenuText() + " to " + action.isEnabled());
parent.getItem(j).setEnabled(action.isEnabled());
}
}
}
}
}
}
@Override
public void fireMenuItem(DataInterfaceMenuAction menuItem) {
// Der Hauptdialog reagiert nicht wie eine Simulation
}
@Override
public void setInstanceCount(int size) {
// startAll nur dann sichtbar, wenn es mehr als einen Worker gibt!!
getMntmStartall().setVisible(size > 1);
getMntmStopall().setVisible(size > 1);
}
@Override
public void clear() {}
@Override
public void setRemoteGui(IRemoteGui remoteGui) {}
@Override
public List<InstanceMessage> getInstanceMessages(String instanceName) {
return null;
}
}

View File

@@ -0,0 +1,246 @@
package com.itac.mes.datainterface.gui;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.ScrollPaneConstants;
import com.itac.mes.datainterface.annotaion.SimulationClass;
import com.itac.mes.datainterface.simulation.DatabaseSimulation;
import com.itac.mes.datainterface.simulation.IDatabasePane;
import com.itac.util.logging.LogLevel;
import com.jgoodies.layout.layout.ColumnSpec;
import com.jgoodies.layout.layout.FormLayout;
import com.jgoodies.layout.layout.FormSpecs;
import com.jgoodies.layout.layout.RowSpec;
@SimulationClass(name = "DatabaseSimulation")
public class DatabaseSimulationPanel extends BasicMessageVisualizePanel implements IDataInterfaceView, IDatabasePane {
private static final long serialVersionUID = 3988177142082469314L;
private JTextPane jTextPane;
private JTextField jTextField;
private JButton btnExecute;
private JLabel lblConnection;
private JButton btnTestConnection;
private JButton btnDisconnect;
private JButton btnConnect;
private JButton btnClear;
private MessageScrollPane messageScrollPane = null;
public DatabaseSimulationPanel() {
this("");
}
/**
* This is the default constructor
*/
public DatabaseSimulationPanel(String title) {
super(title);
initialize();
}
/**
* This method initializes this
*
* @return void
*/
@Override
public void initialize() {
this.setSize(366, 184);
setLayout(new FormLayout(
new ColumnSpec[] { FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("pref:grow"), FormSpecs.RELATED_GAP_COLSPEC,
FormSpecs.PREF_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.PREF_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
FormSpecs.PREF_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, },
new RowSpec[] { FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("max(50dlu;pref):grow"),
FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.PREF_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
FormSpecs.LINE_GAP_ROWSPEC, }));
add(getLblConnection(), "2, 2, 5, 1");
add(getBtnTestConnection(), "2, 4, right, default");
add(getBtnConnect(), "4, 4");
add(getBtnDisconnect(), "6, 4");
add(getBtnClear(), "8, 4");
// add(getTfInterfaceInfo(), "10, 4, 5, 1, fill, fill");
this.add(getJNTextPane(), "2, 6, 5, 1, fill, fill");
this.add(getJTextField(), "2, 8, 5, 1, fill, fill");
this.add(getBtnExecute(), "8, 8, center, center");
}
public void setConnectionString(String connectionString) {
getLblConnection().setText(connectionString);
}
/**
* This method initializes jTextPane
*
* @return javax.swing.JTextPane
*/
private JTextPane getJNTextPane() {
if (jTextPane == null) {
jTextPane = new JTextPane();
jTextPane.setName("jnTextPane");
jTextPane.setPreferredSize(new Dimension(6, 22));
jTextPane.setMinimumSize(new Dimension(15, 22));
}
return jTextPane;
}
/**
* This method initializes jTextField
*
* @return javax.swing.JTextField
*/
private JTextField getJTextField() {
if (jTextField == null) {
jTextField = new JTextField();
}
return jTextField;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getBtnExecute() {
if (btnExecute == null) {
btnExecute = new JButton(new AbstractAction("execute") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(DatabaseSimulation.ID_EXECUTE);
}
});
btnExecute.setPreferredSize(new Dimension(80, 21));
}
return btnExecute;
}
public void logSql(String sql) {
jTextPane.setText(jTextPane.getText() + "\n" + sql);
}
public void logDbException(Exception e) {
jTextPane.setText(jTextPane.getText() + "\nException:\n" + e.getMessage());
}
@Override
public void log(String text) {
jTextPane.setText(jTextPane.getText() + text);
}
@Override
public void logCommand(String readableString) {
jTextPane.setText(jTextPane.getText() + readableString);
}
@Override
public void clear() {
jTextPane.setText("");
}
@Override
public String getSqlStatement() {
return getJTextField().getText();
}
private JLabel getLblConnection() {
if (lblConnection == null) {
lblConnection = new JLabel("Connection");
}
return lblConnection;
}
private JButton getBtnTestConnection() {
if (btnTestConnection == null) {
btnTestConnection = new JButton(new AbstractAction("testConnection") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(DatabaseSimulation.ID_TEST_CONNECTION);
}
});
btnTestConnection.setPreferredSize(new Dimension(80, 21));
}
return btnTestConnection;
}
private JButton getBtnDisconnect() {
if (btnDisconnect == null) {
btnDisconnect = new JButton(new AbstractAction("disconnect") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(DatabaseSimulation.ID_DISCONNECT);
}
});
btnDisconnect.setPreferredSize(new Dimension(80, 21));
}
return btnDisconnect;
}
private JButton getBtnConnect() {
if (btnConnect == null) {
btnConnect = new JButton(new AbstractAction("connect") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(DatabaseSimulation.ID_CONNECT);
}
});
btnConnect.setPreferredSize(new Dimension(80, 21));
}
return btnConnect;
}
private JButton getBtnClear() {
if (btnClear == null) {
btnClear = new JButton(new AbstractAction("clear") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(DatabaseSimulation.ID_CLEAR);
}
});
btnClear.setPreferredSize(new Dimension(80, 21));
}
return btnClear;
}
/**
* This method initializes tfInterfaceInfo
*
* @return javax.swing.JTextField
*/
private MessageScrollPane getTfInterfaceInfo() {
if (messageScrollPane == null) {
messageScrollPane = new MessageScrollPane();
messageScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
messageScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
messageScrollPane.setOpaque(false);
messageScrollPane.setViewportBorder(null);
messageScrollPane.setBorder(null);
}
return messageScrollPane;
}
@Override
public void notifyActionPropertiesChanged(DataInterfaceMenuAction action) {
}
@Override
public synchronized void addMessage(String instance, LogLevel level, boolean append, String text) {
getTfInterfaceInfo().addMessage(instance, level, append, text);
}
@Override
public void addMessage(String instance, LogLevel level, String text) {
getTfInterfaceInfo().addMessage(instance, level, text);
}
}

View File

@@ -0,0 +1,193 @@
package com.itac.mes.datainterface.gui;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JLabel;
import com.itac.mes.datainterface.annotaion.SimulationClass;
import com.itac.mes.datainterface.data.fuji.message.Message;
import com.itac.mes.datainterface.simulation.FujiHostSimulation;
import com.itac.mes.datainterface.simulation.IFujiSimPane;
import com.itac.util.logging.LogLevel;
import com.jgoodies.layout.layout.ColumnSpec;
import com.jgoodies.layout.layout.FormLayout;
import com.jgoodies.layout.layout.FormSpecs;
import com.jgoodies.layout.layout.RowSpec;
@SimulationClass(name = "FujiHostSimulation")
public class FujiMessageVisualizePanel extends BasicMessageVisualizePanel implements IDataInterfaceView, IFujiSimPane {
private static final long serialVersionUID = 1L;
private static final String LOGGER = FujiMessageVisualizePanel.class.getSimpleName();
private JLabel lblServerStatus;
private JLabel lblConnectStatus;
private JButton btnStart;
private JButton btnStop;
private List<Message> inMessages = new ArrayList<Message>();
private List<Message> outMessages = new ArrayList<Message>();
public FujiMessageVisualizePanel() {
this("");
}
/**
* This is the default constructor
*/
public FujiMessageVisualizePanel(String title) {
super(title);
setBackground(SystemColor.window);
setOpaque(true);
initialize();
setSimulation(true);
}
/**
* This method initializes this
*
*/
@Override
public void initialize() {
setSize(306, 216);
setBorder(null);
setLayout(new FormLayout(
new ColumnSpec[] { FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
ColumnSpec.decode("max(45dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(49dlu;default):grow"),
FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, },
new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("129px:grow"), FormSpecs.RELATED_GAP_ROWSPEC, }));
add(getBtnStart(), "2, 2, left, default");
add(getBtnStop(), "4, 2, left, default");
add(getClearButton(), "6, 2, right, center");
add(getCbMessageLayer(), "2, 4, center, center");
add(getCbProtocolLayer(), "4, 4, center, center");
add(getCbTransportLayer(), "6, 4, left, center");
lblConnectStatus = new JLabel();
lblConnectStatus.setText("conn. State");
add(lblConnectStatus, "2, 6, center, center");
lblServerStatus = new JLabel();
lblServerStatus.setText("serverStatus");
add(lblServerStatus, "4, 6, center, center");
add(getJSplitPane(), "2, 8, 6, 1, fill, fill");
}
protected void setServerStatus(String text, Color color) {
lblServerStatus.setText(text);
lblServerStatus.setBackground(color);
}
protected void setClientConnectStatus(boolean connected) {
if (connected) {
lblConnectStatus.setText("client connected");
lblConnectStatus.setBackground(Color.GREEN);
} else {
lblConnectStatus.setText("no client connected");
lblConnectStatus.setBackground(Color.RED);
}
}
public void enableClientConnectStatus(boolean enable) {
lblConnectStatus.setVisible(enable);
}
@Override
public synchronized void addMessage(String instance, LogLevel level, boolean append, String text) {
}
@Override
public void addMessage(String instance, LogLevel level, String text) {
}
@Override
public void notifyActionPropertiesChanged(DataInterfaceMenuAction action) {
if (action.getId().equalsIgnoreCase(FujiHostSimulation.ID_START)) {
getBtnStart().getAction().setEnabled(action.isEnabled());
} else if (action.getId().equalsIgnoreCase(FujiHostSimulation.ID_STOP)) {
getBtnStop().getAction().setEnabled(action.isEnabled());
}
}
@Override
public void setClientConnected(boolean b) {
setClientConnectStatus(b);
}
@Override
public void setServerStarted(Boolean startState) {
if (startState == null) {
setServerStatus("initialize...", Color.ORANGE);
return;
}
if (startState) {
setServerStatus("Server started", Color.GREEN);
} else {
setServerStatus("Server stopped", Color.RED);
}
}
private JButton getBtnStart() {
if (btnStart == null) {
btnStart = new JButton(new AbstractAction("start") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(FujiHostSimulation.ID_START);
}
});
btnStart.setPreferredSize(new Dimension(80, 21));
}
return btnStart;
}
private JButton getBtnStop() {
if (btnStop == null) {
btnStop = new JButton(new AbstractAction("stop") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(FujiHostSimulation.ID_STOP);
}
});
btnStop.setPreferredSize(new Dimension(80, 21));
}
return btnStop;
}
@Override
public void receiveMessage(Message msg) {
// eine Liste aufbauen mit den letzten 100 Messages
// receiveMessage(Ascii.toReadableString(msg.getStringBuffer()));
inMessages.add(msg);
// Liste begrenzen
while (inMessages.size() > 100) {
inMessages.remove(0);
}
// displayInMessages();
if (getCbMessageLayer().isSelected()) {
getJTextPane().setText(msg.toString());
}
}
@Override
public void sendMessage(Message msg) {
// super.sendMessage(Ascii.toReadableString(msg.getStringBuffer()));
outMessages.add(msg);
while (outMessages.size() > 100) {
outMessages.remove(0);
}
if (getCbMessageLayer().isSelected()) {
getJTextPane1().setText(msg.toString());
}
// displayOutMessages();
}
}

View File

@@ -0,0 +1,24 @@
package com.itac.mes.datainterface.gui;
public interface IDataInterfaceView {
/**
* Title of the view that is shown on top of every dashboard view (including station number)
*
* @return
*/
public String getTitle();
/**
* Name of the view (without station number; not shown; only for internal reasons e.g. popup menu)
*
* @return
*/
public String getName();
/**
* Called, when the view is closed.
*/
public abstract void beforeClosing();
}

View File

@@ -0,0 +1,86 @@
package com.itac.mes.datainterface.gui;
import java.util.Date;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import com.itac.mes.linedashboard.data.Machine;
import com.itac.mes.linedashboard.data.MachineStatusRequest;
import com.jgoodies.layout.factories.DefaultComponentFactory;
import com.jgoodies.layout.layout.ColumnSpec;
import com.jgoodies.layout.layout.FormLayout;
import com.jgoodies.layout.layout.FormSpecs;
import com.jgoodies.layout.layout.RowSpec;
public class LineDashboardMachineStatusPanel extends JPanel {
private JTextField tfLineName;
private JTextField tfMachineName;
private JTextField tfLane;
private JTextField tfModule;
private JTextField txtTfCondition;
public LineDashboardMachineStatusPanel() {
setLayout(new FormLayout(
new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
ColumnSpec.decode("default:grow"), },
new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.UNRELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, }));
JLabel lblLinename = new JLabel("LineName");
add(lblLinename, "2, 2, right, default");
tfLineName = new JTextField();
tfLineName.setText("*");
add(tfLineName, "4, 2, fill, default");
tfLineName.setColumns(10);
JLabel lblMachine = DefaultComponentFactory.getInstance().createLabel("MachineName");
add(lblMachine, "2, 4, right, default");
tfMachineName = new JTextField();
tfMachineName.setText("machine");
add(tfMachineName, "4, 4, fill, center");
tfMachineName.setColumns(10);
JLabel lblLanename = DefaultComponentFactory.getInstance().createLabel("LaneName");
add(lblLanename, "2, 6, right, default");
tfLane = new JTextField();
tfLane.setText("*");
add(tfLane, "4, 6, fill, default");
tfLane.setColumns(10);
JLabel lblNewJgoodiesLabel = DefaultComponentFactory.getInstance().createLabel("Module");
add(lblNewJgoodiesLabel, "2, 8, right, default");
tfModule = new JTextField();
tfModule.setText("*");
add(tfModule, "4, 8, fill, default");
tfModule.setColumns(10);
JLabel lblWorkorder = new JLabel("condition");
add(lblWorkorder, "2, 10");
txtTfCondition = new JTextField();
txtTfCondition.setText("Condition");
add(txtTfCondition, "4, 10, fill, default");
txtTfCondition.setColumns(10);
}
public MachineStatusRequest getMachineStatusRequest() {
MachineStatusRequest machineStatusRequest = new MachineStatusRequest();
machineStatusRequest.setEventDate(new Date());
machineStatusRequest.setMachine(new Machine());
machineStatusRequest.getMachine().setLineName(tfLineName.getText());
machineStatusRequest.getMachine().setMachineName(tfMachineName.getText());
machineStatusRequest.getMachine().setLane(tfLane.getText());
machineStatusRequest.getMachine().setModuleName(tfModule.getText());
machineStatusRequest.setStatus(txtTfCondition.getText());
return machineStatusRequest;
}
}

View File

@@ -0,0 +1,277 @@
/*
* Copyright (c) 2010 iTAC Software AG, Germany. All Rights Reserved.
*
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
* without the written permission of iTAC Software AG.
*/
package com.itac.mes.datainterface.gui;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import com.itac.mes.datainterface.annotaion.SimulationClass;
import com.itac.mes.datainterface.simulation.ILineDashboardSimulation;
import com.itac.mes.datainterface.simulation.LineDashboardSimulation;
import com.itac.mes.linedashboard.data.MachineStatusRequest;
import com.itac.mes.linedashboard.data.ProductionTimeRequest;
import com.itac.mes.linedashboard.data.QuantityAndFailureUploadRequest;
import com.itac.mes.linedashboard.data.StationResultRequest;
import com.itac.util.logging.LogLevel;
import com.jgoodies.layout.layout.ColumnSpec;
import com.jgoodies.layout.layout.FormLayout;
import com.jgoodies.layout.layout.FormSpecs;
import com.jgoodies.layout.layout.RowSpec;
/**
* @author frankp created 2010
*/
@SimulationClass(name = "LineDashboardSimulation")
public class LineDashboardPanel extends DataInterfaceDefaultPanel implements IDataInterfaceView, ILineDashboardSimulation {
private static final long serialVersionUID = 1L;
private JPanel pnlMachine = null;
private JButton btnStartMachine = null;
private JButton btnStopMachine = null;
private JLabel jLabel = null;
private MessageScrollPane mspTextArea = null;
private JButton btnStart;
private JButton btnStop;
private JTabbedPane tabbedPane;
private JButton btnSend;
private LineDashboardProductionTimePanel lineProductionTimePanel;
private LineDashboardStationResultPanel lineDashboardStationResultPanel;
private LineDashboardQuantityUploadPanel lineDashboardQuantityUploadPanel;
private LineDashboardMachineStatusPanel lineDashboardMachineStatusPanel_1;
/**
* This is the default constructor
*/
public LineDashboardPanel(String title) {
super(title);
initialize();
setSimulation(true);
}
public LineDashboardPanel() {
this("");
}
/**
* This method initializes this
*
* @return void
*/
@Override
public void initialize() {
setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
this.add(getPnlMachine());
}
/**
* This method initializes pnlMachine
*
* @return javax.swing.JPanel
*/
private JPanel getPnlMachine() {
if (pnlMachine == null) {
pnlMachine = new JPanel();
pnlMachine.setOpaque(false);
pnlMachine.setBorder(null);
pnlMachine.setName("Machine");
pnlMachine.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
ColumnSpec.decode("max(249dlu;pref):grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.NARROW_LINE_GAP_ROWSPEC, RowSpec.decode("19px"),
FormSpecs.UNRELATED_GAP_ROWSPEC, RowSpec.decode("19px:grow"), FormSpecs.LINE_GAP_ROWSPEC,
RowSpec.decode("fill:70px"), FormSpecs.LINE_GAP_ROWSPEC, }));
pnlMachine.add(getBtnStart(), "2, 2, right, default");
pnlMachine.add(getBtnStop(), "4, 2, right, default");
pnlMachine.add(getTabbedPane(), "2, 4, fill, fill");
pnlMachine.add(getBtnSend(), "4, 4, default, top");
pnlMachine.add(getTfInterfaceInfo(), "2, 6, fill, fill");
}
return pnlMachine;
}
/**
* This method initializes btnStartMachine
*
* @return javax.swing.JButton
*/
public JButton getBtnStartMachine() {
if (btnStartMachine == null) {
btnStartMachine = new JButton();
}
return btnStartMachine;
}
/**
* This method initializes btnStopMachine
*
* @return javax.swing.JButton
*/
public JButton getBtnStopMachine() {
if (btnStopMachine == null) {
btnStopMachine = new JButton();
}
return btnStopMachine;
}
/**
* This method initializes tfInterfaceInfo
*
* @return javax.swing.JTextField
*/
private MessageScrollPane getTfInterfaceInfo() {
if (mspTextArea == null) {
mspTextArea = new MessageScrollPane();
mspTextArea.setOpaque(false);
mspTextArea.setViewportBorder(null);
mspTextArea.setBorder(null);
}
return mspTextArea;
}
@Override
public void clear() {
getTfInterfaceInfo().clear();
}
public void stop() {
// getTfChannelName().setText("")
}
@Override
public synchronized void addMessage(String instance, LogLevel level, boolean append, String text) {
getTfInterfaceInfo().addMessage(instance, level, append, text);
}
@Override
public void addMessage(String instance, LogLevel level, String text) {
getTfInterfaceInfo().addMessage(instance, level, text);
}
@Override
public void notifyActionPropertiesChanged(DataInterfaceMenuAction action) {
if (action.getId().equalsIgnoreCase(LineDashboardSimulation.ID_START)) {
getBtnStart().getAction().setEnabled(action.isEnabled());
} else if (action.getId().equalsIgnoreCase(LineDashboardSimulation.ID_STOP)) {
getBtnStop().getAction().setEnabled(action.isEnabled());
}
}
private JButton getBtnStart() {
if (btnStart == null) {
btnStart = new JButton(new AbstractAction("start") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(LineDashboardSimulation.ID_START);
}
});
btnStart.setPreferredSize(new Dimension(80, 21));
}
return btnStart;
}
private JButton getBtnStop() {
if (btnStop == null) {
btnStop = new JButton(new AbstractAction("stop") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(LineDashboardSimulation.ID_STOP);
}
});
btnStop.setPreferredSize(new Dimension(80, 21));
}
return btnStop;
}
private JTabbedPane getTabbedPane() {
if (tabbedPane == null) {
tabbedPane = new JTabbedPane(JTabbedPane.TOP);
tabbedPane.addTab("ProductionData", null, getLineDashboardProductionData(), null);
tabbedPane.addTab("StationResult", null, getLineDashboardStationResultPanel(), null);
tabbedPane.addTab("UploadQuantity", null, getLineDashboardQuantityUploadPanel(), null);
tabbedPane.addTab("MachineStatus", null, getLineDashboardMachineStatusPanel_1(), null);
}
return tabbedPane;
}
private JButton getBtnSend() {
if (btnSend == null) {
btnSend = new JButton(new AbstractAction("send") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(LineDashboardSimulation.ID_SEND);
}
});
btnStart.setPreferredSize(new Dimension(80, 21));
}
return btnSend;
}
private LineDashboardProductionTimePanel getLineDashboardProductionData() {
if (lineProductionTimePanel == null) {
lineProductionTimePanel = new LineDashboardProductionTimePanel();
}
return lineProductionTimePanel;
}
private LineDashboardStationResultPanel getLineDashboardStationResultPanel() {
if (lineDashboardStationResultPanel == null) {
lineDashboardStationResultPanel = new LineDashboardStationResultPanel();
}
return lineDashboardStationResultPanel;
}
private LineDashboardQuantityUploadPanel getLineDashboardQuantityUploadPanel() {
if (lineDashboardQuantityUploadPanel == null) {
lineDashboardQuantityUploadPanel = new LineDashboardQuantityUploadPanel();
}
return lineDashboardQuantityUploadPanel;
}
@Override
public int getPage() {
return tabbedPane.getSelectedIndex();
}
@Override
public ProductionTimeRequest getProductionTimeRequest() {
return lineProductionTimePanel.getProductionTimeRequest();
}
@Override
public StationResultRequest getStationResultRequest() {
return lineDashboardStationResultPanel.getStationResultRequest();
}
@Override
public QuantityAndFailureUploadRequest getUploadQuantityRequest() {
return lineDashboardQuantityUploadPanel.getUploadQuantityRequest();
}
private LineDashboardMachineStatusPanel getLineDashboardMachineStatusPanel_1() {
if (lineDashboardMachineStatusPanel_1 == null) {
lineDashboardMachineStatusPanel_1 = new LineDashboardMachineStatusPanel();
}
return lineDashboardMachineStatusPanel_1;
}
@Override
public MachineStatusRequest getMachineStatusRequest() {
return lineDashboardMachineStatusPanel_1.getMachineStatusRequest();
}
}

View File

@@ -0,0 +1,137 @@
package com.itac.mes.datainterface.gui;
import java.util.Date;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import com.itac.mes.linedashboard.data.Machine;
import com.itac.mes.linedashboard.data.ProductionTimeRequest;
import com.jgoodies.layout.factories.DefaultComponentFactory;
import com.jgoodies.layout.layout.ColumnSpec;
import com.jgoodies.layout.layout.FormLayout;
import com.jgoodies.layout.layout.FormSpecs;
import com.jgoodies.layout.layout.RowSpec;
public class LineDashboardProductionTimePanel extends JPanel {
private JTextField tfLineName;
private JTextField tfMachineName;
private JTextField tfLane;
private JTextField tfModule;
private JTextField txtTfworkorder;
private JTextField txtTfprocesslayer;
private JTextField txtProductiontime;
private JTextField txtSetuptime;
private JTextField txtProcesstype;
private JTextField txtMultiboard;
public ProductionTimeRequest getProductionTimeRequest() {
ProductionTimeRequest productionTimeRequest = new ProductionTimeRequest();
productionTimeRequest.setEventDate(new Date());
productionTimeRequest.setMachine(new Machine());
productionTimeRequest.getMachine().setLineName(tfLineName.getText());
productionTimeRequest.getMachine().setMachineName(tfMachineName.getText());
productionTimeRequest.getMachine().setLane(tfLane.getText());
productionTimeRequest.getMachine().setModuleName(tfModule.getText());
productionTimeRequest.setWorkorder(txtTfworkorder.getText());
productionTimeRequest.setProcessLayer(txtTfprocesslayer.getText());
productionTimeRequest.setProcessType(txtProcesstype.getText());
productionTimeRequest.setProductionTime(Double.parseDouble(txtProductiontime.getText()));
productionTimeRequest.setSetupTime(Double.parseDouble(txtSetuptime.getText()));
productionTimeRequest.setMultiBoard(Integer.parseInt(txtMultiboard.getText()));
return productionTimeRequest;
}
public LineDashboardProductionTimePanel() {
setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, }));
JLabel lblLinename = new JLabel("LineName");
add(lblLinename, "2, 2, right, default");
tfLineName = new JTextField();
tfLineName.setText("*");
add(tfLineName, "4, 2, fill, default");
tfLineName.setColumns(10);
JLabel lblMachine = DefaultComponentFactory.getInstance().createLabel("MachineName");
add(lblMachine, "2, 4, right, default");
tfMachineName = new JTextField();
tfMachineName.setText("machine");
add(tfMachineName, "4, 4, fill, center");
tfMachineName.setColumns(10);
JLabel lblLanename = DefaultComponentFactory.getInstance().createLabel("LaneName");
add(lblLanename, "2, 6, right, default");
tfLane = new JTextField();
tfLane.setText("*");
add(tfLane, "4, 6, fill, default");
tfLane.setColumns(10);
JLabel lblNewJgoodiesLabel = DefaultComponentFactory.getInstance().createLabel("Module");
add(lblNewJgoodiesLabel, "2, 8, right, default");
tfModule = new JTextField();
tfModule.setText("*");
add(tfModule, "4, 8, fill, default");
tfModule.setColumns(10);
JLabel lblWorkorder = new JLabel("workorder");
add(lblWorkorder, "2, 10, right, default");
txtTfworkorder = new JTextField();
txtTfworkorder.setText("WOFUJI05");
add(txtTfworkorder, "4, 10, fill, default");
txtTfworkorder.setColumns(10);
JLabel lblProcesslayer = new JLabel("processLayer");
add(lblProcesslayer, "2, 12, right, default");
txtTfprocesslayer = new JTextField();
txtTfprocesslayer.setText("0");
add(txtTfprocesslayer, "4, 12, fill, default");
txtTfprocesslayer.setColumns(10);
JLabel lblProductiontime = new JLabel("productionTime");
add(lblProductiontime, "2, 14, right, default");
txtProductiontime = new JTextField();
txtProductiontime.setText("30.5");
add(txtProductiontime, "4, 14, fill, default");
txtProductiontime.setColumns(10);
JLabel lblSetuptime = new JLabel("setupTime");
add(lblSetuptime, "2, 16, right, default");
txtSetuptime = new JTextField();
txtSetuptime.setText("80.8");
add(txtSetuptime, "4, 16, fill, default");
txtSetuptime.setColumns(10);
JLabel lblProcesstype = new JLabel("processType");
add(lblProcesstype, "2, 18, right, default");
txtProcesstype = new JTextField();
txtProcesstype.setText("M");
add(txtProcesstype, "4, 18, fill, default");
txtProcesstype.setColumns(10);
JLabel lblMultiboard = new JLabel("multiboard");
add(lblMultiboard, "2, 20, right, default");
txtMultiboard = new JTextField();
txtMultiboard.setText("0");
add(txtMultiboard, "4, 20, fill, default");
txtMultiboard.setColumns(10);
}
}

View File

@@ -0,0 +1,166 @@
/*
* Copyright (c) 2016 iTAC Software AG, Germany. All Rights Reserved.
*
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
* without the written permission of iTAC Software AG.
*/
package com.itac.mes.datainterface.gui;
import java.util.Date;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import com.itac.mes.linedashboard.data.Machine;
import com.itac.mes.linedashboard.data.QuantityAndFailureUploadRequest;
import com.jgoodies.layout.factories.DefaultComponentFactory;
import com.jgoodies.layout.layout.ColumnSpec;
import com.jgoodies.layout.layout.FormLayout;
import com.jgoodies.layout.layout.FormSpecs;
import com.jgoodies.layout.layout.RowSpec;
public class LineDashboardQuantityUploadPanel extends JPanel {
private JTextField tfLineName;
private JTextField tfMachineName;
private JTextField tfLane;
private JTextField tfModule;
private JTextField txtTfworkorder;
private JTextField txtTfprocesslayer;
private JTextField tfPass;
private JTextField tfFail;
private JTextField tfScrap;
private JTextField tfFirstPass;
private JTextField tfFirstFail;
private JTextField tfFirstScrap;
public LineDashboardQuantityUploadPanel() {
setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, }));
JLabel lblLinename = new JLabel("LineName");
add(lblLinename, "2, 2, right, default");
tfLineName = new JTextField();
tfLineName.setText("*");
add(tfLineName, "4, 2, fill, default");
tfLineName.setColumns(10);
JLabel lblMachine = DefaultComponentFactory.getInstance().createLabel("MachineName");
add(lblMachine, "2, 4, right, default");
tfMachineName = new JTextField();
tfMachineName.setText("machine");
add(tfMachineName, "4, 4, fill, center");
tfMachineName.setColumns(10);
JLabel lblLanename = DefaultComponentFactory.getInstance().createLabel("LaneName");
add(lblLanename, "2, 6, right, default");
tfLane = new JTextField();
tfLane.setText("*");
add(tfLane, "4, 6, fill, default");
tfLane.setColumns(10);
JLabel lblNewJgoodiesLabel = DefaultComponentFactory.getInstance().createLabel("Module");
add(lblNewJgoodiesLabel, "2, 8, right, default");
tfModule = new JTextField();
tfModule.setText("*");
add(tfModule, "4, 8, fill, default");
tfModule.setColumns(10);
JLabel lblWorkorder = new JLabel("workorder");
add(lblWorkorder, "2, 10, right, default");
txtTfworkorder = new JTextField();
txtTfworkorder.setText("WOFUJI05");
add(txtTfworkorder, "4, 10, fill, default");
txtTfworkorder.setColumns(10);
JLabel lblProcesslayer = new JLabel("processLayer");
add(lblProcesslayer, "2, 12, right, default");
txtTfprocesslayer = new JTextField();
txtTfprocesslayer.setText("0");
add(txtTfprocesslayer, "4, 12, fill, default");
txtTfprocesslayer.setColumns(10);
JLabel lblPass = new JLabel("pass");
add(lblPass, "2, 14, right, default");
tfPass = new JTextField();
tfPass.setText("1");
add(tfPass, "4, 14, fill, default");
tfPass.setColumns(10);
JLabel lblFail = new JLabel("fail");
add(lblFail, "2, 16, right, default");
tfFail = new JTextField();
tfFail.setText("2");
add(tfFail, "4, 16, fill, default");
tfFail.setColumns(10);
JLabel lblScrap = new JLabel("Scrap");
add(lblScrap, "2, 18, right, default");
tfScrap = new JTextField();
tfScrap.setText("3");
add(tfScrap, "4, 18, fill, default");
tfScrap.setColumns(10);
JLabel lblFirstPass = new JLabel("firstPass");
add(lblFirstPass, "2, 20, right, default");
tfFirstPass = new JTextField();
tfFirstPass.setText("4");
add(tfFirstPass, "4, 20, fill, default");
tfFirstPass.setColumns(10);
JLabel lblFirstFail = new JLabel("firstFail");
add(lblFirstFail, "2, 22, right, default");
tfFirstFail = new JTextField();
tfFirstFail.setText("5");
add(tfFirstFail, "4, 22, fill, fill");
tfFirstFail.setColumns(10);
JLabel llfirstScrap = new JLabel("firstScrap");
add(llfirstScrap, "2, 24, right, top");
tfFirstScrap = new JTextField();
tfFirstScrap.setText("6");
add(tfFirstScrap, "4, 24, fill, default");
tfFirstScrap.setColumns(10);
}
public QuantityAndFailureUploadRequest getUploadQuantityRequest() {
QuantityAndFailureUploadRequest result = new QuantityAndFailureUploadRequest();
result.setEventDate(new Date());
result.setMachine(new Machine());
result.getMachine().setLineName(tfLineName.getText());
result.getMachine().setMachineName(tfMachineName.getText());
result.getMachine().setLane(tfLane.getText());
result.getMachine().setModuleName(tfModule.getText());
result.setWorkorder(txtTfworkorder.getText());
result.setProcessLayer(txtTfprocesslayer.getText());
result.setPass(Integer.parseInt(tfPass.getText()));
result.setFail(Integer.parseInt(tfFail.getText()));
result.setScrap(Integer.parseInt(tfScrap.getText()));
result.setFirstPass(Integer.parseInt(tfFirstPass.getText()));
result.setFirstFail(Integer.parseInt(tfFirstFail.getText()));
result.setFirstScrap(Integer.parseInt(tfFirstScrap.getText()));
return result;
}
}

View File

@@ -0,0 +1,165 @@
package com.itac.mes.datainterface.gui;
import java.util.Date;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import com.itac.mes.linedashboard.data.Machine;
import com.itac.mes.linedashboard.data.StationResult;
import com.itac.mes.linedashboard.data.StationResultRequest;
import com.jgoodies.layout.factories.DefaultComponentFactory;
import com.jgoodies.layout.layout.ColumnSpec;
import com.jgoodies.layout.layout.FormLayout;
import com.jgoodies.layout.layout.FormSpecs;
import com.jgoodies.layout.layout.RowSpec;
public class LineDashboardStationResultPanel extends JPanel {
private JTextField tfLineName;
private JTextField tfMachineName;
private JTextField tfLane;
private JTextField tfModule;
private JTextField txtTfworkorder;
private JTextField tfLowerLimit;
private JTextField tfUpperLimit;
private JTextField tfNominal;
private JTextField tftolerance;
private JTextField tfMeasureName;
private JTextField tfMeasureValue;
private JTextField tfFailcode;
private JTextField tfUnit;
public LineDashboardStationResultPanel() {
setLayout(new FormLayout(
new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
ColumnSpec.decode("default:grow"), },
new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.UNRELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, }));
JLabel lblLinename = new JLabel("LineName");
add(lblLinename, "2, 2, right, default");
tfLineName = new JTextField();
tfLineName.setText("*");
add(tfLineName, "4, 2, fill, default");
tfLineName.setColumns(10);
JLabel lblMachine = DefaultComponentFactory.getInstance().createLabel("MachineName");
add(lblMachine, "2, 4, right, default");
tfMachineName = new JTextField();
tfMachineName.setText("machine");
add(tfMachineName, "4, 4, fill, center");
tfMachineName.setColumns(10);
JLabel lblLanename = DefaultComponentFactory.getInstance().createLabel("LaneName");
add(lblLanename, "2, 6, right, default");
tfLane = new JTextField();
tfLane.setText("*");
add(tfLane, "4, 6, fill, default");
tfLane.setColumns(10);
JLabel lblNewJgoodiesLabel = DefaultComponentFactory.getInstance().createLabel("Module");
add(lblNewJgoodiesLabel, "2, 8, right, default");
tfModule = new JTextField();
tfModule.setText("*");
add(tfModule, "4, 8, fill, default");
tfModule.setColumns(10);
JLabel lblWorkorder = new JLabel("workorder");
add(lblWorkorder, "2, 10, right, default");
txtTfworkorder = new JTextField();
txtTfworkorder.setText("WOFUJI05");
add(txtTfworkorder, "4, 10, fill, default");
txtTfworkorder.setColumns(10);
JLabel lblLowerLimit = new JLabel("lower limit");
add(lblLowerLimit, "2, 12, right, default");
tfLowerLimit = new JTextField();
add(tfLowerLimit, "4, 12, fill, default");
tfLowerLimit.setColumns(10);
JLabel lblUpperLimit = new JLabel("upper limit");
add(lblUpperLimit, "2, 14, right, default");
tfUpperLimit = new JTextField();
add(tfUpperLimit, "4, 14, fill, default");
tfUpperLimit.setColumns(10);
JLabel lblNominal = new JLabel("nominal");
add(lblNominal, "2, 16, right, default");
tfNominal = new JTextField();
add(tfNominal, "4, 16, fill, default");
tfNominal.setColumns(10);
JLabel lblTolerance = new JLabel("tolerance");
add(lblTolerance, "2, 18, right, default");
tftolerance = new JTextField();
add(tftolerance, "4, 18, fill, default");
tftolerance.setColumns(10);
JLabel lblMeasureValue = new JLabel("measure name");
add(lblMeasureValue, "2, 20, right, default");
tfMeasureName = new JTextField();
add(tfMeasureName, "4, 20, fill, default");
tfMeasureName.setColumns(10);
JLabel lblMeasureValue_1 = new JLabel("measure value");
add(lblMeasureValue_1, "2, 22, right, default");
tfMeasureValue = new JTextField();
add(tfMeasureValue, "4, 22, fill, default");
tfMeasureValue.setColumns(10);
JLabel lblFailCode = new JLabel("fail code");
add(lblFailCode, "2, 24, right, default");
tfFailcode = new JTextField();
add(tfFailcode, "4, 24, fill, default");
tfFailcode.setColumns(10);
JLabel lblUnit = new JLabel("unit");
add(lblUnit, "2, 26, right, default");
tfUnit = new JTextField();
add(tfUnit, "4, 26, fill, default");
tfUnit.setColumns(10);
}
public StationResultRequest getStationResultRequest() {
StationResultRequest productionTimeRequest = new StationResultRequest();
productionTimeRequest.setEventDate(new Date());
productionTimeRequest.setMachine(new Machine());
productionTimeRequest.getMachine().setLineName(tfLineName.getText());
productionTimeRequest.getMachine().setMachineName(tfMachineName.getText());
productionTimeRequest.getMachine().setLane(tfLane.getText());
productionTimeRequest.getMachine().setModuleName(tfModule.getText());
productionTimeRequest.setWorkorder(txtTfworkorder.getText());
StationResult stationResult = new StationResult();
stationResult.setLowerLimit(tfLowerLimit.getText());
stationResult.setUpperLimit(tfUpperLimit.getText());
stationResult.setUnit(tfUnit.getText());
stationResult.setNominal(tfNominal.getText());
stationResult.setTolerance(tftolerance.getText());
stationResult.setMeasureFailCode(tfFailcode.getText());
stationResult.setMeasureName(tfMeasureName.getText());
stationResult.setMeasureValue(tfMeasureValue.getText());
productionTimeRequest.getStationResults().add(stationResult);
return productionTimeRequest;
}
}

View File

@@ -0,0 +1,142 @@
package com.itac.mes.datainterface.gui;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Point;
import java.awt.SystemColor;
import java.util.List;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.SwingUtilities;
import javax.swing.text.BadLocationException;
import javax.swing.text.Style;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyleContext;
import javax.swing.text.StyledDocument;
import com.itac.mes.datainterface.data.MessageListener;
import com.itac.util.logging.LogHandler;
import com.itac.util.logging.LogLevel;
public class MessageScrollPane extends JScrollPane implements MessageListener {
private static final long serialVersionUID = 2188240282484447301L;
// private static final int MAX_LINES = 500;
// private JTextArea taMessage = null;
// private StringBuffer text = new StringBuffer(); // @jve:decl-index=0:
private Object lockObject = new Object();
private JTextPane taMessage;
/**
* This is the default constructor
*/
public MessageScrollPane() {
super();
setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
taMessage = new JTextPane();
setViewportView(taMessage);
StyledDocument doc = taMessage.getStyledDocument();
Style regular = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
Style s = doc.addStyle(LogLevel.ERROR.name(), regular);
StyleConstants.setForeground(s, Color.red);
s = doc.addStyle(LogLevel.FATAL.name(), regular);
StyleConstants.setForeground(s, Color.red);
s = doc.addStyle(LogLevel.DEBUG.name(), regular);
StyleConstants.setForeground(s, Color.blue);
s = doc.addStyle(LogLevel.TRACE.name(), regular);
StyleConstants.setForeground(s, Color.green);
s = doc.addStyle(LogLevel.WARN.name(), regular);
StyleConstants.setForeground(s, Color.magenta);
s = doc.addStyle(LogLevel.INFO.name(), regular);
StyleConstants.setForeground(s, Color.black);
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(300, 200);
setOpaque(false);
setBorder(null);
setBackground(SystemColor.window);
}
@Override
public void addMessage(String instance,LogLevel level, String text) {
addMessage(instance, level, false, text);
}
/**
* (non-Javadoc) if the level is less than 0 text is appended to the last line!
*
* @param level
* @param append
* @param message
* @see com.itac.mes.datainterface.data.MessageListener#addMessage(int, java.lang.String)
*/
@Override
public void addMessage(String instance, LogLevel level, boolean append, String message) {
// Set message color
synchronized (lockObject) {
StyledDocument doc = taMessage.getStyledDocument();
try {
doc.insertString(doc.getLength(), message, doc.getStyle(level.name()));
} catch (BadLocationException e1) {
LogHandler.log(getClass().getSimpleName(), LogLevel.ERROR, "insert text failed", e1);
}
try {
if (!append) {
// das letzte Zeilenende durch ein Space ersetzen
doc.insertString(doc.getLength(), "\n", null);
}
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
Point point = new Point(0, (int) (taMessage.getSize().getHeight()));
getViewport().setViewPosition(point);
} catch (Exception e) {
LogHandler.error("failed to scroll viewport, continue without updating UI");
}
}
});
} catch (Exception e) {
LogHandler.warn(e.toString()); // NullPointer fangen
}
}
}
public void clear() {
synchronized (lockObject) {
StyledDocument doc = taMessage.getStyledDocument();
try {
doc.remove(0, doc.getLength());
} catch (BadLocationException e) {
LogHandler.error("failed to clear viewport");
}
}
}
@Override
public List<InstanceMessage> getInstanceMessages(String instanceName) {
// Panel is not buffering
return null;
}
}

View File

@@ -0,0 +1,219 @@
/*
* Copyright (c) 2010 iTAC Software AG, Germany. All Rights Reserved.
*
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
* without the written permission of iTAC Software AG.
*/
package com.itac.mes.datainterface.gui;
import static com.jgoodies.layout.layout.FormSpecs.DEFAULT_ROWSPEC;
import static com.jgoodies.layout.layout.FormSpecs.LABEL_COMPONENT_GAP_COLSPEC;
import static com.jgoodies.layout.layout.FormSpecs.LINE_GAP_ROWSPEC;
import static com.jgoodies.layout.layout.FormSpecs.NARROW_LINE_GAP_ROWSPEC;
import static com.jgoodies.layout.layout.FormSpecs.PREF_COLSPEC;
import static com.jgoodies.layout.layout.FormSpecs.UNRELATED_GAP_ROWSPEC;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.text.MessageFormat;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JTextField;
import com.itac.mes.datainterface.annotaion.SimulationClass;
import com.itac.mes.datainterface.simulation.IAdapterControl;
import com.itac.mes.datainterface.simulation.OibSimulation;
import com.itac.util.logging.LogLevel;
import com.jgoodies.layout.layout.ColumnSpec;
import com.jgoodies.layout.layout.FormLayout;
import com.jgoodies.layout.layout.RowSpec;
/**
* @author frankp created 2010
*/
@SimulationClass(name = "OibSimulation")
public class OibPanel extends DataInterfaceDefaultPanel implements IDataInterfaceView, IAdapterControl {
private static final long serialVersionUID = 1L;
private JCheckBox cbSetupCenterNotifierRegistered = null;
private JCheckBox cbMonitoringReceiverRegistered = null;
private JCheckBox cbTraceReceiverStarted = null;
private JTextField tfChannelName = null;
private MessageScrollPane mspTextArea = null;
private JButton btnStart;
private JButton btnStop;
/**
* This is the default constructor
*/
public OibPanel(String title) {
super(title);
initialize();
setSimulation(true);
}
public OibPanel() {
this("");
}
/**
* This method initializes this
*
* @return void
*/
@Override
public void initialize() {
setLayout(new FormLayout(new ColumnSpec[] { LABEL_COMPONENT_GAP_COLSPEC, PREF_COLSPEC,
LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("max(97dlu;default):grow"),
LABEL_COMPONENT_GAP_COLSPEC },
new RowSpec[] { NARROW_LINE_GAP_ROWSPEC, DEFAULT_ROWSPEC,
UNRELATED_GAP_ROWSPEC, DEFAULT_ROWSPEC, UNRELATED_GAP_ROWSPEC, DEFAULT_ROWSPEC,
LINE_GAP_ROWSPEC, DEFAULT_ROWSPEC, LINE_GAP_ROWSPEC, RowSpec.decode("F:0:G") }));
cbSetupCenterNotifierRegistered = new JCheckBox();
cbSetupCenterNotifierRegistered.setOpaque(false);
cbSetupCenterNotifierRegistered.setText("SetupCenterNotifier registered");
cbSetupCenterNotifierRegistered.setEnabled(false);
add(cbSetupCenterNotifierRegistered, "2, 2, left, center");
btnStart = new JButton(new AbstractAction("start") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(OibSimulation.ID_START);
}
});
btnStart.setPreferredSize(new Dimension(80, 21));
add(btnStart, "4, 2, right, default");
cbMonitoringReceiverRegistered = new JCheckBox();
cbMonitoringReceiverRegistered.setOpaque(false);
cbMonitoringReceiverRegistered.setText("Monitoring Receiver registered");
cbMonitoringReceiverRegistered.setEnabled(false);
add(cbMonitoringReceiverRegistered, "2, 4, left, center");
btnStop = new JButton(new AbstractAction("stop") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(OibSimulation.ID_STOP);
}
});
btnStop.setPreferredSize(new Dimension(80, 21));
add(btnStop, "4, 4, right, default");
cbTraceReceiverStarted = new JCheckBox();
cbTraceReceiverStarted.setOpaque(false);
cbTraceReceiverStarted.setEnabled(false);
cbTraceReceiverStarted.setText("Trace receiver registered");
add(cbTraceReceiverStarted, "2, 6, left, center");
add(new JLabel("Channel Name"), "2, 8, left, center");
tfChannelName = new JTextField();
tfChannelName.setOpaque(false);
tfChannelName.setBorder(null);
tfChannelName.setEditable(false);
add(tfChannelName, "4, 8, fill, fill");
mspTextArea = new MessageScrollPane();
mspTextArea.setOpaque(false);
mspTextArea.setViewportBorder(null);
mspTextArea.setBorder(null);
add(mspTextArea, "2, 10, 3, 1, fill, fill");
}
@Override
public boolean isSetupStation() {
return false;
}
@Override
public boolean ping() {
return false;
}
@Override
public void setChannelName(String channelName) {
tfChannelName.setText(channelName);
}
@Override
public void setInterfaceHost(int port, String ipAddress, String canonicalHostName, String hostName) {
mspTextArea.addMessage("",
LogLevel.INFO,
MessageFormat.format("Data Interface runs on port {0} on host {3} with IP {1}, canonical host {2}", port,
ipAddress, canonicalHostName, hostName));
}
@Override
public void startMonitoringReceiver() {
cbMonitoringReceiverRegistered.setSelected(true);
}
@Override
public void startSetupCenterNotifyReceiver() {
cbSetupCenterNotifierRegistered.setSelected(true);
}
@Override
public void startTraceReceiver() {
cbTraceReceiverStarted.setSelected(true);
}
@Override
public void stopMonitoringReceiver() {
cbMonitoringReceiverRegistered.setSelected(false);
}
@Override
public void stopSetupCenterNotifyReceiver() {
cbSetupCenterNotifierRegistered.setSelected(false);
}
@Override
public void stopTraceReceiver() {
cbTraceReceiverStarted.setSelected(false);
}
@Override
public void clear() {
mspTextArea.clear();
}
public void stop() {
stopSetupCenterNotifyReceiver();
stopMonitoringReceiver();
stopTraceReceiver();
tfChannelName.setText("");
}
@Override
public synchronized void addMessage(String instance, LogLevel level, boolean append, String text) {
mspTextArea.addMessage(instance, level, append, text);
}
@Override
public void addMessage(String instance, LogLevel level, String text) {
mspTextArea.addMessage(instance, level, text);
}
@Override
public void notifyActionPropertiesChanged(DataInterfaceMenuAction action) {
if (action.getId().equalsIgnoreCase(OibSimulation.ID_START)) {
btnStart.getAction().setEnabled(action.isEnabled());
} else if (action.getId().equalsIgnoreCase(OibSimulation.ID_STOP)) {
btnStop.getAction().setEnabled(action.isEnabled());
}
}
}

View File

@@ -0,0 +1,8 @@
package com.itac.mes.datainterface.gui;
import com.itac.mes.datainterface.RemoteInterfaceInfo;
public interface OpenViewListener {
public void openView(RemoteInterfaceInfo rmio);
}

View File

@@ -0,0 +1,159 @@
/*
* Copyright (c) 2010 iTAC Software AG, Germany. All Rights Reserved.
*
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
* without the written permission of iTAC Software AG.
*/
package com.itac.mes.datainterface.gui;
import java.awt.Dimension;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JLabel;
import com.itac.mes.datainterface.annotaion.SimulationClass;
import com.itac.mes.datainterface.simulation.IPanaCimPane;
import com.itac.mes.datainterface.simulation.PanaCimSimulation;
import com.itac.util.logging.LogLevel;
import com.jgoodies.layout.layout.ColumnSpec;
import com.jgoodies.layout.layout.FormLayout;
import com.jgoodies.layout.layout.FormSpecs;
import com.jgoodies.layout.layout.RowSpec;
/**
* @author frankp created 2010
*/
@SimulationClass(name = "PanaCimSimulation")
public class PanaCimPanel extends BasicMessageVisualizePanel implements IDataInterfaceView, IPanaCimPane {
private static final long serialVersionUID = 1L;
private static final String LOGGER = PanaCimPanel.class.getSimpleName();
private JLabel lblConnectStatus;
private JButton btnStart;
private JButton btnStop;
private List<String> inMessages = new ArrayList<String>();
private List<String> outMessages = new ArrayList<String>();
public PanaCimPanel() {
this("");
}
/**
* This is the default constructor
*/
public PanaCimPanel(String title) {
super(title);
setBackground(SystemColor.window);
setOpaque(true);
initialize();
setSimulation(true);
}
/**
* This method initializes this
*
*/
@Override
public void initialize() {
this.setSize(258, 209);
setBorder(null);
setLayout(new FormLayout(
new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, },
new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
FormSpecs.DEFAULT_ROWSPEC, FormSpecs.NARROW_LINE_GAP_ROWSPEC, RowSpec.decode("122px:grow"),
FormSpecs.RELATED_GAP_ROWSPEC, }));
add(getBtnStart(), "2, 2, right, default");
add(getBtnStop(), "4, 2, right, default");
this.add(getClearButton(), "6, 2, right, center");
this.add(getCbMessageLayer(), "2, 4, center, center");
lblConnectStatus = new JLabel();
lblConnectStatus.setText("conn. State");
this.add(lblConnectStatus, "4, 4, center, center");
this.add(getJSplitPane(), "2, 6, 6, 1, fill, fill");
}
@Override
public synchronized void addMessage(String instance, LogLevel level, boolean append, String text) {
}
@Override
public void addMessage(String instance, LogLevel level, String text) {
}
@Override
public void notifyActionPropertiesChanged(DataInterfaceMenuAction action) {
if (action.getId().equalsIgnoreCase(PanaCimSimulation.ID_START)) {
getBtnStart().getAction().setEnabled(action.isEnabled());
} else if (action.getId().equalsIgnoreCase(PanaCimSimulation.ID_STOP)) {
getBtnStop().getAction().setEnabled(action.isEnabled());
}
}
private JButton getBtnStart() {
if (btnStart == null) {
btnStart = new JButton(new AbstractAction("start") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(PanaCimSimulation.ID_START);
}
});
btnStart.setPreferredSize(new Dimension(80, 21));
}
return btnStart;
}
private JButton getBtnStop() {
if (btnStop == null) {
btnStop = new JButton(new AbstractAction("stop") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(PanaCimSimulation.ID_STOP);
}
});
btnStop.setPreferredSize(new Dimension(80, 21));
}
return btnStop;
}
@Override
public void setConnectionText(String clientConnectionText) {
lblConnectStatus.setText(clientConnectionText);
}
@Override
public void receiveMessage(String msg) {
// eine Liste aufbauen mit den letzten 100 Messages
inMessages.add(msg);
// Liste begrenzen
while (inMessages.size() > 100) {
inMessages.remove(0);
}
// displayInMessages();
if (getCbMessageLayer().isSelected()) {
getJTextPane().setText(msg);
}
}
@Override
public void sendMessage(String msg) {
outMessages.add(msg);
while (outMessages.size() > 100) {
outMessages.remove(0);
}
if (getCbMessageLayer().isSelected()) {
getJTextPane1().setText(msg);
}
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (c) 2008 iTAC Software AG, Germany. All Rights Reserved.
*
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
* without the written permission of iTAC Software AG.
*/
package com.itac.mes.datainterface.gui;
import static com.itac.util.logging.LogLevel.DEBUG;
import com.itac.util.logging.LogHandler;
/**
* Der RemoteWorker ist die Worker instanz, die in einer entfernten GUI l&auml;uft, und nur die Verbindung zu einem
* wirklichen Worker in einem GUI-losen Interface besitzt
*
* @author frankp
*
*/
public class RemoteWorker implements IWorker {
private static final String LOGGER = RemoteWorker.class.getSimpleName();
@Override
public void startAll() {
// no default implementation
}
@Override
public void stopAll() {
// no default implementation
}
@Override
public void finish() {
// no default implementation
}
@Override
public void executeAction(DataInterfaceMenuAction action) {
LogHandler.log(LOGGER, DEBUG, "executing " + action);
action.execute();
}
}

View File

@@ -0,0 +1,422 @@
/*
* Copyright (c) 2016 iTAC Software AG, Germany. All Rights Reserved.
*
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
* without the written permission of iTAC Software AG.
*/
package com.itac.mes.datainterface.gui;
import static com.jgoodies.layout.layout.FormSpecs.RELATED_GAP_COLSPEC;
import static com.jgoodies.layout.layout.FormSpecs.RELATED_GAP_ROWSPEC;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.ScrollPaneConstants;
import com.itac.mes.datainterface.annotaion.SimulationClass;
import com.itac.mes.datainterface.data.samsung.message.Message;
import com.itac.mes.datainterface.simulation.ISamsungSimPane;
import com.itac.mes.datainterface.simulation.SamsungSimulation;
import com.itac.util.logging.LogLevel;
import com.jgoodies.layout.builder.FormBuilder;
import com.jgoodies.layout.layout.ColumnSpec;
import com.jgoodies.layout.layout.FormLayout;
import com.jgoodies.layout.layout.RowSpec;
@SimulationClass(name = "SamsungSimulation")
public class SamsungPanel extends DataInterfaceDefaultPanel
implements IDataInterfaceView, IWorkerPane, PropertyChangeListener, ISamsungSimPane {
protected static final String LOGGER = null;
private MessageScrollPane messageScrollPane;
private JButton btnStart;
private JButton btnStop;
private JTabbedPane tabbedPane;
private JPanel pnlBoardBarcode;
private JButton btnSendBoardBarcode;
private JTextField tfBoardBarcodeId;
private JTextField tfJobName;
private JPanel pnlMessages;
private JPanel pnlScanReelId;
private JButton btnSendScanReelId;
private JTextField tfScanReelId;
private JTextField tfReelQuantity;
private JPanel pnlPlacementRecipeCheck;
private JTextField tfPlaceProgFileName;
private JTextArea taPlacementRecipeCheck;
private JButton btnSendPlacementRecipe;
private JTextField tfReelInfoId;
private JButton btnSendReelInfoResponse;
private JPanel pnlBoardInterlockingResponse;
private JTextField tfBoardInterlockingId;
private JButton btnSendBoardInterlockingResponse;
private JPanel pnlTraceabilityData;
private JTextArea taTraceabilityData;
private JButton btnSendTraceabilityData;
private JTextField tfTraceabilityFileName;
public SamsungPanel() {
this("");
}
public SamsungPanel(String title) {
super(title);
initialize();
setSimulation(true);
tabbedPane = new JTabbedPane(JTabbedPane.TOP);
add(tabbedPane, "2, 4, 5, 1, fill, fill");
pnlMessages = new FormBuilder()
.columns("fill:0:grow")
.rows("fill:0:grow")
.padding("8,5,8,5")
.add(getTfInterfaceInfo()).xy(1, 1)
.build();
tabbedPane.addTab("Messages", null, pnlMessages, null);
// BoardBarcode
tfBoardBarcodeId = new JTextField();
tfBoardBarcodeId.setColumns(10);
tfBoardBarcodeId.setText("SMT004178");
tfJobName = new JTextField();
tfJobName.setColumns(10);
tfJobName.setText("C:\\file\\SXCPP_TestA#Top.hxx");
tfJobName.setToolTipText("JobName requires product and layer information");
btnSendBoardBarcode = new JButton("senden");
btnSendBoardBarcode.addActionListener(this::sendBarcodeClicked);
pnlBoardBarcode = new FormBuilder()
.columns("pref,$lcgap, pref:grow,$rg, 70dlu")
.rows("pref, $rg, top:pref:grow")
.padding("8,5,8,5")
.add(new JLabel("BoardBarcode")).xy(1, 1)
.add(tfBoardBarcodeId) .xy(3, 1)
.add(new JLabel("JobName")) .xy(1, 3)
.add(tfJobName) .xy(3, 3)
.add(btnSendBoardBarcode) .xy(5, 1)
.build();
tabbedPane.addTab("BoardBarcode", null, pnlBoardBarcode, null);
// Scanning Reels
tfScanReelId = new JTextField();
tfScanReelId.setColumns(10);
tfReelQuantity = new JTextField();
tfReelQuantity.setColumns(10);
btnSendScanReelId = new JButton("senden");
btnSendScanReelId.addActionListener(this::sendReelScanClicked);
pnlScanReelId = new FormBuilder()
.columns("pref,$lcgap, pref:grow,$rg, 70dlu")
.rows("pref, $rg, top:pref:grow")
.padding("8,5,8,5")
.add(new JLabel("Reel Id")) .xy(1, 1)
.add(tfScanReelId) .xy(3, 1)
.add(new JLabel("Reel Quantity")).xy(1, 3)
.add(tfReelQuantity) .xy(3, 3)
.add(btnSendScanReelId) .xy(5, 1)
.build();
tabbedPane.addTab("Scan Reels", null, pnlScanReelId, null);
// Placement Recipe check
tfPlaceProgFileName = new JTextField();
tfPlaceProgFileName.setText("file.dat");
tfPlaceProgFileName.setColumns(10);
taPlacementRecipeCheck = new JTextArea();
StringBuffer text = new StringBuffer("[HEAD]\n"); //
text.append("PCB_FILE_NAME=C:\\SmartSM\\PCB\\XDS-R910000-2036TB_M2(471)_1_Top.OPT\n"); //
text.append("[DATA]\n"); //
text.append("WORKZONE=1\n"); //
text.append("Begin\n"); //
text.append("STEP,REF,PART_NAME,SLOT_NO,SKIP,CYCLE,HEAD,ARRAY,BLOCK\n"); //
text.append("10,R10,0603R,F-35,0,1,2,1,1\n"); //
text.append("1,R11,0603R,F-38,0,1,4,1,1\n"); //
text.append("4,R12,0603R,F-34,0,1,1,1,1\n"); //
text.append("2,R13,0603R,F-36,0,1,3,1,1\n"); //
text.append("6,R14,0603R,F-40,0,1,6,1,1\n"); //
text.append("5,R170,0402R,R-22,0,1,13,1,1\n"); //
text.append("8,R171,0402R,R-26,0,1,17,1,1\n"); //
text.append("7,R172,0402R,R-25,0,1,16,1,1\n"); //
text.append("End\n"); //
text.append("WORKZONE=2\n"); //
text.append("Begin\n"); //
text.append("STEP,REF,PART_NAME,SLOT_NO,SKIP,CYCLE,HEAD,ARRAY,BLOCK\n"); //
text.append("6,D3,0201C,F-40,0,1,6,1,1\n"); //
text.append("2,D4,0201C,F-36,0,1,3,1,1\n"); //
text.append("4,R176,0402R,F-34,0,1,1,1,1\n"); //
text.append("1,R177,0402R,F-38,0,1,4,1,1\n"); //
text.append("End \n"); //
taPlacementRecipeCheck.setText(text.toString());
btnSendPlacementRecipe = new JButton("senden");
btnSendPlacementRecipe.addActionListener(this::sendPlacementRecipeClicked);
pnlPlacementRecipeCheck = new FormBuilder()
.columns("pref,$lcgap, pref:grow,$rg,70dlu")
.rows("pref, $rg, top:default:grow,$rg,default")
.padding("8,5,8,5")
.add(new JLabel("Filename")).xy(1, 1)
.add(tfPlaceProgFileName) .xy(3, 1)
.add(new JLabel("Content")) .xy(1, 3)
.add(taPlacementRecipeCheck).xy(3, 3)
.add(btnSendPlacementRecipe).xy(5, 1)
.build();
tabbedPane.addTab("PreSetupCheck", null, pnlPlacementRecipeCheck, null);
// Reel Information
tfReelInfoId = new JTextField();
tfReelInfoId.setText("345");
tfReelInfoId.setColumns(10);
tfReelInfoId.setToolTipText("sending a reel information response message");
btnSendReelInfoResponse = new JButton("senden");
btnSendReelInfoResponse.addActionListener(this::sendReelInformationResponseClicked);
pnlBoardInterlockingResponse = new FormBuilder()
.columns("pref,$lcgap, pref:grow,$rg,70dlu")
.rows("pref, pref:grow")
.padding("8,5,8,5")
.add(new JLabel("Reel Barcode")).xy(1, 1)
.add(tfReelInfoId) .xy(3, 1)
.add(btnSendReelInfoResponse) .xy(5, 1)
.build();
tabbedPane.addTab("ReelInformationResponse", null, pnlBoardInterlockingResponse, null);
// Board Interlocking
tfBoardInterlockingId = new JTextField();
tfBoardInterlockingId.setText("123");
tfBoardInterlockingId.setColumns(10);
tfBoardInterlockingId.setToolTipText("sending a board interlocking response message");
btnSendBoardInterlockingResponse = new JButton("senden");
btnSendBoardInterlockingResponse.addActionListener(this::sendBoardInterlockingClicked);
pnlBoardInterlockingResponse = new FormBuilder()
.columns("pref,$lcgap, pref:grow,$rg,70dlu")
.rows("pref, pref:grow")
.padding("8,5,8,5")
.add(new JLabel("Board Barcode")) .xy(1, 1)
.add(tfBoardInterlockingId) .xy(3, 1)
.add(btnSendBoardInterlockingResponse).xy(5, 1)
.build();
tabbedPane.addTab("BoardInterlockingResponse", null, pnlBoardInterlockingResponse, null);
// Tracedata
tfTraceabilityFileName = new JTextField();
tfTraceabilityFileName.setText("file.trk");
tfTraceabilityFileName.setColumns(10);
taTraceabilityData = new JTextArea();
StringBuffer traceabilityDataText = new StringBuffer("[HEAD]\n"); //
traceabilityDataText.append("VERSION=1.541\n"); //
traceabilityDataText.append("BOARD_SN=2000821298\n"); //
traceabilityDataText.append("ARRAY_NO=8\n"); //
traceabilityDataText
.append("ARRAY_SN=2000821298,2000821297,2000821299,2000821300,2000821302,2000821301,2000821303,2000821304\n"); //
traceabilityDataText.append("ORDERNAME=FILENAME_T_DATE\n"); //
traceabilityDataText.append("MACHINE_CODE=0000000026\n"); //
traceabilityDataText.append("PCB_FILE_NAME=C:\\SmartSM\\pcb\\13363301 9163-S01 top_1.PCB\n"); //
traceabilityDataText.append("OPERATOR=TESTMAN\n"); //
traceabilityDataText.append("START_TIME=2017-03-16 06:48:39\n"); //
traceabilityDataText.append("END_TIME=2017-03-16 06:53:03\n"); //
traceabilityDataText.append("WORKZONE=1\n"); //
traceabilityDataText.append("[DATA]\n"); //
traceabilityDataText.append("STEP,REF,PART_NAME,REELID,FEEDERID,SLOT_NO,ARRAY,BLOCK,VCODE,VPART,VNAME,LOT_CODE,DUMP\n"); //
traceabilityDataText.append("3,R5,13327433,0000484217,PI-08W-00471-D7,F56,1,1,,,,,0\n"); //
traceabilityDataText.append("2,D1,13326790,0000483699,PI-08S-33781-DB,F01,1,1,,,,,2\n"); //
traceabilityDataText.append("3,R5,13327433,0000484217,PI-08W-00471-D7,F56,2,1,,,,,0\n"); //
traceabilityDataText.append("2,D1,13326790,0000483699,PI-08S-33781-DB,F01,2,1,,,,,1\n"); //
traceabilityDataText.append("3,R5,13327433,0000484217,PI-08W-00471-D7,F56,3,1,,,,,0\n"); //
traceabilityDataText.append("2,D1,13326790,0000483699,PI-08S-33781-DB,F01,3,1,,,,,0\n"); //
traceabilityDataText.append("3,R5,13327433,0000484217,PI-08W-00471-D7,F56,4,1,,,,,0\n"); //
traceabilityDataText.append("2,D1,13326790,0000483699,PI-08S-33781-DB,F01,4,1,,,,,0\n"); //
traceabilityDataText.append("3,R5,13327433,0000484217,PI-08W-00471-D7,F56,5,1,,,,,0\n"); //
traceabilityDataText.append("2,D1,13326790,0000483699,PI-08S-33781-DB,F01,5,1,,,,,0\n"); //
traceabilityDataText.append("3,R5,13327433,0000484217,PI-08W-00471-D7,F56,6,1,,,,,0\n"); //
traceabilityDataText.append("2,D1,13326790,0000483699,PI-08S-33781-DB,F01,6,1,,,,,0\n"); //
traceabilityDataText.append("3,R5,13327433,0000484217,PI-08W-00471-D7,F56,7,1,,,,,0\n"); //
traceabilityDataText.append("2,D1,13326790,0000483699,PI-08S-33781-DB,F02,7,1,,,,,0\n"); //
traceabilityDataText.append("3,R5,13327433,0000484217,PI-08W-00471-D7,F56,8,1,,,,,0\n"); //
traceabilityDataText.append("2,D1,13326790,0000483699,PI-08S-33781-DB,F02,8,1,,,,,0\n"); //
traceabilityDataText.append("END\n"); //
taTraceabilityData.setText(traceabilityDataText.toString());
btnSendTraceabilityData = new JButton("senden");
btnSendTraceabilityData.addActionListener(this::sendTraceabilityDataClicked);
pnlTraceabilityData = new FormBuilder()
.columns("pref,$lcgap, pref:grow,$rg,70dlu")
.rows("pref, $rg, top:default:grow,$rg,default")
.padding("8,5,8,5")
.add(new JLabel("Filename")) .xy(1, 1)
.add(tfTraceabilityFileName) .xy(3, 1)
.add(new JLabel("Content")) .xy(1, 3)
.add(taTraceabilityData) .xy(3, 3)
.add(btnSendTraceabilityData).xy(5, 1)
.build();
tabbedPane.addTab("TraceabilityData", null, pnlTraceabilityData, null);
}
public void sendBarcodeClicked(ActionEvent e) {
executeAction(SamsungSimulation.ID_SEND_BOARDBARCODE);
}
public void sendReelScanClicked(ActionEvent e) {
executeAction(SamsungSimulation.ID_SEND_REELBARCODE);
}
public void sendPlacementRecipeClicked(ActionEvent e) {
executeAction(SamsungSimulation.ID_SEND_PLACEMENT_PROGRAM_VERIFICATION);
}
public void sendReelInformationResponseClicked(ActionEvent e) {
executeAction(SamsungSimulation.ID_SEND_REEL_INFORMATION_RESPONSE);
}
public void sendBoardInterlockingClicked(ActionEvent e) {
executeAction(SamsungSimulation.ID_SEND_BOARD_INTERLOCKING_RESPONSE);
}
public void sendTraceabilityDataClicked(ActionEvent e) {
executeAction(SamsungSimulation.ID_SEND_TRACEABILITY_DATA);
}
@Override
public void initialize() {
setSize(501, 444);
setLayout(new FormLayout(
new ColumnSpec[] { RELATED_GAP_COLSPEC, ColumnSpec.decode("fill:pref:grow"), RELATED_GAP_COLSPEC, ColumnSpec.decode("70dlu"),
RELATED_GAP_COLSPEC, ColumnSpec.decode("70dlu"), RELATED_GAP_COLSPEC, },
new RowSpec[] { RELATED_GAP_ROWSPEC, RowSpec.decode("23px"), RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), }));
btnStart = new JButton(new AbstractAction("start") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(SamsungSimulation.ID_START);
}
});
add(btnStart, "4, 2, fill, top");
btnStop = new JButton(new AbstractAction("stop") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(SamsungSimulation.ID_STOP);
}
});
add(btnStop, "6, 2, fill, top");
}
@Override
public void propertyChange(PropertyChangeEvent evt) {
String text = "Connections: \n";
getTfInterfaceInfo().addMessage("", LogLevel.INFO, text);
}
/**
* This method initializes tfInterfaceInfo
*
* @return javax.swing.JTextField
*/
private MessageScrollPane getTfInterfaceInfo() {
if (messageScrollPane == null) {
messageScrollPane = new MessageScrollPane();
messageScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
messageScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
messageScrollPane.setOpaque(false);
messageScrollPane.setBorder(null);
}
return messageScrollPane;
}
@Override
public synchronized void addMessage(String instance, LogLevel level, boolean append, String text) {
getTfInterfaceInfo().addMessage(instance, level, append, text);
}
@Override
public void addMessage(String instance, LogLevel level, String text) {
getTfInterfaceInfo().addMessage(instance, level, text);
}
@Override
public void notifyActionPropertiesChanged(DataInterfaceMenuAction action) {
if (action.getId().equalsIgnoreCase(SamsungSimulation.ID_START)) {
btnStart.getAction().setEnabled(action.isEnabled());
} else if (action.getId().equalsIgnoreCase(SamsungSimulation.ID_STOP)) {
btnStop.getAction().setEnabled(action.isEnabled());
}
}
@Override
public void setClientConnected(boolean b) {
addMessage("inst", LogLevel.INFO, "client connected!");
}
@Override
public void setServerStarted(Boolean startState) {
addMessage("inst", LogLevel.INFO, "server started!");
}
@Override
public void receiveMessage(Message msg) {
addMessage("received", LogLevel.INFO, msg.getHexDump());
}
@Override
public void sendMessage(Message msg) {
addMessage("sent", LogLevel.INFO, msg.getHexDump());
}
public String getReelBarcodeId() {
return tfScanReelId.getText();
}
@Override
public String getBoardBarcode() {
return tfBoardBarcodeId.getText();
}
@Override
public String getInterlockingResponseCode() {
return tfBoardInterlockingId.getText();
}
@Override
public String getReelInfoResponseCode() {
return tfReelInfoId.getText();
}
@Override
public String getPlacementProgramFileName() {
return tfPlaceProgFileName.getText();
}
@Override
public String getPlacementProgramContent() {
return taPlacementRecipeCheck.getText();
}
@Override
public String getReelQuantity() {
return tfReelQuantity.getText();
}
/*
* (non-Javadoc)
* @see com.itac.mes.datainterface.simulation.ISamsungSimPane#getJobName()
*/
@Override
public String getJobName() {
return tfJobName.getText();
}
@Override
public String getTraceabilityDataFileName() {
return tfTraceabilityFileName.getText();
}
@Override
public String getTracebilityDataContent() {
return taTraceabilityData.getText();
}
}

View File

@@ -0,0 +1,340 @@
/*
* Copyright (c) 2010 iTAC Software AG, Germany. All Rights Reserved.
*
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied, printed, edited
* or otherwise distributed, be stored in a retrieval system, or be translated into another language without the written permission
* of iTAC Software AG.
*/
package com.itac.mes.datainterface.gui;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.io.File;
import java.io.IOException;
import javax.swing.AbstractAction;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import com.itac.mes.datainterface.annotaion.SimulationClass;
import com.itac.mes.datainterface.simulation.ITestCenterPane;
import com.itac.mes.datainterface.simulation.TestCenter;
import com.itac.util.logging.LogHandler;
import com.itac.util.logging.LogLevel;
import com.jgoodies.layout.layout.ColumnSpec;
import com.jgoodies.layout.layout.FormLayout;
import com.jgoodies.layout.layout.FormSpecs;
import com.jgoodies.layout.layout.RowSpec;
@SimulationClass(name = "TestCenter")
public class TestCenterPane extends DataInterfaceDefaultPanel implements IDataInterfaceView, ITestCenterPane {
private static final String LOGGER = "Test Center GUI";
private static final long serialVersionUID = -5676616295531131381L;
private JList<String> jFileList = null;
private JTextArea jTxtArea = null;
private DefaultListModel<String> defaultListModel;
private JScrollPane jScrollPane = null;
private JLabel lblDirectory = null;
private JPanel jPanel = null;
private JScrollPane jScrollPane2 = null;
private JPanel jPanel2 = null;
private JSplitPane jSplitPane = null;
private JButton btnExecute = null;
private JButton btnReload = null;
private JLabel lblSelectedDir;
private File[] files = new File[0];
/**
* This method initializes
*
* @param title
*
*/
public TestCenterPane(String title) {
super(title);
initialize();
setSimulation(true);
}
public TestCenterPane() {
this("");
}
/**
* This method initializes this
*
*/
@Override
public void initialize() {
lblDirectory = new JLabel();
lblDirectory.setText("Directory: ");
setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("left:pref"),
FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC,
FormSpecs.PREF_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.LINE_GAP_ROWSPEC,
RowSpec.decode("14px"), FormSpecs.LINE_GAP_ROWSPEC, RowSpec.decode("40px:grow"), FormSpecs.LINE_GAP_ROWSPEC,
RowSpec.decode("bottom:default"), FormSpecs.LINE_GAP_ROWSPEC, }));
this.add(lblDirectory, "2, 2, left, center");
add(getLblSelectedDir(), "4, 2");
this.add(getJSplitPane(), "2, 4, 5, 1, fill, fill");
this.add(getBtnExecute(), "6, 6, center, center");
this.add(getBtnReload(), "4, 6, right, center");
getList().addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
executeAction(TestCenter.ID_EXECUTE_SCRIPT);
}
}
});
getList().getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()){
selectionChanged();}
}
});
}
/**
* This method initializes jList
*
* @return javax.swing.JList
*/
private JList getList() {
if (jFileList == null) {
defaultListModel = new DefaultListModel<String>();
jFileList = new JList<String>(defaultListModel);
jFileList.setToolTipText("pressing Enter executes a script");
}
return jFileList;
}
/**
* This method initializes jList
*
* @return javax.swing.JList
*/
private JTextArea getTxtArea() {
if (jTxtArea == null) {
jTxtArea = new JTextArea();
jTxtArea.setEditable(false);
}
return jTxtArea;
}
/**
* Liste loeschen
*/
public void clear() {
defaultListModel.removeAllElements();
}
/**
* Eine menge von Dateien anzeigen; es kann eine oder mehrere ausgewäaehlt werden
*
* @param files
* die anzuzeigenden Dateien
*/
@Override
public void setFiles(File[] files) {
clear();
this.files = files;
for (File file : files) {
defaultListModel.addElement(file.getName());
}
}
protected void selectionChanged() {
LogHandler.log(LOGGER, LogLevel.INFO, "selection changed");
DataInterfaceMenuAction menuAction = getMachineSimulation().getCustomAction("showScript");
getMachineSimulation().execute(menuAction);
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane2() {
if (jScrollPane2 == null) {
jScrollPane2 = new JScrollPane();
jScrollPane2.setBorder(null);
jScrollPane2.setViewportView(getTxtArea());
}
return jScrollPane2;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setBorder(null);
jScrollPane.setViewportView(getList());
}
return jScrollPane;
}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel() {
if (jPanel == null) {
jPanel = new JPanel();
jPanel.setLayout(new BorderLayout(0, 0));
jPanel.add(getJScrollPane(), BorderLayout.CENTER);
}
return jPanel;
}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel2() {
if (jPanel2 == null) {
jPanel2 = new JPanel();
jPanel2.setLayout(new BorderLayout(0, 0));
jPanel2.add(getJScrollPane2(), BorderLayout.CENTER);
}
return jPanel2;
}
/**
* This method initializes jSplitPane
*
* @return javax.swing.JSplitPane
*/
private JSplitPane getJSplitPane() {
if (jSplitPane == null) {
jSplitPane = new JSplitPane();
jSplitPane.setBorder(null);
jSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
jSplitPane.setResizeWeight(0.5D);
jSplitPane.setBottomComponent(getJPanel2());
jSplitPane.setTopComponent(getJPanel());
}
return jSplitPane;
}
/**
* This method initializes btnExecute
*
* @return javax.swing.JButton
*/
public JButton getBtnExecute() {
if (btnExecute == null) {
btnExecute = new JButton(new AbstractAction("executeScript") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(TestCenter.ID_EXECUTE_SCRIPT);
}
});
}
return btnExecute;
}
/**
* This method initializes btnReload
*
* @return javax.swing.JButton
*/
public JButton getBtnReload() {
if (btnReload == null) {
btnReload = new JButton(new AbstractAction("reload") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(TestCenter.ID_RELOAD_SCRIPT);
}
});
}
return btnReload;
}
@Override
public synchronized void addMessage(String instance, LogLevel level, boolean append, String text) {
}
@Override
public void addMessage(String instance, LogLevel level, String text) {
}
@Override
public void clearFiles() {
getTxtArea().setText("");
}
@Override
public void setDirectoryName(File sourceDirectory) {
try {
getLblSelectedDir().setText(sourceDirectory.getCanonicalPath());
} catch (IOException e) {
getLblSelectedDir().setText("no directory");
}
}
private JLabel getLblSelectedDir() {
if (lblSelectedDir == null) {
lblSelectedDir = new JLabel("" + 0x2026);
}
return lblSelectedDir;
}
@Override
public File[] getSelectedScripts() {
@SuppressWarnings("deprecation")
Object[] selectedValues = jFileList.getSelectedValues();
if (selectedValues == null || selectedValues.length == 0) {
return new File[] {};
}
File[] resultFiles = new File[selectedValues.length];
// über alle selectedValues iterieren
int index = 0;
for (Object fileName : selectedValues) {
for (File file : files) {
if (file.getName().equals(fileName)) {
resultFiles[index] = file;
index++;
}
}
}
return resultFiles;
}
@Override
public void setScriptText(String string) {
getTxtArea().setText(string);
}
@Override
public void notifyActionPropertiesChanged(DataInterfaceMenuAction action) {
if (action.getId().equalsIgnoreCase(TestCenter.ID_EXECUTE_SCRIPT)) {
btnExecute.getAction().setEnabled(action.isEnabled());
} else if (action.getId().equalsIgnoreCase(TestCenter.ID_RELOAD_SCRIPT)) {
btnReload.getAction().setEnabled(action.isEnabled());
}
}
}

View File

@@ -0,0 +1,28 @@
package com.itac.mes.datainterface.gui;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
@SuppressWarnings("serial")
public class WorkerAction extends AbstractAction {
private IWorkerPane workerPane;
private DataInterfaceMenuAction action;
private IWorker worker;
public WorkerAction(DataInterfaceMenuAction simMenuItem, IWorker worker, IWorkerPane workerPane) {
super(simMenuItem.getMenuText());
this.action = simMenuItem;
this.worker = worker;
this.workerPane = workerPane;
}
@Override
public void actionPerformed(ActionEvent e) {
if (worker != null) {
worker.executeAction(action);
}
}
}

View File

@@ -0,0 +1,174 @@
package com.itac.mes.datainterface.gui;
import static com.itac.util.logging.LogLevel.DEBUG;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.util.Collection;
import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JLabel;
import com.itac.mes.datainterface.datasource.BasicDataSource;
import com.itac.util.logging.LogHandler;
import com.itac.util.logging.LogLevel;
import com.jgoodies.layout.layout.ColumnSpec;
import com.jgoodies.layout.layout.FormLayout;
import com.jgoodies.layout.layout.FormSpecs;
import com.jgoodies.layout.layout.RowSpec;
/*
* Copyright (c) 2008 iTAC Software AG, Germany. All Rights Reserved.
*
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
* without the written permission of iTAC Software AG.
*/
public class WorkerPane extends DataInterfaceDefaultPanel implements IDataInterfaceView, IWorkerPane {
private static final long serialVersionUID = -7081052036265722600L;
private static final String LOGGER = null;
private JButton btnStop = null;
private JButton btnStart = null;
private JLabel lblStatusText = null;
private MessageScrollPane messagePane = null;
public WorkerPane() {
super("NoName");
initialize();
}
/**
* This is the default constructor
*/
public WorkerPane(String title) {
super(title);
initialize();
}
/**
* This method initializes this
*
* @return void
*/
@Override
public void initialize() {
lblStatusText = new JLabel();
lblStatusText.setText("init " + 0x2024);
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.insets = new Insets(0, 6, 0, 5);
gridBagConstraints11.gridy = -1;
gridBagConstraints11.gridx = -1;
setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("91px:grow"),
FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("89px"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("89px"),
FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("49px:grow"),
FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, }));
this.add(getMessagePane(), "2, 2, 5, 1, fill, fill");
this.add(lblStatusText, "2, 4, left, center");
btnStart = new JButton();
btnStart.setVisible(false);
btnStart.setPreferredSize(new Dimension(89, 23));
btnStart.setEnabled(false);
add(btnStart, "4, 4, right, center");
btnStop = new JButton();
btnStop.setVisible(false);
btnStop.setEnabled(false);
btnStop.setPreferredSize(new Dimension(89, 23));
add(btnStop, "6, 4, right, center");
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
public MessageScrollPane getMessagePane() {
if (messagePane == null) {
messagePane = new MessageScrollPane();
messagePane.setOpaque(false);
}
return messagePane;
}
@Override
public void setDescription(String description) {
lblStatusText.setText(description);
}
@Override
public synchronized void addMessage(String instance, LogLevel level, boolean append, String text) {
messagePane.addMessage(instance, level, append, text);
}
@Override
public void addMessage(String instance, LogLevel level, String text) {
messagePane.addMessage(instance, level, text);
}
@Override
public void executeAction(String action) {
LogHandler.log(LOGGER, DEBUG, "executeAction " + action);
}
@Override
public void setMenuItems(Collection<DataInterfaceMenuAction> menuActionCollection) {
for (DataInterfaceMenuAction menuAction : menuActionCollection) {
Action a = new AbstractAction(menuAction.getMenuText()) {
@Override
public void actionPerformed(ActionEvent e) {
DataInterfaceMenuAction menuItem = (DataInterfaceMenuAction) getValue("simMenuItem");
LogHandler.log(LOGGER, DEBUG, menuItem.getMenuText());
menuItem.execute();
}
};
a.putValue("simMenuItem", menuAction);
// Zuordnen der Action zu Button anhand des Namens
if (menuAction.getId().equals(BasicDataSource.ID_START)) {
btnStart.setAction(a);
btnStart.setVisible(true);
} else if (menuAction.getId().equals(BasicDataSource.ID_STOP)) {
btnStop.setAction(a);
btnStop.setVisible(true);
}
notifyActionPropertiesChanged(menuAction);
}
}
/** hiermit wird diese View informiert, dass sich Eigenschaften dieser Action geändert haben */
@Override
public void notifyActionPropertiesChanged(DataInterfaceMenuAction action) {
// Zuordnen der Action zu Button anhand des Namens
if (action.getId().equals(BasicDataSource.ID_START)) {
btnStart.getAction().setEnabled(action.isEnabled());
} else if (action.getId().equals(BasicDataSource.ID_STOP)) {
btnStop.getAction().setEnabled(action.isEnabled());
}
}
@Override
public void clear() {
messagePane.clear();
}
@Override
public void propertiesChanged(DataInterfaceMenuAction dima) {
LogHandler.log(LOGGER, DEBUG, "properties changed for " + dima);
}
@Override
public List<InstanceMessage> getInstanceMessages(String instance) {
return null;
}
}

View File

@@ -0,0 +1,110 @@
package com.itac.mes.datainterface.gui;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.ScrollPaneConstants;
import com.itac.mes.datainterface.annotaion.SimulationClass;
import com.itac.mes.datainterface.simulation.YamahaSimulation;
import com.itac.util.logging.LogLevel;
import com.jgoodies.layout.layout.ColumnSpec;
import com.jgoodies.layout.layout.FormLayout;
import com.jgoodies.layout.layout.FormSpecs;
import com.jgoodies.layout.layout.RowSpec;
@SimulationClass(name = "YamahaSimulation")
public class YamahaPanel extends DataInterfaceDefaultPanel implements IDataInterfaceView, PropertyChangeListener {
protected static final String LOGGER = null;
private MessageScrollPane messageScrollPane = null;
private JButton btnStart;
private JButton btnStop;
public YamahaPanel() {
this("");
}
public YamahaPanel(String title) {
super(title);
initialize();
setSimulation(true);
}
@Override
public void initialize() {
setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.GROWING_BUTTON_COLSPEC,
FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("max(50dlu;pref):grow"), FormSpecs.RELATED_GAP_ROWSPEC, }));
JLabel lblTitle = new JLabel("Yamaha Simulation");
add(lblTitle, "2, 2, left, center");
btnStart = new JButton(new AbstractAction("start") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(YamahaSimulation.ID_START);
}
});
add(btnStart, "4, 2");
btnStop = new JButton(new AbstractAction("stop") {
@Override
public void actionPerformed(ActionEvent e) {
executeAction(YamahaSimulation.ID_STOP);
}
});
add(btnStop, "6, 2");
add(getTfInterfaceInfo(), "2, 4, 5, 1, fill, fill");
}
@Override
public void propertyChange(PropertyChangeEvent evt) {
String text = "Connections: \n";
getTfInterfaceInfo().addMessage("", LogLevel.INFO, text);
}
/**
* This method initializes tfInterfaceInfo
*
* @return javax.swing.JTextField
*/
private MessageScrollPane getTfInterfaceInfo() {
if (messageScrollPane == null) {
messageScrollPane = new MessageScrollPane();
messageScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
messageScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
messageScrollPane.setOpaque(false);
messageScrollPane.setBorder(null);
}
return messageScrollPane;
}
@Override
public synchronized void addMessage(String instance, LogLevel level, boolean append, String text) {
getTfInterfaceInfo().addMessage(instance, level, append, text);
}
@Override
public void addMessage(String instance, LogLevel level, String text) {
getTfInterfaceInfo().addMessage(instance, level, text);
}
@Override
public void notifyActionPropertiesChanged(DataInterfaceMenuAction action) {
if (action.getId().equalsIgnoreCase(YamahaSimulation.ID_START)) {
btnStart.getAction().setEnabled(action.isEnabled());
} else if (action.getId().equalsIgnoreCase(YamahaSimulation.ID_STOP)) {
btnStop.getAction().setEnabled(action.isEnabled());
}
}
}

View File

@@ -0,0 +1,11 @@
com.itac.mes.datainterface.gui.PanaCimPanel
com.itac.mes.datainterface.gui.OibPanel
com.itac.mes.datainterface.gui.CogiscanPanel
com.itac.mes.datainterface.gui.CommonSmtPanel
com.itac.mes.datainterface.gui.FujiMessageVisualizePanel
com.itac.mes.datainterface.gui.DatabaseSimulationPanel
com.itac.mes.datainterface.gui.YamahaPanel
com.itac.mes.datainterface.gui.TestCenterPane
com.itac.mes.datainterface.gui.LineDashboardPanel
com.itac.mes.datainterface.gui.SamsungPanel

View File

@@ -0,0 +1,400 @@
/*
* Copyright (c) 2016 iTAC Software AG, Germany. All Rights Reserved.
*
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
* without the written permission of iTAC Software AG.
*/
package com.itac.mes.datainterface.factories;
import static com.itac.util.logging.LogLevel.INFO;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import org.junit.Test;
import com.itac.mes.config.domain.Parameter;
import com.itac.mes.datainterface.ConfigurationException;
import com.itac.mes.datainterface.DataInterfaceConfiguration;
import com.itac.mes.datainterface.annotations.AAutoHandler;
import com.itac.mes.datainterface.annotations.AInit;
import com.itac.mes.datainterface.annotations.AInstantiationType;
import com.itac.mes.datainterface.annotations.AParamValue;
import com.itac.mes.datainterface.annotations.AParameter;
import com.itac.mes.datainterface.annotations.AParameterDefaultValue;
import com.itac.mes.datainterface.annotations.InstantiationType;
import com.itac.mes.datainterface.data.MessageListener;
import com.itac.mes.datainterface.data.Toolbox;
import com.itac.mes.datainterface.messaging.EventSourceInfo;
import com.itac.util.logging.LogLevel;
/**
* @author frankp
*
*/
public class AConfigurableHandlerTest {
private static final String LOGGER = AConfigurableHandler.class.getSimpleName();
@Test
public void shouldSetDescription() {
AConfigurableHandler handler = new AConfigurableHandler() {
};
assertEquals("", handler.getDescription());
handler.setDescription("desc");
assertEquals("desc", handler.getDescription());
handler.setDescription(null);
assertEquals("", handler.getDescription());
}
@Test
public void shouldSetInstanceName() {
AConfigurableHandler handler = new AConfigurableHandler() {
};
assertEquals("", handler.getInstanceName());
handler.setInstanceName("instance");
assertEquals("instance", handler.getInstanceName());
handler.setInstanceName(null);
assertEquals("", handler.getInstanceName());
}
@Test
public void shouldHaveDefaultName() {
AConfigurableHandler handler = new AConfigurableHandler() {
};
assertEquals("unknown", handler.getName());
}
@AInstantiationType(name = "singleName", type = InstantiationType.APPLICATION)
private class AnnotatedHandler extends AConfigurableHandler {
}
@Test
public void shouldHaveAnnotationName() {
AConfigurableHandler handler = new AnnotatedHandler();
assertEquals("singleName", handler.getName());
}
@Test
public void shouldCreateMessageListenerList() {
AConfigurableHandler handler = new AnnotatedHandler();
assertNotNull(handler.getMessageListener());
// add 2 new messageListener
MessageListener messageListener1 = mock(MessageListener.class);
MessageListener messageListener2 = mock(MessageListener.class);
handler.addMessageListener(null);
handler.addMessageListener(messageListener1);
handler.addMessageListener(messageListener2);
assertEquals(2, handler.getMessageListener().size());
handler.writeMessage(INFO, "message");
// both messageListeners should be called once
verify(messageListener1, times(1)).addMessage(anyString(), any(LogLevel.class), anyString());
verify(messageListener2, times(1)).addMessage(anyString(), any(LogLevel.class), anyString());
handler.writeMessage("newLogger", INFO, "message");
// both messageListeners should be called twice
verify(messageListener1, times(2)).addMessage(anyString(), any(LogLevel.class), anyString());
verify(messageListener2, times(2)).addMessage(anyString(), any(LogLevel.class), anyString());
handler.writeMessage("newLogger", INFO, "message", new Exception());
// both messageListeners should be called 3 times
verify(messageListener1, times(3)).addMessage(anyString(), any(LogLevel.class), anyString());
verify(messageListener2, times(3)).addMessage(anyString(), any(LogLevel.class), anyString());
}
@Test
public void shouldnotCallMessageListener() {
AConfigurableHandler handler = new AnnotatedHandler();
handler.writeMessage(INFO, "message");
handler.writeMessage("newLogger", INFO, "message");
handler.writeMessage("newLogger", INFO, "message", new Exception());
handler.writeMessage(INFO, true, "");
}
@Test
public void shouldCreateMessageListenerListOnAdd() {
AConfigurableHandler handler = new AConfigurableHandler() {
};
MessageListener messageListener1 = mock(MessageListener.class);
handler.addMessageListener(messageListener1);
assertEquals(1, handler.getMessageListener().size());
}
@Test
public void shouldCallPropertyChangeListener() {
AConfigurableHandler handler = new AConfigurableHandler() {
};
PropertyChangeListener listener1 = mock(PropertyChangeListener.class);
assertNull(handler.getPropertyChangeListener());
handler.propertyChange("demo");
handler.setPropertyChangeListener(null);
assertNull(handler.getPropertyChangeListener());
handler.setPropertyChangeListener(listener1);
assertNotNull(handler.getPropertyChangeListener());
handler.propertyChange("demo");
verify(listener1, times(1)).propertyChange(any(PropertyChangeEvent.class));
}
@Test
public void shouldFindPrivateFields() throws ConfigurationException {
AConfigurableHandler handler = new AConfigurableHandler() {
@AAutoHandler(InstantiationType.TOOL)
private Toolbox field;
@AAutoHandler(InstantiationType.TOOL)
private Integer intField;
};
List<Field> fieldList = handler.getAnnotatedClassFields(AAutoHandler.class);
assertNotNull(fieldList);
// by default all handlers have the configuration field
assertEquals(2, fieldList.size());
Toolbox toolboxMock = mock(Toolbox.class);
handler.setHandler(toolboxMock, Toolbox.class);
}
@Test
public void shouldFindPrivateMethods() throws ConfigurationException {
AConfigurableHandler handler = new AConfigurableHandler() {
@AAutoHandler(InstantiationType.TOOL)
private void setToolbox(Toolbox toolbox) {
}
@AAutoHandler(InstantiationType.TOOL)
private void setInteger(Integer intvalue) {
}
};
List<Method> methodList = handler.getAnnotatedMethods(AAutoHandler.class);
assertNotNull(methodList);
// additional the inherited method setConfiguration
assertEquals(3, methodList.size());
Toolbox toolboxMock = mock(Toolbox.class);
handler.setHandler(toolboxMock, Toolbox.class);
}
@Test
public void shouldSetValueWithField() {
AConfigurableHandler handler = new AConfigurableHandler() {
@AParamValue(value = "paramName")
private int intField;
@AParamValue(value = "paramName2")
private long longField;
};
Field field = handler.getAnnotatedField("paramName");
assertNotNull(field);
}
@Test
public void shouldSetValueWithMethod() {
AConfigurableHandler handler = new AConfigurableHandler() {
@AParamValue(value = "paramName")
private void setField(int intField) {
}
};
Method method = handler.getAnnotatedMethod("paramName");
assertNotNull(method);
}
@Test
public void shouldGetEventsource() {
AConfigurableHandler handler = new AConfigurableHandler() {
};
assertNull(handler.getEventSourceInfo());
handler.setEventSourceInfo(new EventSourceInfo(new Object()));
assertNotNull(handler.getEventSourceInfo());
}
@Test
public void shouldCallAtInitNoMethod()
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, ConfigurationException {
AConfigurableHandler handler = new AConfigurableHandler() {
};
handler.callAtInit();
}
@Test
public void shouldCallAtInitValidMethod()
throws ConfigurationException {
AConfigurableHandler handler = new AConfigurableHandler() {
@AInit
private void atInit() {
}
};
handler.callAtInit();
}
@Test(expected = ConfigurationException.class)
public void shouldCallAtInitInvalidMethod()
throws ConfigurationException {
AConfigurableHandler handler = new AConfigurableHandler() {
@AInit
private void atInit(int parameter) {
}
};
handler.callAtInit();
}
@Test
public void shouldConfigure() throws ConfigurationException {
AConfigurableHandler handler = new AConfigurableHandler() {
@AInit
private void atInit(int parameter) {
}
};
handler.configure();
}
@Test
public void shouldThowMissingValue() throws ConfigurationException {
AConfigurableHandler handler = new AConfigurableHandler() {
@AInit
private void atInit(int parameter) {
}
@AParameter(name = "hallo", type = Integer.class, description = "desc")
private Parameter param;
@AParamValue("hallo")
private int paramValue;
};
DataInterfaceConfiguration configuration = mock(DataInterfaceConfiguration.class);
handler.setHandler(configuration, DataInterfaceConfiguration.class);
handler.configure();
assertEquals(AConfigurableHandler.CONFIGURATION_NOT_OK, handler.getConfigurationResult());
}
@Test
public void shouldThowMissingParamValue() throws ConfigurationException {
AConfigurableHandler handler = new AConfigurableHandler() {
@AInit
private void atInit(int parameter) {
}
@AParameter(name = "hallo", type = Integer.class, description = "desc")
private Parameter param;
};
DataInterfaceConfiguration configuration = mock(DataInterfaceConfiguration.class);
handler.setHandler(configuration, DataInterfaceConfiguration.class);
handler.configure();
assertEquals(AConfigurableHandler.CONFIGURATION_NOT_OK, handler.getConfigurationResult());
assertEquals("type:, instance:: no method or field annotated with @AParamValue for Parameter hallo\n", handler.getConfigurationText());
}
@AInstantiationType(name = "singleName", type = InstantiationType.APPLICATION)
private class ConfigHandler extends AConfigurableHandler {
@AInit
private void atInit(int parameter) {
}
@AParameter(name = "hallo", type = Integer.class, description = "desc")
private Parameter param;
@AParamValue("hallo")
public int paramValue;
@AParameter(name = "validParam", type = Void.class, description = "void")
private Parameter voidParam;
@AParameter(name = "stringParam", type = String.class, description = "desc")
private Parameter stringParam;
private String stringParamValue;
@AParamValue("stringParam")
public void setString(String paramValue) {
stringParamValue = paramValue;
}
}
@Test
public void shouldConfigureValid() throws ConfigurationException {
ConfigHandler handler = new ConfigHandler();
DataInterfaceConfiguration configuration = mock(DataInterfaceConfiguration.class);
when(configuration.getValue("hallo", Integer.class)).thenReturn(123);
when(configuration.getValue("stringParam", String.class)).thenReturn("strValue");
handler.setHandler(configuration, DataInterfaceConfiguration.class);
handler.configure();
assertEquals(123, handler.paramValue);
assertEquals("strValue", handler.stringParamValue);
assertEquals("", handler.getConfigurationText());
}
@Test
public void shouldFailSetValueWrongType() throws ConfigurationException {
ConfigHandler handler = new ConfigHandler();
DataInterfaceConfiguration configuration = mock(DataInterfaceConfiguration.class);
when(configuration.getValue("hallo", String.class)).thenReturn("123");
when(configuration.getValue("stringParam", String.class)).thenReturn("strValue");
handler.setHandler(configuration, DataInterfaceConfiguration.class);
handler.configure();
assertEquals(AConfigurableHandler.CONFIGURATION_NOT_OK, handler.getConfigurationResult());
assertEquals("type:ConfigHandler, instance:: Parameter hallo requires a configuration, but no value is configured and no default value is defined\n", handler.getConfigurationText());
}
@Test(expected = ConfigurationException.class)
public void shouldThrowWhenTypeIsUnknown() throws ConfigurationException {
ConfigHandler handler = new ConfigHandler();
DataInterfaceConfiguration configuration = mock(DataInterfaceConfiguration.class);
handler.setHandler(configuration, Object.class);
}
@Test
public void shouldGetDefaultValueByField() throws ConfigurationException {
AConfigurableHandler handler = new AConfigurableHandler() {
@AParameterDefaultValue(name = "fieldDefaultValue")
int i = 5;
@AParameterDefaultValue(name = "methodDefaultValue")
protected int getInt() {
return 111;
}
};
assertNotNull(handler.getDefaultValue("fieldDefaultValue"));
assertEquals(5, handler.getDefaultValue("fieldDefaultValue"));
assertNotNull(handler.getDefaultValue("methodDefaultValue"));
assertEquals(111, handler.getDefaultValue("methodDefaultValue"));
assertNull(handler.getDefaultValue("unavailableField"));
}
}

View File

@@ -0,0 +1,5 @@
Manifest-Version: 1.0
Built-By: frankp
Build-Jdk: 1.8.0_111
Created-By: Maven Integration for Eclipse

View File

@@ -0,0 +1,7 @@
#Generated by Maven Integration for Eclipse
#Tue Oct 13 14:05:25 CEST 2020
version=9.10.00beta-DEVELOPER
groupId=com.itac.interface.interfaces
m2e.projectName=data-interface-remote-gui
m2e.projectLocation=C\:\\projects_jee\\imsinterface\\mainline\\interface\\remotegui
artifactId=data-interface-remote-gui

View File

@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-remote-gui</artifactId>
<packaging>jar</packaging>
<name>data-interface-remote-gui</name>
<version>${mes.interface.version}</version>
<parent>
<groupId>com.itac.interface</groupId>
<artifactId>data-interface</artifactId>
<version>${mes.interface.version}</version>
</parent>
<dependencies>
<dependency>
<groupId>com.itac.product</groupId>
<artifactId>artes-client</artifactId>
</dependency>
<dependency>
<groupId>com.itac.product</groupId>
<artifactId>resource-common</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface</groupId>
<artifactId>imsinterfaces-resources-export</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-basic</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-mesutil</artifactId>
</dependency>
<dependency>
<groupId>com.jgoodies</groupId>
<artifactId>jgoodies-forms</artifactId>
</dependency>
<dependency>
<groupId>com.jgoodies</groupId>
<artifactId>jgoodies-looks</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-core</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-remote-gui-definition</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-fuji</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-fuji-definition</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-cogiscan-interface</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>imsinterfaces-commonsmt-interface</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-asm-interface</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-panasonic</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-yamaha-interface</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-line-dashboard-interface</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-machine</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>imsinterfaces-samsung</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>imsinterfaces-molding</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.itac.tools</groupId>
<artifactId>webstart-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>itacWebstartClient</goal>
</goals>
</execution>
</executions>
<configuration>
<applicationName>DataInterface.jnlp</applicationName>
<title>iTAC.MES.DataInterface without GUI</title>
<description>iTAC.MES.DataInterface</description>
<category>standard</category>
<mainClass>com.itac.mes.datainterface.DataInterface</mainClass>
<offlineAllowed>true</offlineAllowed>
<!-- optional params -->
<shortdescription>iTAC.MES.Suite without Gui</shortdescription>
<tooltip>iTAC.MES.DataInterface</tooltip>
<icon>com/itac/resource/binaries/companyIcon.png</icon>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,11 @@
com.itac.mes.datainterface.gui.PanaCimPanel
com.itac.mes.datainterface.gui.OibPanel
com.itac.mes.datainterface.gui.CogiscanPanel
com.itac.mes.datainterface.gui.CommonSmtPanel
com.itac.mes.datainterface.gui.FujiMessageVisualizePanel
com.itac.mes.datainterface.gui.DatabaseSimulationPanel
com.itac.mes.datainterface.gui.YamahaPanel
com.itac.mes.datainterface.gui.TestCenterPane
com.itac.mes.datainterface.gui.LineDashboardPanel
com.itac.mes.datainterface.gui.SamsungPanel

Some files were not shown because too many files have changed in this diff Show More