The following document contains the results of PMD's CPD 5.1.2.
File | Line |
---|---|
com/vaadin/v7/client/ui/VScrollTablePatched.java | 6730 |
com/vaadin/v7/client/ui/VTreeTablePatched.java | 298 |
public VScrollTableGeneratedRow(UIDL uidl, char[] aligns) { super(uidl, aligns); addStyleName("v-table-generated-row"); } public boolean isSpanColumns() { return spanColumns; } @Override protected void initCellWidths() { if (spanColumns) { setSpannedColumnWidthAfterDOMFullyInited(); } else { super.initCellWidths(); } } private void setSpannedColumnWidthAfterDOMFullyInited() { // Defer setting width on spanned columns to make sure that // they are added to the DOM before trying to calculate // widths. Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { if (showRowHeaders) { setCellWidth(0, tHead.getHeaderCell(0) .getWidthWithIndent()); calcAndSetSpanWidthOnCell(1); } else { calcAndSetSpanWidthOnCell(0); } } }); } @Override protected boolean isRenderHtmlInCells() { return htmlContentAllowed; } @Override protected void addCellsFromUIDL(UIDL uidl, char[] aligns, int col, int visibleColumnIndex) { htmlContentAllowed = uidl.getBooleanAttribute("gen_html"); spanColumns = uidl.getBooleanAttribute("gen_span"); if (spanColumns) { int colCount = uidl.getChildCount(); // add the first cell only for (final Object cell : uidl) { if (cell instanceof String) { addSpannedCell(uidl, cell.toString(), aligns[0], "", htmlContentAllowed, false, null, colCount); } else { addSpannedCell(uidl, (Widget) cell, aligns[0], "", false, colCount); } break; } } else { super.addCellsFromUIDL(uidl, aligns, col, visibleColumnIndex); } } private void addSpannedCell(UIDL rowUidl, Widget w, char align, String style, boolean sorted, int colCount) { TableCellElement td = DOM.createTD().cast(); td.setColSpan(colCount); initCellWithWidget(w, align, style, sorted, td); |
File | Line |
---|---|
com/googlecode/mgwt/dom/client/recognizer/pinch/PinchRecognizer.java | 134 |
info/magnolia/ui/vaadin/gwt/client/pinch/MagnoliaPinchRecognizer.java | 146 |
break; default: state = State.INVALID; break; } } /* * (non-Javadoc) * * @see * com.googlecode.mgwt.dom.client.event.touch.TouchEndHandler#onTouchEnd(com.googlecode.mgwt.dom * .client.event.touch.TouchEndEvent) */ @Override public void onTouchEnd(TouchEndEvent event) { touchCount--; if (touchCount <= 0) { reset(); } else { if (state == State.TWO_FINGER) { state = State.ONE_FINGER; } else { if (touchCount == 2) { state = State.TWO_FINGER; } } } } /* * (non-Javadoc) * * @see * com.googlecode.mgwt.dom.client.event.touch.TouchCancelHandler#onTouchCanceled(com.googlecode * .mgwt.dom.client.event.touch.TouchCancelEvent) */ @Override public void onTouchCanceled(TouchCancelEvent event) { touchCount--; if (touchCount <= 0) { reset(); } else { if (state == State.TWO_FINGER) { state = State.ONE_FINGER; } else { if (touchCount == 2) { state = State.TWO_FINGER; } } } } protected EventPropagator getEventPropagator() { if (eventPropagator == null) { if (DEFAULT_EVENT_PROPAGATOR == null) { DEFAULT_EVENT_PROPAGATOR = GWT.create(EventPropagator.class); } eventPropagator = DEFAULT_EVENT_PROPAGATOR; } return eventPropagator; } protected void setEventPropagator(EventPropagator eventPropagator) { this.eventPropagator = eventPropagator; } private void reset() { touchCount = 0; state = State.READY; } } |
File | Line |
---|---|
info/magnolia/ui/vaadin/grid/MagnoliaTable.java | 57 |
info/magnolia/ui/vaadin/grid/MagnoliaTreeTable.java | 75 |
this(new IndexedContainer()); } @Override protected String formatPropertyValue(Object rowId, Object colId, Property<?> property) { String result = super.formatPropertyValue(rowId, colId, property); return StringEscapeUtils.escapeHtml4(result); } @Override public void changeVariables(Object source, Map<String, Object> variables) { super.changeVariables(source, variables); if (variables.containsKey("selectAll")) { boolean selectAll = (Boolean) variables.get("selectAll"); if (selectAll) { Collection<?> ids = getItemIds(); for (final Object id : ids) { select(id); } } else { setValue(null); } } if (variables.containsKey("toggleSelection")) { boolean selected = (Boolean) variables.get("toggleSelection"); String key = String.valueOf(variables.get("toggledRowId")); final Object id = itemIdMapper.get(key); if (selected) { select(id); } else { unselect(id); } } } |
File | Line |
---|---|
info/magnolia/ui/vaadin/gwt/client/ckeditor/VMagnoliaCKEditorTextField.java | 103 |
info/magnolia/ui/vaadin/gwt/client/richtext/VMagnoliaRichTextField.java | 110 |
editor = (VMagnoliaCKEditor) super.loadEditor(inPageConfig); return editor; } private native void setVaadinDirUrl(String vaadinDirUrl) /*-{ $wnd.CKEDITOR.vaadinDirUrl = vaadinDirUrl; }-*/; private native void addExternalPlugin(String pluginName, String path) /*-{ $wnd.CKEDITOR.plugins.addExternal(pluginName, path, 'plugin.js'); }-*/; /** * Add plugin listeners when instance is ready. */ @Override public void onInstanceReady() { super.onInstanceReady(); // Add plugin listeners if (pluginEvents != null && !pluginEvents.isEmpty()) { for (String eventName : pluginEvents) { editor.addPluginListener(eventName, this); } } } @Override public void onPluginEvent(String eventName, String data) { if (pluginEvents.contains(eventName)) { clientToServer.updateVariable(paintableId, VAR_EVENT_PREFIX + eventName, data == null ? "" : data, true); } } /** * Override VCKEditorTextField's default behavior, defer update in case field is immediate. */ @Override public void onChange() { if (editor != null && !editor.isReadOnly()) { clientToServer.updateVariable(paintableId, VAR_TEXT, editor.getData(), false); if (immediate) { valueUpdateTimer.schedule(200); } } } private Timer valueUpdateTimer = new Timer() { @Override public void run() { |
File | Line |
---|---|
com/googlecode/mgwt/ui/client/widget/touch/TouchPanel.java | 62 |
com/googlecode/mgwt/ui/client/widget/touch/TouchWidget.java | 63 |
public TouchPanel() { gestureUtility = new GestureUtility(this); } /* * (non-Javadoc) * @see com.googlecode.mgwt.dom.client.event.touch.HasTouchHandlers#addTouchStartHandler(com.googlecode.mgwt.dom.client.event.touch.TouchStartHandler) */ /** {@inheritDoc} */ @Override public HandlerRegistration addTouchStartHandler(TouchStartHandler handler) { return impl.addTouchStartHandler(this, handler); } /* * (non-Javadoc) * @see com.googlecode.mgwt.dom.client.event.touch.HasTouchHandlers#addTouchMoveHandler(com.googlecode.mgwt.dom.client.event.touch.TouchMoveHandler) */ /** {@inheritDoc} */ @Override public HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) { return impl.addTouchMoveHandler(this, handler); } /* * (non-Javadoc) * @see com.googlecode.mgwt.dom.client.event.touch.HasTouchHandlers#addTouchCancelHandler(com.googlecode.mgwt.dom.client.event.touch.TouchCancelHandler) */ /** {@inheritDoc} */ @Override public HandlerRegistration addTouchCancelHandler(TouchCancelHandler handler) { return impl.addTouchCancelHandler(this, handler); } /* * (non-Javadoc) * @see com.googlecode.mgwt.dom.client.event.touch.HasTouchHandlers#addTouchEndHandler(com.googlecode.mgwt.dom.client.event.touch.TouchEndHandler) */ /** {@inheritDoc} */ @Override public HandlerRegistration addTouchEndHandler(TouchEndHandler handler) { return impl.addTouchEndHandler(this, handler); } /* * (non-Javadoc) * @see com.googlecode.mgwt.dom.client.event.touch.HasTouchHandlers#addTouchHandler(com.googlecode.mgwt.dom.client.event.touch.TouchHandler) */ /** {@inheritDoc} */ @Override public HandlerRegistration addTouchHandler(TouchHandler handler) { HandlerRegistrationCollection handlerRegistrationCollection = new HandlerRegistrationCollection(); handlerRegistrationCollection.addHandlerRegistration(addTouchCancelHandler(handler)); handlerRegistrationCollection.addHandlerRegistration(addTouchStartHandler(handler)); handlerRegistrationCollection.addHandlerRegistration(addTouchEndHandler(handler)); handlerRegistrationCollection.addHandlerRegistration(addTouchMoveHandler(handler)); return handlerRegistrationCollection; } |
File | Line |
---|---|
info/magnolia/ui/vaadin/ckeditor/MagnoliaCKEditorConfig.java | 50 |
info/magnolia/ui/vaadin/richtext/MagnoliaRichTextFieldConfig.java | 51 |
public class MagnoliaCKEditorConfig extends CKEditorConfig { private List<String> events = new ArrayList<>(); private Map<String, String> externalPlugins = new HashMap<>(); /** * Adds list of toolbar groups. Groups are placed in one * row if space allows. */ public void addToolbarLine(List<ToolbarGroup> toolbars) { Gson gson = new Gson(); String json = gson.toJson(toolbars); addCustomToolbarLine(json.substring(1, json.length() - 1)); } /** * Add CKEditor event name that server side will listen. * Only event names added to configuration will be listened. * * @param eventName This must match in client side. e.g: editor.fire('eventName') */ public void addListenedEvent(String eventName) { events.add(eventName); } public String[] getListenedEvents() { return events.toArray(new String[0]); } public void addExternalPlugin(String pluginName, String source) { externalPlugins.put(pluginName, source); } public Map<String, String> getExternalPlugins() { return externalPlugins; } |
File | Line |
---|---|
com/vaadin/v7/client/ui/VScrollTablePatched.java | 6811 |
com/vaadin/v7/client/ui/VTreeTablePatched.java | 385 |
description, td); } @Override protected void setCellWidth(int cellIx, int width) { if (isSpanColumns()) { if (showRowHeaders) { if (cellIx == 0) { super.setCellWidth(0, width); } else { // We need to recalculate the spanning TDs width for // every cellIx in order to support column resizing. calcAndSetSpanWidthOnCell(1); } } else { // Same as above. calcAndSetSpanWidthOnCell(0); } } else { super.setCellWidth(cellIx, width); } } private void calcAndSetSpanWidthOnCell(final int cellIx) { int spanWidth = 0; for (int ix = (showRowHeaders ? 1 : 0); ix < tHead .getVisibleCellCount(); ix++) { spanWidth += tHead.getHeaderCell(ix).getOffsetWidth(); } WidgetUtil.setWidthExcludingPaddingAndBorder( (Element) getElement().getChild(cellIx), spanWidth, 13, false); } } |
File | Line |
---|---|
info/magnolia/ui/vaadin/gwt/client/ckeditor/VMagnoliaCKEditorTextField.java | 57 |
info/magnolia/ui/vaadin/gwt/client/richtext/VMagnoliaRichTextField.java | 57 |
private VMagnoliaCKEditor editor; private List<String> pluginEvents; private ValueMap customPlugins; private boolean immediate; @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { // Make sure external plugins are assigned before the loading command. if (uidl.hasAttribute(VAR_SERVERPLUGINS)) { customPlugins = uidl.getMapAttribute(VAR_SERVERPLUGINS); } // list of plugin events that server is interested of handling. if (uidl.hasAttribute(VAR_EVENTNAMES)) { pluginEvents = Arrays.asList(uidl.getStringArrayAttribute(VAR_EVENTNAMES)); } if (uidl.hasAttribute(ATTR_IMMEDIATE)) { immediate = uidl.getBooleanAttribute(ATTR_IMMEDIATE); } super.updateFromUIDL(uidl, client); // Server wants to send an event to a plugin, we must do this after super value update. if (uidl.hasAttribute(VAR_FIRE_PLUGIN_EVENT) && this.editor != null) { this.editor.fire( uidl.getStringAttribute(VAR_FIRE_PLUGIN_EVENT), uidl.getStringAttribute(VAR_FIRE_PLUGIN_EVENT_VALUE) ); } } @Override protected CKEditor loadEditor(String inPageConfig) { |
File | Line |
---|---|
com/googlecode/mgwt/dom/client/recognizer/pinch/PinchRecognizer.java | 117 |
info/magnolia/ui/vaadin/gwt/client/pinch/MagnoliaPinchRecognizer.java | 129 |
Touch touch2 = event.getTouches().get(1); int left = offsetProvider.getLeft(); int top = offsetProvider.getTop(); int x1 = touch1.getPageX() - left; int y1 = touch1.getPageY() - top; int x2 = touch2.getPageX() - left; int y2 = touch2.getPageY() - top; double newDistance = Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2)); int x = (x1 + x2) / 2; int y = (y1 + y2) / 2; getEventPropagator().fireEvent(source, new PinchEvent(x, y, distance / newDistance)); |
File | Line |
---|---|
com/vaadin/v7/client/ui/VScrollTablePatched.java | 3866 |
com/vaadin/v7/client/ui/VScrollTablePatched.java | 4710 |
public void setHeaderCell(int index, HeaderCell cell) { if (cell.isEnabled()) { // we're moving the cell DOM.removeChild(tr, cell.getElement()); orphan(cell); visibleCells.remove(cell); } if (index < visibleCells.size()) { // insert to right slot DOM.insertChild(tr, cell.getElement(), index); adopt(cell); visibleCells.add(index, cell); } else if (index == visibleCells.size()) { // simply append DOM.appendChild(tr, cell.getElement()); adopt(cell); visibleCells.add(cell); } else { throw new RuntimeException( "Header cells must be appended in order"); } } public HeaderCell getHeaderCell(int index) { |
File | Line |
---|---|
info/magnolia/ui/vaadin/ckeditor/MagnoliaCKEditorTextField.java | 101 |
info/magnolia/ui/vaadin/richtext/MagnoliaRichTextField.java | 100 |
} @Override public void firePluginEvent(String event, String value) { fireEvent = event; fireEventValue = value; markAsDirty(); } @Override public void paintContent(PaintTarget target) throws PaintException { super.paintContent(target); if (serverPlugins != null) { target.addAttribute(VAR_SERVERPLUGINS, serverPlugins); } // tell client that server is interested of these events if (customEvents != null) { target.addAttribute(VAR_EVENTNAMES, customEvents); } // send event to plugin if (fireEvent != null && fireEventValue != null) { target.addAttribute(VAR_FIRE_PLUGIN_EVENT, fireEvent); target.addAttribute(VAR_FIRE_PLUGIN_EVENT_VALUE, fireEventValue); fireEvent = null; fireEventValue = null; } } @Override public void setHeight(float height, Unit unit) { |
File | Line |
---|---|
com/vaadin/v7/client/ui/VScrollTablePatched.java | 3508 |
com/vaadin/v7/client/ui/VScrollTablePatched.java | 4459 |
if (w == this) { break; } columnIndex++; } } final int cw = scrollBody.getColWidth(columnIndex); naturalWidth = (hw > cw ? hw : cw); } } /** * Detects the natural minimum width for the column of this header cell. * If column is resized by user or the width is defined by server the * actual width is returned. Else the natural min width is returned. * * @param columnIndex * column index hint, if -1 (unknown) it will be detected * * @return */ public int getNaturalColumnWidth(int columnIndex) { final int iw = columnIndex == getHierarchyColumnIndex() ? scrollBody.getMaxIndent() : 0; saveNaturalColumnWidthIfNotSaved(columnIndex); if (isDefinedWidth()) { if (iw > width) { return iw; } return width; } else { if (iw > naturalWidth) { // indent is temporary value, naturalWidth shouldn't be // updated return iw; } else { return naturalWidth; } } } public void setExpandRatio(float floatAttribute) { |