de.mhus.lib.vaadin.form.DefaultAdapterProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mhu-lib-vaadin Show documentation
Show all versions of mhu-lib-vaadin Show documentation
Tools to develop applications with vaadin UI
The newest version!
/**
* Copyright 2018 Mike Hummel
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.mhus.lib.vaadin.form;
import de.mhus.lib.core.MActivator;
import de.mhus.lib.core.MApi;
import de.mhus.lib.core.activator.DefaultActivator;
import de.mhus.lib.core.config.IConfig;
import de.mhus.lib.core.logging.MLogUtil;
import de.mhus.lib.form.ActivatorAdapterProvider;
/*
Default Config:
*/
public class DefaultAdapterProvider extends ActivatorAdapterProvider {
public DefaultAdapterProvider() {
super(null);
DefaultActivator a = new DefaultActivator();
activator = a;
IConfig cfg = MApi.getCfg(DefaultAdapterProvider.class, null);
if (cfg != null) {
MActivator from = MApi.get().createActivator();
for (IConfig mapping : cfg.getNodes("adapter")) {
try {
String name = mapping.getString("name");
String className = mapping.getString("class");
Class> clazz = from.getClazz(className);
a.addMap(name, clazz);
} catch (Exception e) {
MLogUtil.log().e(mapping,e);
}
}
} else {
// default config
a.addMap("text", UiText.Adapter.class);
a.addMap("checkbox", UiCheckbox.Adapter.class);
a.addMap("date", UiDate.Adapter.class);
a.addMap("password", UiPassword.Adapter.class);
a.addMap("number", UiNumber.Adapter.class);
a.addMap("textarea", UiTextArea.Adapter.class);
a.addMap("richtext", UiRichTextArea.Adapter.class);
a.addMap("combobox", UiCombobox.Adapter.class);
a.addMap("layout100", UiLayout100.Adapter.class);
a.addMap("layout50x50", UiLayout2x50.Adapter.class);
a.addMap("layout33x33x33", UiLayout3x33.Adapter.class);
a.addMap("layout25x25x25x25", UiLayout4x25.Adapter.class);
a.addMap("layouttabs", UiLayoutTabs.Adapter.class);
a.addMap("layoutwizard", UiLayoutWizard.Adapter.class);
a.addMap("100", UiLayout100.Adapter.class);
a.addMap("50x50", UiLayout2x50.Adapter.class);
a.addMap("tabs", UiLayoutTabs.Adapter.class);
a.addMap("options", UiOptions.Adapter.class);
a.addMap("layoutpanel", UiPanel.Adapter.class);
a.addMap("panel", UiPanel.Adapter.class);
a.addMap("link", UiLink.Adapter.class);
a.addMap("label", UiLabel.Adapter.class);
a.addMap("action", UiAction.Adapter.class);
a.addMap("void", UiVoid.Adapter.class);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy