use of com.google.gwt.text.shared.AbstractRenderer in project openremote by openremote.
the class DatapointBrowser method createChart.
protected void createChart() {
addLabel(environment.getMessages().historicalData());
Canvas canvas = Canvas.createIfSupported();
if (canvas == null) {
add(new Label(environment.getMessages().canvasNotSupported()));
return;
}
canvas.getCanvasElement().setWidth(width);
canvas.getCanvasElement().setHeight(height);
FlowPanel canvasContainer = new FlowPanel();
canvasContainer.setWidth(width + "px");
canvasContainer.setHeight(height + "px");
canvasContainer.getElement().getStyle().setProperty("margin", "0 auto");
canvasContainer.add(canvas);
add(canvasContainer);
Form controlForm = new Form();
controlForm.getElement().getStyle().setWidth(width, PX);
controlForm.getElement().getStyle().setMarginTop(0.4, EM);
controlForm.getElement().getStyle().setProperty("margin", "0 auto");
add(controlForm);
FormGroup controlFormGroup = new FormGroup();
controlForm.add(controlFormGroup);
FormLabel controlFormLabel = new FormLabel(environment.getMessages().showChartAggregatedFor());
controlFormLabel.addStyleName("end-justified");
controlFormGroup.setFormLabel(controlFormLabel);
FormField controlFormField = new FormField();
controlFormGroup.setFormField(controlFormField);
intervalListBox = new FormValueListBox<>(new AbstractRenderer<DatapointInterval>() {
@Override
public String render(DatapointInterval interval) {
return environment.getMessages().datapointInterval(interval.name());
}
});
intervalListBox.addValueChangeHandler(event -> refresh(timestamp));
intervalListBox.setValue(interval);
intervalListBox.setAcceptableValues(Arrays.asList(DatapointInterval.values()));
intervalListBox.setEnabled(true);
controlFormField.add(intervalListBox);
timeOutput = new FormOutputText();
timeOutput.addStyleName("flex");
timeOutput.getElement().getStyle().setFontSize(0.8, EM);
controlFormField.add(timeOutput);
FormGroupActions controlFormActions = new FormGroupActions();
controlFormGroup.setFormGroupActions(controlFormActions);
FormButton previousButton = new FormButton();
previousButton.setIcon("arrow-circle-left");
previousButton.setText(environment.getMessages().previous());
previousButton.addClickHandler(event -> refresh(calculateTimestamp(true)));
controlFormActions.add(previousButton);
nextButton = new FormButton();
nextButton.setIcon("arrow-circle-right");
nextButton.setText(environment.getMessages().next());
nextButton.addClickHandler(event -> refresh(calculateTimestamp(false)));
controlFormActions.add(nextButton);
chart = ChartUtil.createLineChart(canvas.getContext2d());
// TODO: Ugly, sometimes the chart is not ready (chart == undefined but !null in Java...) so we wait a bit
Browser.getWindow().setTimeout(() -> refresh(timestamp), 50);
}
use of com.google.gwt.text.shared.AbstractRenderer in project ovirt-engine by oVirt.
the class VolumeGeoRepSessionDetailsPopUpView method intiEditors.
private void intiEditors(final ApplicationConstants constants) {
checkPointStatus = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {
@Override
public String render(GlusterGeoRepSessionDetails object) {
String checkPointStatusValue = object.getCheckPointStatus();
return checkPointStatusValue == null || checkPointStatusValue.isEmpty() ? constants.notAvailableLabel() : checkPointStatusValue;
}
});
crawlStatus = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {
@Override
public String render(GlusterGeoRepSessionDetails object) {
return object.getCrawlStatus().toString();
}
});
dataOpsPending = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {
@Override
public String render(GlusterGeoRepSessionDetails object) {
return object.getDataOpsPending().toString();
}
});
metaOpsPending = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {
@Override
public String render(GlusterGeoRepSessionDetails object) {
return object.getMetaOpsPending().toString();
}
});
entryOpsPending = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {
@Override
public String render(GlusterGeoRepSessionDetails object) {
return object.getEntryOpsPending().toString();
}
});
failures = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {
@Override
public String render(GlusterGeoRepSessionDetails object) {
return object.getFailures().toString();
}
});
checkPointTime = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {
@Override
public String render(GlusterGeoRepSessionDetails object) {
return new FullDateTimeRenderer().render(object.getCheckPointTime());
}
});
checkPointCompletedAt = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {
@Override
public String render(GlusterGeoRepSessionDetails object) {
return new FullDateTimeRenderer().render(object.getCheckPointCompletedAt());
}
});
geoRepSessionSummaryTable = new EntityModelCellTable<>(false, true);
geoRepSessionSummaryTable.addColumn(new AbstractEntityModelTextColumn<GlusterGeoRepSessionDetails>() {
@Override
public String getText(GlusterGeoRepSessionDetails object) {
return object.getMasterBrickHostName() == null ? constants.notAvailableLabel() : object.getMasterBrickHostName();
}
}, constants.geoRepSessionHostName());
geoRepSessionSummaryTable.addColumn(new AbstractEntityModelTextColumn<GlusterGeoRepSessionDetails>() {
@Override
protected String getText(GlusterGeoRepSessionDetails entity) {
return (entity == null || entity.getStatus() == null) ? constants.notAvailableLabel() : entity.getStatus().toString();
}
}, constants.geoRepSessionStatus());
geoRepSessionSummaryTable.addColumn(new AbstractFullDateTimeColumn<EntityModel<GlusterGeoRepSessionDetails>>() {
@Override
protected Date getRawValue(EntityModel<GlusterGeoRepSessionDetails> object) {
GlusterGeoRepSessionDetails sessionDetail = object.getEntity();
return (sessionDetail == null || sessionDetail.getLastSyncedAt() == null) ? new Date() : sessionDetail.getLastSyncedAt();
}
}, constants.geoRepLastSyncedAt());
}
use of com.google.gwt.text.shared.AbstractRenderer in project ovirt-engine by oVirt.
the class StoragePopupView method initListBoxEditors.
@SuppressWarnings({ "unchecked", "rawtypes" })
void initListBoxEditors() {
datacenterListEditor = new ListModelListBoxEditor<>(new AbstractRenderer<StoragePool>() {
@Override
public String render(StoragePool storage) {
// $NON-NLS-1$
String formattedString = "";
if (storage != null) {
// Get formatted storage type and format using Enum renders
// $NON-NLS-1$
String storageType = storage.isLocal() ? constants.storageTypeLocal() : "";
String storageFormatType = // $NON-NLS-1$
storage.getStoragePoolFormatType() == null ? // $NON-NLS-1$
"" : new EnumRenderer<StorageFormatType>().render(storage.getStoragePoolFormatType());
// Add storage type and format if available
if (!storageType.isEmpty() || !storageFormatType.isEmpty()) {
// $NON-NLS-1$
formattedString = " (";
if (storage.isLocal()) {
formattedString += storageType;
} else {
formattedString += storageFormatType;
}
// $NON-NLS-1$
formattedString += ")";
}
formattedString = storage.getName() + formattedString;
}
return formattedString;
}
});
formatListEditor = new ListModelListBoxEditor<>(new EnumRenderer());
hostListEditor = new ListModelListBoxEditor<>(new NameRenderer<VDS>());
domainFunctionListEditor = new ListModelListBoxEditor<>(new EnumRenderer<StorageDomainType>());
storageTypeListEditor = new ListModelListBoxEditor<>(new EnumRenderer<StorageType>());
activateDomainEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
wipeAfterDeleteEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
backup = new EntityModelCheckBoxEditor(Align.RIGHT);
discardAfterDeleteEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
}
use of com.google.gwt.text.shared.AbstractRenderer in project ovirt-engine by oVirt.
the class GlusterVolumeSnapshotCreatePopupView method initEditors.
private void initEditors() {
snapshotNameEditor = new StringEntityModelTextBoxEditor();
snapshotNameEditor.hideLabel();
EnableableFormLabel label = new EnableableFormLabel();
label.setText(constants.volumeSnapshotNamePrefixLabel());
snapshotNameEditorWithInfo = new EntityModelWidgetWithInfo(label, snapshotNameEditor);
snapshotNameEditorWithInfo.setExplanation(templates.italicText(constants.snapshotNameInfo()));
startAtEditor = new EntityModelDateTimeBoxEditor();
startAtEditor.getContentWidget().setDateTimeFormat(GwtBootstrapDateTimePicker.DEFAULT_DATE_TIME_FORMAT);
startAtEditor.getContentWidget().showDateAndTime();
daysOfWeekEditor = new ListModelCheckBoxGroupEditor<>(new AbstractRenderer<DayOfWeek>() {
@Override
public String render(DayOfWeek object) {
return object.toString().substring(0, 3);
}
});
endDate = new EntityModelDateTimeBoxEditor();
endDate.getContentWidget().setDateTimeFormat(GwtBootstrapDateTimePicker.DEFAULT_DATE_TIME_FORMAT);
endDate.getContentWidget().showDateAndTime();
executionTimeEditor = new EntityModelDateTimeBoxEditor();
// $NON-NLS-1$
executionTimeEditor.getContentWidget().setDateTimeFormat("hh:ii");
executionTimeEditor.getContentWidget().showTimeOnly();
recurrenceEditor = new ListModelListBoxEditor<>(new AbstractRenderer<GlusterVolumeSnapshotScheduleRecurrence>() {
@Override
public String render(GlusterVolumeSnapshotScheduleRecurrence object) {
return EnumTranslator.getInstance().translate(object);
}
});
}
use of com.google.gwt.text.shared.AbstractRenderer in project ovirt-engine by oVirt.
the class ClusterPopupView method initCheckBoxEditors.
private void initCheckBoxEditors() {
enableOvirtServiceEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
enableGlusterServiceEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
importGlusterConfigurationEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
countThreadsAsCoresEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
enableTrustedServiceEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
enableHaReservationEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
enableOptionalReasonEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
enableHostMaintenanceReasonEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
enableKsm = new EntityModelCheckBoxEditor(Align.RIGHT);
// $NON-NLS-1$
enableKsm.getContentWidgetContainer().setWidth("350px");
enableBallooning = new EntityModelCheckBoxEditor(Align.RIGHT);
// $NON-NLS-1$
enableBallooning.getContentWidgetContainer().setWidth("350px");
rngHwrngSourceRequired = new EntityModelCheckBoxEditor(Align.RIGHT);
fencingEnabledCheckBox = new EntityModelCheckBoxEditor(Align.RIGHT);
skipFencingIfSDActiveCheckBox = new EntityModelCheckBoxEditor(Align.RIGHT);
skipFencingIfConnectivityBrokenCheckBox = new EntityModelCheckBoxEditor(Align.RIGHT);
skipFencingIfGlusterBricksUpCheckBox = new EntityModelCheckBoxEditor(Align.RIGHT);
skipFencingIfGlusterQuorumNotMetCheckBox = new EntityModelCheckBoxEditor(Align.RIGHT);
spiceProxyOverrideEnabled = new EntityModelCheckBoxEditor(Align.RIGHT);
additionalFeaturesEditor = new ListModelCheckBoxGroup<>(new AbstractRenderer<AdditionalFeature>() {
@Override
public String render(AdditionalFeature feature) {
return feature.getDescription();
}
});
}
Aggregations