Classes created.
This commit is contained in:
14
flux/src/main/java/com/iluwatar/Action.java
Normal file
14
flux/src/main/java/com/iluwatar/Action.java
Normal 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;
|
||||
}
|
||||
}
|
7
flux/src/main/java/com/iluwatar/ActionType.java
Normal file
7
flux/src/main/java/com/iluwatar/ActionType.java
Normal file
@ -0,0 +1,7 @@
|
||||
package com.iluwatar;
|
||||
|
||||
public enum ActionType {
|
||||
|
||||
MENU_ITEM_SELECTED, CONTENT_CHANGED;
|
||||
|
||||
}
|
@ -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!" );
|
||||
}
|
||||
}
|
||||
|
7
flux/src/main/java/com/iluwatar/Content.java
Normal file
7
flux/src/main/java/com/iluwatar/Content.java
Normal file
@ -0,0 +1,7 @@
|
||||
package com.iluwatar;
|
||||
|
||||
public enum Content {
|
||||
|
||||
PRODUCTS, COMPANY;
|
||||
|
||||
}
|
15
flux/src/main/java/com/iluwatar/ContentAction.java
Normal file
15
flux/src/main/java/com/iluwatar/ContentAction.java
Normal 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;
|
||||
}
|
||||
}
|
11
flux/src/main/java/com/iluwatar/ContentStore.java
Normal file
11
flux/src/main/java/com/iluwatar/ContentStore.java
Normal file
@ -0,0 +1,11 @@
|
||||
package com.iluwatar;
|
||||
|
||||
public class ContentStore implements Store {
|
||||
|
||||
@Override
|
||||
public void onAction(Action action) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
11
flux/src/main/java/com/iluwatar/ContentView.java
Normal file
11
flux/src/main/java/com/iluwatar/ContentView.java
Normal file
@ -0,0 +1,11 @@
|
||||
package com.iluwatar;
|
||||
|
||||
public class ContentView implements View {
|
||||
|
||||
@Override
|
||||
public void storeChanged(Store store) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
26
flux/src/main/java/com/iluwatar/Dispatcher.java
Normal file
26
flux/src/main/java/com/iluwatar/Dispatcher.java
Normal 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) {
|
||||
|
||||
}
|
||||
}
|
15
flux/src/main/java/com/iluwatar/MenuAction.java
Normal file
15
flux/src/main/java/com/iluwatar/MenuAction.java
Normal 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;
|
||||
}
|
||||
}
|
7
flux/src/main/java/com/iluwatar/MenuItem.java
Normal file
7
flux/src/main/java/com/iluwatar/MenuItem.java
Normal file
@ -0,0 +1,7 @@
|
||||
package com.iluwatar;
|
||||
|
||||
public enum MenuItem {
|
||||
|
||||
HOME, PRODUCTS, COMPANY;
|
||||
|
||||
}
|
11
flux/src/main/java/com/iluwatar/MenuStore.java
Normal file
11
flux/src/main/java/com/iluwatar/MenuStore.java
Normal file
@ -0,0 +1,11 @@
|
||||
package com.iluwatar;
|
||||
|
||||
public class MenuStore implements Store {
|
||||
|
||||
@Override
|
||||
public void onAction(Action action) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
11
flux/src/main/java/com/iluwatar/MenuView.java
Normal file
11
flux/src/main/java/com/iluwatar/MenuView.java
Normal file
@ -0,0 +1,11 @@
|
||||
package com.iluwatar;
|
||||
|
||||
public class MenuView implements View {
|
||||
|
||||
@Override
|
||||
public void storeChanged(Store store) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
7
flux/src/main/java/com/iluwatar/Store.java
Normal file
7
flux/src/main/java/com/iluwatar/Store.java
Normal file
@ -0,0 +1,7 @@
|
||||
package com.iluwatar;
|
||||
|
||||
public interface Store {
|
||||
|
||||
public void onAction(Action action);
|
||||
|
||||
}
|
7
flux/src/main/java/com/iluwatar/View.java
Normal file
7
flux/src/main/java/com/iluwatar/View.java
Normal file
@ -0,0 +1,7 @@
|
||||
package com.iluwatar;
|
||||
|
||||
public interface View {
|
||||
|
||||
public void storeChanged(Store store);
|
||||
|
||||
}
|
Reference in New Issue
Block a user