Commit bfaf1052 authored by Claes Sjofors's avatar Claes Sjofors

Language selection added to webhandler

parent 8838a2a4
...@@ -45,18 +45,27 @@ public class JopOpWindow extends JPanel { ...@@ -45,18 +45,27 @@ public class JopOpWindow extends JPanel {
this.root = root; this.root = root;
en = session.getEngine(); en = session.getEngine();
// Set language // Get WebHandler object
JopLang lng = new JopLang(session);
lng.set( JopLang.LANGUAGE_sv_SE);
JopLang.setDefault(lng);
CdhrObjid oretWebH = en.gdh.getClassList( Pwrb.cClass_WebHandler); CdhrObjid oretWebH = en.gdh.getClassList( Pwrb.cClass_WebHandler);
if ( oretWebH.evenSts()) return; if ( oretWebH.evenSts()) return;
CdhrString sret = en.gdh.objidToName( oretWebH.objid, Cdh.mName_volumeStrict); CdhrString sret = en.gdh.objidToName( oretWebH.objid, Cdh.mName_volumeStrict);
if ( sret.evenSts()) return; if ( sret.evenSts()) return;
String s = sret.str + ".Title"; // Set language
JopLang lng = new JopLang(session);
String s = sret.str + ".Language";
CdhrInt iret = en.gdh.getObjectInfoInt( s);
if ( iret.oddSts())
lng.set( iret.value);
JopLang.setDefault(lng);
if ( root instanceof JFrame)
((JFrame)root).setTitle( JopLang.transl("Operator Window"));
s = sret.str + ".Title";
CdhrString srettxt = en.gdh.getObjectInfoString( s); CdhrString srettxt = en.gdh.getObjectInfoString( s);
if ( srettxt.evenSts()) return; if ( srettxt.evenSts()) return;
...@@ -81,12 +90,19 @@ public class JopOpWindow extends JPanel { ...@@ -81,12 +90,19 @@ public class JopOpWindow extends JPanel {
this.add( label); this.add( label);
OpWindButton button; OpWindButton button;
langButton = new OpWindButton( session, "", JopLang.transl("Language"),
OpWindButton.LANGUAGE); s = sret.str + ".EnableLanguage";
this.add( langButton); iret = en.gdh.getObjectInfoInt( s);
if ( iret.evenSts()) return;
if ( iret.value != 0) {
langButton = new OpWindButton( session, "", JopLang.transl("Language"),
OpWindButton.LANGUAGE);
this.add( langButton);
}
s = sret.str + ".EnableLogin"; s = sret.str + ".EnableLogin";
CdhrInt iret = en.gdh.getObjectInfoInt( s); iret = en.gdh.getObjectInfoInt( s);
if ( iret.evenSts()) return; if ( iret.evenSts()) return;
if ( iret.value != 0) { if ( iret.value != 0) {
...@@ -104,7 +120,7 @@ public class JopOpWindow extends JPanel { ...@@ -104,7 +120,7 @@ public class JopOpWindow extends JPanel {
iret = en.gdh.getObjectInfoInt( s); iret = en.gdh.getObjectInfoInt( s);
if ( iret.evenSts()) return; if ( iret.evenSts()) return;
if ( iret.value != 0) { if ( iret.value != 0 && !(root instanceof JFrame)) {
alarmButton = new OpWindButton( session, "", JopLang.transl("Alarm and Event List"), alarmButton = new OpWindButton( session, "", JopLang.transl("Alarm and Event List"),
OpWindButton.ALARMLIST); OpWindButton.ALARMLIST);
this.add( alarmButton); this.add( alarmButton);
...@@ -114,7 +130,7 @@ public class JopOpWindow extends JPanel { ...@@ -114,7 +130,7 @@ public class JopOpWindow extends JPanel {
iret = en.gdh.getObjectInfoInt( s); iret = en.gdh.getObjectInfoInt( s);
if ( iret.evenSts()) return; if ( iret.evenSts()) return;
if ( iret.value != 0) { if ( iret.value != 0 && !(root instanceof JFrame)) {
eventLogButton = new OpWindButton( session, "", JopLang.transl("Event Log"), eventLogButton = new OpWindButton( session, "", JopLang.transl("Event Log"),
OpWindButton.EVENTLOG); OpWindButton.EVENTLOG);
this.add( eventLogButton); this.add( eventLogButton);
...@@ -294,7 +310,9 @@ public class JopOpWindow extends JPanel { ...@@ -294,7 +310,9 @@ public class JopOpWindow extends JPanel {
} }
public void setLanguage( int language) { public void setLanguage( int language) {
System.out.println( "Opwindow: Set language");
if ( root instanceof JFrame)
((JFrame)root).setTitle( JopLang.transl("Operator Window"));
if ( langButton != null) if ( langButton != null)
langButton.setText( JopLang.transl("Language")); langButton.setText( JopLang.transl("Language"));
......
...@@ -103,6 +103,14 @@ SObject pwrb:Class ...@@ -103,6 +103,14 @@ SObject pwrb:Class
EndBody EndBody
EndObject EndObject
!/** !/**
! A language selection entry will be placed in the menu frame.
!*/
Object EnableLanguage $Attribute 14
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
!/**
! @Summary A login entry will be placed in the menu frame. ! @Summary A login entry will be placed in the menu frame.
! A login entry will be placed in the menu frame, that makes it possible ! A login entry will be placed in the menu frame, that makes it possible
! to login as a proview user, and gain privileges to make changes to ! to login as a proview user, and gain privileges to make changes to
...@@ -148,6 +156,14 @@ SObject pwrb:Class ...@@ -148,6 +156,14 @@ SObject pwrb:Class
EndBody EndBody
EndObject EndObject
!/** !/**
! Specifies default language.
!*/
Object Language $Attribute 15
Body SysBody
Attr TypeRef = "pwrb:Type-LanguageEnum"
EndBody
EndObject
!/**
! @Summary css-file that will be used by generated html-files. ! @Summary css-file that will be used by generated html-files.
! css-file (Cascading Style Sheets) that will be used by ! css-file (Cascading Style Sheets) that will be used by
! generated html-files. ! generated html-files.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment