再次
,我一直在想,...
更重要的是,如果你的目標是測驗文檔在測驗系統中打開爲測驗參與者分發的文件,然後他們打開它,然後他們可以用答案填寫表格(例如Pdf表格)並簽名(或自動簽名爲您的登錄名)並提交/保存使系統具有所有有效/合法測試/問答文件的文件,可以查詢和法官/年級,我認爲這是如何去:
型號:
package com.emerlard.test.temp.test.model;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
*
* @author eddhie
*/
@Entity
public class Document implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Document)) {
return false;
}
Document other = (Document) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.emerlard.test.temp.test.model.Document[ id=" + id + " ]";
}
private String Name;
private User CreatedBy;
//todo:create a directory system/model
private Directory directory;
`
}-----
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.emerlard.test.temp.test.model;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
*
* @author eddie
*/
@Entity
public class QuestionDocument extends Document implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof QuestionDocument)) {
return false;
}
QuestionDocument other = (QuestionDocument) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.emerlard.test.temp.test.model.QuestionDocument[ id=" + id + " ]";
}
} /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.emerlard.test.temp;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.File;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileNameExtensionFilter;
/**
*
* @author eddhie
*
*/
public class JQuizFileChooser extends JFileChooser implements IJQuizFileChooser {
//todo:the event still using property change call so maybe need to be regular agent or not. but it is quite standard for this java beans
public static final String PROP_FILE_CHOOSEN_EVENT = "FileChoosenEvent";
private String FileChoosenEvent;
private PropertyChangeSupport propertySupport;
@Override
public String getFileChoosenEvent() {
return FileChoosenEvent;
}
@Override
public void setFileChoosenEvent(String value) {
String oldValue = FileChoosenEvent;
FileChoosenEvent = value;
propertySupport.firePropertyChange(PROP_FILE_CHOOSEN_EVENT, oldValue, FileChoosenEvent);
}
//todo:what to do woith mutltipel file seleantion
@Override
public void setSelectedFile(File file) {
super.setSelectedFile(file); //To change body of generated methods, choose Tools | Templates.
//todo:what aobut mamignt eh proeety hcangei envet is not sring but drectoyr fpeorty
setFileChoosenEvent("Selected File Changed , do your setting of your hander to fill the containter");
}
public void addPropertyChangeListener(PropertyChangeListener listener) {
propertySupport.addPropertyChangeListener(listener);
}
public void removePropertyChangeListener(PropertyChangeListener listener) {
propertySupport.removePropertyChangeListener(listener);
}
public JQuizFileChooser() {
propertySupport = new PropertyChangeSupport(this);
this.setFileFilter(new FileNameExtensionFilter("Text File", "txt"));
}
}
而且界面THA tcompoent
package com.emerlard.test.temp;
/**
*
* @author eddhie
*/
public interface IJQuizFileChooser {
String getFileChoosenEvent();
void setFileChoosenEvent(String value);
}
SEEE:
在這裏,您可以在JquisFileCooser的compojnet相關(incude使用注射例如界面春天,例如。
你然後(儘管也可以僅僅指剛財產inection用豆)
主代碼
@autowire
IQuizFileChooser
這將導致這個文件選擇的內容或處理
然後你就可以趕上在主代碼中選擇的文件事件將會像
private void newBean11PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_newBean11PropertyChange
// TODO add your handling code here:
}//GEN-LAST:event_newBean11PropertyChange
凡EVT通訊員您的活動
,並填寫要顯示的容器內
保存時,那麼你使用一些的FileWriter寫有正確的ID名稱正確的目錄
您只需連接易於應用的型號記錄
GOTIT?
所以最後你只需要這一切
@autowire Iquizzfilechooser
@autowire Containner //如果你想做到這一點, 您可以立即根據你想要去的地方運行如果,其他是注射或如果你想添加更多的其他東西取決於你然後
很酷的權利?
來源
2017-01-23 08:03:35
Edd
你可以使用子字符串。這是對的?這就是它的樣子。我想你可以在C中使用字符串索引'str [0:4]' –