Re: Pollo extension

Bruno Dumon <[email protected]> 02 Aug 1998 11:54:52 +0200
Newsgroups gmane.editors.pollo.devel
Organization Outerthought
Message-ID <[email protected]>
Al,

is your latest ag101 code (containing the changes you listed) somewhere
available?

Thanks,

Bruno

On Thu, 2003-02-27 at 17:04, Al Byers wrote:
> Bruno,
> 
> I realize that I was not getting the list responses sent to me, so I 
> re-subscribed. In the meantime, I will try to get my thinking in order 
> and respond to your questions.
> 
>  >  
>  >> Any chance that we could pass Pollo as an arg to the PolloFrame 
>  >>  constructor instead?
>  
>  >Yes, but why? What are you trying to achieve by changing that? (not that
>  >I'm opposed to it, I'd just like to know the rationale behind it)
>  
> 
> Like I have to have a reason ? :0) I guess because PolloFrame or its 
> subclass needs to have an instance of Pollo or its subclass. I could put 
> code in the PolloFrame constructor to do a Pollo.getInstance() and even 
> if Pollo was extended, the right version should be in the instance ivar. 
> But I thought that passing the instance in was more straight forward. 
> The motivating problem is that PolloFrame now populates its "pollo" ivar 
> in the class initialization code. If you see a better way, please let me 
> know and I will implement it.
> 
>  
>  >> 2. Creating the menubar and toolbar in the constructor makes it a little 
>  >> problematic in extending. I guess an init() method might be better?
>  
> > No problem with that. But how will you extend it? By subclassing?
> No, I don't see anyway to extend it. I was suggesting the init() because it would allow me to not call it. 
> What I ended up doing was putting a noargs constructor in PolloFrame so that I didn't have to worry about 
> the menus being constructed until I wanted.
>  
> 
> 
> I have finished my refactoring of my code to require as few changes to 
> Pollo as I could manage.
> I tried to send this to the list, but I had the wrong address for you, 
> so I don't know if it made it or not. I will embed it instead of 
> attaching it.
> 
> ./org/outerj/pollo/Pollo.java:46:    public Pollo() // -amb Need to 
> inherit? Was private.
> ./org/outerj/pollo/Pollo.java:305:    public Action 
> getNewPolloFrameAction() // -amb Calling it from frame
> ./org/outerj/pollo/PolloFrame.java:49:    protected Pollo pollo = null; 
> // was ->Pollo.getInstance(); This seems to be the most
>                         disruptive change. Pollo being instantiated in 
> the class declaration does not give it
>                         a change to be something else.
>                         I felt it was better to pass the instance of 
> Pollo in,
>                         but, perhaps, Pollo could be instantiated within 
> the constructor with a call
>                         to Pollo.getInstance().
>                         This is assuming that Pollo or a subclass has 
> already been instantiated and the Pollo.instance
>                         var has been set.
> ./org/outerj/pollo/PolloFrame.java ?  Added noargs constructor so that 
> it would not call create menus routine.
> ./org/outerj/pollo/PolloFrame.java:144:        
> viewMenu.add(Utilities.createMenuItemFromAction(Pollo.getInstance().getNewPolloFrameAction())); 
> // -amb
> ./org/outerj/pollo/action/NewPolloFrameAction.java:18:    protected 
> Pollo pollo; // -amb If PolloFrame does not automatically have
>                                 a value of Pollo instantiated, then this 
> action must have one embedded
>                                 so that it can pass it to the PolloFrame 
> constructor.
> ./org/outerj/pollo/action/NewPolloFrameAction.java:20:    public 
> NewPolloFrameAction(Pollo inst) // -amb Needs Pollo instance. See above.
> ./org/outerj/pollo/action/NewPolloFrameAction.java:22:        pollo    = 
> inst; // -amb
> ./org/outerj/pollo/config/ViewTypeConf.java:150:        public ArrayList 
> getSchemas(){ // -amb Need to access schemas from outside.
> ./org/outerj/pollo/EditorPanelImpl.java:80:    public EditorPanelImpl(){ 
> // -amb Allows subclassing without calling createMenus, etc.
> ./org/outerj/pollo/xmleditor/XmlEditor.java:356:    public void 
> rebuildView() // -amb This and some other methods that deal with the view
>                             need to be callable from my XSL debugging 
> code. For instance, once the program
>                             stops at a stylesheet node, I need to be 
> able to tell the XmlEditor to rebuild
>                             that view as the highlighted one.
> ./org/outerj/pollo/xmleditor/XmlEditor.java:410:    protected void 
> createViewsRecursive(Node parentNode, View parentView) // -amb See above.
> ./org/outerj/pollo/xmleditor/XmlEditorPanel.java:51:    public 
> XmlEditorPanel(){ // -amb Necessary inorder to subclass
> ./org/outerj/pollo/xmleditor/attreditor/AttributesTableModel.java:97:    
> public TempAttrEditInfo getTempAttrEditInfo(int row) // -amb
>                         Changed from protected so I can call it from 
> AttributesPanel.
>                         I use this to determine schema node type (I think).
> ./org/outerj/pollo/xmleditor/attreditor/AttributesTableModel.java:290:    
> public class TempAttrEditInfo //-amb Was protected. I made it public.
> ./org/outerj/pollo/xmleditor/chardataeditor/CharDataPanel.java:94:        
> public JTextArea getCharTextArea(){ //-amb
>                                     Added to get access to charDataTextArea.
>                                     There are simply places where I need 
> to control what shows in the
>                                     attributes panel.
> ./org/outerj/pollo/xmleditor/model/XmlModel.java:751:    public void 
> setCurrentMode(int md) // -amb Need to set mode from outside for XSL 
> debugging purpose
> ./org/outerj/pollo/xmleditor/model/XmlModel.java:756:        public void 
> setDocument(Document doc){ // -amb Need to set document from outside for 
> XSL debugging purpose
> ./org/outerj/pollo/xmleditor/view/ChildrenBlockView.java:24:    
> protected ArrayList childViewList = new ArrayList(10); //-amb, was private,
>                                     but I need to define subclasses of 
> ElementBlockView so I can
>                                     put a "break" component on it.
> ./org/outerj/pollo/xmleditor/view/ChildrenBlockView.java:42:        
> public ArrayList getChildViewList(){ // -amb, too inconvenient not to 
> have this
> ./org/outerj/pollo/xmleditor/view/ElementBlockView.java:270:    
> protected int max(int val1, int val2, int val3) //-amb Was private,
>                                 but I created a subclass of 
> ElementBlockView.
> 
> Is there anything more I can do to help with making Pollo extensible?
> 
> -Al
-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[email protected]                          [email protected]



-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en