Skip to content

Commit

Permalink
For #210 - Started implementing reports
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalidze committed Oct 19, 2015
1 parent 834ec2d commit 8d7b2f5
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 2 deletions.
Expand Up @@ -28,6 +28,7 @@
import org.traccar.web.client.model.BaseAsyncCallback;
import org.traccar.web.client.view.ArchiveView;
import org.traccar.web.client.view.FilterDialog;
import org.traccar.web.client.view.ReportsDialog;
import org.traccar.web.client.view.UserSettingsDialog;
import org.traccar.web.shared.model.Device;
import org.traccar.web.shared.model.Position;
Expand Down Expand Up @@ -248,4 +249,9 @@ public void onError(Request request, Throwable exception) {
GWT.log("Request failed", re);
}
}

@Override
public void onShowReports() {
new ReportsDialog().show();
}
}
2 changes: 2 additions & 0 deletions src/main/java/org/traccar/web/client/i18n/Messages.java
Expand Up @@ -412,4 +412,6 @@ String defaultNotificationTemplate(@Select DeviceEventType type,
String timeZone();

String bingMapsKey();

String reports();
}
6 changes: 6 additions & 0 deletions src/main/java/org/traccar/web/client/view/ArchiveView.java
Expand Up @@ -68,6 +68,7 @@ public interface ArchiveHandler {
void onFilterSettings();
void onClear(Device device);
void onChangeArchiveMarkerType(PositionIconType newMarkerType);
void onShowReports();
}

private ArchiveHandler archiveHandler;
Expand Down Expand Up @@ -387,4 +388,9 @@ private void setDateTimefd(int index){
toTime.setValue(combo.getEndOfPeriod(index));
}
}

@UiHandler("reportsButton")
public void onReportsClicked(SelectEvent event) {
archiveHandler.onShowReports();
}
}
Expand Up @@ -81,6 +81,7 @@
<toolbar:SeparatorToolItem />
<button:TextButton ui:field="clearButton" text="{i18n.clear}" />
<toolbar:FillToolItem />
<button:TextButton ui:field="reportsButton" text="{i18n.reports}" />
<button:TextButton text="{i18n.importData} / {i18n.exportData}">
<button:menu>
<menu:Menu>
Expand Down
40 changes: 40 additions & 0 deletions src/main/java/org/traccar/web/client/view/ReportsDialog.java
@@ -0,0 +1,40 @@
/*
* Copyright 2015 Vitaly Litvak (vitavaque@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.traccar.web.client.view;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.widget.core.client.Window;

public class ReportsDialog {
private static ReportsDialogDialogUiBinder uiBinder = GWT.create(ReportsDialogDialogUiBinder.class);

interface ReportsDialogDialogUiBinder extends UiBinder<Widget, ReportsDialog> {
}

@UiField
Window window;

public ReportsDialog() {
uiBinder.createAndBindUi(this);
}

public void show() {
window.show();
}
}
57 changes: 57 additions & 0 deletions src/main/java/org/traccar/web/client/view/ReportsDialog.ui.xml
@@ -0,0 +1,57 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder
xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:gxt="urn:import:com.sencha.gxt.widget.core.client"
xmlns:container="urn:import:com.sencha.gxt.widget.core.client.container"
xmlns:toolbar="urn:import:com.sencha.gxt.widget.core.client.toolbar"
xmlns:grid="urn:import:com.sencha.gxt.widget.core.client.grid"
xmlns:button="urn:import:com.sencha.gxt.widget.core.client.button">

<!-- ui:with type="com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData" field="toolBarRowData">
<ui:attributes width="1" height="-1" />
</ui:with -->

<ui:with type="com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData" field="verticalLayoutData">
<ui:attributes width="1" height="1" />
</ui:with>

<!-- ui:with type="com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer.HorizontalLayoutData" field="horizontalLayoutData">
<ui:attributes width="-1" height="1" />
</ui:with -->

<!-- ui:with type="com.sencha.gxt.data.shared.ListStore" field="sensorStore" />
<ui:with type="com.sencha.gxt.widget.core.client.grid.ColumnModel" field="columnModel" />
<ui:with type="com.sencha.gxt.widget.core.client.grid.GridView" field="view">
<ui:attributes stripeRows="true" autoFill="true" />
</ui:with -->

<ui:with field='i18n' type='org.traccar.web.client.i18n.Messages' />

<gxt:Window ui:field="window" pixelSize="330, 270" modal="true" headingText="{i18n.reports}">
<container:VerticalLayoutContainer>
<!-- container:child layoutData="{verticalLayoutData}">
<gxt:ContentPanel ui:field="contentPanel" headerVisible="false">
<container:VerticalLayoutContainer>
<container:child layoutData="{toolBarRowData}">
<toolbar:ToolBar ui:field="addRemoveToolbar">
<button:TextButton ui:field="addButton" text="{i18n.add}" />
<button:TextButton ui:field="removeButton" text="{i18n.remove}" enabled="false" />
</toolbar:ToolBar>
</container:child>
<container:child layoutData="{verticalLayoutData}">
<grid:Grid ui:field="grid" store="{sensorStore}" cm="{columnModel}" view="{view}" />
</container:child>
</container:VerticalLayoutContainer>
</gxt:ContentPanel>
</container:child -->
</container:VerticalLayoutContainer>
<!-- gxt:button>
<button:TextButton ui:field="saveButton" text="{i18n.save}" />
</gxt:button>
<gxt:button>
<button:TextButton ui:field="cancelButton" text="{i18n.cancel}" />
</gxt:button -->
</gxt:Window>

</ui:UiBinder>
Expand Up @@ -237,4 +237,6 @@ periodComboBox_PreviousWeek = Previous week
periodComboBox_ThisMonth = This month
periodComboBox_PreviousMonth = Previous month
periodComboBox_Custom = Custom
periodComboBox_SelectPeriod = Select period
periodComboBox_SelectPeriod = Select period
# Reports
reports = Reports
Expand Up @@ -236,4 +236,6 @@ periodComboBox_PreviousWeek = Прошлая неделя
periodComboBox_ThisMonth = Этот месяц
periodComboBox_PreviousMonth = Прошлый месяц
periodComboBox_Custom = Пользовтельский
periodComboBox_SelectPeriod = Выбор периода
periodComboBox_SelectPeriod = Выбор периода
# Reports
reports = Отчеты

4 comments on commit 8d7b2f5

@mpele
Copy link
Contributor

@mpele mpele commented on 8d7b2f5 Oct 21, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any special reason why this branch starts from neptune branch?

@vitalidze
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to release both neptune theme and reports at the same time.

@mpele
Copy link
Contributor

@mpele mpele commented on 8d7b2f5 Oct 21, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it mean that neptune theme will be default for the future releases?

@vitalidze
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly.

Please sign in to comment.