[Dirconsole-cvs] dirconsole/Snapins/Schema/src/dirconsole/snapin/schema/task ViewClassTask.java,1.2,
Brought to you by:
bavodr
|
From: Bavo De R. <ba...@us...> - 2004-07-25 15:45:08
|
Update of /cvsroot/dirconsole/dirconsole/Snapins/Schema/src/dirconsole/snapin/schema/task In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1069/Snapins/Schema/src/dirconsole/snapin/schema/task Modified Files: ViewClassTask.java Log Message: Added exit button Index: ViewClassTask.java =================================================================== RCS file: /cvsroot/dirconsole/dirconsole/Snapins/Schema/src/dirconsole/snapin/schema/task/ViewClassTask.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ViewClassTask.java 24 Jul 2004 14:12:08 -0000 1.2 --- ViewClassTask.java 25 Jul 2004 15:44:58 -0000 1.3 *************** *** 1,20 **** /* ! * Copyright 2001 - 2004, Bavo De Ridder * * This file is part of Directory Console. ! * ! * Directory Console is free software; you can redistribute it ! * and/or modify it under the terms of the GNU General Public License ! * as published by the Free Software Foundation; either version 2 of the ! * License, or (at your option) any later version. ! * ! * Directory Console is distributed in the hope that it will be ! * useful, but WITHOUT ANY WARRANTY; without even the implied warranty ! * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with Directory Console; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston * * http://www.gnu.org/licenses/gpl.html --- 1,20 ---- /* ! * Copyright 2001 - 2004, Bavo De Ridder * * This file is part of Directory Console. ! * ! * Directory Console is free software; you can redistribute it and/or modify it ! * under the terms of the GNU General Public License as published by the Free ! * Software Foundation; either version 2 of the License, or (at your option) any ! * later version. ! * ! * Directory Console is distributed in the hope that it will be useful, but ! * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ! * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ! * details. ! * ! * You should have received a copy of the GNU General Public License along with ! * Directory Console; if not, write to the Free Software Foundation, Inc., 59 ! * Temple Place, Suite 330, Boston * * http://www.gnu.org/licenses/gpl.html *************** *** 46,138 **** public class ViewClassTask extends PanelDelegator implements Task { ! private static Logger logger = Logger.getLogger(ViewClassTask.class); ! public String getName() ! { ! return "View Object Class"; ! } ! public void init(TaskContext taskContext) ! { ! FlowLayout flowLayout = new FlowLayout(FlowLayout.HORIZONTAL); ! flowLayout.setSpacing(3); ! getContentPanel().setLayout(flowLayout); ! this.taskContext = taskContext; ! listModel = new DefaultListModel(); ! listBox = new ListBox(listModel); ! listBox.setSize(15); ! ! populateListModel(); ! viewButton = new Button(); ! viewButton.getButtonModel().setCaption("View"); ! viewButton.getButtonModel().setButtonAction(new Action() ! { ! public void doAction() ! { ! objectClassViewer.getObjectClassViewerModel().setObjectClass(listModel.getElementAt(listModel.getSelected())); ! } ! }); ! objectClassViewer = new ObjectClassViewer(); ! getContentPanel().add(listBox, "ObjectInput"); ! getContentPanel().add(viewButton, "ViewButton"); ! getContentPanel().add(objectClassViewer, "ObjectClassViewer"); ! } ! public Component getComponent() ! { ! return this; ! } ! public void destroy() ! { ! } ! private void populateListModel() ! { ! try ! { ! DirContext ctx = LdapFactory.getRootContext(); ! DirContext schema = ctx.getSchema(""); ! NamingEnumeration enum = schema.list("ClassDefinition"); ! ArrayList result = new ArrayList(); ! while (enum.hasMore()) ! { ! NameClassPair pair = (NameClassPair) enum.next(); ! result.add(pair.getName()); ! } ! ! Collections.sort(result); ! ! Iterator it = result.iterator(); ! while(it.hasNext()) ! { ! listModel.addElement((String) it.next()); ! } ! } ! catch (Exception e) ! { ! logger.error("Could not populate class list model", e); ! } ! ! //listModel.addElement(pair.getName()); ! } ! private TaskContext taskContext; ! private ObjectClassViewer objectClassViewer; ! private ListBox listBox; ! private DefaultListModel listModel; ! private Button viewButton; ! } --- 46,151 ---- public class ViewClassTask extends PanelDelegator implements Task { ! private static Logger logger = Logger.getLogger(ViewClassTask.class); ! public String getName() ! { ! return "Schema Viewer"; ! } ! public void init(TaskContext pTaskContext) ! { ! FlowLayout flowLayout = new FlowLayout(FlowLayout.HORIZONTAL); ! flowLayout.setSpacing(3); ! getContentPanel().setLayout(flowLayout); ! this.taskContext = pTaskContext; ! listModel = new DefaultListModel(); ! listBox = new ListBox(listModel); ! listBox.setSize(15); ! populateListModel(); ! viewButton = new Button(); ! viewButton.getButtonModel().setCaption("View"); ! viewButton.getButtonModel().setButtonAction(new Action() ! { ! public void doAction() ! { ! objectClassViewer.getObjectClassViewerModel().setObjectClass( ! listModel.getElementAt(listModel.getSelected())); ! } ! }); ! exitButton = new Button(); ! exitButton.getButtonModel().setCaption("Exit"); ! exitButton.getButtonModel().setButtonAction(new Action() ! { ! public void doAction() ! { ! taskContext.close(); ! } ! }); ! objectClassViewer = new ObjectClassViewer(); ! getContentPanel().add(exitButton, "ExitButton"); ! getContentPanel().add(listBox, "ObjectInput"); ! getContentPanel().add(viewButton, "ViewButton"); ! getContentPanel().add(objectClassViewer, "ObjectClassViewer"); ! } ! public Component getComponent() ! { ! return this; ! } ! public void destroy() ! { ! } ! private void populateListModel() ! { ! try ! { ! DirContext ctx = LdapFactory.getRootContext(); ! DirContext schema = ctx.getSchema(""); ! NamingEnumeration enum = schema.list("ClassDefinition"); ! ArrayList result = new ArrayList(); ! while (enum.hasMore()) ! { ! NameClassPair pair = (NameClassPair) enum.next(); ! result.add(pair.getName()); ! } ! Collections.sort(result); ! Iterator it = result.iterator(); ! while (it.hasNext()) ! { ! listModel.addElement((String) it.next()); ! } ! } ! catch (Exception e) ! { ! logger.error("Could not populate class list model", e); ! } ! ! //listModel.addElement(pair.getName()); ! } ! ! private TaskContext taskContext; ! ! private ObjectClassViewer objectClassViewer; ! ! private ListBox listBox; ! private DefaultListModel listModel; ! ! private Button viewButton; ! private Button exitButton; ! } \ No newline at end of file |