@Override
 public void show() {
   super.show();
   this.loadDataToDisplay();
   GPLayerTreeModel layerElement =
       (GPLayerTreeModel) treePanel.getSelectionModel().getSelectedItem();
   String timeFilter = layerElement.getTimeFilter();
   String variableTimeFilter = layerElement.getVariableTimeFilter();
   if (variableTimeFilter != null) {
     try {
       String[] variableTimeFilterSplitted = timeFilter.split("/");
       int integerTimeFilter = Integer.parseInt(variableTimeFilterSplitted[0]);
       this.startFilterNumberField.setValue(integerTimeFilter);
       this.dimensionRadioGroup.setValue(this.variableDimensionRadio);
       if (variableTimeFilterSplitted.length > 1) {
         integerTimeFilter = Integer.parseInt(variableTimeFilterSplitted[1]);
         this.endFilterNumberField.setValue(integerTimeFilter);
       }
     } catch (NumberFormatException nfe) {
     }
   } else if (timeFilter != null) {
     String[] timeFilterSplitted = timeFilter.split("/");
     this.startDimensionComboBox.setValue(new DimensionData(timeFilterSplitted[0]));
     if (timeFilterSplitted.length > 1) {
       this.endDimensionComboBox.enable();
       this.endDimensionComboBox.setValue(new DimensionData(timeFilterSplitted[1]));
     }
     this.dimensionRadioGroup.setValue(this.fixedDimensionRadio);
   }
 }
  private void loadDataToDisplay() {
    final GetLayerDimensionRequest getLayerDimensionRequest =
        GWT.<GetLayerDimensionRequest>create(GetLayerDimensionRequest.class);

    final GPLayerTreeModel layerSelected =
        (GPLayerTreeModel) treePanel.getSelectionModel().getSelectedItem();
    getLayerDimensionRequest.setLayerName(layerSelected.getName());

    ClientCommandDispatcher.getInstance()
        .execute(
            new GPClientCommand<GetLayerDimensionResponse>() {
              private static final long serialVersionUID = 4372276287420606744L;

              {
                super.setCommandRequest(getLayerDimensionRequest);
              }

              @Override
              public void onCommandSuccess(GetLayerDimensionResponse response) {
                List<String> dimensionList =
                    Lists.<String>newArrayList(response.getResult().split(","));
                dimensionSizeLabel.setHtml(
                    LayerModuleMessages.INSTANCE.LayerTimeFilterWidget_dimensionSizeHTMLMessage(
                        dimensionList.size()));
                dimensionSizeLabel.setStyleAttribute("font-size", "1.3em");
                dimensionSizeLabel.setStyleAttribute("text-align", "right");
                startStore.removeAll();
                endStore.removeAll();
                for (String dimension : GPSharedUtils.safeList(dimensionList)) {
                  startStore.add(new DimensionData(dimension));
                }
                if (!dimensionList.isEmpty()) {
                  slider.setMaxValue(dimensionList.size());
                  slider.setMinValue(0);
                  endFilterNumberField.setValue(0);
                  if (layerSelected.getTimeFilter() != null) {
                    String[] timeFilterSplitted = layerSelected.getTimeFilter().split("/");
                    int startDimensionPosition = Integer.parseInt(timeFilterSplitted[0]);
                    slider.setValue(startStore.getModels().size() - startDimensionPosition - 1);
                    startFilterNumberField.setValue(startDimensionPosition);
                    if (timeFilterSplitted.length > 1) {
                      int endDimensionPosition = Integer.parseInt(timeFilterSplitted[1]);
                      endFilterNumberField.setValue(endDimensionPosition);
                    }
                  } else {
                    startFilterNumberField.setValue(dimensionList.size() - 1);
                  }
                }
              }

              @Override
              public void onCommandFailure(Throwable exception) {
                if (exception.getCause() instanceof GPSessionTimeout) {
                  GPHandlerManager.fireEvent(new GPLoginEvent(null));
                } else {
                  GeoPlatformMessage.errorMessage(
                      LayerModuleConstants.INSTANCE
                          .LayerTimeFilterWidget_timeFilterErrorTitleText(),
                      WindowsConstants.INSTANCE.errorMakingConnectionBodyText());
                  LayoutManager.getInstance()
                      .getStatusMap()
                      .setStatus(
                          LayerModuleConstants.INSTANCE
                              .LayerTimeFilterWidget_statusTimeFilterErrorLoadingText(),
                          SearchStatus.EnumSearchStatus.STATUS_NO_SEARCH.toString());
                  System.out.println(
                      "Error Loading Time Filter: "
                          + exception.toString()
                          + " data: "
                          + exception.getMessage());
                }
              }
            });
  }
 @Override
 public void setRefreshTime(int refreshTime, GPLayerTreeModel layer) {
   if (refreshTime != LayerRefreshTimeEnum.NO_REFRESH.getValue()) {
     layer.setState(LayerStateEnum.RASTER_TIME_REFRESH.getValue());
   }
 }
 @Override
 public void setTimeFilter(String timeFilter, GPLayerTreeModel layer) {
   if (timeFilter == null || timeFilter.isEmpty()) {
     layer.setState(LayerStateEnum.RASTER_NO_OP.getValue());
   }
 }
 @Override
 public void setCqlFilter(String cqlFilter, GPLayerTreeModel layer) {
   if (cqlFilter != null && !cqlFilter.isEmpty()) {
     layer.setState(LayerStateEnum.RASTER_CQL_TIME.getValue());
   }
 }