1 19 package org.openharmonise.him.serverconfig; 20 21 import java.awt.*; 22 import java.awt.event.*; 23 24 import javax.swing.*; 25 26 import org.openharmonise.commons.xml.namespace.*; 27 import org.openharmonise.him.*; 28 import org.openharmonise.him.configuration.*; 29 import org.openharmonise.him.harmonise.*; 30 import org.openharmonise.him.swing.resourcetree.*; 31 import org.openharmonise.vfs.*; 32 import org.openharmonise.vfs.metadata.*; 33 import org.openharmonise.vfs.servers.ServerList; 34 35 36 42 public class DocumentPreviewConfigOptions extends AbstractPreviewConfigOptions implements LayoutManager, ActionListener, ApplyChangesListener, TreeViewListener { 43 44 private ResourceTree m_pageTree = null; 45 private ResourceTree m_sectionTree = null; 46 private RelatedResourceDisplay m_pages = null; 47 private JTextArea m_sectionTextLabel = null; 48 private JTextArea m_pageTextLabel = null; 49 50 53 public DocumentPreviewConfigOptions(PreviewConfigDialog dialog) { 54 super(dialog); 55 setup(); 56 } 57 private void setup() { 58 try { 59 setLayout(this); 60 61 String fontName = "Dialog"; 62 int fontSize = 11; 63 Font font = new Font(fontName, Font.PLAIN, fontSize); 64 65 this.m_sectionTree = new ResourceTree(); 66 this.m_sectionTree.setBorder(BorderFactory.createEtchedBorder()); 67 this.m_sectionTree.setShowLeafNodes(false); 68 this.m_sectionTree.setShowApprovedOnly(true); 69 70 AbstractVirtualFileSystem vfs = ServerList.getInstance().getHarmoniseServer().getVFS(); 72 this.m_sectionTree.addCollection(vfs.getVirtualFile( HarmonisePaths.PATH_DOCUMENTS ).getResource()); 73 m_sectionTree.addListener(this); 74 add(this.m_sectionTree); 75 76 m_pages = new RelatedResourceDisplay(this); 77 m_pages.setShowApprovedOnly(true); 78 add(m_pages); 79 80 m_sectionTextLabel = new JTextArea("Select a Section to Apply Templates to"); 81 m_sectionTextLabel.setOpaque(false); 82 add(m_sectionTextLabel); 83 m_pageTextLabel = new JTextArea("Select Template to Apply"); 84 m_pageTextLabel.setOpaque(false); 85 add(m_pageTextLabel); 86 } catch (Exception e) { 87 e.printStackTrace(System.err); 88 } 89 90 } 91 92 public void save(){ 93 m_pages.saveChangedValues(); 94 } 95 96 99 public void layoutContainer(Container arg0) { 100 int width = getParent().getWidth(); 101 int height = getParent().getHeight(); 102 setSize(width, height-20); 103 setLocation(0, 20); 104 setBorder( BorderFactory.createEtchedBorder() ); 105 106 int x = 10; 107 108 this.m_sectionTree.setSize(200,230); 109 this.m_sectionTree.setLocation(x, 30); 110 this.m_sectionTree.setBorder(BorderFactory.createEtchedBorder()); 111 112 m_pages.setSize(m_pages.getPreferredSize()); 113 m_pages.setLocation(x+250,30); 114 115 m_sectionTextLabel.setSize(250,20); 116 m_sectionTextLabel.setLocation(x,10); 117 118 m_pageTextLabel.setSize(150,20); 119 m_pageTextLabel.setLocation(x+250,10); 120 } 121 122 125 public void virtualFileSelected(AbstractVirtualFileSystem vfs, String sPath) { 126 VirtualFile vFile = vfs.getVirtualFile(sPath).getResource(); 128 PropertyInstance propInst = vFile.getProperty(NamespaceType.OHRM.getURI(),"PREVIEWPAGE"); 129 m_pages.populate(propInst); 130 } 131 132 135 public void removeLayoutComponent(Component arg0) { 136 137 } 138 139 142 public void addLayoutComponent(String arg0, Component arg1) { 143 } 144 145 148 public Dimension minimumLayoutSize(Container arg0) { 149 return null; 150 } 151 152 155 public Dimension preferredLayoutSize(Container arg0) { 156 return null; 157 } 158 159 162 public void actionPerformed(ActionEvent arg0) { 163 } 164 165 168 public boolean applyChanges() { 169 return true; 170 171 } 172 173 176 public void discardChanges() { 177 } 178 179 182 public void keyPressed(KeyEvent arg0) { 183 } 184 185 188 public void keyReleased(KeyEvent arg0) { 189 } 190 191 194 public void keyTyped(KeyEvent arg0) { 195 } 196 } 197
| Popular Tags
|