1 10 11 12 package org.enhydra.jawe.xml.elements.specialpanels; 13 14 import org.enhydra.jawe.xml.*; 15 import org.enhydra.jawe.xml.elements.*; 16 import org.enhydra.jawe.xml.panels.*; 17 18 import java.util.*; 19 import javax.swing.*; 20 import java.awt.*; 21 import java.awt.event.*; 22 23 27 public class XMLComplexContentPanel extends XMLMultiLineTextPanel { 28 29 public XMLComplexContentPanel (XMLElement myOwner, 30 final org.enhydra.jawe.xml.elements.Package pkg) { 31 super(myOwner,XMLPanel.BOX_LAYOUT,false,true,false); 32 33 String s=XMLUtil.getLanguageDependentString("NamespacesKey"); 34 double w=0; 35 try { 36 w=getFontMetrics(getFont()).stringWidth(s); 37 } catch(Exception ex) {} 38 double h=getFontMetrics(getFont()).getHeight(); 39 w+=25; 40 if (w<30) w=30; 41 Dimension dim=new Dimension((int)w,(int)h); 42 43 XMLButton buttonDefine=new XMLButton(s,"Define",dim); 44 buttonDefine.setAlignmentX(Component.LEFT_ALIGNMENT); 45 buttonDefine.setAlignmentY(Component.TOP_ALIGNMENT); 46 buttonDefine.setEnabled(!myOwner.isReadOnly()); 47 buttonDefine.setToolTipText(XMLUtil.getLanguageDependentString("DefineAdditionalNamespacesKey")); 48 buttonDefine.addActionListener(new ActionListener(){ 50 public void actionPerformed(ActionEvent ae){ 51 if (pkg==null) return; 52 XMLPanel p=pkg.getPanel(10); 53 XMLElementDialog d=new XMLElementDialog(getDialog(), 54 XMLUtil.getLanguageDependentString("PackageKey")+" '"+ 55 pkg.toString()+"' - "+ 56 XMLUtil.getLanguageDependentString("NamespacesKey")); 57 d.editXMLElement(p,false,false); 58 } 59 60 }); 61 62 add(Box.createRigidArea(new Dimension(10,0))); 63 add(buttonDefine); 64 65 } 66 67 } 68 | Popular Tags |