Refs #581 (Desktop client)

This commit is contained in:
Konstantin Krivopustov 2011-04-14 15:05:28 +00:00
parent 0a668b03d0
commit 00466125e6
52 changed files with 2479 additions and 803 deletions

View File

@ -35,6 +35,7 @@
<root url="jar://$PROJECT_DIR$/../lib/common/src/spring-expression-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/common/src/guava-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/common/src/spring-web-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/common/src/spring-tx-sources.jar!/" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/../lib/common" recursive="false" />
</library>

View File

@ -1,7 +1,12 @@
<component name="libraryTable">
<library name="desktop">
<CLASSES />
<CLASSES>
<root url="file://$PROJECT_DIR$/../lib/desktop" />
</CLASSES>
<JAVADOC />
<SOURCES />
<SOURCES>
<root url="jar://$PROJECT_DIR$/../lib/desktop/src/miglayout-sources.jar!/" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/../lib/desktop" recursive="false" />
</library>
</component>

View File

@ -6,7 +6,6 @@
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/../lib/server/src/cas-client-core-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/server/src/spring-tx-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/server/src/spring-orm-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/server/src/xpp3_min-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/../lib/server/src/ooo-bootstrapconnector-sources.jar!/" />

View File

@ -63,6 +63,7 @@
<ext:install-lib groupId="org.springframework" artifactId="spring-asm" version="${springframework.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="org.springframework" artifactId="spring-expression" version="${springframework.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="org.springframework" artifactId="spring-web" version="${springframework.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="org.springframework" artifactId="spring-tx" version="${springframework.version}" toDir="${lib.common.dir}"/>
<ext:install-lib groupId="xerces" artifactId="xercesImpl" version="${xercesImpl.version}" toDir="${lib.common.dir}"/>
<!--<ext:install-lib name="jaxen" version="${jaxen.version}" toDir="${lib.common.dir}"/>-->
@ -78,7 +79,6 @@
<ext:install-lib groupId="org.springframework" artifactId="spring-jdbc" version="${springframework.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="org.springframework" artifactId="spring-orm" version="${springframework.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="org.springframework" artifactId="spring-tx" version="${springframework.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="org.springframework" artifactId="spring-context-support" version="${springframework.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="org.apache.commons" artifactId="commons-compress" version="${commons-compress.version}" toDir="${lib.server.dir}"/>
@ -125,6 +125,9 @@
<!--XStream-->
<ext:install-lib groupId="com.haulmont.thirdparty" artifactId="xstream" version="${xstream.version}" toDir="${lib.server.dir}"/>
<ext:install-lib groupId="xpp3" artifactId="xpp3_min" version="${xpp3.version}" toDir="${lib.server.dir}"/>
<!-- Desktop libs -->
<ext:install-lib groupId="com.haulmont.thirdparty" artifactId="miglayout" version="${miglayout.version}" toDir="${lib.desktop.dir}"/>
</target>
<target name="compile">

View File

@ -28,6 +28,7 @@ jcommon.version=1.0.16
jespa.version=1.0.7
jfreechart.version=1.0.13
jgroups.version=2.9.0.GA
miglayout.version=3.7.4
mybatis.version=3.0.4
mybatis-spring.version=1.0.0
openjpa.version=1.2.2

View File

@ -112,7 +112,7 @@ public class MetadataProviderClientImpl extends MetadataProvider {
List<View> views = deployerService.getViews();
for (View view : views) {
MetaClass metaClass = session.getClass(view.getEntityClass());
MetaClass metaClass = __getSession().getClass(view.getEntityClass());
vr.storeView(metaClass, view);
}

View File

@ -31,3 +31,11 @@ cuba.appConfig.messagesPack=com.haulmont.cuba.desktop
cuba.groovyClassPath=
cuba.groovyEvaluatorImport.GUI=com.haulmont.cuba.core.global.PersistenceHelper
###############################################################################
# Security #
###############################################################################
# Default user accout to show in login dialog. Comment out for production mode.
cuba.desktop.loginDialogDefaultUser=admin
cuba.desktop.loginDialogDefaultPassword=admin

View File

@ -1,139 +1,5 @@
<screen-config xmlns="http://www.haulmont.com/schema/cuba/gui/screen-config.xsd">
<screen id="tableTest"
class="com.haulmont.cuba.web.app.ui.LazyLoadingTableScreen"/>
<screen id="core$Server.browse"
template="/com/haulmont/cuba/web/app/ui/core/server/server-browse.xml"/>
<screen id="core$FileDescriptor.browse"
template="/com/haulmont/cuba/web/app/ui/core/file/file-browse.xml"/>
<screen id="core$FileDescriptor.edit"
template="/com/haulmont/cuba/web/app/ui/core/file/file-edit.xml"/>
<screen id="sec$User.browse"
template="/com/haulmont/cuba/gui/app/security/user/browse/user-browse.xml"/>
<screen id="sec$User.lookup"
template="/com/haulmont/cuba/gui/app/security/user/browse/user-lookup.xml"/>
<screen id="sec$User.edit"
template="/com/haulmont/cuba/gui/app/security/user/edit/user-edit.xml"/>
<screen id="sec$User.changePassw"
template="/com/haulmont/cuba/gui/app/security/user/changepassw/user-changepassw.xml"/>
<screen id="sec$UserSubstitution.edit"
template="/com/haulmont/cuba/gui/app/security/usersubst/edit/usersubst-edit.xml"/>
<screen id="sec$Group.edit"
template="/com/haulmont/cuba/gui/app/security/group/edit/group-edit.xml"/>
<screen id="sec$Group.browse"
template="/com/haulmont/cuba/gui/app/security/group/browse/group-browse.xml"/>
<screen id="sec$Group.lookup"
template="/com/haulmont/cuba/gui/app/security/group/lookup/group-lookup.xml"/>
<screen id="sec$Role.browse"
template="/com/haulmont/cuba/gui/app/security/role/browse/role-browse.xml"/>
<screen id="sec$Role.edit"
template="/com/haulmont/cuba/gui/app/security/role/edit/role-edit.xml"/>
<screen id="sec$Target.entityPermissions.lookup"
template="/com/haulmont/cuba/gui/app/security/role/edit/entity-permission-lookup.xml"/>
<screen id="sec$Target.propertyPermissions.lookup"
template="/com/haulmont/cuba/gui/app/security/role/edit/property-permission-lookup.xml"/>
<screen id="sec$Target.screenPermissions.lookup"
template="/com/haulmont/cuba/gui/app/security/role/edit/screen-permission-lookup.xml"/>
<screen id="sec$Target.specificPermissions.lookup"
template="/com/haulmont/cuba/gui/app/security/role/edit/specific-permission-lookup.xml"/>
<screen id="sec$Permission.show"
template="/com/haulmont/cuba/gui/app/security/role/edit/permission-show.xml"/>
<screen id="cuba$ExcelExport"
template="/com/haulmont/cuba/web/app/ui/export/excel/excel-export.xml"/>
<screen id="sec$UserSessionEntity.browse"
template="/com/haulmont/cuba/gui/app/security/session/browse/session-browse.xml"/>
<screen id="sec$Constraint.edit"
template="/com/haulmont/cuba/gui/app/security/constraint/edit/constraint-edit.xml"/>
<screen id="sec$SessionAttribute.edit"
template="/com/haulmont/cuba/gui/app/security/sessionattr/edit/session-attr-edit.xml"/>
<screen id="settings"
template="/com/haulmont/cuba/web/app/ui/core/settings/settings-window.xml"/>
<screen id="feedback"
template="/com/haulmont/cuba/web/app/ui/core/feedback/feedback-window.xml"/>
<screen id="logWindow"
class="com.haulmont.cuba.web.log.LogWindowLauncher"/>
<screen id="core$SimpleLookup"
template="/com/haulmont/cuba/gui/app/core/lookup/simple-lookup.xml"/>
<screen id="core$LockInfo.browse"
template="/com/haulmont/cuba/gui/app/core/locking/lock-browse.xml"/>
<screen id="fts$Search"
class="com.haulmont.fts.web.ui.results.SearchLauncher"/>
<screen id="fts$SearchResults"
template="/com/haulmont/fts/web/ui/results/search-results.xml"/>
<!-- report screens-->
<screen id="report$Report.browse"
template="/cuba/client/web/ui/report/browse/report-browse.xml"/>
<screen id="report$Report.edit"
template="/cuba/client/web/ui/report/edit/report-edit.xml"/>
<screen id="report$Report.fileUploadDialog"
template="/cuba/client/web/ui/report/fileuploaddialog/file-upload-dialog.xml"/>
<screen id="report$Report.run"
template="/cuba/client/web/ui/report/run/report-run.xml"/>
<screen id="report$BandDefinition.edit"
template="/cuba/client/web/ui/report/definition/edit/definition-edit.xml"/>
<screen id="report$inputParameters"
template="/cuba/client/web/ui/report/browse/input-parameters.xml"/>
<screen id="report$commonLookup"
template="/cuba/client/web/ui/report/browse/common-lookup.xml"/>
<screen id="report$ReportInputParameter.edit"
template="/cuba/client/web/ui/report/edit/parameter-edit.xml"/>
<screen id="report$ReportValueFormat.edit"
template="/cuba/client/web/ui/report/edit/formats-edit.xml"/>
<screen id="report$ReportScreen.edit"
template="/cuba/client/web/ui/report/edit/report-screen-edit.xml"/>
<screen id="core$Entity.restore"
template="/com/haulmont/cuba/web/app/ui/core/restore/entity-restore.xml"/>
<!-- JMX control -->
<screen id="jmxcontrol$DisplayMbeans"
template="/cuba/client/web/ui/jmxcontrol/browse/display-mbeans.xml"/>
<screen id="jmxcontrol$InspectMbean"
template="/cuba/client/web/ui/jmxcontrol/inspect/mbean-inspect.xml"/>
<screen id="jmxcontrol$EditAttribute"
template="/cuba/client/web/ui/jmxcontrol/inspect/attribute/attribute-edit.xml"/>
<screen id="jmxcontrol$OperationResult"
template="/cuba/client/web/ui/jmxcontrol/inspect/operation/operation-result.xml"/>
<screen id="sec$ScreenHistory.browse"
template="/com/haulmont/cuba/web/app/ui/security/history/screen-history-browse.xml"/>
<screen id="multiupload" template="/com/haulmont/cuba/web/app/ui/core/file/multiupload.xml"/>
<include file="/com/haulmont/cuba/gui/screen-config.xml"/>
</screen-config>

View File

@ -6,8 +6,13 @@
package com.haulmont.cuba.desktop;
import com.haulmont.cuba.core.global.MessageProvider;
import com.haulmont.cuba.core.sys.AppContext;
import com.haulmont.cuba.desktop.sys.DesktopAppContextLoader;
import com.haulmont.cuba.desktop.sys.DesktopWindowManager;
import com.haulmont.cuba.desktop.sys.MenuBuilder;
import com.haulmont.cuba.gui.AppConfig;
import com.haulmont.cuba.gui.WindowManager;
import com.haulmont.cuba.security.global.LoginException;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.text.StrSubstitutor;
@ -21,6 +26,7 @@ import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.util.Locale;
/**
* <p>$Id$</p>
@ -31,13 +37,17 @@ public class App implements ConnectionListener {
protected static App app;
private Log log;
protected JFrame frame;
protected JMenuBar menuBar;
protected Connection connection;
private Log log;
protected DesktopWindowManager windowManager;
private JTabbedPane tabsPane;
public static void main(String[] args) {
app = new App();
@ -62,10 +72,13 @@ public class App implements ConnectionListener {
try {
initConnection();
initUI();
DesktopAppContextLoader contextLoader = new DesktopAppContextLoader(getDefaultAppPropertiesConfig());
contextLoader.load();
windowManager = new DesktopWindowManager();
initUI();
} catch (Throwable t) {
log.error("Error initializing application", t);
System.exit(-1);
@ -82,6 +95,10 @@ public class App implements ConnectionListener {
return connection;
}
public JTabbedPane getTabsPane() {
return tabsPane;
}
protected void showLoginDialog() {
LoginDialog loginDialog = new LoginDialog(connection);
loginDialog.setLocationRelativeTo(frame);
@ -183,12 +200,14 @@ public class App implements ConnectionListener {
menuBar = new JMenuBar();
pane.add(menuBar, BorderLayout.NORTH);
JMenu menu = new JMenu("File");
Locale loc = Locale.getDefault();
JMenu menu = new JMenu(MessageProvider.getMessage(AppConfig.getMessagesPack(), "mainMenu.file", loc));
menuBar.add(menu);
JMenuItem item;
item = new JMenuItem("Connect");
item = new JMenuItem(MessageProvider.getMessage(AppConfig.getMessagesPack(), "mainMenu.connect", loc));
item.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
@ -198,7 +217,7 @@ public class App implements ConnectionListener {
);
menu.add(item);
item = new JMenuItem("Exit");
item = new JMenuItem(MessageProvider.getMessage(AppConfig.getMessagesPack(), "mainMenu.exit", loc));
item.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
@ -228,12 +247,12 @@ public class App implements ConnectionListener {
protected JComponent createMenuBar() {
menuBar = new JMenuBar();
JMenu menu = new JMenu("File");
JMenu menu = new JMenu(MessageProvider.getMessage(AppConfig.getMessagesPack(), "mainMenu.file"));
menuBar.add(menu);
JMenuItem item;
item = new JMenuItem("Disconnect");
item = new JMenuItem(MessageProvider.getMessage(AppConfig.getMessagesPack(), "mainMenu.disconnect"));
item.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
@ -243,7 +262,7 @@ public class App implements ConnectionListener {
);
menu.add(item);
item = new JMenuItem("Exit");
item = new JMenuItem(MessageProvider.getMessage(AppConfig.getMessagesPack(), "mainMenu.exit"));
item.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
@ -253,6 +272,9 @@ public class App implements ConnectionListener {
);
menu.add(item);
MenuBuilder builder = new MenuBuilder(connection.getSession(), menuBar);
builder.build();
return menuBar;
}
@ -269,18 +291,33 @@ public class App implements ConnectionListener {
return pane;
}
private JComponent createTabsPane() {
return new JTabbedPane();
protected JComponent createTabsPane() {
tabsPane = new JTabbedPane();
return tabsPane;
}
protected void initExceptionHandlers(boolean isConnected) {
// TODO
}
public void connectionStateChanged(Connection connection) throws LoginException {
if (connection.isConnected()) {
frame.setContentPane(createContentPane());
frame.repaint();
initExceptionHandlers(true);
} else {
frame.setContentPane(createStartContentPane());
frame.repaint();
initExceptionHandlers(false);
showLoginDialog();
}
}
public WindowManager getWindowManager() {
return windowManager;
}
public JFrame getMainFrame() {
return frame;
}
}

View File

@ -6,8 +6,15 @@
package com.haulmont.cuba.desktop;
import com.haulmont.cuba.core.sys.AppContext;
import com.haulmont.cuba.core.sys.SecurityContext;
import com.haulmont.cuba.gui.ServiceLocator;
import com.haulmont.cuba.security.app.LoginService;
import com.haulmont.cuba.security.global.LoginException;
import com.haulmont.cuba.security.global.UserSession;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.util.ArrayList;
import java.util.List;
@ -24,18 +31,35 @@ public class Connection {
private boolean connected;
private UserSession session;
private Log log = LogFactory.getLog(Connection.class);
public void login(String login, String password, Locale locale) throws LoginException {
LoginService loginService = ServiceLocator.lookup(LoginService.NAME);
session = loginService.login(login, password, locale);
AppContext.setSecurityContext(new SecurityContext(session.getId()));
connected = true;
fireConnectionListeners();
}
public void logout() {
try {
LoginService loginService = ServiceLocator.lookup(LoginService.NAME);
loginService.logout();
AppContext.setSecurityContext(null);
} catch (Exception e) {
log.warn("Error on logout", e);
}
connected = false;
try {
fireConnectionListeners();
} catch (LoginException e) {
//
log.warn("Error on logout", e);
}
session = null;
}
public boolean isConnected() {
@ -43,7 +67,7 @@ public class Connection {
}
public UserSession getSession() {
return null;
return session;
}
public void addListener(ConnectionListener listener) {

View File

@ -0,0 +1,26 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.desktop;
import com.haulmont.cuba.core.config.Config;
import com.haulmont.cuba.core.config.Prefix;
import com.haulmont.cuba.core.config.Source;
import com.haulmont.cuba.core.config.SourceType;
import com.haulmont.cuba.core.config.defaults.DefaultInt;
/**
* <p>$Id$</p>
*
* @author krivopustov
*/
@Source(type = SourceType.APP)
@Prefix("cuba.desktop.")
public interface DesktopConfig extends Config {
@DefaultInt(25)
int getMainTabCaptionLength();
}

View File

@ -6,7 +6,13 @@
package com.haulmont.cuba.desktop;
import com.haulmont.cuba.core.global.MessageProvider;
import com.haulmont.cuba.core.sys.AppContext;
import com.haulmont.cuba.gui.AppConfig;
import com.haulmont.cuba.security.global.LoginException;
import net.miginfocom.swing.MigLayout;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang.StringUtils;
import javax.swing.*;
import java.awt.*;
@ -25,27 +31,40 @@ public class LoginDialog extends JDialog {
public LoginDialog(Connection connection) {
this.connection = connection;
setTitle("Login");
setTitle(MessageProvider.getMessage(AppConfig.getMessagesPack(), "loginWindow.caption", Locale.getDefault()));
setContentPane(createContentPane());
setSize(300, 200);
// setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
setResizable(false);
pack();
}
private Container createContentPane() {
JPanel contentPane = new JPanel(new BorderLayout());
contentPane.add(createButtonsPane(), BorderLayout.SOUTH);
return contentPane;
}
MigLayout layout = new MigLayout("fillx, insets dialog", "[right][]");
JPanel panel = new JPanel(layout);
private JComponent createButtonsPane() {
JPanel buttonsPane = new JPanel(new FlowLayout());
panel.add(new JLabel(MessageProvider.getMessage(AppConfig.getMessagesPack(), "loginWindow.loginField", Locale.getDefault())));
JButton loginBtn = new JButton("Login");
final JTextField nameField = new JTextField();
String defaultName = AppContext.getProperty("cuba.desktop.loginDialogDefaultUser");
if (!StringUtils.isBlank(defaultName))
nameField.setText(defaultName);
panel.add(nameField, "width 150!, wrap");
panel.add(new JLabel(MessageProvider.getMessage(AppConfig.getMessagesPack(), "loginWindow.passwordField", Locale.getDefault())));
final JTextField passwordField = new JPasswordField();
String defaultPassword = AppContext.getProperty("cuba.desktop.loginDialogDefaultPassword");
if (!StringUtils.isBlank(defaultPassword))
passwordField.setText(defaultPassword);
panel.add(passwordField, "width 150!, wrap");
JButton loginBtn = new JButton(MessageProvider.getMessage(AppConfig.getMessagesPack(), "loginWindow.okButton", Locale.getDefault()));
loginBtn.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
connection.login("", "", Locale.getDefault());
String name = nameField.getText();
String password = passwordField.getText();
connection.login(name, DigestUtils.md5Hex(password), Locale.getDefault());
setVisible(false);
} catch (LoginException ex) {
throw new RuntimeException(ex);
@ -53,8 +72,9 @@ public class LoginDialog extends JDialog {
}
}
);
buttonsPane.add(loginBtn);
panel.add(loginBtn, "span, align center");
return buttonsPane;
return panel;
}
}

View File

@ -0,0 +1,62 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.desktop.gui;
import com.haulmont.cuba.desktop.gui.components.*;
import com.haulmont.cuba.gui.components.*;
import com.haulmont.cuba.gui.components.charts.Chart;
import com.haulmont.cuba.gui.xml.layout.ComponentsFactory;
import java.util.HashMap;
import java.util.Map;
/**
* <p>$Id$</p>
*
* @author krivopustov
*/
public class DesktopComponentsFactory implements ComponentsFactory {
private static Map<String, Class<? extends Component>> classes = new HashMap<String, Class<?extends Component>>();
static {
classes.put(Window.NAME, DesktopWindow.class);
classes.put("hbox", DesktopHBox.class);
classes.put("vbox", DesktopVBox.class);
classes.put(Button.NAME, DesktopButton.class);
classes.put(Table.NAME, DesktopTable.class);
classes.put(ButtonsPanel.NAME, DesktopButtonsPanel.class);
}
public static void registerComponent(String element, Class<? extends Component> componentClass) {
classes.put(element, componentClass);
}
public <T extends Component> T createComponent(String name) {
final Class<Component> componentClass = (Class<Component>) classes.get(name);
if (componentClass == null) {
throw new IllegalStateException(String.format("Can't find component class for '%s'", name));
}
try {
return (T) componentClass.newInstance();
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
public <T extends Timer> T createTimer() {
return null;
}
public <T extends Chart> T createChart(String vendor, String name) {
return null;
}
}

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.desktop.gui.components;
import com.haulmont.cuba.gui.components.Action;
import org.apache.commons.lang.ObjectUtils;
import javax.swing.*;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
/**
* <p>$Id$</p>
*
* @author krivopustov
*/
public class DesktopAbstractActionOwnerComponent<C extends JComponent> extends DesktopAbstractComponent {
protected java.util.List<Action> actionsOrder = new LinkedList<com.haulmont.cuba.gui.components.Action>();
public void addAction(Action action) {
actionsOrder.add(action);
}
public void removeAction(Action action) {
actionsOrder.remove(action);
}
public Collection<Action> getActions() {
return Collections.unmodifiableCollection(actionsOrder);
}
public com.haulmont.cuba.gui.components.Action getAction(String id) {
for (com.haulmont.cuba.gui.components.Action action : getActions()) {
if (ObjectUtils.equals(action.getId(), id)) {
return action;
}
}
return null;
}
}

View File

@ -0,0 +1,136 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.desktop.gui.components;
import com.haulmont.cuba.gui.components.Component;
import com.haulmont.cuba.gui.components.IFrame;
import org.dom4j.Element;
import javax.swing.*;
/**
* <p>$Id$</p>
*
* @author krivopustov
*/
public abstract class DesktopAbstractComponent<C extends JComponent>
implements
Component, Component.Wrapper, Component.HasXmlDescriptor, Component.BelongToFrame, Component.Expandable
{
protected C jComponent;
protected String id;
protected IFrame frame;
protected Element xmlDescriptor;
protected boolean expandable;
public <A extends IFrame> A getFrame() {
return (A) frame;
}
public void setFrame(IFrame frame) {
this.frame = frame;
frame.registerComponent(this);
}
public void setExpandable(boolean expandable) {
this.expandable = expandable;
}
public boolean isExpandable() {
return expandable;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDebugId() {
return null;
}
public void setDebugId(String id) {
}
public boolean isEnabled() {
return jComponent.isEnabled();
}
public void setEnabled(boolean enabled) {
jComponent.setEnabled(enabled);
}
public boolean isVisible() {
return jComponent.isVisible();
}
public void setVisible(boolean visible) {
jComponent.setVisible(visible);
}
public void requestFocus() {
jComponent.requestFocus();
}
public float getHeight() {
return jComponent.getHeight();
}
public int getHeightUnits() {
return 0;
}
public void setHeight(String height) {
// TODO
}
public float getWidth() {
return jComponent.getWidth();
}
public int getWidthUnits() {
return 0;
}
public void setWidth(String width) {
// TODO
}
public Alignment getAlignment() {
return null;
}
public void setAlignment(Alignment alignment) {
}
public String getStyleName() {
return null;
}
public void setStyleName(String name) {
}
public Element getXmlDescriptor() {
return xmlDescriptor;
}
public void setXmlDescriptor(Element element) {
xmlDescriptor = element;
}
public <T> T getComponent() {
return (T) jComponent;
}
public JComponent getComposition() {
return jComponent;
}
}

View File

@ -0,0 +1,86 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.desktop.gui.components;
import com.haulmont.cuba.gui.ComponentsHelper;
import com.haulmont.cuba.gui.components.Component;
import net.miginfocom.swing.MigLayout;
import javax.swing.*;
import java.util.*;
/**
* <p>$Id$</p>
*
* @author krivopustov
*/
public abstract class DesktopAbstractContainer
extends DesktopAbstractComponent<JPanel>
implements Component.Container, Component.Expandable, Component.BelongToFrame, com.haulmont.cuba.gui.components.BoxLayout
{
protected MigLayout layout;
protected Collection<Component> ownComponents = new HashSet<Component>();
protected Map<String, Component> componentByIds = new HashMap<String, Component>();
public DesktopAbstractContainer() {
layout = new MigLayout();
jComponent = new JPanel(layout);
}
public void add(Component component) {
JComponent composition = DesktopComponentsHelper.getComposition(component);
jComponent.add(composition);
// setComponentAlignment(itmillComponent, WebComponentsHelper.convertAlignment(component.getAlignment()));
if (component.getId() != null) {
componentByIds.put(component.getId(), component);
if (frame != null) {
frame.registerComponent(component);
}
}
ownComponents.add(component);
}
public void remove(Component component) {
JComponent composition = DesktopComponentsHelper.getComposition(component);
jComponent.remove(composition);
if (component.getId() != null) {
componentByIds.remove(component.getId());
}
ownComponents.remove(component);
}
public <T extends Component> T getOwnComponent(String id) {
return (T) componentByIds.get(id);
}
public <T extends Component> T getComponent(String id) {
return DesktopComponentsHelper.<T>getComponent(this, id);
}
public Collection<Component> getOwnComponents() {
return Collections.unmodifiableCollection(ownComponents);
}
public Collection<Component> getComponents() {
return ComponentsHelper.getComponents(this);
}
public void expand(Component component, String height, String width) {
}
public void setMargin(boolean enable) {
}
public void setMargin(boolean topEnable, boolean rightEnable, boolean bottomEnable, boolean leftEnable) {
}
public void setSpacing(boolean enabled) {
}
}

View File

@ -0,0 +1,199 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.desktop.gui.components;
import com.haulmont.cuba.core.entity.Entity;
import com.haulmont.cuba.gui.components.*;
import com.haulmont.cuba.gui.components.Action;
import com.haulmont.cuba.gui.data.CollectionDatasource;
import com.haulmont.cuba.gui.presentations.Presentations;
import org.dom4j.Element;
import javax.swing.*;
import java.util.Collection;
import java.util.List;
import java.util.Set;
/**
* <p>$Id$</p>
*
* @author krivopustov
*/
public class DesktopAbstractTable
extends DesktopAbstractActionOwnerComponent<JTable>
implements Table
{
protected CollectionDatasource datasource;
public DesktopAbstractTable() {
jComponent = new JTable();
}
public List<Column> getColumns() {
return null;
}
public Column getColumn(String id) {
return null;
}
public void addColumn(Column column) {
}
public void removeColumn(Column column) {
}
public void setDatasource(CollectionDatasource datasource) {
this.datasource = datasource;
}
public void setRequired(Column column, boolean required, String message) {
}
public void addValidator(Column column, Field.Validator validator) {
}
public void addValidator(Field.Validator validator) {
}
public void setItemClickAction(com.haulmont.cuba.gui.components.Action action) {
}
public Action getItemClickAction() {
return null;
}
public List<Column> getNotCollapsedColumns() {
return null;
}
public void setSortable(boolean sortable) {
}
public boolean isSortable() {
return false;
}
public void setAggregatable(boolean aggregatable) {
}
public boolean isAggregatable() {
return false;
}
public void setShowTotalAggregation(boolean showAggregation) {
}
public boolean isShowTotalAggregation() {
return false;
}
public void sortBy(Object propertyId, boolean ascending) {
}
public RowsCount getRowsCount() {
return null;
}
public void setRowsCount(RowsCount rowsCount) {
}
public boolean isAllowMultiStringCells() {
return false;
}
public void setAllowMultiStringCells(boolean value) {
}
public void setRowHeaderMode(RowHeaderMode mode) {
}
public void setStyleProvider(StyleProvider styleProvider) {
}
public void setPagingMode(PagingMode mode) {
}
public void setPagingProvider(PagingProvider pagingProvider) {
}
public void addGeneratedColumn(String columnId, ColumnGenerator generator) {
}
public boolean isEditable() {
return false;
}
public void setEditable(boolean editable) {
}
public ButtonsPanel getButtonsPanel() {
return null;
}
public void setButtonsPanel(ButtonsPanel panel) {
}
public void usePresentations(boolean b) {
}
public boolean isUsePresentations() {
return false;
}
public void loadPresentations() {
}
public Presentations getPresentations() {
return null;
}
public void applyPresentation(Object id) {
}
public void applyPresentationAsDefault(Object id) {
}
public Object getDefaultPresentationId() {
return null;
}
public void applySettings(Element element) {
}
public boolean saveSettings(Element element) {
return false;
}
public boolean isMultiSelect() {
return false;
}
public void setMultiSelect(boolean multiselect) {
}
public <T extends Entity> T getSingleSelected() {
return null;
}
public Set getSelected() {
return null;
}
public void setSelected(Entity item) {
}
public void setSelected(Collection<Entity> items) {
}
public CollectionDatasource getDatasource() {
return datasource;
}
public void refresh() {
}
}

View File

@ -0,0 +1,53 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.desktop.gui.components;
import com.haulmont.cuba.gui.components.*;
import com.haulmont.cuba.gui.components.Action;
import javax.swing.*;
/**
* <p>$Id$</p>
*
* @author krivopustov
*/
public class DesktopButton extends DesktopAbstractComponent<JButton> implements Button {
public DesktopButton() {
jComponent = new JButton();
}
public com.haulmont.cuba.gui.components.Action getAction() {
return null;
}
public void setAction(Action action) {
}
public String getCaption() {
return jComponent.getText();
}
public void setCaption(String caption) {
jComponent.setText(caption);
}
public String getDescription() {
return null;
}
public void setDescription(String description) {
}
public String getIcon() {
return null;
}
public void setIcon(String icon) {
}
}

View File

@ -0,0 +1,34 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.desktop.gui.components;
import com.haulmont.cuba.gui.components.Button;
import com.haulmont.cuba.gui.components.ButtonsPanel;
import java.util.Collection;
/**
* <p>$Id$</p>
*
* @author krivopustov
*/
public class DesktopButtonsPanel extends DesktopHBox implements ButtonsPanel {
public void addButton(Button actionButton) {
}
public void removeButton(Button actionButton) {
}
public Collection<Button> getButtons() {
return null;
}
public Button getButton(String id) {
return null;
}
}

View File

@ -0,0 +1,70 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.desktop.gui.components;
import com.haulmont.cuba.gui.components.Component;
import com.haulmont.cuba.gui.components.ValuePathHelper;
import javax.swing.*;
import java.util.*;
/**
* <p>$Id$</p>
*
* @author krivopustov
*/
public class DesktopComponentsHelper {
public static JComponent unwrap(Component component) {
Object comp = component;
while (comp instanceof Component.Wrapper) {
comp = ((Component.Wrapper) comp).getComponent();
}
return (JComponent) comp;
}
public static JComponent getComposition(Component component) {
Object comp = component;
while (comp instanceof Component.Wrapper) {
comp = ((Component.Wrapper) comp).getComposition();
}
return (JComponent) comp;
}
public static <T extends Component> T getComponent(Component.Container comp, String id) {
final JComponent container = unwrap(comp);
final String[] elements = ValuePathHelper.parse(id);
if (elements.length == 1) {
final Component component = comp.getOwnComponent(id);
if (component == null) {
return (T) getComponentByIteration(container, id);
} else {
return (T) component;
}
} else {
Component component = comp.getOwnComponent(elements[0]);
if (component == null) {
return (T) getComponentByIteration(container, id);
} else {
final List<String> subpath = Arrays.asList(elements).subList(1, elements.length);
if (component instanceof Component.Container) {
return ((Component.Container) component).<T>getComponent(
ValuePathHelper.format(subpath.toArray(new String[subpath.size()])));
} else {
return null;
}
}
}
}
private static <T extends Component> T getComponentByIteration(JComponent container, String id) {
throw new UnsupportedOperationException();
}
}

View File

@ -0,0 +1,18 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.desktop.gui.components;
/**
* <p>$Id$</p>
*
* @author krivopustov
*/
public class DesktopHBox extends DesktopAbstractContainer {
public DesktopHBox() {
}
}

View File

@ -0,0 +1,15 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.desktop.gui.components;
/**
* <p>$Id$</p>
*
* @author krivopustov
*/
public class DesktopTable extends DesktopAbstractTable {
}

View File

@ -0,0 +1,18 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.desktop.gui.components;
/**
* <p>$Id$</p>
*
* @author krivopustov
*/
public class DesktopVBox extends DesktopAbstractContainer {
public DesktopVBox() {
}
}

View File

@ -0,0 +1,360 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.desktop.gui.components;
import com.haulmont.cuba.core.entity.Entity;
import com.haulmont.cuba.gui.DialogParams;
import com.haulmont.cuba.gui.WindowManager;
import com.haulmont.cuba.gui.components.*;
import com.haulmont.cuba.gui.components.Action;
import com.haulmont.cuba.gui.components.Timer;
import com.haulmont.cuba.gui.data.Datasource;
import com.haulmont.cuba.gui.data.DsContext;
import com.haulmont.cuba.gui.data.WindowContext;
import com.haulmont.cuba.gui.settings.Settings;
import org.dom4j.Element;
import javax.swing.*;
import java.lang.reflect.Constructor;
import java.util.*;
import java.util.List;
/**
* <p>$Id$</p>
*
* @author krivopustov
*/
public class DesktopWindow implements Window, Component.Wrapper, Component.HasXmlDescriptor, WrappedWindow
{
private static final long serialVersionUID = 1026363207247384464L;
protected JPanel panel;
protected String id;
protected Window wrapper;
protected Map<String, Component> allComponents = new HashMap<String, Component>();
private DsContext dsContext;
private WindowContext context;
public DesktopWindow() {
panel = new JPanel();
}
public Element getXmlDescriptor() {
return null;
}
public void setXmlDescriptor(Element element) {
}
public void addListener(CloseListener listener) {
}
public void removeListener(CloseListener listener) {
}
public void applySettings(Settings settings) {
}
public void saveSettings() {
}
public Settings getSettings() {
return null;
}
public boolean close(String actionId) {
return false;
}
public boolean close(String actionId, boolean force) {
return false;
}
public void closeAndRun(String actionId, Runnable runnable) {
}
public void addTimer(Timer timer) {
}
public Timer getTimer(String id) {
return null;
}
public void addAction(Action action) {
}
public void removeAction(Action action) {
}
public Collection<Action> getActions() {
return null;
}
public Action getAction(String id) {
return null;
}
public String getCaption() {
return null;
}
public void setCaption(String caption) {
}
public String getDescription() {
return null;
}
public void setDescription(String description) {
}
public WindowContext getContext() {
return context;
}
public void setContext(WindowContext ctx) {
context = ctx;
}
public DsContext getDsContext() {
return dsContext;
}
public void setDsContext(DsContext dsContext) {
this.dsContext = dsContext;
}
public String getMessagesPack() {
return null;
}
public void setMessagesPack(String name) {
}
public String getMessage(String key) {
return null;
}
public void registerComponent(Component component) {
if (component.getId() != null)
allComponents.put(component.getId(), component);
}
public DialogParams getDialogParams() {
return null;
}
public <T extends Window> T openWindow(String windowAlias, WindowManager.OpenType openType, Map<String, Object> params) {
return null;
}
public <T extends Window> T openWindow(String windowAlias, WindowManager.OpenType openType) {
return null;
}
public <T extends Window> T openEditor(String windowAlias, Entity item, WindowManager.OpenType openType, Map<String, Object> params, Datasource parentDs) {
return null;
}
public <T extends Window> T openEditor(String windowAlias, Entity item, WindowManager.OpenType openType, Map<String, Object> params) {
return null;
}
public <T extends Window> T openEditor(String windowAlias, Entity item, WindowManager.OpenType openType, Datasource parentDs) {
return null;
}
public <T extends Window> T openEditor(String windowAlias, Entity item, WindowManager.OpenType openType) {
return null;
}
public <T extends Window> T openLookup(String windowAlias, Lookup.Handler handler, WindowManager.OpenType openType, Map<String, Object> params) {
return null;
}
public <T extends Window> T openLookup(String windowAlias, Lookup.Handler handler, WindowManager.OpenType openType) {
return null;
}
public <T extends IFrame> T openFrame(Component parent, String windowAlias) {
return null;
}
public <T extends IFrame> T openFrame(Component parent, String windowAlias, Map<String, Object> params) {
return null;
}
public void showMessageDialog(String title, String message, MessageType messageType) {
}
public void showOptionDialog(String title, String message, MessageType messageType, Action[] actions) {
}
public void showOptionDialog(String title, String message, MessageType messageType, java.util.List<Action> actions) {
}
public void showNotification(String caption, NotificationType type) {
}
public void showNotification(String caption, String description, NotificationType type) {
}
public <A extends IFrame> A getFrame() {
return null;
}
public void setFrame(IFrame frame) {
}
public void expand(Component component, String height, String width) {
}
public void add(Component component) {
}
public void remove(Component component) {
}
public <T extends Component> T getOwnComponent(String id) {
return null;
}
public <T extends Component> T getComponent(String id) {
final String[] elements = ValuePathHelper.parse(id);
if (elements.length == 1) {
return (T) allComponents.get(id);
} else {
Component frame = allComponents.get(elements[0]);
if (frame != null && frame instanceof Container) {
final List<String> subList = Arrays.asList(elements).subList(1, elements.length);
String subPath = ValuePathHelper.format(subList.toArray(new String[subList.size()]));
return (T) ((Container) frame).getComponent(subPath);
} else
return null;
}
}
public Collection<Component> getOwnComponents() {
return null;
}
public Collection<Component> getComponents() {
return null;
}
public void expandLayout(boolean expandLayout) {
}
public <T> T getComponent() {
return (T) panel;
}
public JComponent getComposition() {
return panel;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDebugId() {
return null;
}
public void setDebugId(String id) {
}
public boolean isEnabled() {
return false;
}
public void setEnabled(boolean enabled) {
}
public boolean isVisible() {
return false;
}
public void setVisible(boolean visible) {
}
public void requestFocus() {
}
public float getHeight() {
return 0;
}
public int getHeightUnits() {
return 0;
}
public void setHeight(String height) {
}
public float getWidth() {
return 0;
}
public int getWidthUnits() {
return 0;
}
public void setWidth(String width) {
}
public Alignment getAlignment() {
return null;
}
public void setAlignment(Alignment alignment) {
}
public String getStyleName() {
return null;
}
public void setStyleName(String name) {
}
public void setMargin(boolean enable) {
}
public void setMargin(boolean topEnable, boolean rightEnable, boolean bottomEnable, boolean leftEnable) {
}
public void setSpacing(boolean enabled) {
}
public Window wrapBy(Class<Window> aClass) {
try {
Constructor<?> constructor;
try {
constructor = aClass.getConstructor(Window.class);
} catch (NoSuchMethodException e) {
constructor = aClass.getConstructor(IFrame.class);
}
wrapper = (Window) constructor.newInstance(this);
return wrapper;
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
public Window getWrapper() {
return wrapper;
}
}

View File

@ -0,0 +1,12 @@
#
# Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
# Haulmont Technology proprietary and confidential.
# Use is subject to license terms.
#
@include=com.haulmont.cuba.gui
mainMenu.file=File
mainMenu.connect=Connect
mainMenu.disconnect=Disconnect
mainMenu.exit=Exit

View File

@ -0,0 +1,12 @@
#
# Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
# Haulmont Technology proprietary and confidential.
# Use is subject to license terms.
#
@include=com.haulmont.cuba.gui
mainMenu.file=Файл
mainMenu.connect=Подключиться
mainMenu.disconnect=Отключиться
mainMenu.exit=Выход

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.desktop.sys;
import com.haulmont.cuba.desktop.gui.DesktopComponentsFactory;
import com.haulmont.cuba.gui.AppConfig;
import com.haulmont.cuba.gui.export.ExportDisplay;
import com.haulmont.cuba.gui.xml.layout.ComponentsFactory;
/**
* <p>$Id$</p>
*
* @author krivopustov
*/
public class DesktopAppConfig extends AppConfig {
private volatile ComponentsFactory componentsFactory;
@Override
protected ExportDisplay __createExportDisplay() {
return null;
}
@Override
protected ComponentsFactory __getFactory() {
if (componentsFactory == null) {
synchronized (this) {
componentsFactory = new DesktopComponentsFactory();
}
}
return componentsFactory;
}
}

View File

@ -11,6 +11,7 @@ import com.haulmont.cuba.core.global.MessageUtils;
import com.haulmont.cuba.core.sys.AppContext;
import com.haulmont.cuba.gui.AppConfig;
import com.haulmont.cuba.gui.ServiceLocator;
import com.haulmont.cuba.gui.config.WindowConfig;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.text.StrLookup;
import org.apache.commons.lang.text.StrSubstitutor;
@ -57,6 +58,8 @@ public class DesktopAppContextLoader {
private void initAppProperties() {
AppContext.setProperty(AppConfig.CLIENT_TYPE_PROP, ClientType.DESKTOP.toString());
AppContext.setProperty(AppConfig.IMPL_PROP, DesktopAppConfig.class.getName());
AppContext.setProperty(AppConfig.WINDOW_CONFIG_IMPL_PROP, WindowConfig.class.getName());
String appPropertiesConfig = System.getProperty(APP_PROPERTIES_CONFIG_SYS_PROP);
if (StringUtils.isBlank(appPropertiesConfig))

View File

@ -0,0 +1,241 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.desktop.sys;
import com.haulmont.cuba.core.global.ConfigProvider;
import com.haulmont.cuba.desktop.App;
import com.haulmont.cuba.desktop.DesktopConfig;
import com.haulmont.cuba.desktop.gui.components.DesktopComponentsHelper;
import com.haulmont.cuba.gui.WindowManager;
import com.haulmont.cuba.gui.components.*;
import com.haulmont.cuba.gui.components.Action;
import com.haulmont.cuba.gui.components.Component;
import com.haulmont.cuba.gui.components.Window;
import com.haulmont.cuba.gui.config.WindowInfo;
import com.haulmont.cuba.gui.data.DataService;
import com.haulmont.cuba.gui.data.impl.DsContextImplementation;
import com.haulmont.cuba.gui.data.impl.GenericDataService;
import com.haulmont.cuba.gui.settings.SettingsImpl;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.dom4j.Element;
import javax.swing.*;
import java.awt.*;
import java.util.*;
/**
* <p>$Id$</p>
*
* @author krivopustov
*/
public class DesktopWindowManager extends WindowManager {
protected final Map<JComponent, WindowBreadCrumbs> tabs = new HashMap<JComponent, WindowBreadCrumbs>();
protected final Map<Window, WindowOpenMode> windowOpenMode = new LinkedHashMap<Window, WindowOpenMode>();
protected final Map<WindowBreadCrumbs,Stack<Map.Entry<Window,Integer>>> stacks = new HashMap<WindowBreadCrumbs,Stack<Map.Entry<Window,Integer>>>();
protected final Map<Window,Integer> windows = new HashMap<Window,Integer>();
@Override
public Collection<Window> getOpenWindows() {
return new ArrayList<Window>(windowOpenMode.keySet());
}
@Override
protected void putToWindowMap(Window window, Integer hashCode) {
if (window != null) {
windows.put(window, hashCode);
}
}
@Override
protected Window getWindow(Integer hashCode) {
Set<Map.Entry<Window, Integer>> set = windows.entrySet();
for (Map.Entry<Window, Integer> entry : set) {
if (hashCode.equals(entry.getValue())) {
return entry.getKey();
}
}
return null;
}
@Override
protected void checkCanOpenWindow(WindowInfo windowInfo, OpenType openType, Map<String, Object> params) {
}
@Override
protected void showWindow(Window window, String caption, OpenType openType) {
showWindow(window, caption, null, openType);
}
@Override
protected void showWindow(Window window, String caption, String description, OpenType openType) {
window.setCaption(caption);
window.setDescription(description);
JComponent jComponent = null;
final WindowOpenMode openMode = new WindowOpenMode(window, openType);
boolean newTab = true;
switch (openType) {
case NEW_TAB:
JComponent tab = findTab(window);
if (tab != null) {
App.getInstance().getTabsPane().setSelectedComponent(tab);
jComponent = tab;
newTab = false;
} else {
jComponent = showWindowNewTab(window, caption, description);
}
break;
case THIS_TAB:
break;
case DIALOG:
break;
default:
throw new UnsupportedOperationException();
}
openMode.setData(jComponent);
if (window instanceof Window.Wrapper) {
Window wrappedWindow = ((Window.Wrapper) window).getWrappedWindow();
windowOpenMode.put(wrappedWindow, openMode);
} else {
windowOpenMode.put(window, openMode);
}
afterShowWindow(window, newTab);
}
protected JComponent showWindowNewTab(Window window, String caption, String description) {
final WindowBreadCrumbs breadCrumbs = createWindowBreadCrumbs();
breadCrumbs.addListener(
new WindowBreadCrumbs.Listener() {
public void windowClick(final Window window) {
Runnable op = new Runnable() {
public void run() {
Window currentWindow = breadCrumbs.getCurrentWindow();
if (currentWindow != null && window != currentWindow) {
currentWindow.closeAndRun("close", this);
}
}
};
op.run();
}
}
);
breadCrumbs.addWindow(window);
JComponent tabContent = createNewTabSheet(window, caption, description, breadCrumbs);
tabs.put(tabContent, breadCrumbs);
return tabContent;
}
protected JComponent createNewTabSheet(Window window, String caption, String description, WindowBreadCrumbs breadCrumbs) {
JPanel panel = new JPanel(new BorderLayout());
panel.add(breadCrumbs, BorderLayout.NORTH);
JComponent composition = DesktopComponentsHelper.getComposition(window);
panel.add(composition, BorderLayout.CENTER);
JTabbedPane tabsPane = App.getInstance().getTabsPane();
tabsPane.add(formatTabCaption(caption, description), panel);
return panel;
}
private String formatTabCaption(String caption, String description) {
String s = formatTabDescription(caption, description);
int maxLength = ConfigProvider.getConfig(DesktopConfig.class).getMainTabCaptionLength();
if (s.length() > maxLength) {
return s.substring(0, maxLength) + "...";
} else {
return s;
}
}
protected String formatTabDescription(final String caption, final String description) {
if (!StringUtils.isEmpty(description)) {
return String.format("%s | %s", caption, description);
} else {
return caption;
}
}
protected WindowBreadCrumbs createWindowBreadCrumbs() {
WindowBreadCrumbs windowBreadCrumbs = new WindowBreadCrumbs();
stacks.put(windowBreadCrumbs, new Stack<Map.Entry<Window, Integer>>());
return windowBreadCrumbs;
}
@Override
protected void showFrame(Component parent, IFrame frame) {
}
@Override
protected void initCompanion(Element companionsElem, AbstractWindow res) {
}
@Override
public void showNotification(String caption, IFrame.NotificationType type) {
}
@Override
public void showNotification(String caption, String description, IFrame.NotificationType type) {
}
@Override
public void showMessageDialog(String title, String message, IFrame.MessageType messageType) {
}
@Override
public void showOptionDialog(String title, String message, IFrame.MessageType messageType, Action[] actions) {
}
protected JComponent findTab(Window window) {
Set<Map.Entry<JComponent, WindowBreadCrumbs>> set = tabs.entrySet();
for (Map.Entry<JComponent, WindowBreadCrumbs> entry : set) {
if (entry.getValue().getCurrentWindow().equals(window))
return entry.getKey();
}
return null;
}
protected static class WindowOpenMode {
protected Window window;
protected OpenType openType;
protected Object data;
public WindowOpenMode(Window window, OpenType openType) {
this.window = window;
this.openType = openType;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public Window getWindow() {
return window;
}
public OpenType getOpenType() {
return openType;
}
}
}

View File

@ -0,0 +1,112 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.desktop.sys;
import com.haulmont.cuba.desktop.App;
import com.haulmont.cuba.gui.AppConfig;
import com.haulmont.cuba.gui.NoSuchScreenException;
import com.haulmont.cuba.gui.config.MenuCommand;
import com.haulmont.cuba.gui.config.MenuConfig;
import com.haulmont.cuba.gui.config.MenuItem;
import com.haulmont.cuba.gui.config.WindowInfo;
import com.haulmont.cuba.security.global.UserSession;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
/**
* <p>$Id$</p>
*
* @author krivopustov
*/
public class MenuBuilder {
private UserSession userSession;
private JMenuBar menuBar;
private MenuConfig menuConfig;
public MenuBuilder(UserSession userSession, JMenuBar menuBar) {
this.userSession = userSession;
this.menuBar = menuBar;
menuConfig = AppConfig.getInstance().getMenuConfig();
}
public void build() {
List<MenuItem> rootItems = menuConfig.getRootItems();
for (MenuItem item : rootItems) {
if (item.isPermitted(userSession)) {
createMenuBarItem(menuBar, item);
}
}
}
private void createMenuBarItem(JMenuBar menuBar, MenuItem item) {
String caption = MenuConfig.getMenuItemCaption(item.getId());
if (!item.getChildren().isEmpty()) {
JMenu jMenu = new JMenu(caption);
assignShortcut(jMenu, item);
menuBar.add(jMenu);
createSubMenu(jMenu, item);
} else {
JMenuItem jMenuItem = new JMenuItem(caption);
assignShortcut(jMenuItem, item);
assignCommand(jMenuItem, item);
menuBar.add(jMenuItem);
}
}
private void assignCommand(JMenuItem jMenuItem, MenuItem item) {
WindowInfo windowInfo;
try {
windowInfo = AppConfig.getInstance().getWindowConfig().getWindowInfo(item.getId());
} catch (NoSuchScreenException e) {
return;
}
final MenuCommand command = new MenuCommand(App.getInstance().getWindowManager(), item, windowInfo);
jMenuItem.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
command.execute();
}
}
);
}
private void createSubMenu(JMenu jMenu, MenuItem item) {
for (MenuItem child : item.getChildren()) {
if (child.isPermitted(userSession)) {
if (child.getChildren().isEmpty()) {
if (child.isSeparator()) {
jMenu.addSeparator();
} else {
JMenuItem jMenuItem = new JMenuItem(MenuConfig.getMenuItemCaption(child.getId()));
assignCommand(jMenuItem, child);
assignShortcut(jMenuItem, child);
jMenu.add(jMenuItem);
}
} else {
JMenu jChildMenu = new JMenu(MenuConfig.getMenuItemCaption(child.getId()));
assignShortcut(jChildMenu, child);
createSubMenu(jChildMenu, child);
if (!isMenuEmpty(jChildMenu)) {
jMenu.add(jChildMenu);
}
}
}
}
}
private boolean isMenuEmpty(JMenu jMenu) {
return jMenu.getSubElements().length == 0;
}
private void assignShortcut(JMenuItem jMenuItem, MenuItem item) {
// TODO
}
}

View File

@ -0,0 +1,79 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.desktop.sys;
import com.haulmont.cuba.gui.components.Window;
import javax.swing.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Set;
/**
* <p>$Id$</p>
*
* @author krivopustov
*/
public class WindowBreadCrumbs extends JPanel {
public interface Listener extends Serializable {
void windowClick(Window window);
}
protected LinkedList<Window> windows = new LinkedList<Window>();
protected Set<Listener> listeners = new HashSet<Listener>();
public WindowBreadCrumbs() {
}
public Window getCurrentWindow() {
if (windows.isEmpty())
return null;
else
return windows.getLast();
}
public void addWindow(Window window) {
windows.add(window);
update();
if (windows.size() > 1)
setVisible(true);
}
public void removeWindow() {
if (!windows.isEmpty()) {
windows.removeLast();
update();
}
if (windows.size() <= 1)
setVisible(false);
}
public void addListener(Listener listener) {
listeners.add(listener);
}
public void removeListener(Listener listener) {
listeners.remove(listener);
}
public void clearListeners() {
listeners.clear();
}
private void fireListeners(Window window) {
for (Listener listener : listeners) {
listener.windowClick(window);
}
}
public void update() {
}
}

View File

@ -25,6 +25,8 @@ import java.util.UUID;
@MappedSuperclass
public class BaseUuidEntity implements BaseEntity<UUID>
{
private static final long serialVersionUID = -2217624132287086972L;
@Id
@Column(name = "ID")
@Persistent

View File

@ -24,6 +24,8 @@ public class StandardEntity
extends BaseUuidEntity
implements Versioned, Updatable, SoftDelete
{
private static final long serialVersionUID = 5642226839555253331L;
@Version
@Column(name = "VERSION")
protected Integer version;

View File

@ -17,6 +17,7 @@ import com.haulmont.cuba.core.entity.Updatable;
import javax.persistence.MappedSuperclass;
import javax.persistence.Column;
import javax.persistence.Version;
import java.io.Serializable;
import java.util.Date;
/**
@ -27,6 +28,8 @@ public class HardDeleteEntity
extends BaseUuidEntity
implements Versioned, Updatable
{
private static final long serialVersionUID = -7868980589172607336L;
@Version
@Column(name = "VERSION")
protected Integer version;

View File

@ -29,7 +29,6 @@ import java.util.concurrent.ConcurrentHashMap;
public abstract class AppConfig
{
public static final String IMPL_PROP = "cuba.appConfig.impl";
public static final String DEFAULT_IMPL = "com.haulmont.cuba.gui.AppConfig";
public static final String WINDOW_CONFIG_IMPL_PROP = "cuba.windowConfig.impl";
public static final String WINDOW_CONFIG_XML_PROP = "cuba.windowConfig";
@ -57,7 +56,7 @@ public abstract class AppConfig
public static AppConfig getInstance() {
if (instance == null) {
instance = createInstance(IMPL_PROP, DEFAULT_IMPL);
instance = createInstance(IMPL_PROP, null);
}
return instance;
}
@ -66,6 +65,9 @@ public abstract class AppConfig
String implClassName = AppContext.getProperty(propertyName);
if (implClassName == null)
implClassName = defaultImplementation;
if (implClassName == null)
throw new IllegalStateException("Property " + propertyName + " is not set");
try {
Class implClass = ReflectionHelper.getClass(implClassName);
//noinspection unchecked
@ -144,7 +146,11 @@ public abstract class AppConfig
* Message pack used by GenericUI components.
* Set up through system property by specific client implementation.
*/
public String getMessagesPack() {
public static String getMessagesPack() {
return getInstance().__getMessagesPack();
}
protected String __getMessagesPack() {
if (messagesPackage == null) {
messagesPackage = AppContext.getProperty(MESSAGES_PACK_PROP);
}

View File

@ -11,10 +11,10 @@
package com.haulmont.cuba.gui;
import com.haulmont.cuba.gui.components.*;
import com.haulmont.cuba.gui.components.List;
import com.haulmont.cuba.gui.components.actions.*;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.*;
/**
* Utility class to work for GenericUI components
@ -23,6 +23,19 @@ public abstract class ComponentsHelper {
public static final String[] UNIT_SYMBOLS = { "px", "pt", "pc", "em", "ex",
"mm", "cm", "in", "%" };
public static Collection<Component> getComponents(Component.Container container) {
final Collection<Component> ownComponents = container.getOwnComponents();
Set<Component> res = new HashSet<Component>(ownComponents);
for (Component component : ownComponents) {
if (component instanceof Component.Container) {
res.addAll(getComponents((Component.Container) component));
}
}
return res;
}
/**
* Visit all components below the specified container
*/

View File

@ -20,6 +20,9 @@ import com.haulmont.cuba.gui.data.DataService;
import com.haulmont.cuba.gui.data.Datasource;
import com.haulmont.cuba.gui.data.DsContext;
import com.haulmont.cuba.gui.data.impl.DatasourceImplementation;
import com.haulmont.cuba.gui.data.impl.DsContextImplementation;
import com.haulmont.cuba.gui.data.impl.GenericDataService;
import com.haulmont.cuba.gui.settings.SettingsImpl;
import com.haulmont.cuba.gui.xml.ParameterInfo;
import com.haulmont.cuba.gui.xml.XmlInheritanceProcessor;
import com.haulmont.cuba.gui.xml.data.DsContextLoader;
@ -30,6 +33,7 @@ import com.haulmont.cuba.gui.xml.layout.LayoutLoaderConfig;
import com.haulmont.cuba.gui.xml.layout.loaders.ComponentLoaderContext;
import com.haulmont.cuba.security.app.UserSettingService;
import com.haulmont.cuba.security.entity.PermissionType;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.dom4j.Document;
import org.dom4j.Element;
@ -87,7 +91,9 @@ public abstract class WindowManager implements Serializable {
return settingService;
}
protected abstract DataService createDefaultDataService();
protected DataService createDefaultDataService() {
return new GenericDataService();
}
public abstract Collection<Window> getOpenWindows();
@ -580,6 +586,15 @@ public abstract class WindowManager implements Serializable {
protected abstract void showFrame(Component parent, IFrame frame);
protected void afterShowWindow(Window window, boolean newTab) {
if (window.getContext() != null &&
!BooleanUtils.isTrue((Boolean) window.getContext().getParams().get("disableApplySettings")) && newTab) {
window.applySettings(new SettingsImpl(window.getId()));
}
((DsContextImplementation) window.getDsContext()).resumeSuspended();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
protected Locale getLocale() {

View File

@ -0,0 +1,123 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
*/
package com.haulmont.cuba.gui.config;
import com.haulmont.bali.util.Dom4j;
import com.haulmont.chile.core.model.MetaClass;
import com.haulmont.cuba.core.app.DataService;
import com.haulmont.cuba.core.entity.Entity;
import com.haulmont.cuba.core.global.EntityLoadInfo;
import com.haulmont.cuba.core.global.LoadContext;
import com.haulmont.cuba.core.global.MetadataProvider;
import com.haulmont.cuba.gui.ServiceLocator;
import com.haulmont.cuba.gui.WindowManager;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.dom4j.Element;
import java.util.HashMap;
import java.util.Map;
/**
* <p>$Id$</p>
*
* @author krivopustov
*/
public class MenuCommand {
private WindowManager windowManager;
private MenuItem item;
private WindowInfo windowInfo;
public MenuCommand(WindowManager windowManager, MenuItem item, WindowInfo windowInfo) {
this.windowManager = windowManager;
this.item = item;
this.windowInfo = windowInfo;
}
public void execute() {
String caption = MenuConfig.getMenuItemCaption(item.getId());
Map<String, Object> params = new HashMap<String, Object>();
Element descriptor = item.getDescriptor();
for (Element element : Dom4j.elements(descriptor, "param")) {
String value = element.attributeValue("value");
EntityLoadInfo info = EntityLoadInfo.parse(value);
if (info == null) {
if ("true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value)) {
Boolean booleanValue = Boolean.valueOf(value);
params.put(element.attributeValue("name"), booleanValue);
} else {
params.put(element.attributeValue("name"), value);
}
} else
params.put(element.attributeValue("name"), loadEntityInstance(info));
}
params.put("caption", caption);
WindowManager.OpenType openType = WindowManager.OpenType.NEW_TAB;
String openTypeStr = descriptor.attributeValue("openType");
if (openTypeStr != null) {
openType = WindowManager.OpenType.valueOf(openTypeStr);
}
if (openType == WindowManager.OpenType.DIALOG) {
String resizable = descriptor.attributeValue("resizable");
if (!StringUtils.isEmpty(resizable)) {
windowManager.getDialogParams().setResizable(BooleanUtils.toBoolean(resizable));
}
}
final String id = windowInfo.getId();
if (id.endsWith(".create") || id.endsWith(".edit")) {
Entity entityItem;
if (params.containsKey("item")) {
entityItem = (Entity) params.get("item");
} else {
final String[] strings = id.split("[.]");
String metaClassName;
if (strings.length == 2)
metaClassName = strings[0];
else if (strings.length == 3)
metaClassName = strings[1];
else
throw new UnsupportedOperationException();
final MetaClass metaClass = MetadataProvider.getSession().getClass(metaClassName);
if (metaClass == null)
throw new IllegalStateException(String.format("Can't find metaClass %s", metaClassName));
try {
entityItem = metaClass.createInstance();
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
windowManager.openEditor(
windowInfo,
entityItem,
openType,
params
);
} else {
windowManager.openWindow(
windowInfo,
openType,
params
);
}
}
private Entity loadEntityInstance(EntityLoadInfo info) {
DataService ds = ServiceLocator.getDataService();
LoadContext ctx = new LoadContext(info.getMetaClass()).setId(info.getId());
if (info.getViewName() != null)
ctx.setView(info.getViewName());
Entity entity = ds.load(ctx);
return entity;
}
}

View File

@ -1,3 +1,235 @@
#
# Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
# Haulmont Technology proprietary and confidential.
# Use is subject to license terms.
#
actions.Create=Create
actions.Edit=Edit
actions.View=View
actions.Remove=Remove
actions.Exclude=Remove
actions.Refresh=Refresh
actions.Excel=Excel
actions.Clear=Clear
actions.Apply=Apply
actions.Add=Add
actions.Yes=Yes
actions.No=No
actions.Ok=OK
actions.OkClose=OK & Close
actions.Cancel=Cancel
actions.Select=Select
actions.Close=Close
dialogs.Information=Information
dialogs.Confirmation=Confirmation
dialogs.Confirmation.Remove=Are you sure you want to delete selected elements?
loginWindow.caption=CUBA Login
loginWindow.welcomeLabel=Welcome to CUBA!
loginWindow.loginField=Login Name
loginWindow.passwordField=Password
loginWindow.localesSelect=Language
loginWindow.okButton=Submit
loginWindow.rememberMe=Remember Me
menu-config.-=<hr/>
menu-config.administration=Administration
menu-config.core$Server.browse=Servers
menu-config.core$FileDescriptor.browse=External Files
menu-config.tableTest=Lazy Loading Table
menu-config.security=Security
menu-config.sec$Group.browse=Access groups
menu-config.sec$Role.browse=Roles
menu-config.sec$User.browse=Users
menu-config.sec$UserSessionEntity.browse=User Sessions
menu-config.core$LockInfo.browse=Locks
menu-config.help=Help
menu-config.logWindow=Application log
menu-config.settings=Settings
menu-config.feedback=Feedback
menu-config.jmxcontrol$DisplayMbeans = JMX Console
menu-config.core$Entity.restore=Data recovery
menu-config.sec$ScreenHistory.browse=History
menu-config.reports=Reports
menu-config.report$Report.browse=Reports
menu-config.report$Report.run=Run reports
application.caption=CUBA Application
#welcomeLabel=Hello from Cuba!
navBtn=Navigator
logoutBtn=Logout
logoLabel=CUBA Application
loggedInLabel=User
viewLogBtn=View Log
newWindowBtn=New Window
folders.showFolders=Show Folders
folders.hideFolders=Hide Folders
folders.appFoldersRoot=Application Folders
folders.searchFoldersRoot=Search Folders
folders.openFolderAction=Open
folders.createFolderAction=Create
folders.copyFolderAction=Copy
folders.editFolderAction=Rename
folders.removeFolderAction=Remove
folders.folderEditWindow=Edit Folder
folders.folderEditWindow.adding=Add Folder
folders.folderEditWindow.nameField=Folder Name
folders.folderEditWindow.tabNameField=Screen Caption
folders.folderEditWindow.parentSelect=Parent Folder
folders.folderEditWindow.sortOrder=Order No
folders.folderEditWindow.invalidSortOrder=Invalid order no
folders.folderEditWindow.global=Available to all users
folders.folderEditWindow.presentation=Presentation Setting
folders.removeFolderConfirmation=Are you sure you want to delete the selected folder?
folders.visibilityScript=Visibility script
folders.quantityScript=Quantity script
closeBtn=Close
navigator.caption=Navigator
changeProfileWindow.caption=Change profile
changeProfileWindow.label=Warning! All open windows will be closed.
changeProfileWindow.button=Select
logWindow.caption=Application log
logWindow.refreshBtn=Refresh
logWindow.versionString=Version %s / %s
loginWindow.loginFailed=Login failed
login.invalidIP=You are not permitted to login from this IP address
permissionConfig.screenRoot=Screens
permissionConfig.entityRoot=Entities
permissionConfig.specificRoot=Specific Permissions
permission-config.cuba=CUBA
permission-config.cuba.gui=Generic UI
permission-config.cuba.gui.showInfo=System Information
permission-config.cuba.gui.filter=Filter
permission-config.cuba.gui.filter.global=Create/modify global filters
permission-config.cuba.gui.filter.customConditions=Create/modify custom conditions
permission-config.cuba.gui.filter.maxResults=Unlimited number of rows
permission-config.cuba.gui.searchFolder.global=Create/modify global search folders
permission-config.cuba.gui.presentations.global=Create/modify global presentations
permission-config.cuba.gui.appFolder.global=Create/modify application folders
exceptionDialog.caption=Information
exceptionDialog.closeBtn=Close
uniqueConstraintViolation.message=Unique constraint violation occured
accessDenied.message=Access denied
noSuchScreen.message=No such screen
deletePolicy.message=Delete impossible
deletePolicy.references.message = There are references from
noUserSession.message=User session expired. Click "OK" to login again.
numericFieldOverflow.message=Numberic field overflow
optimisticException.message=Object %s was modified in another transaction
reportException.message=An error occurred while generating report
entityLocked.msg=Read only
entityLocked.desc=Record is locked by %s since %s
tooManyOpenTabs.message=Too many open tabs (Max %d).<br>Please close not used.
numericFieldOverflow.marker=Numeric field overflow
validationFail.caption=Alert
validationFail=Form validation failed
validation.invalidNumber=Invalid number format
validation.invalidDate=Invalid date format
validation.required.defaultMsg=%s required
maxFetchUIExceeded=Maximum number of rows exceeded. <br/>Please refine your search criteria.
closeUnsaved.caption=You have unsaved changes
closeUnsaved=Do you want to discard unsaved changes?
upload.submit=Upload
Upload=
upload.fileTooBig.message=Your file is too big
paging.nextCaption=Next
paging.prevCaption=Prev
substUserSelectDialog.title=Warning
substUserSelectDialog.msg=Are you sure you want to work as %s? All open screens will be closed!
changeSubstUserAction=Yes
doNotChangeSubstUserAction=No
label.SearchParameters=Search Parameters
table.showInfoAction=System Information
table.showInfoAction.entityName=Entity Name: <b>%s</b>
table.showInfoAction.entityClass=Entity Class: <b>%s</b>
table.showInfoAction.entityTable=Table: <b>%s</b>
table.showInfoAction.id=ID: <b>%s</b>
table.showInfoAction.version=Version: <b>%s</b>
table.showInfoAction.createTs=Created: <b>%s</b>
table.showInfoAction.createdBy=Created By: <b>%s</b>
table.showInfoAction.updateTs=Updated: <b>%s</b>
table.showInfoAction.updatedBy=Updated By: <b>%s</b>
table.showInfoAction.deleteTs=Deleted: <b>%s</b>
table.showInfoAction.deletedBy=Deleted By: <b>%s</b>
filter.emptyConditions=Can't apply filter without conditions
filter.noFilter=<no filtering>
filter.maxResults = Show %d rows
filter.maxResults.label1=Show
filter.maxResults.label2=rows
table.rowsCount.msg1=%s rows of
table.rowsCount.msg2=%s rows
table.rowsCount.msg3=[?]
# Date formats
dateFormat=dd/MM/yyyy
dateTimeFormat=dd/MM/yyyy HH:mm
#Number formats
integerFormat=#,##0
longFormat=##,##0
doubleFormat=#,##0.###
bigDecimalFormat=#,##0.##
# Number separators
numberDecimalSeparator=.
numberGroupingSeparator=,
info.EntitySave= Entity %s saved succesfully
# Supported data types
Datatype.decimal=Decimal
Datatype.boolean=Boolean
Datatype.byteArray=Byte Array
Datatype.date=Date
Datatype.double=Double
Datatype.int=Integer
Datatype.long=Long Integer
Datatype.string=String
Datatype.uuid=UUID
report.notFoundReports=Not found reports for this screen
userDeleteMsg=The user %s has been removed
actions.closeAllTabs=Close All
actions.closeOtherTabs=Close Other
actions.closeCurrentTab=Close
excelExporter.true=Yes
excelExporter.false=No
excelExporter.empty=[Empty]

View File

@ -1,3 +1,235 @@
#
# Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
# Haulmont Technology proprietary and confidential.
# Use is subject to license terms.
#
actions.Create=Создать
actions.Edit=Изменить
actions.Remove=Удалить
actions.Exclude=Удалить
actions.Refresh=Обновить
actions.Excel=Excel
actions.Clear=Очистить
actions.Apply=Применить
actions.Add=Добавить
actions.Yes=Да
actions.No=Нет
actions.Ok=OK
actions.OkClose=OK и Закрыть
actions.Cancel=Отмена
actions.Select=Выбрать
dialogs.Information=Информация
dialogs.Confirmation=Подтверждение
dialogs.Confirmation.Remove=Вы действительно хотите удалить выбранные элементы?
loginWindow.caption=CUBA Login
loginWindow.welcomeLabel=Добро пожаловать в CUBA!
loginWindow.loginField=Логин
loginWindow.passwordField=Пароль
loginWindow.okButton=Войти
loginWindow.rememberMe=Запомнить меня
menu-config.-=<hr/>
menu-config.administration=Администрирование
menu-config.core$Server.browse=Серверы
menu-config.core$FileDescriptor.browse=Внешние файлы
menu-config.tableTest=Lazy Loading Table
menu-config.security=Безопасность
menu-config.sec$Group.browse=Группы доступа
menu-config.sec$Role.browse=Роли
menu-config.sec$User.browse=Пользователи
menu-config.sec$UserSessionEntity.browse=Пользовательские сессии
menu-config.core$LockInfo.browse=Блокировки
menu-config.help=Помощь
menu-config.logWindow=Журнал
menu-config.settings=Параметры
menu-config.feedback=Обратная связь
menu-config.jmxcontrol$DisplayMbeans = Консоль JMX
menu-config.core$Entity.restore=Восстановление записей
menu-config.sec$ScreenHistory.browse=История
menu-config.reports=Отчеты
menu-config.report$Report.browse=Отчеты
menu-config.report$Report.run=Запуск отчетов
application.caption=CUBA Application
#welcomeLabel=Hello from Cuba!
navBtn=Navigator
logoutBtn=Выйти
logoLabel=CUBA Application
loggedInLabel=Пользователь
viewLogBtn=Журнал
newWindowBtn=Новое окно
folders.showFolders=Показать папки
folders.hideFolders=Скрыть папки
folders.appFoldersRoot=Папки приложения
folders.searchFoldersRoot=Папки поиска
folders.openFolderAction=Открыть
folders.createFolderAction=Создать
folders.copyFolderAction=Копировать
folders.editFolderAction=Изменить
folders.removeFolderAction=Удалить
folders.folderEditWindow=Изменение папки
folders.folderEditWindow.adding=Добавление папки
folders.folderEditWindow.nameField=Наименование папки
folders.folderEditWindow.tabNameField=Заголовок окна
folders.folderEditWindow.parentSelect=Родительская папка
folders.folderEditWindow.sortOrder=Порядковый номер
folders.folderEditWindow.invalidSortOrder=Неверный порядковый номер
folders.folderEditWindow.global=Общая для всех пользователей
folders.folderEditWindow.presentation=Настройка отображения
folders.removeFolderConfirmation=Вы действительно хотите удалить выбранную папку?
folders.visibilityScript=Скрипт видимости
folders.quantityScript=Quantity скрипт
closeBtn=Закрыть
navigator.caption=Navigator
changeProfileWindow.caption=Change profile
changeProfileWindow.label=Warning! All open windows will be closed.
changeProfileWindow.button=Select
logWindow.caption=Журнал приложения
logWindow.refreshBtn=Обновить
logWindow.versionString=Версия %s / %s
loginWindow.loginFailed=Вход невозможен
login.invalidIP=Вы не имеете права входить с данного IP адреса
permissionConfig.screenRoot=Экраны
permissionConfig.entityRoot=Сущности
permissionConfig.specificRoot=Специфические права
permission-config.cuba=CUBA
permission-config.cuba.gui=Generic UI
permission-config.cuba.gui.showInfo=Системная информация
permission-config.cuba.gui.filter=Фильтр
permission-config.cuba.gui.filter.global=Создание/изменение глобальных фильтров
permission-config.cuba.gui.filter.customConditions=Создание/изменение настраиваемых условий
permission-config.cuba.gui.filter.maxResults=Неограниченное число строк
permission-config.cuba.gui.searchFolder.global=Создание/изменение глобальных папок поиска
permission-config.cuba.gui.presentations.global=Создание/изменение глобальных представлений
permission-config.cuba.gui.appFolder.global=Создание/изменение папок приложения
exceptionDialog.caption=Информация
exceptionDialog.closeBtn=Закрыть
uniqueConstraintViolation.message=Нарушено ограничение уникальности
reportException.message=Во время генерации отчёта возникла ошибка
validationFail=Ошибка ввода данных
validationFail.caption=Внимание
validation.invalidDate=Недопустимый формат даты
validation.invalidNumber=Недопустимый формат числа
validation.required.defaultMsg=Введите %s
maxFetchUIExceeded=Превышено максимально допустимое количество строк.<br/>Пожалуйста уточните условия поиска.
closeUnsaved=Внимание! Имеются несохраненные изменения. Вы действительно хотите закрыть экран?
closeUnsaved.caption=Имеются несохраненные изменения
accessDenied.message=Доступ запрещен
noSuchScreen.message=Экран не определен
deletePolicy.message=Удаление невозможно
noUserSession.message=Пользовательская сессия истекла. Нажмите "OK" чтобы войти снова.
entityLocked.msg=Только чтение
entityLocked.desc=Запись заблокирована пользователем %s с %s
tooManyOpenTabs.message=Слишком много открытых закладок (максимум %d).<br>Пожалуйста закройте неиспользуемые.
upload.submit=Загрузить
Upload=
upload.fileTooBig.message=Превышено ограничение на размер файла
paging.nextCaption=Следующая
paging.prevCaption=Предыдущая
actions.Close=Закрыть
actions.View=Просмотр
changeSubstUserAction=Да
doNotChangeSubstUserAction=Нет
substUserSelectDialog.msg=Вы действительно хотите работать от имени %s? Все экраны будут закрыты!
substUserSelectDialog.title=Предупреждение
loginWindow.localesSelect=Язык
chromeframe.hint=Для ускорения работы Internet Explorer рекоммендуем установить плагин Chrome Frame.<br/>\
<a href="http://code.google.com/chrome/chromeframe/" target="_blank">Скачать плагин</a>
label.SearchParameters=Параметры поиска
table.showInfoAction=Системная информация
table.showInfoAction.entityName=Имя сущности: <b>%s</b>
table.showInfoAction.entityClass=Класс сущности: <b>%s</b>
table.showInfoAction.entityTable=Таблица: <b>%s</b>
table.showInfoAction.id=ID: <b>%s</b>
table.showInfoAction.version=Версия: <b>%s</b>
table.showInfoAction.createTs=Дата создания: <b>%s</b>
table.showInfoAction.createdBy=Создана пользователем: <b>%s</b>
table.showInfoAction.updateTs=Дата изменения: <b>%s</b>
table.showInfoAction.updatedBy=Изменена пользователем: <b>%s</b>
table.showInfoAction.deleteTs=Дата удаления: <b>%s</b>
table.showInfoAction.deletedBy=Удалена пользователем: <b>%s</b>
filter.emptyConditions=Задайте хотябы одно условие для фильтра
filter.noFilter=<без фильтрации>
filter.maxResults = Показывать %d строк
filter.maxResults.label1=Показывать
filter.maxResults.label2=строк
table.rowsCount.msg1=%s строк из
table.rowsCount.msg2=%s строк
table.rowsCount.msg3=[?]
deletePolicy.references.message=Имеются связанные объекты типа
optimisticException.message=Объект %s был изменён в другой транзакции
# Date formats
dateFormat=dd.MM.yyyy
dateTimeFormat=dd.MM.yyyy HH:mm
#Number formats
integerFormat=#,##0
longFormat=##,##0
doubleFormat=#,##0.###
bigDecimalFormat=#,##0.##
# Number separators
numberDecimalSeparator=,
numberGroupingSeparator=\u0020
info.EntitySave=Объект %s сохранен успешно
# Supported data types
Datatype.decimal=Decimal
Datatype.boolean=Boolean
Datatype.byteArray=Byte Array
Datatype.date=Date
Datatype.double=Double
Datatype.int=Integer
Datatype.long=Long Integer
Datatype.string=String
Datatype.uuid=UUID
report.notFoundReports=Для данного экрана отчётов нет
userDeleteMsg=Пользователь %s был удален
actions.closeAllTabs=Закрыть все
actions.closeOtherTabs=Закрыть все кроме текущей
actions.closeCurrentTab=Закрыть текущую
excelExporter.true=Да
excelExporter.false=Нет
excelExporter.empty=[Пусто]

View File

@ -0,0 +1,57 @@
<screen-config xmlns="http://www.haulmont.com/schema/cuba/gui/screen-config.xsd">
<screen id="sec$User.browse"
template="/com/haulmont/cuba/gui/app/security/user/browse/user-browse.xml"/>
<screen id="sec$User.lookup"
template="/com/haulmont/cuba/gui/app/security/user/browse/user-lookup.xml"/>
<screen id="sec$User.edit"
template="/com/haulmont/cuba/gui/app/security/user/edit/user-edit.xml"/>
<screen id="sec$User.changePassw"
template="/com/haulmont/cuba/gui/app/security/user/changepassw/user-changepassw.xml"/>
<screen id="sec$UserSubstitution.edit"
template="/com/haulmont/cuba/gui/app/security/usersubst/edit/usersubst-edit.xml"/>
<screen id="sec$Group.edit"
template="/com/haulmont/cuba/gui/app/security/group/edit/group-edit.xml"/>
<screen id="sec$Group.browse"
template="/com/haulmont/cuba/gui/app/security/group/browse/group-browse.xml"/>
<screen id="sec$Group.lookup"
template="/com/haulmont/cuba/gui/app/security/group/lookup/group-lookup.xml"/>
<screen id="sec$Role.browse"
template="/com/haulmont/cuba/gui/app/security/role/browse/role-browse.xml"/>
<screen id="sec$Role.edit"
template="/com/haulmont/cuba/gui/app/security/role/edit/role-edit.xml"/>
<screen id="sec$Target.entityPermissions.lookup"
template="/com/haulmont/cuba/gui/app/security/role/edit/entity-permission-lookup.xml"/>
<screen id="sec$Target.propertyPermissions.lookup"
template="/com/haulmont/cuba/gui/app/security/role/edit/property-permission-lookup.xml"/>
<screen id="sec$Target.screenPermissions.lookup"
template="/com/haulmont/cuba/gui/app/security/role/edit/screen-permission-lookup.xml"/>
<screen id="sec$Target.specificPermissions.lookup"
template="/com/haulmont/cuba/gui/app/security/role/edit/specific-permission-lookup.xml"/>
<screen id="sec$Permission.show"
template="/com/haulmont/cuba/gui/app/security/role/edit/permission-show.xml"/>
<screen id="sec$UserSessionEntity.browse"
template="/com/haulmont/cuba/gui/app/security/session/browse/session-browse.xml"/>
<screen id="sec$Constraint.edit"
template="/com/haulmont/cuba/gui/app/security/constraint/edit/constraint-edit.xml"/>
<screen id="sec$SessionAttribute.edit"
template="/com/haulmont/cuba/gui/app/security/sessionattr/edit/session-attr-edit.xml"/>
<screen id="core$SimpleLookup"
template="/com/haulmont/cuba/gui/app/core/lookup/simple-lookup.xml"/>
<screen id="core$LockInfo.browse"
template="/com/haulmont/cuba/gui/app/core/locking/lock-browse.xml"/>
</screen-config>

View File

@ -1,7 +1,6 @@
<screen-config xmlns="http://www.haulmont.com/schema/cuba/gui/screen-config.xsd">
<screen id="tableTest"
class="com.haulmont.cuba.web.app.ui.LazyLoadingTableScreen"/>
<include file="/com/haulmont/cuba/gui/screen-config.xml"/>
<screen id="core$Server.browse"
template="/com/haulmont/cuba/web/app/ui/core/server/server-browse.xml"/>
@ -12,57 +11,9 @@
<screen id="core$FileDescriptor.edit"
template="/com/haulmont/cuba/web/app/ui/core/file/file-edit.xml"/>
<screen id="sec$User.browse"
template="/com/haulmont/cuba/gui/app/security/user/browse/user-browse.xml"/>
<screen id="sec$User.lookup"
template="/com/haulmont/cuba/gui/app/security/user/browse/user-lookup.xml"/>
<screen id="sec$User.edit"
template="/com/haulmont/cuba/gui/app/security/user/edit/user-edit.xml"/>
<screen id="sec$User.changePassw"
template="/com/haulmont/cuba/gui/app/security/user/changepassw/user-changepassw.xml"/>
<screen id="sec$UserSubstitution.edit"
template="/com/haulmont/cuba/gui/app/security/usersubst/edit/usersubst-edit.xml"/>
<screen id="sec$Group.edit"
template="/com/haulmont/cuba/gui/app/security/group/edit/group-edit.xml"/>
<screen id="sec$Group.browse"
template="/com/haulmont/cuba/gui/app/security/group/browse/group-browse.xml"/>
<screen id="sec$Group.lookup"
template="/com/haulmont/cuba/gui/app/security/group/lookup/group-lookup.xml"/>
<screen id="sec$Role.browse"
template="/com/haulmont/cuba/gui/app/security/role/browse/role-browse.xml"/>
<screen id="sec$Role.edit"
template="/com/haulmont/cuba/gui/app/security/role/edit/role-edit.xml"/>
<screen id="sec$Target.entityPermissions.lookup"
template="/com/haulmont/cuba/gui/app/security/role/edit/entity-permission-lookup.xml"/>
<screen id="sec$Target.propertyPermissions.lookup"
template="/com/haulmont/cuba/gui/app/security/role/edit/property-permission-lookup.xml"/>
<screen id="sec$Target.screenPermissions.lookup"
template="/com/haulmont/cuba/gui/app/security/role/edit/screen-permission-lookup.xml"/>
<screen id="sec$Target.specificPermissions.lookup"
template="/com/haulmont/cuba/gui/app/security/role/edit/specific-permission-lookup.xml"/>
<screen id="sec$Permission.show"
template="/com/haulmont/cuba/gui/app/security/role/edit/permission-show.xml"/>
<screen id="cuba$ExcelExport"
template="/com/haulmont/cuba/web/app/ui/export/excel/excel-export.xml"/>
<screen id="sec$UserSessionEntity.browse"
template="/com/haulmont/cuba/gui/app/security/session/browse/session-browse.xml"/>
<screen id="sec$Constraint.edit"
template="/com/haulmont/cuba/gui/app/security/constraint/edit/constraint-edit.xml"/>
<screen id="sec$SessionAttribute.edit"
template="/com/haulmont/cuba/gui/app/security/sessionattr/edit/session-attr-edit.xml"/>
<screen id="settings"
template="/com/haulmont/cuba/web/app/ui/core/settings/settings-window.xml"/>
@ -72,12 +23,6 @@
<screen id="logWindow"
class="com.haulmont.cuba.web.log.LogWindowLauncher"/>
<screen id="core$SimpleLookup"
template="/com/haulmont/cuba/gui/app/core/lookup/simple-lookup.xml"/>
<screen id="core$LockInfo.browse"
template="/com/haulmont/cuba/gui/app/core/locking/lock-browse.xml"/>
<screen id="fts$Search"
class="com.haulmont.fts.web.ui.results.SearchLauncher"/>

View File

@ -10,12 +10,8 @@
*/
package com.haulmont.cuba.web;
import com.haulmont.bali.util.Dom4j;
import com.haulmont.chile.core.model.Instance;
import com.haulmont.chile.core.model.MetaClass;
import com.haulmont.chile.core.model.utils.InstanceUtils;
import com.haulmont.cuba.core.app.DataService;
import com.haulmont.cuba.core.entity.Entity;
import com.haulmont.cuba.core.global.*;
import com.haulmont.cuba.core.sys.AppContext;
import com.haulmont.cuba.gui.AppConfig;
@ -25,6 +21,7 @@ import com.haulmont.cuba.gui.WindowManager;
import com.haulmont.cuba.gui.components.AbstractAction;
import com.haulmont.cuba.gui.components.Action;
import com.haulmont.cuba.gui.components.IFrame;
import com.haulmont.cuba.gui.config.MenuCommand;
import com.haulmont.cuba.gui.config.MenuConfig;
import com.haulmont.cuba.gui.config.MenuItem;
import com.haulmont.cuba.gui.config.WindowInfo;
@ -43,9 +40,7 @@ import com.vaadin.event.ShortcutListener;
import com.vaadin.terminal.*;
import com.vaadin.ui.*;
import com.vaadin.ui.themes.BaseTheme;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.dom4j.Element;
import javax.annotation.Nullable;
import java.io.File;
@ -540,7 +535,7 @@ public class AppWindow extends Window implements UserSubstitutionListener {
return null;
}
private void createShortcut(MenuBar.MenuItem menuItem, MenuItem item) {
private void assignShortcut(MenuBar.MenuItem menuItem, MenuItem item) {
if (item.getShortcut() != null) {
MenuShortcutAction shortcut = new MenuShortcutAction(menuItem, "shortcut_" + item.getId(), item.getShortcut());
this.addAction(shortcut);
@ -558,9 +553,9 @@ public class AppWindow extends Window implements UserSubstitutionListener {
final UserSession session = connection.getSession();
if (item.isPermitted(session)) {
MenuBar.MenuItem menuItem = menuBar.addItem(MenuConfig.getMenuItemCaption(item.getId()), createMenuBarCommand(item));
createShortcut(menuItem, item);
assignShortcut(menuItem, item);
createSubMenu(menuItem, item, session);
createDebugIds(menuItem, item);
assignDebugIds(menuItem, item);
if (isMenuItemEmpty(menuItem)) {
menuBar.removeItem(menuItem);
}
@ -573,15 +568,15 @@ public class AppWindow extends Window implements UserSubstitutionListener {
if (child.getChildren().isEmpty()) {
if (child.isPermitted(session)) {
MenuBar.MenuItem menuItem = (child.isSeparator()) ? vItem.addSeparator() : vItem.addItem(MenuConfig.getMenuItemCaption(child.getId()), createMenuBarCommand(child));
createShortcut(menuItem, child);
createDebugIds(menuItem, child);
assignShortcut(menuItem, child);
assignDebugIds(menuItem, child);
}
} else {
if (child.isPermitted(session)) {
MenuBar.MenuItem menuItem = vItem.addItem(MenuConfig.getMenuItemCaption(child.getId()), null);
createShortcut(menuItem, child);
assignShortcut(menuItem, child);
createSubMenu(menuItem, child, session);
createDebugIds(menuItem, child);
assignDebugIds(menuItem, child);
if (isMenuItemEmpty(menuItem)) {
vItem.removeChild(menuItem);
}
@ -591,7 +586,7 @@ public class AppWindow extends Window implements UserSubstitutionListener {
}
}
private void createDebugIds(MenuBar.MenuItem menuItem, MenuItem conf) {
private void assignDebugIds(MenuBar.MenuItem menuItem, MenuItem conf) {
if (menuBar.getDebugId() != null && !conf.isSeparator()) {
menuBar.setDebugId(menuItem, menuBar.getDebugId() + ":" + conf.getId());
}
@ -605,7 +600,12 @@ public class AppWindow extends Window implements UserSubstitutionListener {
} catch (NoSuchScreenException e) {
return null;
}
return new MainMenuCommand(item, windowInfo);
final MenuCommand command = new MenuCommand(App.getInstance().getWindowManager(), item, windowInfo);
return new com.vaadin.ui.MenuBar.Command() {
public void menuSelected(com.vaadin.ui.MenuBar.MenuItem selectedItem) {
command.execute();
}
};
}
protected void fillSubstitutedUsers(AbstractSelect select) {
@ -798,100 +798,6 @@ public class AppWindow extends Window implements UserSubstitutionListener {
}
}
public static class MainMenuCommand implements MenuBar.Command {
private final MenuItem item;
private final WindowInfo windowInfo;
public MainMenuCommand(MenuItem item, WindowInfo windowInfo) {
this.item = item;
this.windowInfo = windowInfo;
}
public void menuSelected(MenuBar.MenuItem selectedItem) {
String caption = MenuConfig.getMenuItemCaption(item.getId());
Map<String, Object> params = new HashMap<String, Object>();
Element descriptor = item.getDescriptor();
for (Element element : Dom4j.elements(descriptor, "param")) {
String value = element.attributeValue("value");
EntityLoadInfo info = EntityLoadInfo.parse(value);
if (info == null) {
if ("true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value)) {
Boolean booleanValue = Boolean.valueOf(value);
params.put(element.attributeValue("name"), booleanValue);
} else {
params.put(element.attributeValue("name"), value);
}
} else
params.put(element.attributeValue("name"), loadEntityInstance(info));
}
params.put("caption", caption);
WindowManager.OpenType openType = WindowManager.OpenType.NEW_TAB;
String openTypeStr = descriptor.attributeValue("openType");
if (openTypeStr != null) {
openType = WindowManager.OpenType.valueOf(openTypeStr);
}
if (openType == WindowManager.OpenType.DIALOG) {
String resizable = descriptor.attributeValue("resizable");
if (!StringUtils.isEmpty(resizable)) {
App.getInstance().getWindowManager().getDialogParams()
.setResizable(BooleanUtils.toBoolean(resizable));
}
}
final String id = windowInfo.getId();
if (id.endsWith(".create") || id.endsWith(".edit")) {
Entity entityItem;
if (params.containsKey("item")) {
entityItem = (Entity) params.get("item");
} else {
final String[] strings = id.split("[.]");
String metaClassName;
if (strings.length == 2)
metaClassName = strings[0];
else if (strings.length == 3)
metaClassName = strings[1];
else
throw new UnsupportedOperationException();
final MetaClass metaClass = MetadataProvider.getSession().getClass(metaClassName);
if (metaClass == null)
throw new IllegalStateException(String.format("Can't find metaClass %s", metaClassName));
try {
entityItem = metaClass.createInstance();
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
App.getInstance().getWindowManager().openEditor(
windowInfo,
entityItem,
openType,
params
);
} else {
App.getInstance().getWindowManager().openWindow(
windowInfo,
openType,
params
);
}
}
private Entity loadEntityInstance(EntityLoadInfo info) {
DataService ds = ServiceLocator.getDataService();
LoadContext ctx = new LoadContext(info.getMetaClass()).setId(info.getId());
if (info.getViewName() != null)
ctx.setView(info.getViewName());
Entity entity = ds.load(ctx);
return entity;
}
}
@SuppressWarnings("serial")
public static class AppTabSheet extends ActionsTabSheet implements com.vaadin.event.Action.Handler {

View File

@ -9,8 +9,8 @@ package com.haulmont.cuba.web;
import com.haulmont.cuba.gui.AppConfig;
import com.haulmont.cuba.gui.export.ExportDisplay;
import com.haulmont.cuba.gui.xml.layout.ComponentsFactory;
import com.haulmont.cuba.web.gui.WebComponentsFactory;
import com.haulmont.cuba.web.rpt.WebExportDisplay;
import com.haulmont.cuba.web.xml.layout.WebComponentsFactory;
/**
* <p>$Id$</p>

View File

@ -110,11 +110,6 @@ public class WebWindowManager extends WindowManager {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@Override
protected DataService createDefaultDataService() {
return new GenericDataService();
}
@Override
public Collection<Window> getOpenWindows() {
return new ArrayList<Window>(getWindowOpenMode().keySet());
@ -287,12 +282,7 @@ public class WebWindowManager extends WindowManager {
getWindowOpenMode().put(window, openMode);
}
if (window.getContext() != null &&
!BooleanUtils.isTrue((Boolean) window.getContext().getParams().get("disableApplySettings")) && newTab) {
window.applySettings(new SettingsImpl(window.getId()));
}
((DsContextImplementation) window.getDsContext()).resumeSuspended();
afterShowWindow(window, newTab);
}
private void closeStartupScreen(AppWindow appWindow) {

View File

@ -7,7 +7,7 @@
* Created: 19.12.2008 16:05:08
* $Id$
*/
package com.haulmont.cuba.web.xml.layout;
package com.haulmont.cuba.web.gui;
import com.haulmont.cuba.gui.components.*;
import com.haulmont.cuba.gui.components.charts.BarChart;

View File

@ -472,7 +472,7 @@ public class WebWindow
Component frame = allComponents.get(elements[0]);
if (frame != null && frame instanceof Container) {
final List<String> subList = Arrays.asList(elements).subList(1, elements.length);
String subPath = ValuePathHelper.format(subList.toArray(new String[]{}));
String subPath = ValuePathHelper.format(subList.toArray(new String[subList.size()]));
return (T) ((Container) frame).getComponent(subPath);
} else
return null;

View File

@ -9,6 +9,7 @@
*/
package com.haulmont.cuba.web.gui.components;
import com.haulmont.cuba.gui.ComponentsHelper;
import com.haulmont.cuba.gui.components.Component;
import com.haulmont.cuba.gui.components.IFrame;
import com.vaadin.ui.AbstractOrderedLayout;
@ -66,7 +67,7 @@ class WebAbstractContainer extends AbstractOrderedLayout
}
public Collection<Component> getComponents() {
return WebComponentsHelper.getComponents(this);
return ComponentsHelper.getComponents(this);
}
public String getId() {

View File

@ -103,6 +103,10 @@ public class WebComponentsHelper {
return (com.vaadin.ui.Component) comp;
}
/**
* @deprecated Use ComponentsHelper.getComponents() instead
*/
@Deprecated
public static Collection<com.haulmont.cuba.gui.components.Component> getComponents(
com.haulmont.cuba.gui.components.Component.Container container) {
final Collection<com.haulmont.cuba.gui.components.Component> ownComponents = container.getOwnComponents();
@ -142,7 +146,7 @@ public class WebComponentsHelper {
final List<String> subpath = Arrays.asList(elements).subList(1, elements.length);
if (component instanceof com.haulmont.cuba.gui.components.Component.Container) {
return ((com.haulmont.cuba.gui.components.Component.Container) component).<T>getComponent(
ValuePathHelper.format(subpath.toArray(new String[]{})));
ValuePathHelper.format(subpath.toArray(new String[subpath.size()])));
} else {
return null;
}

View File

@ -16,7 +16,7 @@ import com.haulmont.cuba.gui.data.impl.DsContextImplementation;
import com.haulmont.cuba.gui.settings.Settings;
import com.haulmont.cuba.gui.xml.layout.ComponentLoader;
import com.haulmont.cuba.gui.ComponentVisitor;
import com.haulmont.cuba.web.xml.layout.WebComponentsFactory;
import com.haulmont.cuba.web.gui.WebComponentsFactory;
import com.vaadin.ui.TabSheet;
import java.io.Serializable;

View File

@ -1,230 +1,11 @@
actions.Create=Create
actions.Edit=Edit
actions.View=View
actions.Remove=Remove
actions.Exclude=Remove
actions.Refresh=Refresh
actions.Excel=Excel
actions.Clear=Clear
actions.Apply=Apply
actions.Add=Add
#
# Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
# Haulmont Technology proprietary and confidential.
# Use is subject to license terms.
#
actions.Yes=Yes
actions.No=No
actions.Ok=OK
actions.OkClose=OK & Close
actions.Cancel=Cancel
actions.Select=Select
actions.Close=Close
dialogs.Information=Information
dialogs.Confirmation=Confirmation
dialogs.Confirmation.Remove=Are you sure you want to delete selected elements?
loginWindow.caption=CUBA Login
loginWindow.welcomeLabel=Welcome to CUBA!
loginWindow.loginField=Login Name
loginWindow.passwordField=Password
loginWindow.localesSelect=Language
loginWindow.okButton=Submit
loginWindow.rememberMe=Remember Me
menu-config.-=<hr/>
menu-config.administration=Administration
menu-config.core$Server.browse=Servers
menu-config.core$FileDescriptor.browse=External Files
menu-config.tableTest=Lazy Loading Table
menu-config.security=Security
menu-config.sec$Group.browse=Access groups
menu-config.sec$Role.browse=Roles
menu-config.sec$User.browse=Users
menu-config.sec$UserSessionEntity.browse=User Sessions
menu-config.core$LockInfo.browse=Locks
menu-config.help=Help
menu-config.logWindow=Application log
menu-config.settings=Settings
menu-config.feedback=Feedback
menu-config.jmxcontrol$DisplayMbeans = JMX Console
menu-config.core$Entity.restore=Data recovery
menu-config.sec$ScreenHistory.browse=History
menu-config.reports=Reports
menu-config.report$Report.browse=Reports
menu-config.report$Report.run=Run reports
application.caption=CUBA Application
#welcomeLabel=Hello from Cuba!
navBtn=Navigator
logoutBtn=Logout
logoLabel=CUBA Application
loggedInLabel=User
viewLogBtn=View Log
newWindowBtn=New Window
folders.showFolders=Show Folders
folders.hideFolders=Hide Folders
folders.appFoldersRoot=Application Folders
folders.searchFoldersRoot=Search Folders
folders.openFolderAction=Open
folders.createFolderAction=Create
folders.copyFolderAction=Copy
folders.editFolderAction=Rename
folders.removeFolderAction=Remove
folders.folderEditWindow=Edit Folder
folders.folderEditWindow.adding=Add Folder
folders.folderEditWindow.nameField=Folder Name
folders.folderEditWindow.tabNameField=Screen Caption
folders.folderEditWindow.parentSelect=Parent Folder
folders.folderEditWindow.sortOrder=Order No
folders.folderEditWindow.invalidSortOrder=Invalid order no
folders.folderEditWindow.global=Available to all users
folders.folderEditWindow.presentation=Presentation Setting
folders.removeFolderConfirmation=Are you sure you want to delete the selected folder?
folders.visibilityScript=Visibility script
folders.quantityScript=Quantity script
closeBtn=Close
navigator.caption=Navigator
changeProfileWindow.caption=Change profile
changeProfileWindow.label=Warning! All open windows will be closed.
changeProfileWindow.button=Select
logWindow.caption=Application log
logWindow.refreshBtn=Refresh
logWindow.versionString=Version %s / %s
loginWindow.loginFailed=Login failed
login.invalidIP=You are not permitted to login from this IP address
@include=com.haulmont.cuba.gui
activeDirectory.invalidName=Invalid Active Directory user name: %s
activeDirectory.unknownDomain=Active Directory configuration doesn't contain domain %s
activeDirectory.authenticationError=Active Directory authentication failed: %s
permissionConfig.screenRoot=Screens
permissionConfig.entityRoot=Entities
permissionConfig.specificRoot=Specific Permissions
permission-config.cuba=CUBA
permission-config.cuba.gui=Generic UI
permission-config.cuba.gui.showInfo=System Information
permission-config.cuba.gui.filter=Filter
permission-config.cuba.gui.filter.global=Create/modify global filters
permission-config.cuba.gui.filter.customConditions=Create/modify custom conditions
permission-config.cuba.gui.filter.maxResults=Unlimited number of rows
permission-config.cuba.gui.searchFolder.global=Create/modify global search folders
permission-config.cuba.gui.presentations.global=Create/modify global presentations
permission-config.cuba.gui.appFolder.global=Create/modify application folders
exceptionDialog.caption=Information
exceptionDialog.closeBtn=Close
uniqueConstraintViolation.message=Unique constraint violation occured
accessDenied.message=Access denied
noSuchScreen.message=No such screen
deletePolicy.message=Delete impossible
deletePolicy.references.message = There are references from
noUserSession.message=User session expired. Click "OK" to login again.
numericFieldOverflow.message=Numberic field overflow
optimisticException.message=Object %s was modified in another transaction
reportException.message=An error occurred while generating report
entityLocked.msg=Read only
entityLocked.desc=Record is locked by %s since %s
tooManyOpenTabs.message=Too many open tabs (Max %d).<br>Please close not used.
numericFieldOverflow.marker=Numeric field overflow
validationFail.caption=Alert
validationFail=Form validation failed
validation.invalidNumber=Invalid number format
validation.invalidDate=Invalid date format
validation.required.defaultMsg=%s required
maxFetchUIExceeded=Maximum number of rows exceeded. <br/>Please refine your search criteria.
closeUnsaved.caption=You have unsaved changes
closeUnsaved=Do you want to discard unsaved changes?
upload.submit=Upload
Upload=
upload.fileTooBig.message=Your file is too big
paging.nextCaption=Next
paging.prevCaption=Prev
substUserSelectDialog.title=Warning
substUserSelectDialog.msg=Are you sure you want to work as %s? All open screens will be closed!
changeSubstUserAction=Yes
doNotChangeSubstUserAction=No
label.SearchParameters=Search Parameters
table.showInfoAction=System Information
table.showInfoAction.entityName=Entity Name: <b>%s</b>
table.showInfoAction.entityClass=Entity Class: <b>%s</b>
table.showInfoAction.entityTable=Table: <b>%s</b>
table.showInfoAction.id=ID: <b>%s</b>
table.showInfoAction.version=Version: <b>%s</b>
table.showInfoAction.createTs=Created: <b>%s</b>
table.showInfoAction.createdBy=Created By: <b>%s</b>
table.showInfoAction.updateTs=Updated: <b>%s</b>
table.showInfoAction.updatedBy=Updated By: <b>%s</b>
table.showInfoAction.deleteTs=Deleted: <b>%s</b>
table.showInfoAction.deletedBy=Deleted By: <b>%s</b>
filter.emptyConditions=Can't apply filter without conditions
filter.noFilter=<no filtering>
filter.maxResults = Show %d rows
filter.maxResults.label1=Show
filter.maxResults.label2=rows
table.rowsCount.msg1=%s rows of
table.rowsCount.msg2=%s rows
table.rowsCount.msg3=[?]
# Date formats
dateFormat=dd/MM/yyyy
dateTimeFormat=dd/MM/yyyy HH:mm
#Number formats
integerFormat=#,##0
longFormat=##,##0
doubleFormat=#,##0.###
bigDecimalFormat=#,##0.##
# Number separators
numberDecimalSeparator=.
numberGroupingSeparator=,
info.EntitySave= Entity %s saved succesfully
# Supported data types
Datatype.decimal=Decimal
Datatype.boolean=Boolean
Datatype.byteArray=Byte Array
Datatype.date=Date
Datatype.double=Double
Datatype.int=Integer
Datatype.long=Long Integer
Datatype.string=String
Datatype.uuid=UUID
report.notFoundReports=Not found reports for this screen
userDeleteMsg=The user %s has been removed
actions.closeAllTabs=Close All
actions.closeOtherTabs=Close Other
actions.closeCurrentTab=Close

View File

@ -1,230 +1,11 @@
actions.Create=Создать
actions.Edit=Изменить
actions.Remove=Удалить
actions.Exclude=Удалить
actions.Refresh=Обновить
actions.Excel=Excel
actions.Clear=Очистить
actions.Apply=Применить
actions.Add=Добавить
#
# Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
# Haulmont Technology proprietary and confidential.
# Use is subject to license terms.
#
actions.Yes=Да
actions.No=Нет
actions.Ok=OK
actions.OkClose=OK и Закрыть
actions.Cancel=Отмена
actions.Select=Выбрать
dialogs.Information=Информация
dialogs.Confirmation=Подтверждение
dialogs.Confirmation.Remove=Вы действительно хотите удалить выбранные элементы?
loginWindow.caption=CUBA Login
loginWindow.welcomeLabel=Добро пожаловать в CUBA!
loginWindow.loginField=Логин
loginWindow.passwordField=Пароль
loginWindow.okButton=Войти
loginWindow.rememberMe=Запомнить меня
menu-config.-=<hr/>
menu-config.administration=Администрирование
menu-config.core$Server.browse=Серверы
menu-config.core$FileDescriptor.browse=Внешние файлы
menu-config.tableTest=Lazy Loading Table
menu-config.security=Безопасность
menu-config.sec$Group.browse=Группы доступа
menu-config.sec$Role.browse=Роли
menu-config.sec$User.browse=Пользователи
menu-config.sec$UserSessionEntity.browse=Пользовательские сессии
menu-config.core$LockInfo.browse=Блокировки
menu-config.help=Помощь
menu-config.logWindow=Журнал
menu-config.settings=Параметры
menu-config.feedback=Обратная связь
menu-config.jmxcontrol$DisplayMbeans = Консоль JMX
menu-config.core$Entity.restore=Восстановление записей
menu-config.sec$ScreenHistory.browse=История
menu-config.reports=Отчеты
menu-config.report$Report.browse=Отчеты
menu-config.report$Report.run=Запуск отчетов
application.caption=CUBA Application
#welcomeLabel=Hello from Cuba!
navBtn=Navigator
logoutBtn=Выйти
logoLabel=CUBA Application
loggedInLabel=Пользователь
viewLogBtn=Журнал
newWindowBtn=Новое окно
folders.showFolders=Показать папки
folders.hideFolders=Скрыть папки
folders.appFoldersRoot=Папки приложения
folders.searchFoldersRoot=Папки поиска
folders.openFolderAction=Открыть
folders.createFolderAction=Создать
folders.copyFolderAction=Копировать
folders.editFolderAction=Изменить
folders.removeFolderAction=Удалить
folders.folderEditWindow=Изменение папки
folders.folderEditWindow.adding=Добавление папки
folders.folderEditWindow.nameField=Наименование папки
folders.folderEditWindow.tabNameField=Заголовок окна
folders.folderEditWindow.parentSelect=Родительская папка
folders.folderEditWindow.sortOrder=Порядковый номер
folders.folderEditWindow.invalidSortOrder=Неверный порядковый номер
folders.folderEditWindow.global=Общая для всех пользователей
folders.folderEditWindow.presentation=Настройка отображения
folders.removeFolderConfirmation=Вы действительно хотите удалить выбранную папку?
folders.visibilityScript=Скрипт видимости
folders.quantityScript=Quantity скрипт
closeBtn=Закрыть
navigator.caption=Navigator
changeProfileWindow.caption=Change profile
changeProfileWindow.label=Warning! All open windows will be closed.
changeProfileWindow.button=Select
logWindow.caption=Журнал приложения
logWindow.refreshBtn=Обновить
logWindow.versionString=Версия %s / %s
loginWindow.loginFailed=Вход невозможен
login.invalidIP=Вы не имеете права входить с данного IP адреса
@include=com.haulmont.cuba.gui
activeDirectory.invalidName=Неверное имя пользователя Active Directory: %s
activeDirectory.unknownDomain=Конфигурация Active Directory не содержит описания домена %s
activeDirectory.authenticationError=Ошибка аутентификации в Active Directory : %s
permissionConfig.screenRoot=Экраны
permissionConfig.entityRoot=Сущности
permissionConfig.specificRoot=Специфические права
permission-config.cuba=CUBA
permission-config.cuba.gui=Generic UI
permission-config.cuba.gui.showInfo=Системная информация
permission-config.cuba.gui.filter=Фильтр
permission-config.cuba.gui.filter.global=Создание/изменение глобальных фильтров
permission-config.cuba.gui.filter.customConditions=Создание/изменение настраиваемых условий
permission-config.cuba.gui.filter.maxResults=Неограниченное число строк
permission-config.cuba.gui.searchFolder.global=Создание/изменение глобальных папок поиска
permission-config.cuba.gui.presentations.global=Создание/изменение глобальных представлений
permission-config.cuba.gui.appFolder.global=Создание/изменение папок приложения
exceptionDialog.caption=Информация
exceptionDialog.closeBtn=Закрыть
uniqueConstraintViolation.message=Нарушено ограничение уникальности
reportException.message=Во время генерации отчёта возникла ошибка
validationFail=Ошибка ввода данных
validationFail.caption=Внимание
validation.invalidDate=Недопустимый формат даты
validation.invalidNumber=Недопустимый формат числа
validation.required.defaultMsg=Введите %s
maxFetchUIExceeded=Превышено максимально допустимое количество строк.<br/>Пожалуйста уточните условия поиска.
closeUnsaved=Внимание! Имеются несохраненные изменения. Вы действительно хотите закрыть экран?
closeUnsaved.caption=Имеются несохраненные изменения
accessDenied.message=Доступ запрещен
noSuchScreen.message=Экран не определен
deletePolicy.message=Удаление невозможно
noUserSession.message=Пользовательская сессия истекла. Нажмите "OK" чтобы войти снова.
entityLocked.msg=Только чтение
entityLocked.desc=Запись заблокирована пользователем %s с %s
tooManyOpenTabs.message=Слишком много открытых закладок (максимум %d).<br>Пожалуйста закройте неиспользуемые.
upload.submit=Загрузить
Upload=
upload.fileTooBig.message=Превышено ограничение на размер файла
paging.nextCaption=Следующая
paging.prevCaption=Предыдущая
actions.Close=Закрыть
actions.View=Просмотр
changeSubstUserAction=Да
doNotChangeSubstUserAction=Нет
substUserSelectDialog.msg=Вы действительно хотите работать от имени %s? Все экраны будут закрыты!
substUserSelectDialog.title=Предупреждение
loginWindow.localesSelect=Язык
chromeframe.hint=Для ускорения работы Internet Explorer рекоммендуем установить плагин Chrome Frame.<br/>\
<a href="http://code.google.com/chrome/chromeframe/" target="_blank">Скачать плагин</a>
label.SearchParameters=Параметры поиска
table.showInfoAction=Системная информация
table.showInfoAction.entityName=Имя сущности: <b>%s</b>
table.showInfoAction.entityClass=Класс сущности: <b>%s</b>
table.showInfoAction.entityTable=Таблица: <b>%s</b>
table.showInfoAction.id=ID: <b>%s</b>
table.showInfoAction.version=Версия: <b>%s</b>
table.showInfoAction.createTs=Дата создания: <b>%s</b>
table.showInfoAction.createdBy=Создана пользователем: <b>%s</b>
table.showInfoAction.updateTs=Дата изменения: <b>%s</b>
table.showInfoAction.updatedBy=Изменена пользователем: <b>%s</b>
table.showInfoAction.deleteTs=Дата удаления: <b>%s</b>
table.showInfoAction.deletedBy=Удалена пользователем: <b>%s</b>
filter.emptyConditions=Задайте хотябы одно условие для фильтра
filter.noFilter=<без фильтрации>
filter.maxResults = Показывать %d строк
filter.maxResults.label1=Показывать
filter.maxResults.label2=строк
table.rowsCount.msg1=%s строк из
table.rowsCount.msg2=%s строк
table.rowsCount.msg3=[?]
deletePolicy.references.message=Имеются связанные объекты типа
optimisticException.message=Объект %s был изменён в другой транзакции
# Date formats
dateFormat=dd.MM.yyyy
dateTimeFormat=dd.MM.yyyy HH:mm
#Number formats
integerFormat=#,##0
longFormat=##,##0
doubleFormat=#,##0.###
bigDecimalFormat=#,##0.##
# Number separators
numberDecimalSeparator=,
numberGroupingSeparator=\u0020
info.EntitySave=Объект %s сохранен успешно
# Supported data types
Datatype.decimal=Decimal
Datatype.boolean=Boolean
Datatype.byteArray=Byte Array
Datatype.date=Date
Datatype.double=Double
Datatype.int=Integer
Datatype.long=Long Integer
Datatype.string=String
Datatype.uuid=UUID
report.notFoundReports=Для данного экрана отчётов нет
userDeleteMsg=Пользователь %s был удален
actions.closeAllTabs=Закрыть все
actions.closeOtherTabs=Закрыть все кроме текущей
actions.closeCurrentTab=Закрыть текущую