java - Is there a design pattern that can help configuring commands on a generic display? -


i have display object displays list of users , provides menu acting on list - adding new users, adding them groups, deleting them, etc. right display configures own menu, can add menu command docreatenewusers(). unfortunately, means every instance of display has "create new" option.

i want configure menu differently different instances of display - in "users" tab, should include "create new" option, , in "groups" tab, shouldn't. first thought externalize menu, configure differently. problem lose ability call private docreatenewusers() function!

is there design pattern situation? don't idea of making docreatenewusers public because shows dialog shouldn't triggered external classes. make display abstract, define menu in anonymous subclasses, kind of messes way reuse widgets right - i'd configure menu after display has been created , initialized. i'm hoping there's industry-standard way of dealing this!

it sounds me possibly use strategy pattern in case.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -