use of com.storedobject.ui.Application in project SODevelopment by syampillai.
the class ApplicationFrame method loggedin.
@Override
public void loggedin(com.storedobject.vaadin.Application application) {
if (!ApplicationServer.getGlobalBooleanProperty("application.config.toolbox.hide")) {
Application a = (Application) application;
boolean landscape = a.getDeviceWidth() > a.getDeviceHeight();
TransactionManager tm = ((Application) application).getTransactionManager();
SystemUser su = tm.getUser();
application.setLocale(su.getLocale());
Person p = su.getPerson();
application.speak("Welcome " + p);
StringBuilder sb = new StringBuilder();
sb.append(su.getLogin()).append(" (").append(p.getName()).append(')');
SystemEntity se = tm.getEntity();
if (se != null) {
Entity e = se.getEntity();
sb.append(", ").append(e.getName()).append(", ").append(e.getLocation());
}
HasText user = getUserNameComponent();
String s = sb.toString();
if (landscape) {
user.setText(s);
((HtmlComponent) user).setTitle("ID:" + su.getId());
} else {
user.setText(su.getName());
((HtmlComponent) user).setTitle(su.getId() + ":" + s);
}
ButtonIcon logoutButton = new ButtonIcon("icons:exit-to-app", e -> a.logout());
logoutButton.setStyle("color", "var(--lumo-error-color)");
logoutButton.getElement().setAttribute("title", "Sign out");
logoutButton.getElement().setAttribute("tabindex", "-1");
getToolbox().add(new SpeakerButton(), ((Application) application).getAlertButton(), new CompactSwitcher(a).icon, logoutButton);
}
if (!ApplicationServer.getGlobalBooleanProperty("application.config.menu.hide")) {
getDrawerToggle().setVisible(true);
}
}
use of com.storedobject.ui.Application in project SODevelopment by syampillai.
the class AbstractQuantityField method onAttach.
@Override
protected void onAttach(AttachEvent attachEvent) {
super.onAttach(attachEvent);
Application a = Application.get();
if (a != null) {
((TextField) getField()).setAutoselect(!a.getWebBrowser().isAndroid());
}
}
use of com.storedobject.ui.Application in project SODevelopment by syampillai.
the class SelectLocation method get.
public static InventoryLocation get(int... types) {
Application a = Application.get();
if (a == null) {
return null;
}
SelectStore.Assignment assignment = a.getData(SelectStore.Assignment.class);
if (assignment != null && assignment.location != null && checkType(assignment.location, types)) {
return assignment.location;
}
InventoryLocation loc = a.getTransactionManager().getUser().listLinks(InventoryVirtualLocation.class).filter(l -> checkType(l, types)).single(false);
if (loc == null) {
return null;
}
if (assignment == null) {
assignment = new SelectStore.Assignment();
a.setData(SelectStore.Assignment.class, assignment);
}
assignment.location = loc;
return loc;
}
use of com.storedobject.ui.Application in project SODevelopment by syampillai.
the class SelectLocation method process.
@Override
protected boolean process() {
Application a = Application.get();
close();
SelectStore.Assignment assignment = a.getData(SelectStore.Assignment.class);
if (assignment == null) {
assignment = new SelectStore.Assignment();
a.setData(SelectStore.Assignment.class, assignment);
}
assignment.location = locField.getValue();
if (logic != null) {
Application.get().execute(logic);
}
return true;
}
use of com.storedobject.ui.Application in project SODevelopment by syampillai.
the class SelectStore method process.
@Override
protected boolean process() {
Application a = Application.get();
close();
SelectStore.Assignment assignment = a.getData(SelectStore.Assignment.class);
if (assignment == null) {
assignment = new SelectStore.Assignment();
a.setData(SelectStore.Assignment.class, assignment);
}
assignment.store = storeField.getValue();
if (logic != null) {
Application.get().execute(logic);
}
return true;
}
Aggregations