sorting methods

This commit is contained in:
Stephan Richter
2020-11-05 21:19:28 +01:00
parent 806502b459
commit 5499d5a82b
6 changed files with 117 additions and 99 deletions

View File

@@ -23,6 +23,11 @@ import de.srsoftware.web4rail.tags.Label;
import de.srsoftware.web4rail.tags.Select;
import de.srsoftware.web4rail.tiles.Contact;
/**
* Base Class for all other actions
* @author Stephan Richter, SRSoftware
*
*/
public abstract class Action extends BaseClass {
private static final HashMap<Integer,Action> actions = new HashMap<Integer, Action>();
public static final Logger LOG = LoggerFactory.getLogger(Action.class);
@@ -115,6 +120,19 @@ public abstract class Action extends BaseClass {
return this;
}
public static Tag selector() {
Select select = new Select(TYPE);
TreeMap<String, String> names = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
for (Class<? extends Action> clazz : Action.list()) {
String s = t(clazz.getSimpleName());
names.put(s, clazz.getSimpleName());
}
for (Entry<String, String> entry : names.entrySet()) select.addOption(entry.getValue(), entry.getKey());
return select.addTo(new Label(t("Action type:")+NBSP));
}
public Window properties(HashMap<String, String> params) {
return new Window("action-props-"+id, t("Properties of {}",this.getClass().getSimpleName()));
}
@@ -131,17 +149,4 @@ public abstract class Action extends BaseClass {
protected Object update(HashMap<String, String> params) {
return t("Nothing changed");
}
public static Tag selector() {
Select select = new Select(TYPE);
TreeMap<String, String> names = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
for (Class<? extends Action> clazz : Action.list()) {
String s = t(clazz.getSimpleName());
names.put(s, clazz.getSimpleName());
}
for (Entry<String, String> entry : names.entrySet()) select.addOption(entry.getValue(), entry.getKey());
return select.addTo(new Label(t("Action type:")+NBSP));
}
}

View File

@@ -23,11 +23,11 @@ import de.srsoftware.web4rail.tags.Form;
import de.srsoftware.web4rail.tags.Input;
public class ActionList extends Vector<Action> implements Constants{
private static final Logger LOG = LoggerFactory.getLogger(ActionList.class);
private static final long serialVersionUID = 4862000041987682112L;
private static final Logger LOG = LoggerFactory.getLogger(ActionList.class);
private int id;
private static final HashMap<Integer, ActionList> actionLists = new HashMap<Integer, ActionList>();
private int id;
public ActionList() {
id = Application.createId();
@@ -210,4 +210,4 @@ public class ActionList extends Vector<Action> implements Constants{
}
return t("No action with id {} found.",actionId);
}
}
}