1 package org.enhydra.shark.swingclient.workflowadmin.cache; 2 3 import javax.swing.*; 4 5 import java.awt.Component ; 6 import java.awt.Dimension ; 7 import java.awt.Window ; 8 import org.enhydra.shark.swingclient.ActionPanel; 9 import org.enhydra.shark.swingclient.ResourceManager; 10 11 17 public class CacheSize extends ActionPanel { 18 19 private static Dimension textFieldDimension=new Dimension (100,20); 20 21 private JTextField cacheSizeField; 22 23 int cacheSize; 24 25 public CacheSize (Window parent,int cacheSize){ 26 super(); 27 this.cacheSize=cacheSize; 28 super.init(); 29 super.initDialog(parent, 30 ResourceManager.getLanguageDependentString("DialogSetCacheSize"), 31 true,true); 32 } 33 34 protected void createActions () {} 35 36 protected Component createCenterComponent (){ 37 JPanel panel = new JPanel(); 38 39 panel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); 40 panel.setLayout(new BoxLayout(panel,BoxLayout.X_AXIS)); 41 42 JLabel rrl=new JLabel(ResourceManager.getLanguageDependentString("NewValueKey")+":"); 43 panel.add(rrl); 44 45 cacheSizeField=new JTextField(String.valueOf(cacheSize)); 46 cacheSizeField.setMinimumSize(new Dimension (textFieldDimension)); 47 cacheSizeField.setMaximumSize(new Dimension (textFieldDimension)); 48 cacheSizeField.setPreferredSize(new Dimension (textFieldDimension)); 49 panel.add(cacheSizeField); 50 51 return panel; 52 } 53 54 protected void applyChanges () { 55 int cs; 56 try { 57 cs=Integer.valueOf(cacheSizeField.getText()).intValue(); 58 } catch (Exception ex) { 59 JOptionPane.showMessageDialog(myDialog, 60 ResourceManager.getLanguageDependentString("ErrorEnteredValueIsNotAllowed"), 61 ResourceManager.getLanguageDependentString("DialogSetCacheSize"), 62 JOptionPane.ERROR_MESSAGE); 63 return; 64 } 65 if (cs<0) { 66 JOptionPane.showMessageDialog(myDialog, 67 ResourceManager.getLanguageDependentString("ErrorEnteredValueIsNotAllowed"), 68 ResourceManager.getLanguageDependentString("DialogSetCacheSize"), 69 JOptionPane.ERROR_MESSAGE); 70 return; 71 } 72 cacheSize=cs; 73 myDialog.dispose(); 74 } 75 76 protected void cancelChanges () { 77 myDialog.dispose(); 78 } 79 80 public int getCacheSize (){ 81 return cacheSize; 82 } 83 84 public void setCacheSize (int cs) { 85 cacheSize=cs; 86 } 87 88 89 } 90 91 | Popular Tags |