Package er.iui.example.components

Source Code of er.iui.example.components.Main

// Generated by the WOLips Templateengine Plug-in at Mar 7, 2008 10:03:32 PM
package er.iui.example.components;

import com.webobjects.appserver.WOActionResults;
import com.webobjects.appserver.WOContext;

import com.webobjects.foundation.NSArray;
import com.webobjects.foundation.NSMutableArray;
import com.webobjects.foundation.NSDictionary;

import er.extensions.components.ERXComponent;

public class Main extends ERXComponent {

    private static final long serialVersionUID = 1L;

    public Main(WOContext context) {
      super(context);
    }

    NSMutableArray<NSDictionary<String,Object>> _performers = null;
    NSMutableArray<NSDictionary<String,Object>> _songs = null;

    public NSArray<NSDictionary<String,Object>> performers() {

        if (_performers == null) {

            NSArray<String> keys = new NSArray<String>(new String[] { "title", "playingTime", "releaseDate" });

            NSDictionary<String,Object> song01 = new NSDictionary<String,Object>(new NSArray<Object>(new Object[] { "Help!", "2:20", "March 1, 1970" }), keys);
            NSDictionary<String,Object> song02 = new NSDictionary<String,Object>(new NSArray<Object>(new Object[] { "Let It Be", "3:05", "October 7, 1965" }), keys);
   
            NSMutableArray<NSDictionary<String,Object>> songSet01 = new NSMutableArray<NSDictionary<String,Object>>();
            songSet01.add(song01);
            songSet01.add(song02);

            NSDictionary<String,Object> song03 = new NSDictionary<String,Object>(new NSArray<Object>(new Object[] { "I Don't Blame You", "3:00", "October 7, 1999" }), keys);
            NSDictionary<String,Object> song04 = new NSDictionary<String,Object>(new NSArray<Object>(new Object[] { "Free", "2:59", "October 1, 2001" }), keys);

            NSMutableArray<NSDictionary<String,Object>> songSet02 = new NSMutableArray<NSDictionary<String,Object>>();
            songSet02.add(song03);
            songSet02.add(song04);

            keys = new NSArray<String>(new String[] { "name", "rank", "songs" });

            NSDictionary<String,Object> record01 = new NSDictionary<String,Object>(new NSArray<Object>(new Object[] { "The Beatles", Integer.valueOf(1), songSet01 }), keys);
            NSDictionary<String,Object> record02 = new NSDictionary<String,Object>(new NSArray<Object>(new Object[] { "Cat Power", Integer.valueOf(2), songSet02 }), keys);

            _performers = new NSMutableArray<NSDictionary<String,Object>>();

            _performers.add(record01);
            _performers.add(record02);

            _songs = new NSMutableArray<NSDictionary<String,Object>>();
            _songs.add(song01);
            _songs.add(song02);
            _songs.add(song03);
            _songs.add(song04);
        }
        return _performers;
   }
   
    public NSDictionary<String,Object> performer;

  public WOActionResults toPerformer() {

//    try {
//      Thread.sleep(2000);
//    }
//    catch (Throwable t) {
//    }

    System.out.println("Main.toPerformer: Going to DictionaryView");
    ERXComponent nextPage = pageWithName(DictionaryView.class);
    nextPage.takeValueForKey(performer, "obj");
    return nextPage;
  }

  public boolean _searchVisible;

  public WOActionResults search() {
    _searchVisible = false;
    System.out.println("Main.search: SEARCH");

    return pageWithName(Main.class);
/*
    NSMutableArray<NSDictionary<String,Object>> found = new NSMutableArray<NSDictionary<String,Object>>();

    for (int idx = 0; idx < _songs.count(); idx++) {
        NSDictionary<String,Object> song = _songs.get(idx);
        String title = (String)song.valueForKey("title");
        if (title.indexOf(searchTerm) >= 0) found.add(song);
    }

    ERXComponent nextPage = pageWithName(DictionaryView.class);
    nextPage.takeValueForKey(found, "objs");
    return nextPage;
*/
  }

  public WOActionResults cancel() {
    _searchVisible = false;
    System.out.println("Main.search: SEARCH_CANCEL");
    return null;
  }

}
TOP

Related Classes of er.iui.example.components.Main

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.