Classes created.

This commit is contained in:
Ilkka Seppala
2015-05-03 22:15:41 +03:00
parent 77255ca798
commit c288f13b21
14 changed files with 150 additions and 2 deletions

View File

@ -0,0 +1,14 @@
package com.iluwatar;
public abstract class Action {
private ActionType type;
public Action(ActionType type) {
this.type = type;
}
public ActionType getType() {
return type;
}
}

View File

@ -0,0 +1,7 @@
package com.iluwatar;
public enum ActionType {
MENU_ITEM_SELECTED, CONTENT_CHANGED;
}

View File

@ -2,8 +2,7 @@ package com.iluwatar;
public class App {
public static void main( String[] args )
{
public static void main( String[] args ) {
System.out.println( "Hello World!" );
}
}

View File

@ -0,0 +1,7 @@
package com.iluwatar;
public enum Content {
PRODUCTS, COMPANY;
}

View File

@ -0,0 +1,15 @@
package com.iluwatar;
public class ContentAction extends Action {
private Content content;
public ContentAction(Content content) {
super(ActionType.CONTENT_CHANGED);
this.content = content;
}
public Content getContent() {
return content;
}
}

View File

@ -0,0 +1,11 @@
package com.iluwatar;
public class ContentStore implements Store {
@Override
public void onAction(Action action) {
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,11 @@
package com.iluwatar;
public class ContentView implements View {
@Override
public void storeChanged(Store store) {
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,26 @@
package com.iluwatar;
import java.util.LinkedList;
import java.util.List;
public class Dispatcher {
private static Dispatcher instance = new Dispatcher();
private List<Store> stores = new LinkedList<>();
private Dispatcher() {
}
public Dispatcher getInstance() {
return instance;
}
public void registerStore(Store store) {
stores.add(store);
}
public void menuItemSelected(MenuItem menuItem) {
}
}

View File

@ -0,0 +1,15 @@
package com.iluwatar;
public class MenuAction extends Action {
private MenuItem menuItem;
public MenuAction(MenuItem menuItem) {
super(ActionType.MENU_ITEM_SELECTED);
this.menuItem = menuItem;
}
public MenuItem getMenuItem() {
return menuItem;
}
}

View File

@ -0,0 +1,7 @@
package com.iluwatar;
public enum MenuItem {
HOME, PRODUCTS, COMPANY;
}

View File

@ -0,0 +1,11 @@
package com.iluwatar;
public class MenuStore implements Store {
@Override
public void onAction(Action action) {
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,11 @@
package com.iluwatar;
public class MenuView implements View {
@Override
public void storeChanged(Store store) {
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,7 @@
package com.iluwatar;
public interface Store {
public void onAction(Action action);
}

View File

@ -0,0 +1,7 @@
package com.iluwatar;
public interface View {
public void storeChanged(Store store);
}