use of org.jboss.hal.ballroom.form.Form.State in project console by hal.
the class AbstractFormItem method attach.
/**
* Calls {@code SuggestHandler.attach()} in case there was one registered. If you override this method, please call
* {@code super.attach()} to keep this behaviour.
*/
@Override
public void attach() {
if (form != null) {
// if there's a back reference use it to attach only the appearances which are supported by the form
for (Map.Entry<State, Appearance<T>> entry : appearances.entrySet()) {
State state = entry.getKey();
if (form.getStateMachine().supports(state)) {
Appearance<T> appearance = entry.getValue();
appearance.attach();
}
}
if (form.getStateMachine().supports(State.EDITING) && suggestHandler instanceof Attachable) {
((Attachable) suggestHandler).attach();
}
} else {
appearances.values().forEach(Appearance::attach);
if (suggestHandler instanceof Attachable) {
((Attachable) suggestHandler).attach();
}
}
}
Aggregations