本文整理汇总了Java中com.vaadin.client.UIDL.getStringAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java UIDL.getStringAttribute方法的具体用法?Java UIDL.getStringAttribute怎么用?Java UIDL.getStringAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.client.UIDL
的用法示例。
在下文中一共展示了UIDL.getStringAttribute方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: accept
import com.vaadin.client.UIDL; //导入方法依赖的package包/类
@Override
// Exception squid:S1166 - Hide origin exception
// Exception squid:S2221 - This code is trans-coded to JavaScript, hence
// Exception semantics changes
@SuppressWarnings({ "squid:S1166", "squid:S2221" })
protected boolean accept(VDragEvent drag, UIDL configuration) {
try {
String component = drag.getTransferable().getDragSource().getWidget().getElement().getId();
int c = configuration.getIntAttribute(COMPONENT_COUNT);
String mode = configuration.getStringAttribute(MODE);
for (int dragSourceIndex = 0; dragSourceIndex < c; dragSourceIndex++) {
String requiredPid = configuration.getStringAttribute(COMPONENT + dragSourceIndex);
if ((STRICT_MODE.equals(mode) && component.equals(requiredPid))
|| (PREFIX_MODE.equals(mode) && component.startsWith(requiredPid))) {
return true;
}
}
} catch (Exception e) {
// log and continue
LOGGER.log(Level.SEVERE, "Error verifying drop target: " + e.getLocalizedMessage());
}
return false;
}
示例2: hideDropTargetHints
import com.vaadin.client.UIDL; //导入方法依赖的package包/类
/**
* Hides the highlighted drop target hints.
*
* @param configuration
* for the accept criterion to retrieve the drop target hints.
*/
// Exception squid:S1166 - Hide origin exception
// Exception squid:S2221 - This code is trans-coded to JavaScript, hence
// Exception semantics changes
@SuppressWarnings({ "squid:S1166", "squid:S2221" })
void hideDropTargetHints(UIDL configuration) {
int totalDropTargetHintsCount = configuration.getIntAttribute(DROP_AREA_CONFIG_COUNT);
for (int dropAreaIndex = 0; dropAreaIndex < totalDropTargetHintsCount; dropAreaIndex++) {
try {
String dropArea = configuration.getStringAttribute(DROP_AREA_CONFIG + dropAreaIndex);
Element hideHintFor = Document.get().getElementById(dropArea);
if (hideHintFor != null) {
hideHintFor.removeClassName(ViewComponentClientCriterion.HINT_AREA_STYLE);
}
} catch (Exception e) {
// log and continue
LOGGER.log(Level.SEVERE, "Error highlighting valid drop targets: " + e.getLocalizedMessage());
}
}
}
示例3: isValidDragSource
import com.vaadin.client.UIDL; //导入方法依赖的package包/类
/**
* Checks if this accept criterion is responsible for the current drag
* source. Therefore the current drag source id has to start with the drag
* source id-prefix configured for the criterion.
*
* @param drag
* the current drag event holding the context.
* @param configuration
* for the accept criterion to retrieve the configured drag
* source id-prefix.
* @return <code>true</code> if the criterion is responsible for the current
* drag source, otherwise <code>false</code>.
*/
// Exception squid:S1166 - Hide origin exception
// Exception squid:S2221 - This code is trans-coded to JavaScript, hence
// Exception semantics changes
@SuppressWarnings({ "squid:S1166", "squid:S2221" })
boolean isValidDragSource(final VDragEvent drag, final UIDL configuration) {
try {
final String dragSource = drag.getTransferable().getDragSource().getWidget().getElement().getId();
final String dragSourcePrefix = configuration.getStringAttribute(DRAG_SOURCE);
if (dragSource.startsWith(dragSourcePrefix)) {
return true;
}
} catch (final Exception e) {
// log and continue
LOGGER.log(Level.SEVERE, "Error verifying drag source: " + e.getLocalizedMessage());
}
return false;
}
示例4: showDropTargetHints
import com.vaadin.client.UIDL; //导入方法依赖的package包/类
/**
* Highlights the valid drop targets configured for the criterion.
*
* @param configuration
* for the accept criterion to retrieve the configured drop hint
* areas.
*/
// Exception squid:S1166 - Hide origin exception
// Exception squid:S2221 - This code is trans-coded to JavaScript, hence
// Exception semantics changes
// Exception squid:S2629 - not supported by GWT
@SuppressWarnings({ "squid:S1166", "squid:S2221", "squid:S2629" })
void showDropTargetHints(final UIDL configuration) {
final int dropAreaCount = configuration.getIntAttribute(DROP_AREA_COUNT);
for (int dropAreaIndex = 0; dropAreaIndex < dropAreaCount; dropAreaIndex++) {
try {
final String dropArea = configuration.getStringAttribute(DROP_AREA + dropAreaIndex);
LOGGER.log(Level.FINE, "Hint Area: " + dropArea);
final Element showHintFor = Document.get().getElementById(dropArea);
if (showHintFor != null) {
showHintFor.addClassName(HINT_AREA_STYLE);
}
} catch (final Exception e) {
// log and continue
LOGGER.log(Level.SEVERE, "Error highlighting drop targets: " + e.getLocalizedMessage());
}
}
}
示例5: isValidDropTarget
import com.vaadin.client.UIDL; //导入方法依赖的package包/类
/**
* Checks if the current drop location is a valid drop target for the
* criterion. Therefore the current drop location id has to start with one
* of the drop target id-prefixes configured for the criterion.
*
* @param configuration
* for the accept criterion to retrieve the configured drop
* target id-prefixes.
* @return <code>true</code> if the current drop location is a valid drop
* target for the criterion, otherwise <code>false</code>.
*/
// Exception squid:S1166 - Hide origin exception
// Exception squid:S2221 - This code is trans-coded to JavaScript, hence
// Exception semantics changes
// Exception squid:S2629 - not supported by GWT
@SuppressWarnings({ "squid:S1166", "squid:S2221", "squid:S2629" })
boolean isValidDropTarget(final UIDL configuration) {
try {
final String dropTarget = VDragAndDropManager.get().getCurrentDropHandler().getConnector().getWidget()
.getElement().getId();
final int dropTargetCount = configuration.getIntAttribute(DROP_TARGET_COUNT);
for (int dropTargetIndex = 0; dropTargetIndex < dropTargetCount; dropTargetIndex++) {
final String dropTargetPrefix = configuration.getStringAttribute(DROP_TARGET + dropTargetIndex);
LOGGER.log(Level.FINE, "Drop Target: " + dropTargetPrefix);
if (dropTarget.startsWith(dropTargetPrefix)) {
return true;
}
}
} catch (final Exception e) {
// log and continue
LOGGER.log(Level.SEVERE, "Error verifying drop target: " + e.getLocalizedMessage());
}
return false;
}
示例6: addCellsFromUIDL
import com.vaadin.client.UIDL; //导入方法依赖的package包/类
protected void addCellsFromUIDL(UIDL uidl) {
int colIndex = 0;
final Iterator cells = uidl.getChildIterator();
while (cells.hasNext() && colIndex < tableWidget.getVisibleColOrder().length) {
String columnId = tableWidget.getVisibleColOrder()[colIndex];
if (addSpecificCell(columnId, colIndex)) {
colIndex++;
continue;
}
final Object cell = cells.next();
String style = "";
if (uidl.hasAttribute("style-" + columnId)) {
style = uidl.getStringAttribute("style-" + columnId);
}
boolean sorted = tableWidget.getHead().getHeaderCell(colIndex).isSorted();
if (cell instanceof String) {
addCell((String) cell, aligns[colIndex], style, sorted);
}
final String colKey = tableWidget.getColKeyByIndex(colIndex);
int colWidth;
if ((colWidth = tableWidget.getColWidth(colKey)) > -1) {
tableWidget.setColWidth(colIndex, colWidth, false);
}
colIndex++;
}
}
示例7: getItemId
import com.vaadin.client.UIDL; //导入方法依赖的package包/类
@Override
protected String getItemId(UIDL uidl) {
if (uidl.hasAttribute("tid")) {
return uidl.getStringAttribute("tid");
}
return null;
}
示例8: assignAdditionalMenuStyles
import com.vaadin.client.UIDL; //导入方法依赖的package包/类
@Override
protected void assignAdditionalMenuStyles(VMenuBar currentMenu, UIDL item) {
String icon = item.getStringAttribute("icon");
if (icon != null) {
currentMenu.addStyleDependentName("has-icons");
}
}
示例9: updateFromUIDL
import com.vaadin.client.UIDL; //导入方法依赖的package包/类
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
getWidget().filterChangeEventMode = uidl
.getStringAttribute(AsyncFilterComboBoxConstants.ATTR_FILTERCHANGE_EVENTMODE);
getWidget().filterChangeEventTimeout = uidl
.getIntAttribute(AsyncFilterComboBoxConstants.ATTR_FILTERCHANGE_TIMEOUT);
super.updateFromUIDL(uidl, client);
}
示例10: buildItemHTML
import com.vaadin.client.UIDL; //导入方法依赖的package包/类
@Override
public String buildItemHTML(UIDL item) {
// Construct html from the text and the optional icon
// Haulmont API : Added support for shortcuts
StringBuilder itemHTML = new StringBuilder();
if (item.hasAttribute("separator")) {
itemHTML.append("<span>---</span><span>---</span>");
} else {
itemHTML.append("<span class=\"")
.append(getStylePrimaryName())
.append("-menuitem-caption\">");
Icon icon = client.getIcon(item.getStringAttribute("icon"));
if (icon != null) {
itemHTML.append(icon.getElement().getString());
}
String itemText = item.getStringAttribute("text");
if (!htmlContentAllowed) {
itemText = WidgetUtil.escapeHTML(itemText);
}
itemHTML.append(itemText);
itemHTML.append("</span>");
// Add submenu indicator
if (item.getChildCount() > 0) {
String bgStyle = "";
itemHTML.append("<span class=\"")
.append(getStylePrimaryName())
.append("-submenu-indicator\"")
.append(bgStyle)
.append("><span class=\"")
.append(getStylePrimaryName())
.append("-submenu-indicator-icon\"")
.append("><span class=\"text\">►</span></span></span>");
} else {
itemHTML.append("<span class=\"");
String shortcut = "";
if (item.hasAttribute("shortcut")) {
shortcut = item.getStringAttribute("shortcut");
} else {
itemHTML.append(getStylePrimaryName())
.append("-menuitem-empty-shortcut ");
}
itemHTML.append(getStylePrimaryName())
.append("-menuitem-shortcut\">")
.append(shortcut)
.append("</span");
}
}
return itemHTML.toString();
}
示例11: updateCaptions
import com.vaadin.client.UIDL; //导入方法依赖的package包/类
void updateCaptions(UIDL uidl) {
String leftCaption = (uidl.hasAttribute(ATTRIBUTE_LEFT_CAPTION) ? uidl
.getStringAttribute(ATTRIBUTE_LEFT_CAPTION) : null);
String rightCaption = (uidl.hasAttribute(ATTRIBUTE_RIGHT_CAPTION) ? uidl
.getStringAttribute(ATTRIBUTE_RIGHT_CAPTION) : null);
/* Column caption styles */
if (uidl.hasAttribute("leftColumnCaptionStyle")) {
leftColumnCaptionStyle = uidl
.getStringAttribute("leftColumnCaptionStyle");
} else {
leftColumnCaptionStyle = null;
}
if (uidl.hasAttribute("rightColumnCaptionStyle")) {
rightColumnCaptionStyle = uidl
.getStringAttribute("rightColumnCaptionStyle");
} else {
rightColumnCaptionStyle = null;
}
boolean hasCaptions = (leftCaption != null || rightCaption != null);
if (leftCaption == null) {
removeOptionsCaption();
} else {
getOptionsCaption().setText(leftCaption);
if (leftColumnCaptionStyle != null) {
getOptionsCaption().setStyleName(leftColumnCaptionStyle);
getOptionsCaption().addStyleName(CLASSNAME + "-caption-left");
} else {
getOptionsCaption().setStyleName(CLASSNAME + "-caption-left");
}
}
if (rightCaption == null) {
removeSelectionsCaption();
} else {
getSelectionsCaption().setText(rightCaption);
if (rightColumnCaptionStyle != null) {
getSelectionsCaption().setStyleName(rightColumnCaptionStyle);
getSelectionsCaption().addStyleName(
CLASSNAME + "-caption-right");
} else {
getSelectionsCaption().setStyleName(
CLASSNAME + "-caption-right");
}
}
captionWrapper.setVisible(hasCaptions);
}