TavernerPOS - Source Code

Clone: 

git clone http://www.librarysmith.co.uk/tavernerPOS

 

Index » tavernerPOS : Commitdiff 30bcca

Add scrollpane to Configuration UI (OK and Cancel buttons disapear off

Matt Smith [16-05-31 22:56]
Add scrollpane to Configuration UI (OK and Cancel buttons disapear off
screen on small screen - Thanks to Kevin Rowe for the bug report).
Correct a couple of missing messages.properties for Configuration UI).
diff --git a/i18n/messages.properties b/i18n/messages.properties
index e8040e3..5060cd3 100755
--- a/i18n/messages.properties
+++ b/i18n/messages.properties
@@ -277,6 +277,8 @@ TICKET_LIST_COLUMN_TOTAL=TOTAL
 TICKET_LIST_COLUMN_DUE=DUE

 ADD_GRATUITY_TEXT=ADD GRATUITY
+PrinterGroupView.0=ADD
+PrinterGroupView.1=EDIT
 AddPrinterDialog.0=Add/Edit Printer
 AddPrinterDialog.12=Default
 AddPrinterDialog.16=OK
@@ -1022,6 +1024,7 @@ RestaurantConfigurationView.42=Service Charge
 RestaurantConfigurationView.48=Default gratuity
 RestaurantConfigurationView.54=Ticket footer message
 RestaurantConfigurationView.7=Address line 1
+Restaurant.0=USD
 SORT_ORDER=Sort Order
 SelectionView.0=BACK
 SelectionView.1=NEXT
@@ -1321,5 +1324,3 @@ DATELONGFORMAT=MMM dd yyyy, h:mm a
 DATESHORTFORMAT=yyyy MMM dd
 DATETIMESHORTFORMAT=MMM dd, h:mm a
 DATETIMEVERYLONGFORMAT=yyyy-MMM-dd hh:mm:ss a
-TerminalConfigurationView.EXTENDDAYHOURS=Extend Day by x Hours
-TerminalConfigurationView.ERROR_RANGE_CHECK_EXTENDED_DAYS=Extended Hours must be between 0 and 11 (i.e. No added time = 0 = 23:59:59 and 11=11AM the next day).
\ No newline at end of file
diff --git a/i18n/messages_en_GB.properties b/i18n/messages_en_GB.properties
index 6a9d48c..640c1d1 100755
--- a/i18n/messages_en_GB.properties
+++ b/i18n/messages_en_GB.properties
@@ -278,6 +278,8 @@ TICKET_LIST_COLUMN_TOTAL=TOTAL
 TICKET_LIST_COLUMN_DUE=DUE

 ADD_GRATUITY_TEXT=ADD GRATUITY
+PrinterGroupView.0=ADD
+PrinterGroupView.1=EDIT
 AddPrinterDialog.0=Add/Edit Printer
 AddPrinterDialog.12=Default
 AddPrinterDialog.16=OK
@@ -1023,6 +1025,7 @@ RestaurantConfigurationView.42=Service Charge
 RestaurantConfigurationView.48=Default gratuity
 RestaurantConfigurationView.54=Ticket footer message
 RestaurantConfigurationView.7=Address line 1
+Restaurant.0=GBP
 SORT_ORDER=Sort Order
 SelectionView.0=BACK
 SelectionView.1=NEXT
@@ -1322,5 +1325,3 @@ DATELONGFORMAT=MMM dd yyyy, h:mm a
 DATESHORTFORMAT=yyyy MMM dd
 DATETIMESHORTFORMAT=MMM dd, h:mm a
 DATETIMEVERYLONGFORMAT=yyyy-MMM-dd hh:mm:ss a
-TerminalConfigurationView.EXTENDDAYHOURS=Extend Day by x Hours
-TerminalConfigurationView.ERROR_RANGE_CHECK_EXTENDED_DAYS=Extended Hours must be between 0 and 11 (i.e. No added time = 0 = 23:59:59 and 11=11AM the next day).
\ No newline at end of file
diff --git a/images/title.png b/images/title.png
index ec0dd84..bbfffb5 100755
Binary files a/images/title.png and b/images/title.png differ
diff --git a/images/ui_icons/title.png b/images/ui_icons/title.png
index ec0dd84..bbfffb5 100755
Binary files a/images/ui_icons/title.png and b/images/ui_icons/title.png differ
diff --git a/images/ui_icons/wide logo with title.png b/images/ui_icons/wide logo with title.png
index ec0dd84..bbfffb5 100755
Binary files a/images/ui_icons/wide logo with title.png and b/images/ui_icons/wide logo with title.png differ
diff --git a/src/com/floreantpos/config/ui/ConfigurationDialog.java b/src/com/floreantpos/config/ui/ConfigurationDialog.java
index bdf2c4e..de1dd4a 100644
--- a/src/com/floreantpos/config/ui/ConfigurationDialog.java
+++ b/src/com/floreantpos/config/ui/ConfigurationDialog.java
@@ -1,5 +1,6 @@
 package com.floreantpos.config.ui;

+import java.awt.Dimension;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.util.ArrayList;
@@ -7,7 +8,9 @@ import java.util.List;

 import javax.swing.JButton;
 import javax.swing.JPanel;
+import javax.swing.JScrollPane;
 import javax.swing.JTabbedPane;
+import javax.swing.JViewport;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;

@@ -22,6 +25,7 @@ import com.floreantpos.main.Application;
 import com.floreantpos.ui.dialog.POSDialog;
 import com.floreantpos.ui.dialog.POSMessageDialog;
 import com.floreantpos.util.POSUtil;
+import java.awt.Component;

 public class ConfigurationDialog extends POSDialog implements ChangeListener, ActionListener {
 	private static final String OK = com.floreantpos.POSConstants.OK;
@@ -74,7 +78,10 @@ public class ConfigurationDialog extends POSDialog implements ChangeListener, Ac
 	}

 	public void addView(ConfigurationView view) {
-		tabbedPane.addTab(view.getName(), view);
+		//Wrap the ConfigurationView in a JScrollPane
+		tabbedPane.addTab(view.getName(), new JScrollPane(view,
+				JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+	            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER));
 		views.add(view);
 	}

@@ -88,7 +95,21 @@ public class ConfigurationDialog extends POSDialog implements ChangeListener, Ac
 	}

 	public void stateChanged(ChangeEvent e) {
-		ConfigurationView view = (ConfigurationView) tabbedPane.getSelectedComponent();
+
+		//Grab the ConfigurationView out of the JScrollPane
+		JScrollPane scroller = (JScrollPane) tabbedPane.getSelectedComponent();
+	    JViewport viewer = scroller.getViewport();
+	    ConfigurationView view = null;
+
+        Component[] components = viewer.getComponents();
+        for (int i  = 0; i < components.length; i++) {
+            if (components[i] instanceof JPanel) {
+            	view = (ConfigurationView) components[i];
+        	}
+        }
+		//End
+
+       if (view!=null) {
 		if(!view.isInitialized()) {
 			try {
 				view.initialize();
@@ -96,6 +117,7 @@ public class ConfigurationDialog extends POSDialog implements ChangeListener, Ac
 				POSMessageDialog.showError(this, POSConstants.ERROR_MESSAGE, e1);
 			}
 		}
+       }
 	}

 	public void actionPerformed(ActionEvent e) {
diff --git a/src/com/floreantpos/config/ui/ConfigurationView.java b/src/com/floreantpos/config/ui/ConfigurationView.java
index 15d1ee8..5a51792 100644
--- a/src/com/floreantpos/config/ui/ConfigurationView.java
+++ b/src/com/floreantpos/config/ui/ConfigurationView.java
@@ -2,6 +2,7 @@ package com.floreantpos.config.ui;

 import javax.swing.JLabel;
 import javax.swing.JPanel;
+import javax.swing.JScrollPane;
 import javax.swing.JTextField;
 import javax.swing.border.CompoundBorder;
 import javax.swing.border.EmptyBorder;
@@ -9,6 +10,9 @@ import javax.swing.border.EtchedBorder;

 public abstract class ConfigurationView extends JPanel {
 	private boolean initialized = false;
+
+
+

 	public ConfigurationView() {
 		setBorder(new CompoundBorder(new EtchedBorder(), new EmptyBorder(10, 10, 10, 10)));

Add comment
These comments are moderated so so won't be published until reviewed.