Skip to content

Commit

Permalink
For #85 - display current marker with 'Select...' button in device di…
Browse files Browse the repository at this point in the history
…alog
  • Loading branch information
vitalidze committed May 20, 2015
1 parent bd71bfa commit 4394729
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/java/org/traccar/web/client/i18n/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,6 @@ String defaultNotificationTemplate(@Select DeviceEventType type,
@Optional String positionTime);

String noMarkers();

String select();
}
7 changes: 7 additions & 0 deletions src/main/java/org/traccar/web/client/view/DeviceDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.traccar.web.client.view;

import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.core.client.util.ToggleGroup;
Expand All @@ -40,6 +41,7 @@
import com.sencha.gxt.widget.core.client.form.TextField;
import org.traccar.web.shared.model.DeviceIconType;
import org.traccar.web.shared.model.Position;
import org.traccar.web.shared.model.PositionIconType;

public class DeviceDialog implements Editor<Device> {

Expand Down Expand Up @@ -83,10 +85,15 @@ public interface DeviceHandler {
@UiField
NumberField<Double> idleSpeedThreshold;

@UiField(provided = true)
final Image markerImage;

ToggleGroup iconRadioGroup = new ToggleGroup();

public DeviceDialog(Device device, DeviceHandler deviceHandler) {
this.deviceHandler = deviceHandler;
markerImage = new Image(device.getIconType().getPositionIconType(Position.Status.OFFLINE).getURL(false));

uiBinder.createAndBindUi(this);

timeout.addValidator(new MinNumberValidator<Integer>(1));
Expand Down
24 changes: 23 additions & 1 deletion src/main/java/org/traccar/web/client/view/DeviceDialog.ui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
<ui:attributes width="1" height="-1" />
</ui:with>

<ui:with type="com.sencha.gxt.core.client.util.Margins" field="rightMargins">
<ui:attributes top="0" right="4" bottom="0" left="0" />
</ui:with>

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

<ui:with type="com.sencha.gxt.widget.core.client.form.NumberPropertyEditor" field="integerPropertyEditor" />
<ui:with type="com.sencha.gxt.widget.core.client.form.NumberPropertyEditor" field="doublePropertyEditor" />

Expand Down Expand Up @@ -58,11 +66,25 @@
</form:widget>
</form:FieldLabel>
</container:child>
<container:child layoutData="{verticalLayoutData}">
<form:FieldLabel text="{i18n.markers}" labelWidth="140">
<form:widget>
<container:HorizontalLayoutContainer>
<container:child layoutData="{horizontalLayoutData}">
<g:Image ui:field="markerImage" />
</container:child>
<container:child layoutData="{horizontalLayoutData}">
<button:TextButton ui:field="selectButton" text="{i18n.select}..." />
</container:child>
</container:HorizontalLayoutContainer>
</form:widget>
</form:FieldLabel>
</container:child>
<container:child layoutData="{verticalLayoutData}">
<container:VerticalLayoutContainer ui:field="devicePictures" />
</container:child>
</container:VerticalLayoutContainer>

<gxt:button>
<button:TextButton ui:field="saveButton" text="{i18n.save}" />
</gxt:button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ power = Power
uniqueIdentifier = Unique Identifier
deviceTimeout = Timeout
idleWhenSpeedIsLE = Idle when speed is <=
select = Select
# device view
objects = Objects
devices = Devices
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ power=Заряд
uniqueIdentifier = Уникальный Код
deviceTimeout = Таймаут
idleWhenSpeedIsLE = Стоит если скорость <=
select = Выбрать
# device view
objects = Объекты
devices = Устройства
Expand Down

0 comments on commit 4394729

Please sign in to comment.