Split Window controller and Window component behaviour #337

Introduced separate screen/window.xsd, screen/fragment.xsd and screen/layout.xsd
This commit is contained in:
Yuriy Artamonov 2018-09-24 14:10:00 +04:00
parent c131832a87
commit ecd7dafcfa
10 changed files with 3211 additions and 3096 deletions

View File

@ -16,13 +16,10 @@
~
-->
<xs:schema
targetNamespace="http://schemas.haulmont.com/cuba/view.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.haulmont.com/cuba/view.xsd"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
>
<xs:schema targetNamespace="http://schemas.haulmont.com/cuba/view.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.haulmont.com/cuba/view.xsd"
elementFormDefault="qualified">
<xs:element name="views">
<xs:complexType>
@ -66,4 +63,4 @@
<xs:enumeration value="BATCH"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
</xs:schema>

View File

@ -1,157 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2008-2016 Haulmont.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<xs:schema targetNamespace="http://schemas.haulmont.com/cuba/mainwindow.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:cuba="http://schemas.haulmont.com/cuba/window.xsd"
xmlns="http://schemas.haulmont.com/cuba/mainwindow.xsd"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:complexType name="baseMainElement">
<xs:attribute name="id" type="xs:string"/>
<xs:attribute name="icon" type="xs:string"/>
<xs:attribute name="caption" type="xs:string"/>
<xs:attribute name="description" type="xs:string"/>
<xs:attribute name="width" type="cuba:componentSize"/>
<xs:attribute name="height" type="cuba:componentSize"/>
<xs:attribute name="align" type="cuba:align"/>
<xs:attribute name="stylename" type="xs:string"/>
<xs:attribute name="enable" type="xs:boolean"/>
<xs:attribute name="visible" type="xs:boolean"/>
</xs:complexType>
<xs:element name="menu">
<xs:complexType>
<xs:complexContent>
<xs:extension base="baseMainElement">
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="sideMenu">
<xs:complexType>
<xs:complexContent>
<xs:extension base="baseMainElement">
<xs:attribute name="selectOnClick" type="xs:boolean"/>
<xs:attribute name="loadMenuConfig" type="xs:boolean"/>
<xs:attribute name="sidePanel" type="xs:string"/>
<xs:attribute name="sidePanelToggleButton" type="xs:string"/>
<xs:attribute name="showSingleExpandedMenu" type="xs:boolean"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:complexType name="initialLayout">
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
</xs:sequence>
<xs:attribute name="id" type="xs:string"/>
<xs:attribute name="stylename" type="xs:string"/>
<xs:attribute name="enable" type="xs:boolean"/>
<xs:attribute name="visible" type="xs:boolean"/>
<xs:attribute name="expand" type="xs:string"/>
<xs:attribute name="spacing" type="xs:boolean"/>
<xs:attribute name="margin" type="xs:string"/>
</xs:complexType>
<xs:element name="workArea">
<xs:complexType>
<xs:complexContent>
<xs:extension base="baseMainElement">
<xs:sequence>
<xs:element name="initialLayout" type="initialLayout"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="foldersPane">
<xs:complexType>
<xs:complexContent>
<xs:extension base="baseMainElement">
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="timeZoneIndicator">
<xs:complexType>
<xs:complexContent>
<xs:extension base="baseMainElement">
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="userIndicator">
<xs:complexType>
<xs:complexContent>
<xs:extension base="baseMainElement">
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="ftsField">
<xs:complexType>
<xs:complexContent>
<xs:extension base="baseMainElement">
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="newWindowButton">
<xs:complexType>
<xs:complexContent>
<xs:extension base="baseMainElement">
<xs:attribute name="icon" type="xs:string"/>
<xs:attribute name="caption" type="xs:string"/>
<xs:attribute name="description" type="xs:string"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="logoutButton">
<xs:complexType>
<xs:complexContent>
<xs:extension base="baseMainElement">
<xs:attribute name="icon" type="xs:string"/>
<xs:attribute name="caption" type="xs:string"/>
<xs:attribute name="description" type="xs:string"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2008-2018 Haulmont.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<xs:schema targetNamespace="http://schemas.haulmont.com/cuba/screen/fragment.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.haulmont.com/cuba/screen/fragment.xsd"
xmlns:layout="http://schemas.haulmont.com/cuba/screen/layout.xsd"
elementFormDefault="qualified">
<xs:include schemaLocation="http://schemas.haulmont.com/cuba/screen/layout.xsd"/>
<!-- Window -->
<xs:element name="fragment">
<xs:complexType>
<xs:sequence>
<xs:element name="actions" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:choice maxOccurs="unbounded">
<xs:element name="action" type="layout:frameAction"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="layout" type="layout:rootLayout"/>
</xs:sequence>
<xs:attribute name="extends" type="xs:string"/>
<xs:attribute name="messagesPack" type="xs:string"/>
<xs:attribute name="icon" type="xs:string"/>
<xs:attribute name="caption" type="layout:resourceString"/>
<xs:attribute name="description" type="layout:resourceString"/>
</xs:complexType>
</xs:element>
</xs:schema>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2008-2018 Haulmont.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<xs:schema targetNamespace="http://schemas.haulmont.com/cuba/screen/window.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
xmlns:layout="http://schemas.haulmont.com/cuba/screen/layout.xsd"
elementFormDefault="qualified">
<xs:include schemaLocation="http://schemas.haulmont.com/cuba/screen/layout.xsd"/>
<!-- Window -->
<xs:element name="window">
<xs:complexType>
<xs:sequence>
<xs:element name="timers" minOccurs="0" type="layout:timer"/>
<xs:element name="actions" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:choice maxOccurs="unbounded">
<xs:element name="action" type="layout:frameAction"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="dialogMode" minOccurs="0" type="layout:dialogMode"/>
<xs:element name="layout" type="layout:rootLayout"/>
</xs:sequence>
<xs:attribute name="extends" type="xs:string"/>
<xs:attribute name="messagesPack" type="xs:string"/>
<xs:attribute name="icon" type="xs:string"/>
<xs:attribute name="caption" type="layout:resourceString"/>
<xs:attribute name="description" type="layout:resourceString"/>
<xs:attribute name="focusComponent" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@ -19,8 +19,7 @@
<xs:schema targetNamespace="http://schemas.haulmont.com/cuba/window-ext.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.haulmont.com/cuba/window-ext.xsd"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
elementFormDefault="qualified">
<xs:attribute name="index" type="xs:int"/>

File diff suppressed because it is too large Load Diff

View File

@ -16,44 +16,62 @@
-->
<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
xmlns:main="http://schemas.haulmont.com/cuba/mainwindow.xsd"
class="com.haulmont.cuba.web.app.mainwindow.AppMainWindow"
caption="mainMsg://application.caption">
<layout expand="foldersSplit">
<hbox id="titleBar" stylename="c-app-menubar"
expand="mainMenu" width="100%" height="AUTO"
spacing="true" margin="false;false;false;true">
<hbox id="titleBar"
stylename="c-app-menubar"
expand="mainMenu"
width="100%"
spacing="true"
margin="false;false;false;true">
<image id="logoImage" align="MIDDLE_LEFT" scaleMode="SCALE_DOWN" stylename="c-app-icon"/>
<image id="logoImage"
align="MIDDLE_LEFT"
scaleMode="SCALE_DOWN"
stylename="c-app-icon"/>
<main:menu id="mainMenu" align="MIDDLE_LEFT"/>
<menu id="mainMenu"
align="MIDDLE_LEFT"/>
<main:ftsField id="ftsField" align="MIDDLE_LEFT"/>
<ftsField id="ftsField"
align="MIDDLE_LEFT"/>
<main:userIndicator id="userIndicator" align="MIDDLE_LEFT"/>
<userIndicator id="userIndicator"
align="MIDDLE_LEFT"/>
<main:timeZoneIndicator id="timeZoneIndicator" align="MIDDLE_LEFT"/>
<timeZoneIndicator id="timeZoneIndicator"
align="MIDDLE_LEFT"/>
<hbox id="mainButtonsBox" stylename="c-main-buttons" align="MIDDLE_LEFT">
<main:newWindowButton id="newWindowButton"
icon="app/images/new-window.png"
description="msg://newWindowBtnDescription"/>
<hbox id="mainButtonsBox"
stylename="c-main-buttons"
align="MIDDLE_LEFT">
<newWindowButton id="newWindowButton"
icon="app/images/new-window.png"
description="msg://newWindowBtnDescription"/>
<main:logoutButton id="logoutButton"
icon="app/images/exit.png"
description="msg://logoutBtnDescription"/>
<logoutButton id="logoutButton"
icon="app/images/exit.png"
description="msg://logoutBtnDescription"/>
</hbox>
</hbox>
<split id="foldersSplit" width="100%" orientation="horizontal" pos="200px">
<main:foldersPane id="foldersPane" width="100%" height="100%"/>
<split id="foldersSplit"
width="100%"
orientation="horizontal"
pos="200px">
<foldersPane id="foldersPane"
width="100%"
height="100%"/>
<main:workArea id="workArea" width="100%" height="100%">
<main:initialLayout spacing="true" margin="true">
<workArea id="workArea"
width="100%"
height="100%">
<initialLayout spacing="true" margin="true">
</main:initialLayout>
</main:workArea>
</initialLayout>
</workArea>
</split>
</layout>
</window>

View File

@ -21,18 +21,19 @@ import com.haulmont.cuba.gui.Notifications;
import com.haulmont.cuba.gui.Notifications.NotificationType;
import com.haulmont.cuba.gui.Screens;
import com.haulmont.cuba.gui.UiComponents;
import com.haulmont.cuba.gui.components.*;
import com.haulmont.cuba.gui.components.Button;
import com.haulmont.cuba.gui.components.DialogAction;
import com.haulmont.cuba.gui.components.Label;
import com.haulmont.cuba.gui.components.actions.BaseAction;
import com.haulmont.cuba.gui.screen.Screen;
import com.haulmont.cuba.gui.screen.Subscribe;
import com.haulmont.cuba.gui.screen.UiController;
import com.haulmont.cuba.gui.screen.Provide;
import com.haulmont.cuba.security.entity.User;
import com.haulmont.cuba.gui.screen.UiDescriptor;
import javax.inject.Inject;
import java.util.Date;
@UiController("user-list")
@UiDescriptor("user-list.xml")
public class UserList extends Screen implements UserListMixin {
@Inject
protected UiComponents uiComponents;
@ -43,22 +44,6 @@ public class UserList extends Screen implements UserListMixin {
@Inject
protected Notifications notifications;
@Provide(type = Table.StyleProvider.class, to = "usersTable")
protected String getStyleName(User user, String property) {
return null;
}
@Provide(type = Table.ColumnGenerator.class,
to = "usersTable.name")
protected Component createNameColumnComponent(User user, String property) {
return null;
}
@Provide(subject = "formatter", to = "label1")
protected String format(Date date) {
return "";
}
@Subscribe
protected void init(InitEvent event) {
Label<String> label = uiComponents.create(Label.NAME);
@ -90,7 +75,7 @@ public class UserList extends Screen implements UserListMixin {
})
);
Label<String> spacer = uiComponents.create(Label.NAME);
Label<String> spacer = uiComponents.create(Label.TYPE_DEFAULT);
getWindow().add(
label,

View File

@ -0,0 +1,27 @@
<!--
~ Copyright (c) 2008-2018 Haulmont.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd">
<actions>
<action id="commit" caption="Commit" shortcut="${COMMIT_SHORTCUT}"/>
</actions>
<layout>
<hbox>
<label value="OK"/>
</hbox>
</layout>
</window>