use of com.vaadin.v7.ui.HorizontalLayout in project opencms-core by alkacon.
the class CmsAdditionalInfosDialog method addInfoLayout.
/**
* Get horizontal layout with key, value from additional info.<p>
*
* @param key key
* @param value value
* @param editable boolean
* @return HorizontalLayout
*/
HorizontalLayout addInfoLayout(String key, Object value, boolean editable) {
HorizontalLayout res = new HorizontalLayout();
res.setWidth("100%");
res.setSpacing(true);
TextField keyField = new TextField();
keyField.setValue(key);
keyField.setEnabled(editable);
keyField.setWidth("100%");
TextField valueField = new TextField();
valueField.setValue(value.toString());
valueField.setEnabled(editable);
valueField.setWidth("100%");
res.addComponent(keyField);
res.addComponent(valueField);
res.setExpandRatio(keyField, 1);
res.setExpandRatio(valueField, 1);
return res;
}
use of com.vaadin.v7.ui.HorizontalLayout in project opencms-core by alkacon.
the class CmsResourceTypeStatResultList method removeRow.
/**
* Removes result row representing given results.<p>
*
* @param layout with results
* @param result to be removed
*/
private void removeRow(VerticalLayout layout, CmsResourceTypeStatResult result) {
Component componentToRemove = null;
Iterator<Component> iterator = layout.iterator();
while (iterator.hasNext()) {
Component component = iterator.next();
if (component instanceof HorizontalLayout) {
if (result.equals(((HorizontalLayout) component).getData())) {
componentToRemove = component;
}
}
}
if (componentToRemove != null) {
layout.removeComponent(componentToRemove);
}
}
use of com.vaadin.v7.ui.HorizontalLayout in project opencms-core by alkacon.
the class CmsResourceTypeStatResultList method getLayoutFromResult.
/**
* Creates a result row.<p>
*
* @param statResult result to be displayed
* @return a row with information about result
*/
private HorizontalLayout getLayoutFromResult(final CmsResourceTypeStatResult statResult) {
HorizontalLayout hLayout = new HorizontalLayout();
hLayout.setWidth("100%");
hLayout.setHeight("60px");
hLayout.addStyleName("o-report");
Label result = new Label();
result.setContentMode(ContentMode.HTML);
result.addStyleName("v-scrollable");
// result.addStyleName("o-report");
result.setValue(statResult.getResult());
Label type = new Label();
type.setWidth("200px");
type.setContentMode(ContentMode.HTML);
type.addStyleName("v-scrollable");
// type.addStyleName("o-report");
type.setValue(statResult.getTypeTitle());
Label time = new Label();
time.setWidth("180px");
time.setContentMode(ContentMode.HTML);
time.addStyleName("v-scrollable");
// time.addStyleName("o-report");
time.setValue(CmsDateUtil.getDateTime(new Date(statResult.getTimestamp()), java.text.DateFormat.DATE_FIELD, A_CmsUI.get().getLocale()));
Button showList = new Button(CmsVaadinUtils.getMessageText(Messages.GUI_DATABASEAPP_STATS_LIST_0));
showList.setWidth("100px");
showList.addClickListener(new Button.ClickListener() {
private static final long serialVersionUID = 2665235403970750534L;
public void buttonClick(ClickEvent event) {
CmsSearchReplaceSettings settings = new CmsSearchReplaceSettings();
settings.setPaths(Collections.singletonList("/"));
settings.setSiteRoot(statResult.getSiteRoot());
settings.setSearchpattern(".*");
if (statResult.getType() != null) {
settings.setTypes(statResult.getType().getTypeName());
}
settings.setType(SearchType.fullText);
CmsAppWorkplaceUi.get().showApp(CmsSourceSearchAppConfiguration.APP_ID, CmsSourceSearchApp.generateState(settings));
}
});
hLayout.addComponent(type);
hLayout.addComponent(result);
hLayout.addComponent(time);
hLayout.addComponent(showList);
hLayout.setExpandRatio(result, 1);
hLayout.setData(statResult);
hLayout.setSpacing(true);
hLayout.setComponentAlignment(showList, Alignment.MIDDLE_CENTER);
hLayout.setComponentAlignment(time, Alignment.MIDDLE_CENTER);
hLayout.setComponentAlignment(result, Alignment.MIDDLE_CENTER);
hLayout.setComponentAlignment(type, Alignment.MIDDLE_CENTER);
return hLayout;
}
use of com.vaadin.v7.ui.HorizontalLayout in project opencms-core by alkacon.
the class CmsMessageBundleEditorOptions method createUpperRightComponent.
/**
* Creates the upper right component of the options grid.
* Creation includes the initialization of {@link #m_filePathField}.
*
* @return the upper right component in the options grid.
*/
private Component createUpperRightComponent() {
HorizontalLayout upperRight = new HorizontalLayout();
upperRight.setSizeFull();
FormLayout fileNameDisplay = new FormLayout();
fileNameDisplay.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
fileNameDisplay.setSizeFull();
m_filePathField = new TextField();
m_filePathField.setWidth("100%");
m_filePathField.setEnabled(true);
m_filePathField.setReadOnly(true);
fileNameDisplay.addComponent(m_filePathField);
fileNameDisplay.setSpacing(true);
FormLayout filePathDisplay = new FormLayout();
filePathDisplay.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
filePathDisplay.setSizeFull();
filePathDisplay.addComponent(m_filePathField);
filePathDisplay.setSpacing(true);
upperRight.addComponent(filePathDisplay);
upperRight.setExpandRatio(filePathDisplay, 2f);
HorizontalLayout placeHolder = new HorizontalLayout();
placeHolder.setWidth(CmsMessageBundleEditorTypes.OPTION_COLUMN_WIDTH_PX);
upperRight.addComponent(placeHolder);
return upperRight;
}
use of com.vaadin.v7.ui.HorizontalLayout in project opencms-core by alkacon.
the class CmsImageDiff method diff.
/**
* @see org.opencms.ui.dialogs.history.diff.I_CmsDiffProvider#diff(org.opencms.file.CmsObject, org.opencms.gwt.shared.CmsHistoryResourceBean, org.opencms.gwt.shared.CmsHistoryResourceBean)
*/
public Optional<Component> diff(CmsObject cms, CmsHistoryResourceBean v1, CmsHistoryResourceBean v2) throws CmsException {
CmsResource r1 = A_CmsAttributeDiff.readResource(cms, v1);
if (OpenCms.getResourceManager().matchResourceType(CmsResourceTypeImage.getStaticTypeName(), r1.getTypeId())) {
HorizontalLayout hl = new HorizontalLayout();
hl.setSpacing(true);
String v1Param = v1.getVersion().getVersionNumber() != null ? "" + v1.getVersion().getVersionNumber() : "" + CmsHistoryResourceHandler.PROJECT_OFFLINE_VERSION;
String v2Param = v2.getVersion().getVersionNumber() != null ? "" + v2.getVersion().getVersionNumber() : "" + CmsHistoryResourceHandler.PROJECT_OFFLINE_VERSION;
String link1 = OpenCms.getLinkManager().substituteLinkForUnknownTarget(cms, CmsHistoryListUtil.getHistoryLink(cms, v1.getStructureId(), v1Param));
String link2 = OpenCms.getLinkManager().substituteLinkForUnknownTarget(cms, CmsHistoryListUtil.getHistoryLink(cms, v2.getStructureId(), v2Param));
int scaleWidth = 400;
int scaleHeight = (2 * scaleWidth) / 3;
// scale type 1 for thumbnails (no enlargement)
final String scaleParams = "w:" + scaleWidth + ",h:" + scaleHeight + ",t:1";
link1 = CmsRequestUtil.appendParameter(link1, "__scale", scaleParams);
link2 = CmsRequestUtil.appendParameter(link2, "__scale", scaleParams);
Image img1 = new Image("", new ExternalResource(link1));
Image img2 = new Image("", new ExternalResource(link2));
for (Image img : new Image[] { img1, img2 }) {
img.setWidth("" + scaleWidth + "px");
}
img1.setCaption("V1");
img2.setCaption("V2");
hl.addComponent(img1);
hl.addComponent(img2);
Panel result = new Panel("Image comparison");
hl.setMargin(true);
result.setContent(hl);
return Optional.fromNullable((Component) result);
} else {
return Optional.absent();
}
}
Aggregations