*
* @see fr.soleil.comete.bean.AbstractTangoBean#refreshGUI()
*/
@Override
protected void refreshGUI() {
TangoDAOFactory DAOFactory = new TangoDAOFactory();
// CURRENT
setWidgetModel( this.builder.getCurrentViewer(), generateAttributeKey("current"));
// CURRENT TIME TREND
TangoKey valueKey = generateAttributeKey(SPECTRUM_ATTRIBUTE);
TangoKey timeKey = generateAttributeKey(TIME_ATTRIBUTE);
TangoKey modeKey = generateAttributeKey(FUNC_MODE_SPECTRUM_ATTRIBUTE);
TangoKey maxTrendKey = generateAttributeKey(MAXTREND_ATTRIBUTE);
TangoKey tickSpacingKey = generateAttributeKey(TICKSPACING_ATTRIBUTE);
// UNIT
TangoKey unitKey = generateAttributePropertyKey(SPECTRUM_ATTRIBUTE, AttributePropertyType.UNIT);
AbstractDAO<String> unitDAO = DAOFactory.createStringDAO(unitKey);
String unit = "";
if(unitDAO != null) {
unit = unitDAO.getData();
}
// FORMAT
TangoKey formatKey = generateAttributePropertyKey(SPECTRUM_ATTRIBUTE, AttributePropertyType.FORMAT);
AbstractDAO<String> formatDAO = DAOFactory.createStringDAO(formatKey);
String format = "";
if(formatDAO != null) {
format = formatDAO.getData();
}
// CURRENT TIME TREND
this.builder.getTimeScanDeviceViewer().refreshGraphics(
valueKey, timeKey, modeKey, maxTrendKey, tickSpacingKey, unit, format);
// CURRENT TOTAL
setWidgetModel(this.builder.getCurrentTotalScalarViewer(), generateAttributeKey("currentTotal"));
// HEMITTANCE
setWidgetModel(this.builder.getHEmittanceViewer(), generateAttributeKey("hEmittance"));
// VEMITTANCE
setWidgetModel(this.builder.getVEmittanceViewer(), generateAttributeKey("vEmittance"));
// HRMS ORBIT
setWidgetModel(this.builder.getHOrbitRMSViewer(), generateAttributeKey("hRMSOrbit"));
// VRMS ORBIT
setWidgetModel(this.builder.getVOrbitRMSViewer(), generateAttributeKey("vRMSOrbit"));
// H PEAK ORBIT
setWidgetModel(this.builder.getHOrbitPeakViewer(), generateAttributeKey("hPeakOrbit"));
// V PEAK ORBIT
setWidgetModel(this.builder.getVOrbitPeakViewer(), generateAttributeKey("vPeakOrbit"));
// H TUNES
setWidgetModel(this.builder.getHTunesViewer(), generateAttributeKey("hTunes"));
// V TUNES
setWidgetModel(this.builder.getVTunesViewer(), generateAttributeKey("vTunes"));
// AVERAGE PRESSURE
setWidgetModel(this.builder.getAveragePressureViewer(), generateAttributeKey("averagePressure"));
// LIFE TIME
setWidgetModel(this.builder.getLifetimeViewer(), generateAttributeKey("lifeTime"));
// USER INFO
setWidgetModel(this.builder.getUserInfoViewer(), generateAttributeKey("userInfo"));
// END OF CURRENT FUNCTION MODE
setWidgetModel(this.builder.getCountDownViewer(), generateAttributeKey("endOfCurrentFunctionMode"));
// NEXT USER BEAM
setWidgetModel(this.builder.getNextUserBeamDateViewer(), generateAttributeKey("nextUserBeam"));
// FUNCTION MODE
setWidgetModel(this.builder.getFunctionModeViewer(), generateAttributeKey("functionMode"));
// FILLING MODE
setWidgetModel(this.builder.getModeViewer(), generateAttributeKey("fillingMode"));
// MESSAGE
setWidgetModel(this.builder.getMessageScalarViewer(), generateAttributeKey("message"));
// MESSAGE DAO
this.message = DAOFactory.createStringDAO(generateAttributeKey("message"));
// USABLE SINCE
setWidgetModel(this.builder.getLhDateViewer(), generateAttributeKey("usableSince"));
// STATE
setWidgetModel(this.builder.getStatusViewer(), generateAttributeKey("State"));
// Id & Bendings
// TODO YLE: pas d equivalent comete
//this.builder.getStateOfBendingsViewer().setColors(stateColors);
//this.builder.getStateOfIDsViewer().setColors(stateColors);
String[] values = null;
// BugFix : Get the names of beamlines from RCL (FacadeDevice can't show proxy properties
// #??? From A.Buteau
// VH
double version = Double.parseDouble(this.getVersion());
if(version >= 2.1){
// Only compatible with this version which implements
// 2 new attributes
values = getStringArrayFromAttribute("nameOfBendings");
}else{
values = getStringArrayFromProperty("TDLProxies");
for (int i = 0; i < values.length; i++) {
values[i] = values[i].split( ":" )[0];
}
}
// Fill texts with beamlines' names
String[][] texts = new String[values.length][stateColors.length];
for (int i = 0; i < values.length; i++) {
Arrays.fill(texts[i], values[i]);
}
// TODO : equivalent comete a developper
//this.builder.getStateOfBendingsViewer().setTexts( texts );
((JComponent)this.builder.getStateOfBendingsViewer().getComponent()).setFont( this.getTdlFont() );
// Get names of Beamlines on Insertion
if(version >= 2.1){
// Only compatible with this version which implements
// 2 new attributes
values = getStringArrayFromAttribute("nameOfIDs");
}else{
values = getStringArrayFromProperty("InsertionProxies");
for (int i = 0; i < values.length; i++) {
values[i] = values[i].split( ":" )[0];
}
}
texts = new String[values.length][stateColors.length];
for (int i = 0; i < values.length; i++) {
Arrays.fill(texts[i], values[i]);
}
// STATE OF IDS
setWidgetModel(this.builder.getStateOfIDsViewer(), generateAttributeKey("stateOfIDs"));
((JComponent)this.builder.getStateOfIDsViewer().getComponent()).setFont( this.getTdlFont() );
this.builder.getStateOfIDsViewer().setHorizontalAlignment( JLabel.CENTER );
// TODO : equivalent comete a developper
//this.builder.getStateOfIDsViewer().setTexts( texts );
//this.builder.getStateOfIDsViewer().setColumns(3);
// STATE OF BENDINGS
setWidgetModel(this.builder.getStateOfBendingsViewer(), generateAttributeKey("stateOfBendings"));
this.builder.getStateOfBendingsViewer().setHorizontalAlignment( JLabel.CENTER );
// TODO : equivalent comete a developper
//this.builder.getStateOfBendingsViewer().setColumns(1);
if ( !USER_MODE.equals(this.INTERFACE_MODE) ) {
((JComponent)this.builder.getMessageScalarViewer().getComponent()).addMouseListener( new MouseAdapter() {
/*
* (non-Javadoc)
*
* @see java.awt.event.MouseAdapter#mousePressed(java.awt.event.MouseEvent)
*/
@Override
public void mousePressed (MouseEvent arg0) {
String message = (String)JOptionPane.showInputDialog(
MachineStatus.this,
"Enter a new Run message",
"Change Run message",
JOptionPane.QUESTION_MESSAGE,
null,
null,
MachineStatus.this.builder.getMessageScalarViewer().getText()
);
if ( message != null ) {
MachineStatus.this.message.setData(message);
}
}
} );
((JComponent)this.builder.getStringSpectrumScrolledViewer().getComponent()).addMouseListener(
new MouseAdapter() {
@Override
public void mousePressed (MouseEvent arg0) {
String message = (String) JOptionPane
.showInputDialog(
MachineStatus.this,
"Enter a new operator message",
"Change operator message",
JOptionPane.QUESTION_MESSAGE,
null,
null,
MachineStatus.this.builder.getStringSpectrumScrolledViewer()
.getText()
);
if ( message != null
&& MachineStatus.this.operatorMessageString != null ) {
MachineStatus.this.operatorMessageString.setData(message);
}
}
}
);
}
// OPERATOR MESSAGE DAO
this.operatorMessageString = DAOFactory.createStringDAO(generateAttributeKey("operatorMessage"));
// TODO YLE :le textField peut il etre lie a une liste de String?
setWidgetModel(this.builder.getStringSpectrumScrolledViewer(), generateAttributeKey("operatorMessageHistory"));
}