private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final) templateList.setValues(TemplateManager.getInstance().getTemplateNames()); templateList.addChangeListener(this); reloadTemplateButton.addActionListener(this); reloadTemplateButton.setFont(FONT_SMALL); this.getContentPane().setLayout(new BorderLayout(10, 0)); JPanel templateBar = new JPanel(new BorderLayout()); templateBar.add(templateList, BorderLayout.CENTER); JPanel reloadBtnBar = new JPanel(); reloadBtnBar.add(reloadTemplateButton); templateBar.add(reloadBtnBar, BorderLayout.EAST); this.getContentPane().add(templateBar, BorderLayout.NORTH); helpDoc.setContentType("text/html"); //$NON-NLS-1$ helpDoc.setEditable(false); helpDoc.addHyperlinkListener(this); this.getContentPane().add(scroller, BorderLayout.CENTER); applyTemplateButton.addActionListener(this); cancelButton.addActionListener(this); // Bottom buttons bar JPanel actionBtnBar = new JPanel(new FlowLayout()); actionBtnBar.add(applyTemplateButton); actionBtnBar.add(cancelButton); this.getContentPane().add(actionBtnBar, BorderLayout.SOUTH); this.pack(); this.setMinimumSize(new Dimension(MINIMAL_BOX_WIDTH, MINIMAL_BOX_HEIGHT)); ComponentUtil.centerComponentInWindow(this, 50); // center position and 50% of screen size populateTemplatePage(); }
/** * Do search * @param e {@link ActionEvent} */ @Override public void actionPerformed(ActionEvent e) { final Object source = e.getSource(); if (source == cancelButton) { this.setVisible(false); return; } else if (source == applyTemplateButton) { checkDirtyAndLoad(e); } else if (source == reloadTemplateButton) { templateList.setValues(TemplateManager.getInstance().reset().getTemplateNames()); } }