Created
November 20, 2012 16:48
-
-
Save mudgen/4119182 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.inductiveautomation.gemsecs.webpages; | |
| import java.util.List; | |
| import org.apache.log4j.LogManager; | |
| import org.apache.log4j.Logger; | |
| import org.apache.wicket.Component; | |
| import org.apache.wicket.markup.html.form.upload.FileUploadField; | |
| import org.apache.wicket.model.IModel; | |
| import simpleorm.dataset.SRecordInstance; | |
| import com.inductiveautomation.gemsecs.EquipmentRecord; | |
| import com.inductiveautomation.ignition.gateway.localdb.persistence.FormMeta; | |
| import com.inductiveautomation.ignition.gateway.web.components.ConfigPanel; | |
| import com.inductiveautomation.ignition.gateway.web.components.RecordEditForm; | |
| import com.inductiveautomation.ignition.gateway.web.components.RecordEditMode; | |
| import com.inductiveautomation.ignition.gateway.web.components.editors.AbstractFormComponentEditor; | |
| import com.inductiveautomation.ignition.gateway.web.pages.IConfigPage; | |
| public class FileUploadRecordEditForm extends RecordEditForm { | |
| //Logger log = LogManager.getLogger("GEMSECS"); | |
| FileUploadField uploadField = null; | |
| //Logger log = log(); | |
| public FileUploadRecordEditForm(IConfigPage configPage, | |
| ConfigPanel destinationPanel, IModel<String> titleModel, | |
| EquipmentRecord record) { | |
| super(configPage, destinationPanel, titleModel, record); | |
| // TODO Auto-generated constructor stub | |
| } | |
| @Override | |
| protected Component newEditorComponent(String id, FormMeta formMeta, RecordEditMode mode,SRecordInstance record) { | |
| Component comp = super.newEditorComponent(id, formMeta, mode, record); | |
| System.out.println(formMeta.getField()); | |
| if(formMeta.getField().equals(EquipmentRecord.SecsDefinitionFile)) { | |
| uploadField = (FileUploadField) ((AbstractFormComponentEditor<?>) comp).getFormComponent(); | |
| System.out.println("uploadField: "+uploadField); | |
| } | |
| return comp; | |
| } | |
| @Override | |
| protected void onSubmit(RecordEditMode mode, List<SRecordInstance> records) { | |
| //EquipmentRecord record = (EquipmentRecord) records.get(0); | |
| System.out.println("upload:"+uploadField); | |
| //log.info(record.getString(record.SecsDefinitionFile)); | |
| //log.info(uploadField); | |
| //log.info(record.getObject(record.SecsDefinitionFile)); | |
| //log.info(record.SecsDefinitionFile.getField()); | |
| //log.info(record.SecsDefinitionFile.getField().); | |
| //System.out.println(records); | |
| //log.info(record); | |
| super.onSubmit(mode,records); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment