Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3406080
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:35:04+00:00 2026-05-18T05:35:04+00:00

I have 2 views that show lists that then uses a mediator to get

  • 0

I have 2 views that show lists that then uses a mediator to get data. but I want in some way to DRY it so I don’t have to repeat my self 2 times for the same thing. how do I do it?

EDIT1(code):

[SkinPart(required="false")]
public var WOListsDDL:DropDownList;
    // in partadded
case WOListsDDL:
    // when the selected list is changed in the lists drop down list
    WOListsDDL.addEventListener(IndexChangeEvent.CHANGE, _WOListsDDL_changeHandler);
    WOListsDDL.dataProvider = new ArrayCollection();
    WOListsDDL.labelField = 'title';
break;
    //

    protected function _WOListsDDL_changeHandler(event:*):void{
        _debug('List selection changed handler.');
        _getContentsForList();
    }
    protected function _getContentsForList():void{
        _debug('Getting list items.');
        getItemsSignal.dispatch({key: getSelectedList()._key, itemType: 'item'});
    }
    public var getItemsSignal:GetItemsSignal = new GetItemsSignal();

    override public function mediatorComplete():void{
        getItemsSignal.dispatch({key: tottysAuth.getCurrentUser()._key, itemType: 'list'});
    }

// then in my mediator

    [Inject] public var getItemsSignal:GetItemsSignal;
    override public function onRegister():void{
        // view listeners
        view.getItemsSignal.add(_getItemsSignalHandler);
    }
    protected function _getItemsSignalHandler(input:Object):void{
        getItemsSignal.dispatch(input);
    }

this all for one view-mediator. now I have 2 view-mediators that are doing these tasks. How to make them dry?

Solutions I have:
make a little view containing the dropdown list with a mediator that is listening for the event. in the big components they are listening for a signal in the view of this little component. nothing more. it seems quite well but i don’t think is so great

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T05:35:04+00:00Added an answer on May 18, 2026 at 5:35 am

    So there is functionality on both the views and the mediators that you’d like not to repeat?

    You could put the code you want to reuse in another object and call its methods from your multiple views and mediators. Or you could put it in ancestor classes and extend each of those classes in both your view and your mediator.

    Best practice would be to do the former and not the latter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a set of tables and views that merely store some config data
I have an application with several windows/views that show the same object. For example
I have created VIEWS and PartialVIEWS, but so far, i have seen that VIEWS,
I have two tabbar items(views) that use the same data, whats the best solution
I have 4 views that are controlled by 1 SherlockMapActivity. Currently I am switching
I have two views that I would like to combine into one. The first
In one of my iPhone projects, I have three views that you can move
I have about 20 grid views that I have to create. All of them
I have a few asp views that I would like to switch between with
I have a single Rails 2.2.2 app that I want to 'share' with multiple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.