Groups > Borland > Delphi Object Oriented design > Re: Plugin




Re: Plugin

Re: Plugin
Mon, 14 Jan 2008 17:33:56 +000
Dion a écrit :

> I need to adjust an input form(ie add more items to the menu, one or 2 
> dropdowns etc) based on the plugins loaded. The plugins will not be aware
of 
> the data input form at load time, as the form will be created on demand. My

> question is, what is the most elegant and correct way of asking the plugins

> what they want their adjustments to this form to be.

In my version of the MVP framework, we have the concept of a Command 
Set. If you implement such a concept, the editing Model can load the 
Command Set from a static Factory class that detects what plugins are 
loaded and enumerates them to add the Commands found to the Command Set.

The Presenter creates a Menu/CommandSet Interactor  which examines the 
Commands in the set and creates a MenuItem Interactor, one for each 
Command that it finds and links the click event of each item to the 
Execute method of each Command. The MenuItem Interactor also responds to 
the "availability" of a given Command and enables/disables or 
shows/hides the relevent Menu Item.

Joanna

-- 
Joanna Carter [TeamB]
Post Reply
Plugin
Mon, 14 Jan 2008 18:55:38 +020
Hi,

I need to adjust an input form(ie add more items to the menu, one or 2 
dropdowns etc) based on the plugins loaded. The plugins will not be aware of 
the data input form at load time, as the form will be created on demand. My 
question is, what is the most elegant and correct way of asking the plugins 
what they want their adjustments to this form to be.

Many thanks,
Dion. 

Post Reply
Re: Plugin
Mon, 14 Jan 2008 19:16:10 +010
On Mon, 14 Jan 2008 18:55:38 +0200, "Dion" <dion@mighty.co.za>
wrote:

>Hi,
>
>I need to adjust an input form(ie add more items to the menu, one or 2 
>dropdowns etc) based on the plugins loaded. The plugins will not be aware of

>the data input form at load time, as the form will be created on demand. My

>question is, what is the most elegant and correct way of asking the plugins

>what they want their adjustments to this form to be.
>

Two callback function in the plugin packages, on for initialization of
the form (adding the plugin based control), one for finalization
(removing the plugin based controls).

Regards from Germany

Post Reply
Re: Plugin
Mon, 14 Jan 2008 21:44:18 +020
Thanks Joanna. I have not examined your MVP framework, but will I be able to 
add the command to add items to a combo dropdown, or create a new tab on the 
newly created form etc, to the Command Set?

Thanks,
Dion.

Post Reply
Re: Plugin
Mon, 14 Jan 2008 23:55:53 +000
Dion a écrit :

> ... will I be able to 
> add the command to add items to a combo dropdown, or create a new tab on
the 
> newly created form etc, to the Command Set?

Not strictly; the whole idea of frameworks like MVP is to separate UI 
from business logic.

A combo dropdown is typically used to represent the choosing from a 
limited set of options for a given property of an object. MVP theory 
would dictate that the Command would act on the list that is part of the 
underlying Model and which is displayed in the combo dropdown.

Joanna

-- 
Joanna Carter [TeamB]
Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact