initial import

This commit is contained in:
2026-05-11 19:59:10 +07:00
commit 582353e277
479 changed files with 32418 additions and 0 deletions

View File

View File

@ -0,0 +1,34 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd">
<context:component-scan
base-package="com.cmobile.unifiedtms.service.controllers"
/>
<security:http
pattern="/rest/api/**"
create-session="stateless"
entry-point-ref="oauthAuthenticationEntryPoint"
xmlns="http://www.springframework.org/schema/security">
<!-- Specify one or more protected URL patterns-->
<intercept-url
pattern="/rest/api/**"
access="isAuthenticated()"
/>
<anonymous enabled="false"/>
<csrf disabled="true"/>
<cors configuration-source-ref="cuba_RestCorsSource"/>
<custom-filter ref="resourceFilter" before="PRE_AUTH_FILTER"/>
<custom-filter ref="cuba_AnonymousAuthenticationFilter" after="PRE_AUTH_FILTER"/>
</security:http>
</beans>

View File

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<transformations xmlns="http://schemas.haulmont.com/cuba/rest-json-transformations.xsd">
<transformation modelVersion="1.0" currentEntityName="tms_Merchant">
<toVersion>
<removeAttribute name="_entityName"/>
<removeAttribute name="_instanceName"/>
</toVersion>
</transformation>
</transformations>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<queries xmlns="http://schemas.haulmont.com/cuba/rest-queries.xsd">
<query name="merchantList" entity="tms_Merchant" view="_minimal">
<jpql><![CDATA[select t from tms_Merchant t where t.deleteTs is null]]></jpql>
<params>
</params>
</query>
</queries>

View File

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<services xmlns="http://schemas.haulmont.com/cuba/rest-services-v2.xsd">
<service name="tms_HeartBeatService">
<method name="heartBeat" anonymousAllowed="true">
<param name="heartBeatRequest"/>
</method>
</service>
<service name="tms_APIService">
<method name="listMerchant">
<param name="req"/>
</method>
<method name="listModel">
<param name="req"/>
</method>
<method name="getModel">
<param name="req"/>
</method>
<method name="listProfile">
<param name="req"/>
</method>
<method name="getProfile">
<param name="req"/>
</method>
<method name="listTerminal">
<param name="req"/>
</method>
<method name="getTerminal">
<param name="req"/>
</method>
<method name="lastHeartbeat">
<param name="sn"/>
</method>
<method name="lastDiagnostic">
<param name="sn"/>
</method>
<method name="addTerminal">
<param name="req"/>
</method>
<method name="listTerminalGroup">
<param name="req"/>
</method>
<method name="addTerminalGroup">
<param name="req"/>
</method>
<method name="editTerminalGroup">
<param name="req"/>
</method>
<method name="deleteTerminalGroup">
<param name="req"/>
</method>
<method name="addTerminalToGroup">
<param name="req"/>
</method>
<method name="removeTerminalFromGroup">
<param name="req"/>
</method>
<method name="addApplication">
<param name="req"/>
</method>
<method name="addDownloadTask">
<param name="req"/>
</method>
<method name="listDownloadTask">
<param name="req"/>
</method>
<method name="getDownloadTask">
<param name="req"/>
</method>
<method name="init" anonymousAllowed="true">
<param name="req"/>
</method>
<method name="initAidList" anonymousAllowed="true">
<param name="req"/>
</method>
<method name="initCtlsAidList" anonymousAllowed="true">
<param name="req"/>
</method>
<method name="initCapkList" anonymousAllowed="true">
<param name="req"/>
</method>
<method name="initCardList" anonymousAllowed="true">
<param name="req"/>
</method>
<method name="initTerminal" anonymousAllowed="true">
<param name="req"/>
</method>
<method name="checkParameterUpdate" anonymousAllowed="true">
<param name="req"/>
</method>
<method name="ackParameterUpdate" anonymousAllowed="true">
<param name="req"/>
</method>
<method name="getTerminalExtAddress">
<param name="req"/>
</method>
<method name="listHeartbeat" anonymousAllowed="true">
<param name="sn"/>
<param name="startDate"/>
<param name="endDate"/>
</method>
<!-- new apis -->
<method name="checkParameterUpdateExt" anonymousAllowed="true">
<param name="req"/>
</method>
<method name="initResponseCode" anonymousAllowed="true">
<param name="req"/>
</method>
<method name="initTerminalExt" anonymousAllowed="true">
<param name="req"/>
</method>
<method name="initAcquirer" anonymousAllowed="true">
<param name="req"/>
</method>
<!-- end of new apis -->
</service>
<service name="tms_TerminalService">
<method name="getTerminalByTid" anonymousAllowed="true">
<param name="tid"/>
</method>
</service>
<service name="tms_ReportService">
<method name="exportDiagnosticReport" anonymousAllowed="true">
<param name="vendorName"/>
<param name="date"/>
</method>
<method name="exportLastHeartBeatReport" anonymousAllowed="true">
<param name="vendorName"/>
<param name="date"/>
</method>
</service>
</services>

View File

@ -0,0 +1,68 @@
###############################################################################
# Configuration #
###############################################################################
cuba.springContextConfig = +com/cmobile/unifiedtms/web-spring.xml
cuba.dispatcherSpringContextConfig = +com/cmobile/unifiedtms/web-dispatcher-spring.xml
cuba.persistenceConfig = +com/cmobile/unifiedtms/persistence.xml
cuba.metadataConfig = +com/cmobile/unifiedtms/metadata.xml
cuba.viewsConfig = +com/cmobile/unifiedtms/views.xml
cuba.windowConfig = +com/cmobile/unifiedtms/web-screens.xml
cuba.menuConfig = com/cmobile/unifiedtms/web-menu.xml
cuba.permissionConfig = +com/cmobile/unifiedtms/web-permissions.xml
cuba.mainMessagePack = +com.cmobile.unifiedtms.web
cuba.anonymousSessionId = 3aa2d4b1-205c-de8c-bcb6-f4153ae617c7
cuba.creditsConfig = +
###############################################################################
# Other #
###############################################################################
# Middleware connection
cuba.connectionUrlList = http://localhost:8080/tms-core
cuba.rest.anonymousEnabled = true
# Set to false if the middleware works on different JVM
cuba.useLocalServiceInvocation = true
cuba.webContextName = tms
cuba.availableLocales = English|en;Indonesian (Indonesia)|id_ID
cuba.localeSelectVisible = false
cuba.web.theme = helium
cuba.web.loginDialogPoweredByLinkVisible = false
# Multi Tenancy
cubasdbmt.loginByTenantParamEnabled = true
cubasdbmt.tenantIdUrlParamName = tenantId
cuba.web.loginScreenId=login
cuba.web.mainScreenId=extMainScreen
# Charts - Map
charts.map.apiKey = AIzaSyDP2Qptoyatz47wxDX2kjiIy1HiBgqMdiE
charts.map.defaultZoom = 13.0
charts.map.defaultLatitude = -6.200000
charts.map.defaultLongitude = 106.816666
# Rest Services
cuba.rest.servicesConfig=+com/cmobile/unifiedtms/rest-services.xml
cuba.rest.queriesConfig=+com/cmobile/unifiedtms/rest-queries.xml
cuba.rest.jsonTransformationConfig = +com/cmobile/unifiedtms/rest-json-transformations.xml
cuba.rest.client.id=clientid
cuba.rest.client.secret={noop}clientsecret
cuba.rest.client.tokenExpirationTimeSec=43200
cuba.rest.client.refreshTokenExpirationTimeSpec=31536000
#cuba.legacyPasswordEncryptionModule = cuba_Md5EncryptionModule
#cuba.passwordEncryptionModule = cuba_Md5EncryptionModule
cuba.web.productionMode = false

View File

@ -0,0 +1,7 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:security="http://www.springframework.org/schema/security">
<!--context:component-scan base-package="com.cmobile.unifiedtms.web.controllers"/-->
</beans>

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<menu-config xmlns="http://schemas.haulmont.com/cuba/menu.xsd">
<menu id="user-management" icon="font-icon:USERS">
<item screen="sec$User.browse"/>
<item screen="sec$Group.browse"/>
<item screen="sec$Role.browse"/>
</menu>
<menu id="dashboard-menu" insertAfter="user-management" icon="font-icon:DASHBOARD">
<item screen="dashboard$PersistentDashboard.browse"/>
<item screen="dashboard$WidgetTemplate.browse"/>
</menu>
<menu id="masterdata-menu" insertAfter="dashboard-menu" icon="CREATE_ACTION">
<item screen="tms_Country.browse"/>
<item screen="tms_States.browse"/>
<item screen="tms_City.browse"/>
<item screen="tms_District.browse"/>
<separator/>
<item screen="tms_MerchantType.browse"/>
<item screen="tms_Merchant.browse"/>
</menu>
<menu id="application-tms" icon="font-icon:LIST">
<item screen="tms_Application.browse"/>
</menu>
<menu id="terminal-menu" insertAfter="application-tms" icon="font-icon:ANDROID">
<item screen="tms_DeviceModel.browse"/>
<item screen="tms_DeviceProfile.browse"/>
<separator/>
<item screen="tms_TerminalGroup.browse"/>
<item screen="tms_Terminal.browse"/>
<separator/>
<item screen="tms_TerminalLink.browse"/>
<item screen="tms_TerminalProfiling"/>
<item screen="tms_ResponseCode.browse"/>
<!--
<item screen="tms_TerminalProfiling.browse" caption="mainMsg://menu_config.tms_TerminalProfiling.browse"/>
-->
</menu>
<menu id="terminalext-management" icon="font-icon:CUBES" insertAfter="terminal-menu">
<item screen="tms$Aid.browse"/>
<item screen="tms$Capk.browse"/>
<separator/>
<item screen="tms$PublicKeySetting.browse"/>
<item screen="tms$TLESetting.browse"/>
<item screen="tms$TerminalExt.browse"/>
<item screen="tms$Acquirer.browse"/>
<item screen="tms$Issuer.browse"/>
<separator/>
<item screen="tms$Card.browse"/>
<separator/>
</menu>
<menu id="task-menu" icon="CALENDAR_CHECK_O">
<item screen="tms_DownloadTask.browse"/>
<item screen="tms_DeleteTask.browse"/>
</menu>
<menu id="monitoring-menu" icon="font-icon:DESKTOP">
<item screen="tms_TerminalLastDiagnosticInfo.browse"/>
<item screen="tms_TerminalLastHeartBeat.browse"/>
<item screen="tms_TerminalLastHeartBeat.map"/>
<!--item screen="tms_TerminalReport.browse"/-->
<item screen="tms_TerminalReportNew"/>
<!--item screen="tms_HeartBeat.browse"/-->
<!--item screen="terminal-link-log-browse"/-->
<item screen="tms_HeartbeatSummary.browse" caption="mainMsg://menu_config.tms_HeartbeatSummary.browse"/>
<item screen="tms_VTerminalHeartBeat.browse" caption="mainMsg://menu_config.tms_VTerminalHeartBeat.browse"/>
</menu>
<menu id="settings-menu" icon="font-icon:GEARS">
<item id="settings"/>
<item screen="sec$User.changePassword" id="change-password">
<param name="currentPasswordRequired" value="true"/>
</item>
<separator/>
<!--item screen="appProperties"/-->
<item screen="sys$ScheduledTask.browse"/>
<separator/>
<item screen="entityLog"/>
<item screen="tms_LicenseViewer"/>
</menu>
</menu-config>

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<permission-config xmlns="http://schemas.haulmont.com/cuba/permissions.xsd">
</permission-config>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<screen-config xmlns="http://schemas.haulmont.com/cuba/screens.xsd">
<screen id="sec$User.changePassword" template="/com/cmobile/unifiedtms/web/screens/changepasswd/ext-change-password-dialog.xml"/>
<screen id="sec$User.edit" template="com/cmobile/unifiedtms/web/screens/user/ext-user-edit.xml"/>
<screen id="sec$User.browse" template="com/cmobile/unifiedtms/web/screens/user/ext-user-browse.xml"/>
</screen-config>

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:gui="http://schemas.haulmont.com/cuba/spring/cuba-gui.xsd"
xmlns:security="http://www.springframework.org/schema/security">
<!-- Annotation-based beans -->
<context:component-scan base-package="com.cmobile.unifiedtms"/>
<gui:screens base-packages="com.cmobile.unifiedtms.web"/>
<bean id="tms_proxyCreator" class="com.haulmont.cuba.web.sys.remoting.WebRemoteProxyBeanCreator">
<property name="serverSelector" ref="cuba_ServerSelector"/>
<property name="remoteServices">
<map>
<entry key="tms_NumericInfoWidgetService"
value="com.cmobile.unifiedtms.service.NumericInfoWidgetService"/>
<entry key="tms_ChartDataService" value="com.cmobile.unifiedtms.service.ChartDataService"/>
<entry key="tms_HeartBeatService" value="com.cmobile.unifiedtms.service.HeartBeatService"/>
<entry key="tms_DownloadTaskService" value="com.cmobile.unifiedtms.service.DownloadTaskService"/>
<entry key="tms_FileService" value="com.cmobile.unifiedtms.service.FileService"/>
<entry key="tms_DeviceInitService" value="com.cmobile.unifiedtms.service.DeviceInitService"/>
<entry key="tms_DeleteTaskService" value="com.cmobile.unifiedtms.service.DeleteTaskService"/>
<entry key="tms_APIService" value="com.cmobile.unifiedtms.service.APIService"/>
<entry key="tms_ApkService" value="com.cmobile.unifiedtms.service.ApkService"/>
<entry key="tms_TerminalImporterService"
value="com.cmobile.unifiedtms.service.TerminalImporterService"/>
<entry key="tms_EchoService" value="com.cmobile.unifiedtms.service.EchoService"/>
<entry key="tms_LicenseService" value="com.cmobile.unifiedtms.service.LicenseService"/>
<entry key="tms_ExtTerminalService" value="com.cmobile.unifiedtms.service.TerminalExtService"/>
<entry key="tms_TerminalGroupImporterService"
value="com.cmobile.unifiedtms.service.TerminalGroupImporterService"/>
<entry key="tms_ReportService" value="com.cmobile.unifiedtms.service.ReportService"/>
<entry key="tms_ResponseCodeService" value="com.cmobile.unifiedtms.service.ResponseCodeService"/>
<entry key="tms_TerminalService" value="com.cmobile.unifiedtms.service.TerminalService"/>
</map>
</property>
</bean>
</beans>

View File

@ -0,0 +1,45 @@
package com.cmobile.unifiedtms.web.filter;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class BlockHttpMethodFilter implements Filter {
private String validHostHeaders;
@Override
public void init(FilterConfig filterConfig) throws ServletException {
// no-op
this.validHostHeaders = filterConfig.getInitParameter("validHostHeaders");
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;
if(!httpRequest.getMethod().equalsIgnoreCase("POST") &&
!httpRequest.getMethod().equalsIgnoreCase("GET")) {
httpResponse.sendError(405);
} else {
// validate 'Host' header
String hostHeader = httpRequest.getHeader("Host");
String[] validHostHeaderArr = (this.validHostHeaders != null ? this.validHostHeaders.split(";") : new String[] {});
boolean valid = false;
for(String validHost : validHostHeaderArr) {
valid |= hostHeader.equalsIgnoreCase(validHost);
}
if(!valid) {
httpResponse.sendError(403);
} else {
chain.doFilter(request, response);
}
}
}
@Override
public void destroy() {
// no-op
}
}

View File

@ -0,0 +1,52 @@
package com.cmobile.unifiedtms.web.filter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class VaadinBlockDirListingFilter implements Filter {
private Logger logger = LoggerFactory.getLogger(VaadinBlockDirListingFilter.class.getName());
@Override
public void init(FilterConfig filterConfig) throws ServletException {
// no-op
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;
if(!httpRequest.getMethod().equalsIgnoreCase("POST") &&
!httpRequest.getMethod().equalsIgnoreCase("GET")) {
httpResponse.sendError(405);
} else {
String pathInfo = httpRequest.getPathInfo();
if(pathInfo != null && pathInfo.matches("\\/VAADIN(\\/)?.*")) {
// vaadin path
// check if has extension
if(pathInfo.matches("^(.*)\\.[a-z]+$")) {
// has extension
logger.info("VAADIN Dir but with extension: '{}'", pathInfo);
chain.doFilter(request, response);
} else {
// folder
logger.info("Send 403");
httpResponse.sendError(403);
}
} else {
//logger.info("Not VAADIN Path: '{}'", pathInfo);
chain.doFilter(request, response);
}
}
}
@Override
public void destroy() {
// no-op
}
}

View File

@ -0,0 +1,62 @@
application.caption = Unified TMS
application.logoLabel = Unified TMS
application.logoImage = branding/app-icon-menu.png
application.welcomeText = Welcome to Unified TMS!
dashboard.Caption = Dashboard
loginWindow.caption = TMS Login
loginWindow.welcomeLabel = Welcome to TMS!
loginWindow.logoImage = branding/app-icon-login.png
menu-config.application-tms = Application
menu-config.tms_Country.browse=Countries
menu-config.tms_States.browse=States
menu-config.tms_City.browse=Cities
menu-config.tms_District.browse=Districts
menu-config.tms_MerchantType.browse=Merchant Types
menu-config.tms_Merchant.browse=Merchants
menu-config.tms_DeviceModel.browse=Device Models
menu-config.tms_TerminalGroup.browse=Terminal Groups
menu-config.tms_Terminal.browse=Terminals
menu-config.tms_Application.browse=Applications
menu-config.tms_DeviceProfile.browse=Device Profiles
menu-config.user-management=User Management
menu-config.dashboard-menu=Dashboard Settings
menu-config.tms_DownloadTask.browse=Download Tasks
menu-config.tms_TerminalLastHeartBeat.browse=Terminal Last Heart Beats
menu-config.tms_TerminalLastHeartBeat.map=Terminal Last Location
menu-config.task-menu=Tasks
menu-config.terminal-menu=Terminal
menu-config.monitoring-menu=Monitoring
menu-config.masterdata-menu=Master Data
menu-config.tms_TerminalLastDiagnosticInfo.browse=Terminal Last Diagnostic Infos
last.updated.caption=Last Update Time
menu-config.tms_DeleteTask.browse=Delete Tasks
menu-config.terminalext-management=Terminal (Extended)
menu-config.tms$Aid.browse=AID
menu-config.tms$Capk.browse=CAPK
menu-config.tms$Card.browse=BIN Range
menu-config.settings-menu=Settings
menu-config.tms$PublicKeySetting.browse=Public Key Settings
menu-config.tms$TLESetting.browse=TLE Settings
menu-config.tms_TerminalLink.browse=Terminal Links
menu-config.change-password=Change Password
menu-config.tms_TerminalProfiling=Terminal Profiling
menu-config.tms_LicenseViewer=License Viewer
menu-config.license-menu=License
menu-config.terminal-ext-browse=Terminal Ext
menu-config.tms_SimulateExceptionScreen=Simulate Exception Screen
menu-config.tms_TerminalReport.browse=Terminal Reports
menu-config.tms_TerminalGroupImport.browse=Terminal Imports
menu-config.tms_SampleChart=Sample Chart
menu-config.tms_TerminalReportNew=Terminal Report
menu-config.tms_HeartBeat.browse=Heart Beats
menu-config.tms_ResponseCode.browse=Response Codes
menu-config.terminal-link-log-browse=Terminal Link Log
menu_config.tms_HeartbeatSummary.browse=Heartbeat Summaries
menu_config.tms_VTerminalHeartBeat.browse=Heart Beats
menu_config.tms_TerminalProfiling.browse=Terminal Profilings

View File

@ -0,0 +1,5 @@
menu-config.change-password=Ubah Password
menu-config.tms_LicenseViewer=Lihat Lisensi
menu-config.license-menu=Lisensi
menu-config.tms_TerminalGroupImport.browse=Impor Terminal
menu_config.tms_VTerminalHeartBeat.browse=Heart Beat

View File

@ -0,0 +1,70 @@
package com.cmobile.unifiedtms.web.screens;
import com.haulmont.cuba.gui.Notifications;
import com.haulmont.cuba.gui.Route;
import com.haulmont.cuba.gui.components.*;
import com.haulmont.cuba.gui.screen.*;
import com.haulmont.cuba.web.app.login.LoginScreen;
import com.haulmont.cuba.web.events.UIRefreshEvent;
import com.haulmont.cuba.web.gui.screen.ScreenDependencyUtils;
import com.vaadin.ui.Dependency;
import org.springframework.context.event.EventListener;
import javax.inject.Inject;
@Route(path = "login", root = true)
@UiController("login")
@UiDescriptor("app-login-screen.xml")
public class AppLoginScreen extends LoginScreen {
@Inject
protected HBoxLayout bottomPanel;
@Inject
protected Label<String> poweredByLink;
@Subscribe
public void onAppLoginScreenInit(InitEvent event) {
loadStyles();
initBottomPanel();
// set username & password to empty
loginField.setValue("");
passwordField.setValue("");
}
@EventListener
protected void onPageRefresh(UIRefreshEvent event) {
// set username & password to empty
loginField.setValue("");
passwordField.setValue("");
}
@Subscribe("submit")
public void onSubmit(Action.ActionPerformedEvent event) {
login();
}
protected void loadStyles() {
ScreenDependencyUtils.addScreenDependency(this,
"vaadin://brand-login-screen/login.css", Dependency.Type.STYLESHEET);
}
protected void initBottomPanel() {
if (!globalConfig.getLocaleSelectVisible()) {
poweredByLink.setAlignment(Component.Alignment.MIDDLE_CENTER);
if (!webConfig.getLoginDialogPoweredByLinkVisible()) {
bottomPanel.setVisible(false);
}
}
}
@Override
protected void initLogoImage() {
logoImage.setSource(RelativePathResource.class)
.setPath("VAADIN/brand-login-screen/cuba-icon-login.svg");
}
}

View File

@ -0,0 +1,15 @@
package com.cmobile.unifiedtms.web.screens;
import com.haulmont.cuba.gui.components.Window;
import com.haulmont.cuba.gui.screen.*;
@UiController("tms_DashboardScreen")
@UiDescriptor("dashboard-screen.xml")
public class DashboardScreen extends Screen {
@Subscribe
public void onBeforeClose(BeforeCloseEvent event) {
event.preventWindowClose();
}
}

View File

@ -0,0 +1,11 @@
package com.cmobile.unifiedtms.web.screens;
import com.haulmont.cuba.gui.screen.UiController;
import com.haulmont.cuba.gui.screen.UiDescriptor;
import com.haulmont.cuba.web.app.main.MainScreen;
@UiController("extMainScreen")
@UiDescriptor("ext-main-screen.xml")
public class ExtMainScreen extends MainScreen {
}

View File

@ -0,0 +1,44 @@
package com.cmobile.unifiedtms.web.screens;
import com.cmobile.unifiedtms.entity.chartdata.CountryGrowth;
import com.haulmont.cuba.gui.model.CollectionContainer;
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.UiDescriptor;
import javax.inject.Inject;
import java.util.ArrayList;
import java.util.List;
@UiController("tms_SampleChart")
@UiDescriptor("sample-chart.xml")
public class SampleChart extends Screen {
@Inject
private CollectionContainer<CountryGrowth> countryGrowthDc;
@Subscribe
private void onInit(InitEvent event) {
List<CountryGrowth> items = new ArrayList<>();
items.add(countryGrowth("USA", 3.5, 4.2));
items.add(countryGrowth("UK", 1.7, 3.1));
items.add(countryGrowth("Canada", 2.8, 2.9));
items.add(countryGrowth("Japan", 2.6, 2.3));
items.add(countryGrowth("France", 1.4, 2.1));
items.add(countryGrowth("Brazil", 2.6, 4.9));
items.add(countryGrowth("Russia", 6.4, 7.2));
items.add(countryGrowth("India", 8.0, 7.1));
items.add(countryGrowth("China", 9.9, 10.1));
countryGrowthDc.setItems(items);
}
private CountryGrowth countryGrowth(String country, double year2014, double year2015) {
CountryGrowth cg = new CountryGrowth();
cg.setCountry(country);
cg.setYear2014(year2014);
cg.setYear2015(year2015);
return cg;
}
}

View File

@ -0,0 +1,16 @@
package com.cmobile.unifiedtms.web.screens;
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.UiDescriptor;
@UiController("tms_SimulateExceptionScreen")
@UiDescriptor("simulate-exception-screen.xml")
public class SimulateExceptionScreen extends Screen {
@Subscribe
public void onAfterInit(AfterInitEvent event) {
throw new RuntimeException("Simulated Exception. Can you see the stack trace?",
new IllegalArgumentException("IllegalArgumentException nested stack trace."));
}
}

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
messagesPack="com.cmobile.unifiedtms.web.screens"
caption="mainMsg://loginWindow.caption">
<actions>
<action id="submit"
caption="msg://loginWindow.okButton"
shortcut="ENTER"/>
</actions>
<layout>
<cssLayout id="mainLayout"
height="100%"
stylename="c-login-layout"
width="100%">
<vbox id="loginWrapper"
expand="loginPanel"
height="100%"
stylename="c-login-wrapper">
<vbox id="loginPanel">
<vbox id="loginMainBox"
align="MIDDLE_CENTER"
margin="true"
width="AUTO">
<image id="logoImage"
align="MIDDLE_CENTER"
height="AUTO"
scaleMode="SCALE_DOWN"
stylename="c-login-logo"
width="AUTO"/>
<label id="welcomeLabel"
align="MIDDLE_CENTER"
stylename="c-login-welcome-label"
value="mainMsg://loginWindow.welcomeLabel"/>
<capsLockIndicator id="capsLockIndicator"
align="MIDDLE_CENTER"/>
<vbox id="loginForm"
spacing="true">
<textField id="loginField"
htmlName="loginField"
icon="USER"
inputPrompt="mainMsg://loginWindow.loginPlaceholder"
stylename="c-login-field inline-icon"/>
<passwordField id="passwordField"
autocomplete="false"
capsLockIndicator="capsLockIndicator"
htmlName="passwordField"
icon="LOCK"
inputPrompt="mainMsg://loginWindow.passwordPlaceholder"
stylename="c-login-field inline-icon"/>
<hbox id="paramsBox"
align="MIDDLE_CENTER"
width="350px">
<checkBox id="rememberMeCheckBox"
align="MIDDLE_LEFT"
stylename="c-login-remember-me-checkbox"
caption="mainMsg://loginWindow.rememberMe"/>
<lookupField id="localesSelect"
align="MIDDLE_RIGHT"
nullOptionVisible="false"
stylename="c-login-locales-select borderless"
textInputAllowed="false"
width="100px"/>
</hbox>
<button id="loginButton"
action="submit"
align="MIDDLE_CENTER"
stylename="c-login-button"/>
</vbox>
</vbox>
</vbox>
<hbox id="bottomPanel"
align="MIDDLE_CENTER"
stylename="c-login-bottom-panel"
height="40px"
width="100%">
<label id="poweredByLink"
align="MIDDLE_LEFT"
htmlEnabled="true"
stylename="c-login-powered-by-link"
value="mainMsg://cuba.poweredBy"/>
</hbox>
</vbox>
<image id="backgroundImage"
scaleMode="COVER"
stylename="c-login-background">
<relativePath path="VAADIN/brand-login-screen/background.svg"/>
</image>
</cssLayout>
</layout>
</window>

View File

@ -0,0 +1,11 @@
package com.cmobile.unifiedtms.web.screens.application;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.Application;
@UiController("tms_Application.browse")
@UiDescriptor("application-browse.xml")
@LookupComponent("applicationsTable")
@LoadDataBeforeShow
public class ApplicationBrowse extends StandardLookup<Application> {
}

View File

@ -0,0 +1,63 @@
package com.cmobile.unifiedtms.web.screens.application;
import com.cmobile.unifiedtms.entity.misc.FileDownloadWrapper;
import com.cmobile.unifiedtms.service.ApkService;
import com.cmobile.unifiedtms.service.FileService;
import com.haulmont.cuba.core.app.FileStorageService;
import com.haulmont.cuba.core.entity.FileDescriptor;
import com.haulmont.cuba.core.global.FileStorageException;
import com.haulmont.cuba.gui.components.FileUploadField;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.Application;
import com.pras.Manifest;
import org.slf4j.Logger;
import javax.inject.Inject;
import java.io.IOException;
@UiController("tms_Application.edit")
@UiDescriptor("application-edit.xml")
@EditedEntityContainer("applicationDc")
@LoadDataBeforeShow
public class ApplicationEdit extends StandardEditor<Application> {
@Inject
private FileUploadField apkField;
@Inject
private FileStorageService fileStorageService;
@Inject
private ApkService apkService;
@Inject
private FileService fileService;
@Inject
private Logger logger;
@Subscribe
public void onInit(InitEvent event) {
apkField.addFileUploadSucceedListener(fileUploadSucceedEvent -> {
FileDescriptor fd = getEditedEntity().getApk();
try {
byte[] bytes = fileStorageService.loadFile(fd);
Manifest manifest = apkService.extractManifest(bytes);
logger.info("package name: {}, version: {}", manifest.getPackage(), manifest.getVersionName());
logger.info("try to upload file ...");
FileDownloadWrapper fileDownloadWrapper = fileService.uploadFileToRemote(fd);
if(fileDownloadWrapper.isUploaded()) {
getEditedEntity().setChecksum(fileDownloadWrapper.getChecksum());
getEditedEntity().setDownloadUrl(fileDownloadWrapper.getDownloadUrl());
}
logger.info(">>> {}", fileDownloadWrapper.getChecksum());
getEditedEntity().setPackageName(manifest.getPackage());
getEditedEntity().setAppVersion(manifest.getVersionName());
} catch (FileStorageException e) {
throw new RuntimeException("Error saving file to FileStorage", e);
} catch (IOException e) {
throw new RuntimeException("Error reading Manifest", e);
} catch (Exception e) {
throw new RuntimeException("Error reading Manifest", e);
}
});
}
}

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
xmlns:c="http://schemas.haulmont.com/cuba/screen/jpql_condition.xsd"
caption="msg://browseCaption"
focusComponent="applicationsTable"
messagesPack="com.cmobile.unifiedtms.web.screens.application">
<data readOnly="true">
<collection id="applicationsDc"
class="com.cmobile.unifiedtms.entity.Application"
view="application-view">
<loader id="applicationsDl">
<query>
<![CDATA[select e from tms_Application e]]>
</query>
</loader>
</collection>
</data>
<dialogMode height="600"
width="800"/>
<layout expand="applicationsTable"
spacing="true">
<filter id="filter"
applyTo="applicationsTable"
dataLoader="applicationsDl">
<properties include=".*"/>
</filter>
<groupTable id="applicationsTable"
width="100%"
dataContainer="applicationsDc">
<actions>
<action id="create" type="create"/>
<action id="edit" type="edit"/>
<action id="remove" type="remove"/>
</actions>
<columns>
<column id="packageName"/>
<column id="name"/>
<column id="companyName"/>
<column id="appVersion"/>
</columns>
<rowsCount/>
<buttonsPanel id="buttonsPanel"
alwaysVisible="true">
<button id="createBtn" action="applicationsTable.create"/>
<button id="editBtn" action="applicationsTable.edit"/>
<button id="removeBtn" action="applicationsTable.remove"/>
</buttonsPanel>
</groupTable>
<hbox id="lookupActions" spacing="true" visible="false">
<button action="lookupSelectAction"/>
<button action="lookupCancelAction"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
caption="msg://editorCaption"
focusComponent="form"
messagesPack="com.cmobile.unifiedtms.web.screens.application">
<data>
<instance id="applicationDc"
class="com.cmobile.unifiedtms.entity.Application"
view="application-view">
<loader/>
</instance>
</data>
<dialogMode height="600"
width="800"/>
<layout expand="editActions" spacing="true">
<form id="form" dataContainer="applicationDc">
<column width="250px">
<upload id="apkField" fileStoragePutMode="IMMEDIATE" property="apk" showFileName="true"
permittedExtensions=".apk"/>
<upload id="iconField" fileStoragePutMode="IMMEDIATE" property="icon" showFileName="true"
permittedExtensions=".png,.jpg,.jpeg"/>
<textField id="packageNameField" property="packageName"/>
<textField id="nameField" property="name"/>
<textField id="companyNameField" property="companyName"/>
<textField id="descriptionField" property="description"/>
<textField id="appVersionField" property="appVersion"/>
</column>
</form>
<hbox id="editActions" spacing="true">
<button action="windowCommitAndClose"/>
<button action="windowClose"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,2 @@
browseCaption=Application Browser
editorCaption=Application Editor

View File

@ -0,0 +1,19 @@
package com.cmobile.unifiedtms.web.screens.applicationsimple;
import com.cmobile.unifiedtms.entity.DownloadTask;
import com.cmobile.unifiedtms.entity.enums.TaskStatus;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.ApplicationSimple;
@UiController("tms_ApplicationSimple.edit")
@UiDescriptor("application-simple-edit.xml")
@EditedEntityContainer("applicationSimpleDc")
@LoadDataBeforeShow
public class ApplicationSimpleEdit extends StandardEditor<ApplicationSimple> {
@Subscribe
public void onInitEntity(InitEntityEvent<ApplicationSimple> event) {
event.getEntity().setAppVersion("1.0");
}
}

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
caption="msg://editorCaption"
focusComponent="form"
messagesPack="com.cmobile.unifiedtms.web.screens.applicationsimple">
<data>
<instance id="applicationSimpleDc"
class="com.cmobile.unifiedtms.entity.ApplicationSimple"
view="applicationSimple-view">
<loader/>
</instance>
</data>
<dialogMode height="AUTO"
width="AUTO"
modal="true"
forceDialog="true"/>
<layout expand="editActions" spacing="true">
<form id="form" dataContainer="applicationSimpleDc">
<column width="250px">
<textField id="appNameField" property="appName"/>
<textField id="packageNameField" property="packageName"/>
</column>
</form>
<hbox id="editActions" spacing="true">
<button action="windowCommitAndClose"/>
<button action="windowClose"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1 @@
editorCaption=Application Simple editor

View File

@ -0,0 +1,49 @@
package com.cmobile.unifiedtms.web.screens.changepasswd;
import com.haulmont.cuba.gui.util.OperationResult;
import com.haulmont.cuba.security.entity.User;
import com.haulmont.cuba.web.App;
import java.util.Map;
import java.util.UUID;
public class ExtChangePasswordDialog extends ar.com.osmosys.pswdplus.web.screens.ExtChangePasswordDialog {
@Override
public void init(Map<String, Object> params) {
super.init(params);
}
public void changePassword() {
if (validateAll()) {
User targetUser;
UUID targetUserId;
if (user == null) {
targetUserId = userSession.getUser().getId();
targetUser = userSession.getUser();
} else {
targetUserId = user.getId();
targetUser = user;
}
String newPassword = passwField.getValue();
String passwordHash = passwordEncryption.getPasswordHash(targetUserId, newPassword);
userManagementService.changeUserPassword(targetUserId, passwordHash);
publishPasswordChangedEvent(targetUser, newPassword);
showNotification(getMessage("passwordChanged"), NotificationType.HUMANIZED);
close(COMMIT_ACTION_ID);
// force logout
if(currentPasswordRequired) {
OperationResult result = App.getInstance().logout();
result.getStatus();
}
}
}
}

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
class="com.cmobile.unifiedtms.web.screens.changepasswd.ExtChangePasswordDialog"
messagesPack="com.cmobile.unifiedtms.web.screens.changepasswd"
xmlns:ext="http://schemas.haulmont.com/cuba/window-ext.xsd"
extends="com/haulmont/cuba/gui/app/security/user/changepassw/change-password-dialog.xml">
<layout>
<groupBox spacing="true" caption="msg://password-box.title" css="background-color: #f5ea78" ext:index="0">
<label htmlEnabled="true" value="msg://password-notice.label"/>
</groupBox>
<grid id="grid" spacing="true" width="100%">
<columns>
<column count="2"/>
</columns>
<rows>
<row id="currentPasswordRow">
<label id="currentPasswordLabel" value="msg://currentPassword" visible="false" align="MIDDLE_LEFT"/>
<passwordField id="currentPasswordField" width="100%" visible="false" autocomplete="false"
required="true" requiredMessage="msg://currentPasswordRequired"/>
</row>
<row id="passwordRow">
<label id="passwLab" value="msg://password" align="MIDDLE_LEFT"/>
<passwordField id="passwField" width="100%" required="true" autocomplete="false" requiredMessage="msg://passwordRequired"/>
</row>
<row id="passwordConfirmationRow">
<label id="confirmPasswLab" value="msg://confirmPassword" align="MIDDLE_LEFT"/>
<passwordField id="confirmPasswField" width="100%" required="true" autocomplete="false" requiredMessage="msg://passwordConfirmRequired"/>
</row>
</rows>
</grid>
</layout>
</window>

View File

@ -0,0 +1,13 @@
@include=com.haulmont.cuba.gui.app.security.user.changepassw
menuCaption=Change Password
caption=Change Password
close-and-commit-caption=OK
close-caption=Close
password-notice.label=<ul style="list-style-type: square;">\
<li>The password is at least 8 characters long.</li>\
<li>The password has at least one uppercase letter.</li>\
<li>The password has at least one lowercase letter.</li>\
<li>The password has at least one special character.</li>\
</ul>
password-box.title=Password Notice
passwordAlreadyUsed = Password Already Used

View File

@ -0,0 +1,3 @@
@include=com.haulmont.cuba.gui.app.security.user.changepassw
password-box.title=Pemberitahuan Kata Kunci
passwordAlreadyUsed = Password sudah pernah digunakan

View File

@ -0,0 +1,11 @@
package com.cmobile.unifiedtms.web.screens.city;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.City;
@UiController("tms_City.browse")
@UiDescriptor("city-browse.xml")
@LookupComponent("citiesTable")
@LoadDataBeforeShow
public class CityBrowse extends StandardLookup<City> {
}

View File

@ -0,0 +1,11 @@
package com.cmobile.unifiedtms.web.screens.city;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.City;
@UiController("tms_City.edit")
@UiDescriptor("city-edit.xml")
@EditedEntityContainer("cityDc")
@LoadDataBeforeShow
public class CityEdit extends StandardEditor<City> {
}

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
xmlns:c="http://schemas.haulmont.com/cuba/screen/jpql_condition.xsd"
caption="msg://browseCaption"
focusComponent="citiesTable"
messagesPack="com.cmobile.unifiedtms.web.screens.city">
<data readOnly="true">
<collection id="citiesDc"
class="com.cmobile.unifiedtms.entity.City"
view="city-view">
<loader id="citiesDl">
<query>
<![CDATA[select e from tms_City e]]>
</query>
</loader>
</collection>
</data>
<dialogMode height="600"
width="800"/>
<layout expand="citiesTable"
spacing="true">
<filter id="filter"
applyTo="citiesTable"
dataLoader="citiesDl">
<properties include=".*"/>
</filter>
<groupTable id="citiesTable"
width="100%"
dataContainer="citiesDc">
<actions>
<action id="create" type="create"/>
<action id="edit" type="edit"/>
<action id="remove" type="remove"/>
<action id="refresh" type="refresh"/>
</actions>
<columns>
<column id="states"/>
<column id="name"/>
</columns>
<rowsCount/>
<buttonsPanel id="buttonsPanel"
alwaysVisible="true">
<button id="createBtn" action="citiesTable.create"/>
<button id="editBtn" action="citiesTable.edit"/>
<button id="removeBtn" action="citiesTable.remove"/>
<button id="refreshBtn" action="citiesTable.refresh"/>
</buttonsPanel>
</groupTable>
<hbox id="lookupActions" spacing="true" visible="false">
<button action="lookupSelectAction"/>
<button action="lookupCancelAction"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
caption="msg://editorCaption"
focusComponent="form"
messagesPack="com.cmobile.unifiedtms.web.screens.city">
<data>
<instance id="cityDc"
class="com.cmobile.unifiedtms.entity.City"
view="city-view">
<loader/>
</instance>
</data>
<dialogMode height="AUTO"
width="AUTO"
modal="true"
forceDialog="true"/>
<layout expand="editActions" spacing="true">
<form id="form" dataContainer="cityDc">
<column width="250px">
<pickerField id="statesField" property="states">
<actions>
<action id="lookup" type="picker_lookup"/>
<action id="clear" type="picker_clear"/>
</actions>
</pickerField>
<textField id="nameField" property="name"/>
</column>
</form>
<hbox id="editActions" spacing="true">
<button action="windowCommitAndClose"/>
<button action="windowClose"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,2 @@
browseCaption=City Browser
editorCaption=City Editor

View File

@ -0,0 +1,11 @@
package com.cmobile.unifiedtms.web.screens.contactperson;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.ContactPerson;
@UiController("tms_ContactPerson.browse")
@UiDescriptor("contact-person-browse.xml")
@LookupComponent("contactPersonsTable")
@LoadDataBeforeShow
public class ContactPersonBrowse extends StandardLookup<ContactPerson> {
}

View File

@ -0,0 +1,11 @@
package com.cmobile.unifiedtms.web.screens.contactperson;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.ContactPerson;
@UiController("tms_ContactPerson.edit")
@UiDescriptor("contact-person-edit.xml")
@EditedEntityContainer("contactPersonDc")
@LoadDataBeforeShow
public class ContactPersonEdit extends StandardEditor<ContactPerson> {
}

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
xmlns:c="http://schemas.haulmont.com/cuba/screen/jpql_condition.xsd"
caption="msg://browseCaption"
focusComponent="contactPersonsTable"
messagesPack="com.cmobile.unifiedtms.web.screens.contactperson">
<data readOnly="true">
<collection id="contactPersonsDc"
class="com.cmobile.unifiedtms.entity.ContactPerson"
view="contactPerson-view">
<loader id="contactPersonsDl">
<query>
<![CDATA[select e from tms_ContactPerson e]]>
</query>
</loader>
</collection>
</data>
<dialogMode height="600"
width="800"/>
<layout expand="contactPersonsTable"
spacing="true">
<filter id="filter"
applyTo="contactPersonsTable"
dataLoader="contactPersonsDl">
<properties include=".*"/>
</filter>
<groupTable id="contactPersonsTable"
width="100%"
dataContainer="contactPersonsDc">
<actions>
<action id="create" type="create"/>
<action id="edit" type="edit"/>
<action id="remove" type="remove"/>
</actions>
<columns>
<column id="name"/>
<column id="phone"/>
<column id="mobile"/>
<column id="email"/>
</columns>
<rowsCount/>
<buttonsPanel id="buttonsPanel"
alwaysVisible="true">
<button id="createBtn" action="contactPersonsTable.create"/>
<button id="editBtn" action="contactPersonsTable.edit"/>
<button id="removeBtn" action="contactPersonsTable.remove"/>
</buttonsPanel>
</groupTable>
<hbox id="lookupActions" spacing="true" visible="false">
<button action="lookupSelectAction"/>
<button action="lookupCancelAction"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
caption="msg://editorCaption"
focusComponent="form"
messagesPack="com.cmobile.unifiedtms.web.screens.contactperson">
<data>
<instance id="contactPersonDc"
class="com.cmobile.unifiedtms.entity.ContactPerson"
view="contactPerson-view">
<loader/>
</instance>
</data>
<dialogMode height="AUTO"
width="AUTO"
modal="true"
forceDialog="true"/>
<layout expand="editActions" spacing="true">
<form id="form" dataContainer="contactPersonDc">
<column width="250px">
<textField id="nameField" property="name"/>
<textField id="phoneField" property="phone"/>
<textField id="mobileField" property="mobile"/>
<textField id="emailField" property="email"/>
</column>
</form>
<hbox id="editActions" spacing="true">
<button action="windowCommitAndClose"/>
<button action="windowClose"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,3 @@
browseCaption=Contact Person Browser
editorCaption=Contact Person Editor
menuCaption=Contact Persons

View File

@ -0,0 +1,14 @@
package com.cmobile.unifiedtms.web.screens.country;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.Country;
@UiController("tms_Country.browse")
@UiDescriptor("country-browse.xml")
@LookupComponent("countriesTable")
@LoadDataBeforeShow
public class CountryBrowse extends StandardLookup<Country> {
public void onCreateBtnClick() {
}
}

View File

@ -0,0 +1,11 @@
package com.cmobile.unifiedtms.web.screens.country;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.Country;
@UiController("tms_Country.edit")
@UiDescriptor("country-edit.xml")
@EditedEntityContainer("countryDc")
@LoadDataBeforeShow
public class CountryEdit extends StandardEditor<Country> {
}

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
xmlns:c="http://schemas.haulmont.com/cuba/screen/jpql_condition.xsd"
caption="msg://browseCaption"
focusComponent="countriesTable"
messagesPack="com.cmobile.unifiedtms.web.screens.country">
<data readOnly="true">
<collection id="countriesDc"
class="com.cmobile.unifiedtms.entity.Country"
view="country-view">
<loader id="countriesDl">
<query>
<![CDATA[select e from tms_Country e]]>
</query>
</loader>
</collection>
</data>
<dialogMode height="600"
width="800"/>
<layout expand="countriesTable"
spacing="true">
<filter id="filter"
applyTo="countriesTable"
dataLoader="countriesDl">
<properties include=".*"/>
</filter>
<groupTable id="countriesTable"
width="100%"
dataContainer="countriesDc">
<actions>
<action id="create" type="create">
<properties>
<property name="openMode" value="DIALOG"/>
</properties>
</action>
<action id="edit" type="edit"/>
<action id="remove" type="remove"/>
<action id="refresh" type="refresh"/>
</actions>
<columns>
<column id="code"/>
<column id="name"/>
</columns>
<rowsCount/>
<buttonsPanel id="buttonsPanel"
alwaysVisible="true">
<button id="createBtn" action="countriesTable.create" invoke="onCreateBtnClick"/>
<button id="editBtn" action="countriesTable.edit"/>
<button id="removeBtn" action="countriesTable.remove"/>
<button id="refreshBtn" action="countriesTable.refresh"/>
</buttonsPanel>
</groupTable>
<hbox id="lookupActions" spacing="true" visible="false">
<button action="lookupSelectAction"/>
<button action="lookupCancelAction"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
caption="msg://editorCaption"
focusComponent="form"
messagesPack="com.cmobile.unifiedtms.web.screens.country">
<data>
<instance id="countryDc"
class="com.cmobile.unifiedtms.entity.Country"
view="country-view">
<loader/>
</instance>
</data>
<dialogMode height="600"
width="800"/>
<layout expand="editActions" spacing="true">
<form id="form" dataContainer="countryDc">
<column width="250px">
<textField id="codeField" property="code"/>
<textField id="nameField" property="name"/>
</column>
</form>
<hbox id="editActions" spacing="true">
<button action="windowCommitAndClose"/>
<button action="windowClose"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,2 @@
browseCaption=Country Browser
editorCaption=Country Editor

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
caption="msg://dashboar.caption"
xmlns:dashboard="http://schemas.haulmont.com/cubadshb/ui-component.xsd"
messagesPack="com.cmobile.unifiedtms.web.screens">
<layout>
<dashboard:dashboard caption="mainMsg://dashboard.Caption"
id="dashboardId"
code="default-dashboard">
</dashboard:dashboard>
</layout>
</window>

View File

@ -0,0 +1,55 @@
package com.cmobile.unifiedtms.web.screens.deletetask;
import com.cmobile.unifiedtms.entity.enums.TaskStatus;
import com.haulmont.cuba.gui.Notifications;
import com.haulmont.cuba.gui.UiComponents;
import com.haulmont.cuba.gui.components.Button;
import com.haulmont.cuba.gui.components.Component;
import com.haulmont.cuba.gui.components.ContentMode;
import com.haulmont.cuba.gui.components.GroupTable;
import com.haulmont.cuba.gui.components.actions.BaseAction;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.DeleteTask;
import javax.inject.Inject;
@UiController("tms_DeleteTask.browse")
@UiDescriptor("delete-task-browse.xml")
@LookupComponent("deleteTasksTable")
@LoadDataBeforeShow
public class DeleteTaskBrowse extends StandardLookup<DeleteTask> {
@Inject
private GroupTable<DeleteTask> deleteTasksTable;
@Inject
private UiComponents uiComponents;
@Inject
private Notifications notifications;
@Inject
private MessageBundle messageBundle;
@Subscribe
public void onInit(InitEvent event) {
}
/*
public Component generateOperationColumn(DeleteTask task) {
if(task.getStatus() == TaskStatus.NOT_STARTED || task.getStatus() == TaskStatus.IN_PROGRESS) {
Button button = uiComponents.create(Button.class);
button.setCaption(messageBundle.getMessage("cancelTaskButton.Caption"));
button.setIcon("font-icon:CLOSE");
button.setAction(new BaseAction("cancel") {
@Override
public void actionPerform(Component component) {
notifications.create()
.withContentMode(ContentMode.HTML)
.withCaption("<i>Do Cancel!</i>")
.show();
}
});
return button;
}
return null;
}*/
}

View File

@ -0,0 +1,55 @@
package com.cmobile.unifiedtms.web.screens.deletetask;
import com.cmobile.unifiedtms.entity.DeleteTaskLog;
import com.cmobile.unifiedtms.entity.enums.TaskStatus;
import com.haulmont.cuba.core.global.PersistenceHelper;
import com.haulmont.cuba.gui.components.Form;
import com.haulmont.cuba.gui.model.CollectionContainer;
import com.haulmont.cuba.gui.model.CollectionLoader;
import com.haulmont.cuba.gui.model.InstanceContainer;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.DeleteTask;
import javax.inject.Inject;
@UiController("tms_DeleteTask.edit")
@UiDescriptor("delete-task-edit.xml")
@EditedEntityContainer("deleteTaskDc")
@LoadDataBeforeShow
public class DeleteTaskEdit extends StandardEditor<DeleteTask> {
@Inject
private Form form;
@Inject
private CollectionLoader<DeleteTaskLog> deleteTaskLogsDl;
@Subscribe
public void onInitEntity(InitEntityEvent<DeleteTask> event) {
event.getEntity().setStatus(TaskStatus.NOT_STARTED);
}
@Subscribe(id = "deleteTaskDc", target = Target.DATA_CONTAINER)
public void onDeleteTaskDcItemChange(InstanceContainer.ItemChangeEvent<DeleteTask> event) {
DeleteTask task = event.getItem();
if(task != null) {
deleteTaskLogsDl.setParameter("task", task);
deleteTaskLogsDl.load();
} else {
deleteTaskLogsDl.setParameter("task", null);
deleteTaskLogsDl.load();
}
}
@Subscribe
public void onInit(InitEvent event) {
DeleteTask task = getEditedEntity();
deleteTaskLogsDl.setParameter("task", null);
deleteTaskLogsDl.load();
if(task != null && !PersistenceHelper.isNew(task)) {
form.setEditable(false);
} else {
form.setEditable(true);
}
}
}

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
xmlns:c="http://schemas.haulmont.com/cuba/screen/jpql_condition.xsd"
caption="msg://browseCaption"
focusComponent="deleteTasksTable"
messagesPack="com.cmobile.unifiedtms.web.screens.deletetask">
<data readOnly="true">
<collection id="deleteTasksDc"
class="com.cmobile.unifiedtms.entity.DeleteTask"
view="deleteTask-view">
<loader id="deleteTasksDl">
<query>
<![CDATA[select e from tms_DeleteTask e]]>
</query>
</loader>
</collection>
</data>
<dialogMode height="600"
width="800"/>
<layout expand="deleteTasksTable"
spacing="true">
<filter id="filter"
applyTo="deleteTasksTable"
dataLoader="deleteTasksDl">
<properties include=".*"/>
</filter>
<groupTable id="deleteTasksTable"
width="100%"
dataContainer="deleteTasksDc">
<actions>
<action id="create" type="create"/>
<action id="refresh" type="refresh"/>
</actions>
<columns>
<column id="name" link="true"/>
<column id="createTs"/>
<column id="status"/>
<!--column id="operation" generator="generateOperationColumn"/-->
</columns>
<rowsCount/>
<buttonsPanel id="buttonsPanel"
alwaysVisible="true">
<button id="createBtn" action="deleteTasksTable.create"/>
<button id="refreshBtn" action="deleteTasksTable.refresh"/>
</buttonsPanel>
</groupTable>
<hbox id="lookupActions" spacing="true" visible="false">
<button action="lookupSelectAction"/>
<button action="lookupCancelAction"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
caption="msg://editorCaption"
focusComponent="form"
messagesPack="com.cmobile.unifiedtms.web.screens.deletetask">
<data>
<instance id="deleteTaskDc"
class="com.cmobile.unifiedtms.entity.DeleteTask"
view="deleteTask-view">
<loader/>
<collection id="applicationsDc" property="applications"/>
<collection id="terminalGroupsDc" property="terminalGroups"/>
</instance>
<collection id="deleteTaskLogsDc" class="com.cmobile.unifiedtms.entity.DeleteTaskLog"
view="deleteTaskLog-view">
<loader id="deleteTaskLogsDl">
<query>
<![CDATA[select t from tms_DeleteTaskLog t
where t.task = :task]]>
</query>
</loader>
</collection>
</data>
<dialogMode height="600"
width="800"/>
<layout expand="terminalGroupsBox" spacing="true">
<form id="form" dataContainer="deleteTaskDc">
<column width="250px">
<textField id="nameField" property="name"/>
<dateField id="deleteTimeField" property="deleteTime"/>
</column>
</form>
<groupBox id="applicationsBox" caption="msg://com.cmobile.unifiedtms.entity/DeleteTask.applications" width="100%">
<tabSheet>
<tab id="applicationsTab" caption="msg://tab.applications.caption">
<table id="applicationsTable" dataContainer="applicationsDc" width="100%" height="200px">
<actions>
<action id="create" type="create"/>
<action id="exclude" type="exclude"/>
</actions>
<columns>
<column id="appName"/>
<column id="packageName"/>
</columns>
<buttonsPanel>
<button action="applicationsTable.create"/>
<button action="applicationsTable.exclude"/>
</buttonsPanel>
</table>
</tab>
<tab id="historyTab" caption="msg://tab.history.caption">
<table id="deleteTaskTable" dataContainer="deleteTaskLogsDc" width="100%" height="200px">
<actions>
<action id="excel" type="excel">
<properties>
<property name="fileName" value="Delete Task Log"/>
</properties>
</action>
</actions>
<buttonsPanel>
<button id="deleteTaskTableExcelBtn" action="deleteTaskTable.excel"/>
</buttonsPanel>
<columns>
<column id="terminal.sn"/>
<column id="application.appName"/>
<column id="application.packageName"/>
<column id="activity"/>
<column id="message"/>
<column id="updateTs"/>
</columns>
</table>
</tab>
</tabSheet>
</groupBox>
<groupBox id="terminalGroupsBox" caption="msg://com.cmobile.unifiedtms.entity/DeleteTask.terminalGroups"
width="100%">
<table id="terminalGroupsTable" dataContainer="terminalGroupsDc" width="100%" height="200px">
<actions>
<action id="add" type="add"/>
<action id="exclude" type="exclude"/>
</actions>
<columns>
<column id="name"/>
</columns>
<buttonsPanel>
<button action="terminalGroupsTable.add"/>
<button action="terminalGroupsTable.exclude"/>
</buttonsPanel>
</table>
</groupBox>
<hbox id="editActions" spacing="true">
<button action="windowCommitAndClose"/>
<button action="windowClose"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,5 @@
browseCaption=Delete Task browser
editorCaption=Delete Task editor
cancelTaskButton.Caption=Cancel
tab.history.caption=History Details
tab.applications.caption=Applications

View File

@ -0,0 +1,11 @@
package com.cmobile.unifiedtms.web.screens.devicemodel;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.DeviceModel;
@UiController("tms_DeviceModel.browse")
@UiDescriptor("device-model-browse.xml")
@LookupComponent("deviceModelsTable")
@LoadDataBeforeShow
public class DeviceModelBrowse extends StandardLookup<DeviceModel> {
}

View File

@ -0,0 +1,11 @@
package com.cmobile.unifiedtms.web.screens.devicemodel;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.DeviceModel;
@UiController("tms_DeviceModel.edit")
@UiDescriptor("device-model-edit.xml")
@EditedEntityContainer("deviceModelDc")
@LoadDataBeforeShow
public class DeviceModelEdit extends StandardEditor<DeviceModel> {
}

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
xmlns:c="http://schemas.haulmont.com/cuba/screen/jpql_condition.xsd"
caption="msg://browseCaption"
focusComponent="deviceModelsTable"
messagesPack="com.cmobile.unifiedtms.web.screens.devicemodel">
<data readOnly="true">
<collection id="deviceModelsDc"
class="com.cmobile.unifiedtms.entity.DeviceModel"
view="deviceModel-view">
<loader id="deviceModelsDl">
<query>
<![CDATA[select e from tms_DeviceModel e]]>
</query>
</loader>
</collection>
</data>
<dialogMode height="600"
width="800"/>
<layout expand="deviceModelsTable"
spacing="true">
<filter id="filter"
applyTo="deviceModelsTable"
dataLoader="deviceModelsDl">
<properties include=".*"/>
</filter>
<groupTable id="deviceModelsTable"
width="100%"
dataContainer="deviceModelsDc">
<actions>
<action id="create" type="create"/>
<action id="edit" type="edit"/>
<action id="remove" type="remove"/>
<action id="refresh" type="refresh"/>
</actions>
<columns>
<column id="model"/>
<column id="vendorName"/>
<column id="vendorCountry"/>
</columns>
<rowsCount/>
<buttonsPanel id="buttonsPanel"
alwaysVisible="true">
<button id="createBtn" action="deviceModelsTable.create"/>
<button id="editBtn" action="deviceModelsTable.edit"/>
<button id="removeBtn" action="deviceModelsTable.remove"/>
<button id="refreshBtn" action="deviceModelsTable.refresh"/>
</buttonsPanel>
</groupTable>
<hbox id="lookupActions" spacing="true" visible="false">
<button action="lookupSelectAction"/>
<button action="lookupCancelAction"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
caption="msg://editorCaption"
focusComponent="form"
messagesPack="com.cmobile.unifiedtms.web.screens.devicemodel">
<data>
<instance id="deviceModelDc"
class="com.cmobile.unifiedtms.entity.DeviceModel"
view="deviceModel-view">
<loader/>
</instance>
</data>
<dialogMode height="AUTO"
width="AUTO"
modal="true"
forceDialog="true"/>
<layout expand="editActions" spacing="true">
<form id="form" dataContainer="deviceModelDc">
<column width="250px">
<textField id="modelField" property="model"/>
<textArea id="modelInformationField" property="modelInformation" rows="5"/>
<textField id="vendorNameField" property="vendorName"/>
<textField id="vendorCountryField" property="vendorCountry"/>
</column>
</form>
<hbox id="editActions" spacing="true">
<button action="windowCommitAndClose"/>
<button action="windowClose"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,2 @@
browseCaption=Device Model Browser
editorCaption=Device Model Editor

View File

@ -0,0 +1,11 @@
package com.cmobile.unifiedtms.web.screens.deviceprofile;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.DeviceProfile;
@UiController("tms_DeviceProfile.browse")
@UiDescriptor("device-profile-browse.xml")
@LookupComponent("deviceProfilesTable")
@LoadDataBeforeShow
public class DeviceProfileBrowse extends StandardLookup<DeviceProfile> {
}

View File

@ -0,0 +1,28 @@
package com.cmobile.unifiedtms.web.screens.deviceprofile;
import com.cmobile.unifiedtms.service.APIService;
import com.cmobile.unifiedtms.service.DeviceInitService;
import com.haulmont.cuba.gui.Dialogs;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.DeviceProfile;
import javax.inject.Inject;
@UiController("tms_DeviceProfile.edit")
@UiDescriptor("device-profile-edit.xml")
@EditedEntityContainer("deviceProfileDc")
@LoadDataBeforeShow
public class DeviceProfileEdit extends StandardEditor<DeviceProfile> {
@Inject
private DeviceInitService deviceInitService;
@Inject
private APIService apiService;
@Subscribe
public void onAfterCommitChanges(AfterCommitChangesEvent event) {
deviceInitService.publishInitToProfile(getEditedEntity());
apiService.onProfileUpdate(getEditedEntity());
}
}

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
xmlns:c="http://schemas.haulmont.com/cuba/screen/jpql_condition.xsd"
caption="msg://browseCaption"
focusComponent="deviceProfilesTable"
messagesPack="com.cmobile.unifiedtms.web.screens.deviceprofile">
<data readOnly="true">
<collection id="deviceProfilesDc"
class="com.cmobile.unifiedtms.entity.DeviceProfile"
view="deviceProfile-view">
<loader id="deviceProfilesDl">
<query>
<![CDATA[select e from tms_DeviceProfile e]]>
</query>
</loader>
</collection>
</data>
<dialogMode height="600"
width="800"/>
<layout expand="deviceProfilesTable"
spacing="true">
<filter id="filter"
applyTo="deviceProfilesTable"
dataLoader="deviceProfilesDl">
<properties include=".*"/>
</filter>
<groupTable id="deviceProfilesTable"
width="100%"
dataContainer="deviceProfilesDc">
<actions>
<action id="create" type="create"/>
<action id="edit" type="edit">
<properties>
<property name="openMode" value="THIS_TAB"/>
</properties>
</action>
<action id="remove" type="remove"/>
</actions>
<columns>
<column id="name"/>
<column id="heartbeatInterval"/>
<column id="diagnosticInterval"/>
<column id="maskHomeButton"/>
<column id="maskStatusBar"/>
<column id="scheduleReboot"/>
<column id="scheduleRebootTime"/>
<!--
<column id="relocationAlert"/>
<column id="movingThreshold"/>
-->
<column id="isDefault"/>
</columns>
<rowsCount/>
<buttonsPanel id="buttonsPanel"
alwaysVisible="true">
<button id="createBtn" action="deviceProfilesTable.create"/>
<button id="editBtn" action="deviceProfilesTable.edit"/>
<button id="removeBtn" action="deviceProfilesTable.remove"/>
</buttonsPanel>
</groupTable>
<hbox id="lookupActions" spacing="true" visible="false">
<button action="lookupSelectAction"/>
<button action="lookupCancelAction"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
caption="msg://editorCaption"
focusComponent="form"
messagesPack="com.cmobile.unifiedtms.web.screens.deviceprofile">
<data>
<instance id="deviceProfileDc"
class="com.cmobile.unifiedtms.entity.DeviceProfile"
view="deviceProfile-full-view">
<loader/>
<collection id="acquirersDc" property="acquirers"/>
<collection id="appsDc" property="apps"/>
</instance>
</data>
<dialogMode height="600"
width="800"/>
<layout expand="tabSheet" spacing="true">
<form id="form" dataContainer="deviceProfileDc">
<column width="250px">
<textField id="tenantIdField" property="tenantId"/>
<textField id="nameField" property="name"/>
<textField id="heartbeatIntervalField" property="heartbeatInterval"/>
<textField id="diagnosticIntervalField" property="diagnosticInterval"/>
<checkBox id="isDefaultField" property="isDefault"/>
</column>
<column width="250px">
<textField id="adminPasswordField" property="adminPassword"/>
<checkBox id="maskHomeButtonField" property="maskHomeButton"/>
<checkBox id="maskStatusBarField" property="maskStatusBar"/>
<checkBox id="scheduleRebootField" property="scheduleReboot"/>
<timeField id="scheduleRebootTimeField" property="scheduleRebootTime"/>
<textField id="frontApp" property="frontApp"/>
</column>
<column width="250px">
<!--
<checkBox id="relocationAlertField" property="relocationAlert"/>
<textField id="movingThresholdField" property="movingThreshold"/>
-->
<checkBox id="hostReport" property="hostReport"/>
<textField id="hostReportUrl" property="hostReportUrl"/>
<textField id="hostReportApiKey" property="hostReportApiKey"/>
<textField id="hostReportTimeout" property="hostReportTimeout"/>
</column>
<column width="250px">
<checkBox id="hostLogging" property="hostLogging"/>
<textField id="hostLoggingUrl" property="hostLoggingUrl"/>
<textField id="hostLoggingApiKey" property="hostLoggingApiKey"/>
<textField id="hostLoggingTimeout" property="hostLoggingTimeout"/>
<checkBox id="autoStartApp" property="autoStartApp"/>
</column>
</form>
<tabSheet id="tabSheet">
<tab id="acquirersTab" caption="msg://acquirers-table.caption" spacing="true" icon="font-icon:TABLE" margin="true">
<scrollBox id="acquiresScrollBox" width="600px" height="100%" spacing="true" margin="true">
<table id="acquirersTable" dataContainer="acquirersDc" width="100%" height="400px">
<actions>
<action id="add" type="add"/>
<action id="exclude" type="exclude"/>
</actions>
<columns>
<column id="name"/>
<column id="acquirerType"/>
<column id="acquirerId"/>
<column id="description"/>
</columns>
<buttonsPanel>
<button action="acquirersTable.add"/>
<button action="acquirersTable.exclude"/>
</buttonsPanel>
</table>
</scrollBox>
</tab>
<tab id="appsTab" caption="msg://apps-table.caption" margin="true,false,false,false" spacing="true"
icon="font-icon:ANDROID" lazy="true">
<scrollBox id="appsScrollBox" width="600px" height="100%" spacing="true" margin="true">
<table id="appsTable" dataContainer="appsDc" width="100%" height="400px">
<actions>
<action id="create" type="create"/>
<action id="edit" type="edit"/>
<action id="remove" type="remove"/>
</actions>
<columns>
<column id="packageName"/>
</columns>
<buttonsPanel>
<button action="appsTable.create"/>
<button action="appsTable.edit"/>
<button action="appsTable.remove"/>
</buttonsPanel>
</table>
</scrollBox>
</tab>
</tabSheet>
<hbox id="editActions" spacing="true">
<button action="windowCommitAndClose"/>
<button action="windowClose"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,4 @@
browseCaption=Device Profile Browser
editorCaption=DeviceProfile editor
acquirers-table.caption=Acquirers
apps-table.caption=Applications

View File

@ -0,0 +1,11 @@
package com.cmobile.unifiedtms.web.screens.deviceprofileapp;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.DeviceProfileApp;
@UiController("tms_DeviceProfileApp.edit")
@UiDescriptor("device-profile-app-edit.xml")
@EditedEntityContainer("deviceProfileAppDc")
@LoadDataBeforeShow
public class DeviceProfileAppEdit extends StandardEditor<DeviceProfileApp> {
}

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
caption="msg://editorCaption"
focusComponent="form"
messagesPack="com.cmobile.unifiedtms.web.screens.deviceprofileapp">
<data>
<instance id="deviceProfileAppDc"
class="com.cmobile.unifiedtms.entity.DeviceProfileApp"
view="deviceProfileApp-view">
<loader/>
</instance>
</data>
<dialogMode height="AUTO"
width="AUTO"
modal="true"
forceDialog="true"/>
<layout expand="editActions" spacing="true">
<form id="form" dataContainer="deviceProfileAppDc">
<column width="250px">
<textField id="packageNameField" property="packageName"/>
</column>
</form>
<hbox id="editActions" spacing="true">
<button action="windowCommitAndClose"/>
<button action="windowClose"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1 @@
editorCaption=DeviceProfileApp editor

View File

@ -0,0 +1,28 @@
package com.cmobile.unifiedtms.web.screens.diagnosticinfo;
import com.haulmont.cuba.core.entity.Entity;
import com.haulmont.cuba.gui.ScreenBuilders;
import com.haulmont.cuba.gui.Screens;
import com.haulmont.cuba.gui.components.Component;
import com.haulmont.cuba.gui.model.DataLoader;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.DiagnosticInfo;
import javax.inject.Inject;
@UiController("tms_DiagnosticInfo.browse")
@UiDescriptor("diagnostic-info-browse.xml")
@LookupComponent("diagnosticInfoesTable")
@LoadDataBeforeShow
public class DiagnosticInfoBrowse extends StandardLookup<DiagnosticInfo> {
@Inject
private ScreenBuilders screenBuilders;
public void onTerminalClicked(DiagnosticInfo item, String columnId) {
screenBuilders.editor(DiagnosticInfo.class, this)
.editEntity(item)
.build()
.show();
}
}

View File

@ -0,0 +1,10 @@
package com.cmobile.unifiedtms.web.screens.diagnosticinfo;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.DiagnosticInfo;
@UiController("tms_DiagnosticInfo.edit")
@UiDescriptor("diagnostic-info-edit.xml")
@EditedEntityContainer("diagnosticInfoDc")
public class DiagnosticInfoEdit extends StandardEditor<DiagnosticInfo> {
}

View File

@ -0,0 +1,17 @@
package com.cmobile.unifiedtms.web.screens.diagnosticinfo;
import com.cmobile.unifiedtms.entity.DiagnosticInfo;
import com.haulmont.cuba.gui.components.HBoxLayout;
import com.haulmont.cuba.gui.screen.*;
import com.vaadin.ui.Layout;
import javax.inject.Inject;
@UiController("tms_DiagnosticInfo.view")
@UiDescriptor("diagnostic-info-view.xml")
@EditedEntityContainer("diagnosticInfoDc")
@PrimaryEditorScreen(DiagnosticInfo.class)
@LoadDataBeforeShow
public class DiagnosticInfoView extends StandardEditor<DiagnosticInfo> {
}

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
xmlns:c="http://schemas.haulmont.com/cuba/screen/jpql_condition.xsd"
caption="msg://browseCaption"
focusComponent="diagnosticInfoesTable"
messagesPack="com.cmobile.unifiedtms.web.screens.diagnosticinfo">
<data readOnly="true">
<collection id="diagnosticInfoesDc"
class="com.cmobile.unifiedtms.entity.DiagnosticInfo"
view="diagnosticInfo-minimal-view">
<loader id="diagnosticInfoesDl">
<query>
<![CDATA[select e from tms_DiagnosticInfo e]]>
</query>
</loader>
</collection>
</data>
<dialogMode height="600"
width="800"/>
<layout expand="diagnosticInfoesTable"
spacing="true">
<filter id="filter"
applyTo="diagnosticInfoesTable"
dataLoader="diagnosticInfoesDl">
<properties include=".*"/>
</filter>
<groupTable id="diagnosticInfoesTable"
width="100%"
dataContainer="diagnosticInfoesDc">
<actions>
<action id="edit" type="edit"/>
<action id="refresh" type="refresh"/>
<action id="excel" type="excel"/>
</actions>
<columns>
<column id="terminal" link="true" linkInvoke="onTerminalClicked"/>
<column id="meid"/>
<column id="batteryTemp">
<formatter class="com.cmobile.unifiedtms.web.screens.formatter.CelciusFormatter"/>
</column>
<column id="batteryPercentage">
<formatter class="com.cmobile.unifiedtms.web.screens.formatter.PercentageFormatter"/>
</column>
<column id="totalMemory"/>
<column id="availableMemory"/>
</columns>
<rowsCount/>
<buttonsPanel id="buttonsPanel"
alwaysVisible="true">
<button id="editBtn" action="diagnosticInfoesTable.edit"/>
<button id="refreshBtn" action="diagnosticInfoesTable.refresh"/>
<button id="excelBtn" action="diagnosticInfoesTable.excel"/>
</buttonsPanel>
</groupTable>
<hbox id="lookupActions" spacing="true" visible="false">
<button action="lookupSelectAction"/>
<button action="lookupCancelAction"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
caption="msg://editorCaption"
focusComponent="form"
messagesPack="com.cmobile.unifiedtms.web.screens.diagnosticinfo">
<data>
<instance id="diagnosticInfoDc"
class="com.cmobile.unifiedtms.entity.DiagnosticInfo"
view="diagnosticInfo-view">
<loader/>
</instance>
</data>
<dialogMode height="600"
width="800"/>
<layout expand="scrollBox" spacing="true">
<scrollBox id="scrollBox" spacing="true">
<form id="form" dataContainer="diagnosticInfoDc">
<column width="250px">
<pickerField id="terminalField" property="terminal">
<actions>
<action id="lookup" type="picker_lookup"/>
<action id="clear" type="picker_clear"/>
</actions>
</pickerField>
<textField id="batteryTempField" property="batteryTemp"/>
<textField id="batteryPercentageField" property="batteryPercentage"/>
<textField id="latitudeField" property="latitude"/>
<textField id="longitudeField" property="longitude"/>
<textField id="meidField" property="meid"/>
<textField id="totalMemoryField" property="totalMemory"/>
<textField id="availableMemoryField" property="availableMemory"/>
<textField id="totalFlashMemoryField" property="totalFlashMemory"/>
<textField id="availableFlashMemoryField" property="availableFlashMemory"/>
<textField id="totalMobileDataField" property="totalMobileData"/>
<textField id="switchingTimesField" property="switchingTimes"/>
<textField id="currentBootTimeField" property="currentBootTime"/>
<textField id="totalBootTimeField" property="totalBootTime"/>
<textField id="totalLengthPrintedField" property="totalLengthPrinted"/>
<textField id="swipingCardTimesField" property="swipingCardTimes"/>
<textField id="dipInsertingTimesField" property="dipInsertingTimes"/>
<textField id="nfcCardReadingTimesField" property="nfcCardReadingTimes"/>
<textField id="frontCameraOpenTimesField" property="frontCameraOpenTimes"/>
<textField id="rearCameraOpenTimesField" property="rearCameraOpenTimes"/>
<textField id="chargeTimesField" property="chargeTimes"/>
</column>
</form>
</scrollBox>
<hbox id="editActions" spacing="true">
<button action="windowCommitAndClose"/>
<button action="windowClose"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
caption="msg://viewerCaption"
focusComponent="form"
messagesPack="com.cmobile.unifiedtms.web.screens.diagnosticinfo">
<data>
<instance id="diagnosticInfoDc"
class="com.cmobile.unifiedtms.entity.DiagnosticInfo"
view="diagnosticInfo-view">
<loader/>
<collection id="installedAppsDc" property="installedApps"/>
</instance>
</data>
<dialogMode height="600"
width="800"/>
<layout expand="scrollBox" spacing="true">
<scrollBox id="scrollBox" spacing="true">
<form id="form" dataContainer="diagnosticInfoDc" editable="false">
<column width="250px">
<pickerField id="terminalField" property="terminal">
<actions>
<action id="lookup" type="picker_lookup"/>
<action id="clear" type="picker_clear"/>
</actions>
</pickerField>
<textField id="batteryTempField" property="batteryTemp"/>
<textField id="batteryPercentageField" property="batteryPercentage"/>
<textField id="latitudeField" property="latitude"/>
<textField id="longitudeField" property="longitude"/>
<textField id="meidField" property="meid"/>
<textField id="totalMemoryField" property="totalMemory"/>
<textField id="availableMemoryField" property="availableMemory"/>
<textField id="totalFlashMemoryField" property="totalFlashMemory"/>
<textField id="availableFlashMemoryField" property="availableFlashMemory"/>
<textField id="totalMobileDataField" property="totalMobileData"/>
</column>
<column width="250px">
<textField id="switchingTimesField" property="switchingTimes"/>
<textField id="currentBootTimeField" property="currentBootTime"/>
<textField id="totalBootTimeField" property="totalBootTime"/>
<textField id="totalLengthPrintedField" property="totalLengthPrinted"/>
<textField id="swipingCardTimesField" property="swipingCardTimes"/>
<textField id="dipInsertingTimesField" property="dipInsertingTimes"/>
<textField id="nfcCardReadingTimesField" property="nfcCardReadingTimes"/>
<textField id="frontCameraOpenTimesField" property="frontCameraOpenTimes"/>
<textField id="rearCameraOpenTimesField" property="rearCameraOpenTimes"/>
<textField id="chargeTimesField" property="chargeTimes"/>
<textField id="samAvailableField" property="samAvailable"/>
</column>
</form>
<groupBox id="groupBox" spacing="true" caption="msg://installedAppsTable.Caption">
<table id="installedAppsTable" height="100px" width="200px" dataContainer="installedAppsDc">
<columns>
<column id="appName"/>
<column id="packageName"/>
<column id="appVersion"/>
<column id="diagnosticInfo"/>
</columns>
</table>
</groupBox>
</scrollBox>
<hbox id="editActions" spacing="true">
<button action="windowCommitAndClose" enable="false"/>
<button action="windowClose"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,5 @@
browseCaption=Diagnostic Info Browser
editorCaption=Diagnostic Info Editor
viewerCaption=Diagnostic Info View
tabSheet.details.caption=Details
installedAppsTable.Caption=Installed Apps

View File

@ -0,0 +1,11 @@
package com.cmobile.unifiedtms.web.screens.district;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.District;
@UiController("tms_District.browse")
@UiDescriptor("district-browse.xml")
@LookupComponent("districtsTable")
@LoadDataBeforeShow
public class DistrictBrowse extends StandardLookup<District> {
}

View File

@ -0,0 +1,11 @@
package com.cmobile.unifiedtms.web.screens.district;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.District;
@UiController("tms_District.edit")
@UiDescriptor("district-edit.xml")
@EditedEntityContainer("districtDc")
@LoadDataBeforeShow
public class DistrictEdit extends StandardEditor<District> {
}

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
xmlns:c="http://schemas.haulmont.com/cuba/screen/jpql_condition.xsd"
caption="msg://browseCaption"
focusComponent="districtsTable"
messagesPack="com.cmobile.unifiedtms.web.screens.district">
<data readOnly="true">
<collection id="districtsDc"
class="com.cmobile.unifiedtms.entity.District"
view="district-view">
<loader id="districtsDl">
<query>
<![CDATA[select e from tms_District e]]>
</query>
</loader>
</collection>
</data>
<dialogMode height="600"
width="800"/>
<layout expand="districtsTable"
spacing="true">
<filter id="filter"
applyTo="districtsTable"
dataLoader="districtsDl">
<properties include=".*"/>
</filter>
<groupTable id="districtsTable"
width="100%"
dataContainer="districtsDc">
<actions>
<action id="create" type="create"/>
<action id="edit" type="edit"/>
<action id="remove" type="remove"/>
<action id="refresh" type="refresh"/>
</actions>
<columns>
<column id="city"/>
<column id="name"/>
</columns>
<rowsCount/>
<buttonsPanel id="buttonsPanel"
alwaysVisible="true">
<button id="createBtn" action="districtsTable.create"/>
<button id="editBtn" action="districtsTable.edit"/>
<button id="removeBtn" action="districtsTable.remove"/>
<button id="refreshBtn" action="districtsTable.refresh"/>
</buttonsPanel>
</groupTable>
<hbox id="lookupActions" spacing="true" visible="false">
<button action="lookupSelectAction"/>
<button action="lookupCancelAction"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
caption="msg://editorCaption"
focusComponent="form"
messagesPack="com.cmobile.unifiedtms.web.screens.district">
<data>
<instance id="districtDc"
class="com.cmobile.unifiedtms.entity.District"
view="district-view">
<loader/>
</instance>
</data>
<dialogMode height="AUTO"
width="AUTO"
modal="true"
forceDialog="true"/>
<layout expand="editActions" spacing="true">
<form id="form" dataContainer="districtDc">
<column width="250px">
<pickerField id="cityField" property="city">
<actions>
<action id="lookup" type="picker_lookup"/>
<action id="clear" type="picker_clear"/>
</actions>
</pickerField>
<textField id="nameField" property="name"/>
</column>
</form>
<hbox id="editActions" spacing="true">
<button action="windowCommitAndClose"/>
<button action="windowClose"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,2 @@
browseCaption=District Browser
editorCaption=District Editor

View File

@ -0,0 +1,54 @@
package com.cmobile.unifiedtms.web.screens.downloadtask;
import com.cmobile.unifiedtms.entity.enums.TaskStatus;
import com.haulmont.cuba.gui.Notifications;
import com.haulmont.cuba.gui.UiComponents;
import com.haulmont.cuba.gui.components.Button;
import com.haulmont.cuba.gui.components.Component;
import com.haulmont.cuba.gui.components.ContentMode;
import com.haulmont.cuba.gui.components.GroupTable;
import com.haulmont.cuba.gui.components.actions.BaseAction;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.DownloadTask;
import javax.inject.Inject;
@UiController("tms_DownloadTask.browse")
@UiDescriptor("download-task-browse.xml")
@LookupComponent("downloadTasksTable")
@LoadDataBeforeShow
public class DownloadTaskBrowse extends StandardLookup<DownloadTask> {
@Inject
private GroupTable<DownloadTask> downloadTasksTable;
@Inject
private UiComponents uiComponents;
@Inject
private Notifications notifications;
@Inject
private MessageBundle messageBundle;
@Subscribe
public void onInit(InitEvent event) {
}
/*
public Component generateOperationColumn(DownloadTask task) {
if(task.getStatus() == TaskStatus.NOT_STARTED || task.getStatus() == TaskStatus.IN_PROGRESS) {
Button button = uiComponents.create(Button.class);
button.setCaption(messageBundle.getMessage("cancelTaskButton.Caption"));
button.setIcon("font-icon:CLOSE");
button.setAction(new BaseAction("cancel") {
@Override
public void actionPerform(Component component) {
notifications.create()
.withContentMode(ContentMode.HTML)
.withCaption("<i>Do Cancel!</i>")
.show();
}
});
return button;
}
return null;
}*/
}

View File

@ -0,0 +1,59 @@
package com.cmobile.unifiedtms.web.screens.downloadtask;
import com.cmobile.unifiedtms.entity.DownloadTaskLog;
import com.cmobile.unifiedtms.entity.enums.TaskStatus;
import com.cmobile.unifiedtms.entity.enums.DownloadTaskType;
import com.haulmont.cuba.core.global.PersistenceHelper;
import com.haulmont.cuba.gui.components.Form;
import com.haulmont.cuba.gui.model.CollectionContainer;
import com.haulmont.cuba.gui.model.CollectionLoader;
import com.haulmont.cuba.gui.model.InstanceContainer;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.DownloadTask;
import javax.inject.Inject;
@UiController("tms_DownloadTask.edit")
@UiDescriptor("download-task-edit.xml")
@EditedEntityContainer("downloadTaskDc")
@LoadDataBeforeShow
public class DownloadTaskEdit extends StandardEditor<DownloadTask> {
@Inject
private Form form;
@Inject
private CollectionContainer<DownloadTaskLog> downloadTaskLogsDc;
@Inject
private InstanceContainer<DownloadTask> downloadTaskDc;
@Inject
private CollectionLoader<DownloadTaskLog> downloadTaskLogsDl;
@Subscribe
public void onInitEntity(InitEntityEvent<DownloadTask> event) {
event.getEntity().setStatus(TaskStatus.NOT_STARTED);
}
@Subscribe(id = "downloadTaskDc", target = Target.DATA_CONTAINER)
public void onDownloadTaskDcItemChange(InstanceContainer.ItemChangeEvent<DownloadTask> event) {
DownloadTask task = event.getItem();
if(task != null) {
downloadTaskLogsDl.setParameter("task", task);
downloadTaskLogsDl.load();
} else {
downloadTaskLogsDl.setParameter("task", null);
downloadTaskLogsDl.load();
}
}
@Subscribe
public void onInit(InitEvent event) {
DownloadTask task = getEditedEntity();
downloadTaskLogsDl.setParameter("task", null);
downloadTaskLogsDl.load();
if(task != null && !PersistenceHelper.isNew(task)) {
form.setEditable(false);
} else {
form.setEditable(true);
}
}
}

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
xmlns:c="http://schemas.haulmont.com/cuba/screen/jpql_condition.xsd"
caption="msg://browseCaption"
focusComponent="downloadTasksTable"
messagesPack="com.cmobile.unifiedtms.web.screens.downloadtask">
<data readOnly="true">
<collection id="downloadTasksDc"
class="com.cmobile.unifiedtms.entity.DownloadTask"
view="downloadTask-view">
<loader id="downloadTasksDl">
<query>
<![CDATA[select e from tms_DownloadTask e]]>
</query>
</loader>
</collection>
</data>
<dialogMode height="600"
width="800"/>
<layout expand="downloadTasksTable"
spacing="true">
<filter id="filter"
applyTo="downloadTasksTable"
dataLoader="downloadTasksDl">
<properties include=".*"/>
</filter>
<groupTable id="downloadTasksTable"
width="100%"
dataContainer="downloadTasksDc">
<actions>
<action id="create" type="create"/>
<action id="refresh" type="refresh"/>
</actions>
<columns>
<column id="name" link="true"/>
<column id="createTs"/>
<column id="status"/>
<!--column id="operation" generator="generateOperationColumn"/-->
</columns>
<rowsCount/>
<buttonsPanel id="buttonsPanel"
alwaysVisible="true">
<button id="createBtn" action="downloadTasksTable.create"/>
<button id="refreshBtn" action="downloadTasksTable.refresh"/>
</buttonsPanel>
</groupTable>
<hbox id="lookupActions" spacing="true" visible="false">
<button action="lookupSelectAction"/>
<button action="lookupCancelAction"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
caption="msg://editorCaption"
focusComponent="form"
messagesPack="com.cmobile.unifiedtms.web.screens.downloadtask">
<data>
<instance id="downloadTaskDc"
class="com.cmobile.unifiedtms.entity.DownloadTask"
view="downloadTask-view">
<loader/>
<collection id="applicationsDc" property="applications"/>
<collection id="terminalGroupsDc" property="terminalGroups"/>
</instance>
<collection id="downloadTaskLogsDc" class="com.cmobile.unifiedtms.entity.DownloadTaskLog"
view="downloadTaskLog-view">
<loader id="downloadTaskLogsDl">
<query>
<![CDATA[select t from tms_DownloadTaskLog t
where t.task = :task]]>
</query>
</loader>
</collection>
</data>
<dialogMode height="600"
width="800"/>
<layout expand="scrollBox" spacing="true">
<form id="form" dataContainer="downloadTaskDc">
<column width="250px">
<textField id="nameField" property="name"/>
<lookupField id="downloadTimeTypeField" property="downloadTimeType"/>
<dateField id="downloadTimeField" property="downloadTime"/>
<lookupField id="installationTimeTypeField" property="installationTimeType"/>
<dateField id="installationTimeField" property="installationTime"/>
<lookupField id="installationNotificationField" property="installationNotification"/>
</column>
</form>
<scrollBox id="scrollBox">
<groupBox id="applicationsBox" caption="msg://com.cmobile.unifiedtms.entity/DownloadTask.applications" width="100%">
<tabSheet>
<tab id="applicationsTab" caption="msg://tab.applications.caption">
<table id="applicationsTable" dataContainer="applicationsDc" width="100%" height="200px">
<actions>
<action id="add" type="add"/>
<action id="exclude" type="exclude"/>
</actions>
<columns>
<column id="name"/>
<column id="appVersion"/>
<column id="apk.size">
<formatter class="com.cmobile.unifiedtms.web.screens.formatter.FileSizeFormatter"/>
</column>
</columns>
<buttonsPanel>
<button action="applicationsTable.add"/>
<button action="applicationsTable.exclude"/>
</buttonsPanel>
</table>
</tab>
<tab id="historyTab" caption="msg://tab.history.caption">
<table id="downloadTaskTable" dataContainer="downloadTaskLogsDc" width="100%" height="200px">
<actions>
<action id="excel" type="excel"/>
</actions>
<buttonsPanel>
<button id="downloadTaskTableExcelBtn" action="downloadTaskTable.excel"/>
</buttonsPanel>
<columns>
<column id="terminal.terminalLink.terminalExt.terminalId"/>
<column id="terminal.sn"/>
<column id="application.packageName"/>
<column id="application.name"/>
<column id="application.appVersion"/>
<column id="activity"/>
<column id="message"/>
<column id="updateTs"/>
</columns>
</table>
</tab>
</tabSheet>
</groupBox>
<groupBox id="terminalGroupsBox" caption="msg://com.cmobile.unifiedtms.entity/DownloadTask.terminalGroups" width="100%">
<table id="terminalGroupsTable" dataContainer="terminalGroupsDc" width="100%" height="200px">
<actions>
<action id="add" type="add"/>
<action id="exclude" type="exclude"/>
</actions>
<columns>
<column id="name"/>
</columns>
<buttonsPanel>
<button action="terminalGroupsTable.add"/>
<button action="terminalGroupsTable.exclude"/>
</buttonsPanel>
</table>
</groupBox>
</scrollBox>
<hbox id="editActions" spacing="true">
<button action="windowCommitAndClose"/>
<button action="windowClose"/>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,5 @@
browseCaption=Download Task browser
editorCaption=Download Task editor
cancelTaskButton.Caption=Cancel
tab.history.caption=History Details
tab.applications.caption=Applications

View File

@ -0,0 +1,80 @@
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
caption="mainMsg://application.caption"
xmlns:dashboard="http://schemas.haulmont.com/cubadshb/ui-component.xsd"
>
<layout expand="horizontalWrap"
stylename="c-sidemenu-responsive"
responsive="true">
<hbox id="horizontalWrap"
expand="workArea"
stylename="c-sidemenu-layout"
width="100%">
<cssLayout id="sideMenuPanel"
height="100%"
stylename="c-sidemenu-panel">
<button id="mobileMenuButton"
caption="mainMsg://app.menu"
icon="icons/mobile-menu.png"
stylename="primary c-sidemenu-toggle"/>
<hbox id="mobileButtonsBox"
stylename="c-sidemenu-mobile-buttons">
<newWindowButton id="mobileNewWindowButton"
description="mainMsg://newWindowBtnDescription"
icon="app/images/new-window.png"/>
<userActionsButton id="mobileLogoutButton"/>
</hbox>
<hbox id="appTitleBox"
spacing="true"
stylename="c-sidemenu-title"
width="100%">
<label id="appTitleLabel"
value="mainMsg://application.logoLabel"/>
</hbox>
<cssLayout id="sideMenuWrap"
stylename="c-sidemenu-wrap">
<image id="logoImage"
stylename="c-app-icon"
align="MIDDLE_CENTER"
scaleMode="SCALE_DOWN"/>
<userIndicator id="userIndicator"
width="100%"/>
<timeZoneIndicator id="timeZoneIndicator"
width="100%"/>
<hbox id="mainButtonsBox"
stylename="c-main-buttons">
<newWindowButton id="newWindowButton"
description="mainMsg://newWindowBtnDescription"
icon="app/images/new-window.png"/>
<userActionsButton id="logoutButton"/>
</hbox>
<sideMenu id="sideMenu"
sidePanel="sideMenuPanel"
sidePanelToggleButton="mobileMenuButton" selectOnClick="true"/>
<ftsField id="ftsField"
width="100%"/>
</cssLayout>
</cssLayout>
<workArea id="workArea"
height="100%">
<initialLayout margin="true"
spacing="true">
<!--label id="welcomeLabel"
align="MIDDLE_CENTER"
width="100%"
stylename="c-welcome-text"
value="mainMsg://application.welcomeText"/-->
<!--
This is the work area - central part of the screen.
Put your components here.
-->
<!--
<dashboard:dashboard caption="mainMsg://dashboard.Caption"
id="dashboardId"
code="default-dashboard">
</dashboard:dashboard>
-->
</initialLayout>
</workArea>
</hbox>
</layout>
</window>

View File

@ -0,0 +1,12 @@
package com.cmobile.unifiedtms.web.screens.formatter;
import java.text.NumberFormat;
import java.util.Locale;
import java.util.function.Function;
public class CelciusFormatter implements Function<Double, String> {
@Override
public String apply(Double number) {
return NumberFormat.getNumberInstance(Locale.getDefault()).format(number) + " \u2103";
}
}

View File

@ -0,0 +1,30 @@
package com.cmobile.unifiedtms.web.screens.formatter;
import java.text.NumberFormat;
import java.util.Locale;
import java.util.function.Function;
public class FileSizeFormatter implements Function<Long, String> {
private static final long KB = 1024L;
private static final long MB = 1024L * 1024L;
@Override
public String apply(Long value) {
//return NumberFormat.getNumberInstance(Locale.getDefault()).format(integer) + " %";
double x = value * 1.0 / KB;
double y = value * 1.0 / MB;
StringBuilder sb = new StringBuilder();
if(x < 1.0) {
// not event 1 KB
sb.append(NumberFormat.getNumberInstance(Locale.getDefault()).format(value)).append(" bytes");
} else if(x >= 1.0 && y < 1.0) {
// not 1MB but more than 1 KB
sb.append(NumberFormat.getNumberInstance(Locale.getDefault()).format(x)).append(" KB");
} else {
// at least 1MB
sb.append(NumberFormat.getNumberInstance(Locale.getDefault()).format(y)).append(" MB");
}
return sb.toString();
}
}

View File

@ -0,0 +1,12 @@
package com.cmobile.unifiedtms.web.screens.formatter;
import java.text.NumberFormat;
import java.util.Locale;
import java.util.function.Function;
public class PercentageFormatter implements Function<Integer, String> {
@Override
public String apply(Integer integer) {
return NumberFormat.getNumberInstance(Locale.getDefault()).format(integer) + " %";
}
}

View File

@ -0,0 +1,87 @@
package com.cmobile.unifiedtms.web.screens.fragments;
import com.cmobile.unifiedtms.entity.chartdata.PieChartData;
import com.cmobile.unifiedtms.service.ChartDataService;
import com.haulmont.addon.dashboard.web.annotation.DashboardWidget;
import com.haulmont.addon.dashboard.web.events.DashboardEvent;
import com.haulmont.addon.dashboard.web.widget.RefreshableWidget;
import com.haulmont.charts.gui.amcharts.model.*;
import com.haulmont.charts.gui.components.charts.PieChart;
import com.haulmont.charts.gui.data.MapDataItem;
import com.haulmont.cuba.gui.UiComponents;
import com.haulmont.cuba.gui.components.GroupBoxLayout;
import com.haulmont.cuba.gui.components.HBoxLayout;
import com.haulmont.cuba.gui.screen.ScreenFragment;
import com.haulmont.cuba.gui.screen.Subscribe;
import com.haulmont.cuba.gui.screen.UiController;
import com.haulmont.cuba.gui.screen.UiDescriptor;
import javax.inject.Inject;
import java.util.*;
@UiController("tms_DownloadStatsWidget")
@UiDescriptor("download-stats-widget.xml")
@DashboardWidget(name = "download-stats-widget")
public class DownloadStatsWidget extends ScreenFragment implements RefreshableWidget {
@Inject
private ChartDataService chartDataService;
@Inject
private UiComponents uiComponents;
@Inject
private HBoxLayout hbox;
private Map<String, PieChart> charts = new HashMap<>();
@Subscribe
public void onInit(InitEvent event) {
reloadCharts();
}
@Override
public void refresh(DashboardEvent dashboardEvent) {
reloadCharts();
}
private void reloadCharts() {
List<PieChartData> datas = chartDataService.getDownloadStats();
hbox.removeAll();
int boxWidth = !datas.isEmpty() ? (100 / datas.size()) : 100;
for(int a = 0; a < datas.size(); a++) {
PieChartData data = datas.get(a);
// wrap in group box
GroupBoxLayout groupBox = uiComponents.create(GroupBoxLayout.class);
groupBox.setShowAsPanel(true);
PieChart pieChart = charts.get(data.getId());
if(pieChart == null) {
pieChart = uiComponents.create(PieChart.class);
pieChart.setTitleField("key");
pieChart.setValueField("value");
pieChart.setCaption(data.getTitle());
pieChart.setStartAngle(312)
.setLegend(new Legend()
.setMarkerType(MarkerType.CIRCLE)
.setPosition(LegendPosition.RIGHT)
.setMarginRight(10));
pieChart.setLabelRadius(-20);
pieChart.setLabelsEnabled(false);
pieChart.setLabelText("[[percents]] %");
pieChart.setWidthFull();
pieChart.setHeightFull();
pieChart.setCreditsPosition(CreditsPosition.BOTTOM_RIGHT);
}
groupBox.add(pieChart);
hbox.add(groupBox);
// reset chart data only
Set<Map.Entry<String, Object>> sets = data.getValues().entrySet();
for(Iterator<Map.Entry<String, Object>> itr = sets.iterator(); itr.hasNext(); ) {
Map.Entry<String, Object> stringObjectEntry = itr.next();
pieChart.addData(MapDataItem.of("key", stringObjectEntry.getKey(),
"value", stringObjectEntry.getValue()));
}
}
}
}

View File

@ -0,0 +1,93 @@
package com.cmobile.unifiedtms.web.screens.fragments;
import com.cmobile.unifiedtms.service.NumericInfoWidgetService;
import com.haulmont.addon.dashboard.web.annotation.DashboardWidget;
import com.haulmont.addon.dashboard.web.annotation.WidgetParam;
import com.haulmont.addon.dashboard.web.events.DashboardEvent;
import com.haulmont.addon.dashboard.web.widget.RefreshableWidget;
import com.haulmont.cuba.gui.WindowParam;
import com.haulmont.cuba.gui.components.Label;
import com.haulmont.cuba.gui.screen.ScreenFragment;
import com.haulmont.cuba.gui.screen.Subscribe;
import com.haulmont.cuba.gui.screen.UiController;
import com.haulmont.cuba.gui.screen.UiDescriptor;
import javax.inject.Inject;
import java.text.DecimalFormat;
@UiController("tms_NumericInfoWidget")
@UiDescriptor("numeric-info-widget.xml")
@DashboardWidget(name = "numeric-info-widget")
public class NumericInfoWidget extends ScreenFragment implements RefreshableWidget {
@Inject
private Label<String> infoLabel;
@Inject
private Label<String> valueLabel;
private DecimalFormat numberFormat;
@WindowParam
@WidgetParam(viewName = "labelText")
private String labelText = "Info Label";
private Number value = 0;
@WindowParam
@WidgetParam(viewName = "numberFormatPattern")
private String numberFormatPattern = "###";
@WindowParam
@WidgetParam(viewName = "queryTemplate")
private String queryTemplate = "_default_";
@Inject
private NumericInfoWidgetService numericInfoWidgetService;
public void setLabelText(String labelText) {
this.labelText = labelText;
}
public String getLabelText() {
return labelText;
}
public void setValue(Number value) {
this.value = value;
}
public Number getValue() {
return value;
}
@Subscribe
private void onInit(InitEvent event) {
if(!"_default_".equals(queryTemplate)) {
Number value = numericInfoWidgetService.getNumberFromQueryTemplate(queryTemplate);
if(value != null) {
setValue(value);
} else {
setValue(0);
}
}
numberFormat = new DecimalFormat(numberFormatPattern);
infoLabel.setValue(labelText);
valueLabel.setValue(numberFormat.format(getValue()));
}
public void setNumberFormatPattern(String numberFormatPattern) {
this.numberFormatPattern = numberFormatPattern;
}
@Override
public void refresh(DashboardEvent dashboardEvent) {
if(!"_default_".equals(queryTemplate)) {
Number value = numericInfoWidgetService.getNumberFromQueryTemplate(queryTemplate);
if(value != null) {
setValue(value);
} else {
setValue(0);
}
}
if(getValue() != null) {
valueLabel.setValue(numberFormat.format(getValue()));
} else {
valueLabel.setValue("");
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fragment xmlns="http://schemas.haulmont.com/cuba/screen/fragment.xsd"
>
<layout>
<hbox id="hbox" spacing="true" height="100%" width="100%" caption="msg://caption"/>
</layout>
</fragment>

View File

@ -0,0 +1 @@
caption=Download Statistics

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fragment xmlns="http://schemas.haulmont.com/cuba/screen/fragment.xsd">
<layout expand="groupBox">
<groupBox id="groupBox" spacing="true" showAsPanel="true" settingsEnabled="false">
<label id="infoLabel" align="MIDDLE_CENTER" htmlEnabled="true" height="30px" width="100px"
css="text-align: center; vertical-align: middle; font-weight: bold; text-transform: uppercase"/>
<label id="valueLabel" align="MIDDLE_CENTER" htmlEnabled="true" height="70px" width="100px"
css="text-align: center; vertical-align: middle"/>
</groupBox>
</layout>
</fragment>

View File

@ -0,0 +1,11 @@
package com.cmobile.unifiedtms.web.screens.heartbeat;
import com.haulmont.cuba.gui.screen.*;
import com.cmobile.unifiedtms.entity.HeartBeat;
@UiController("tms_HeartBeat.browse")
@UiDescriptor("heart-beat-browse.xml")
@LookupComponent("heartBeatsTable")
@LoadDataBeforeShow
public class HeartBeatBrowse extends StandardLookup<HeartBeat> {
}

Some files were not shown because too many files have changed in this diff Show More