text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>DOM (GWT Javadoc)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Deprecated

Help

GWT 2.8.0-rc1

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.google.gwt.user.client

Class DOM

java.lang.Object

com.google.gwt.user.client.DOM

public class DOM
extends java.lang.Object

This class provides a set of static methods that allow you to manipulate the
 browser's Document Object Model (DOM). It contains methods for manipulating
 both elements and
 events.

Field Summary

Fields

Modifier and Type
Field and Description

(package private) static com.google.gwt.user.client.impl.DOMImpl
impl

Constructor Summary

Constructors

Constructor and Description

DOM()

Method Summary

All Methods Static Methods Concrete Methods Deprecated Methods

Modifier and Type
Method and Description

static void
addEventPreview(EventPreview preview)

Deprecated.

replaced by
             Event.addNativePreviewHandler(Event.NativePreviewHandler)

static void
appendChild(Element parent,
           Element child)

Appends one element to another's list of children.

static Element
asOld(Element elem)

Provided as a convenient way to upcast values statically typed as
 Element to Element.

static Element
clone(Element elem,
     boolean deep)

Clones an element.

static boolean
compare(Element elem1,
       Element elem2)

Deprecated.

Use identity comparison.

static Element
createAnchor()

Creates an HTML A element.

static Element
createButton()

Creates an HTML BUTTON element.

static Element
createCaption()

Creates an HTML CAPTION element.

static Element
createCol()

Creates an HTML COL element.

static Element
createColGroup()

Creates an HTML COLGROUP element.

static Element
createDiv()

Creates an HTML DIV element.

static Element
createElement(java.lang.String tagName)

Creates an HTML element.

static Element
createFieldSet()

Creates an HTML FIELDSET element.

static Element
createForm()

Creates an HTML FORM element.

static Element
createIFrame()

Creates an HTML IFRAME element.

static Element
createImg()

Creates an HTML IMG element.

static Element
createInputCheck()

Creates an HTML INPUT type='CHECK' element.

static Element
createInputPassword()

Creates an HTML INPUT type='PASSWORD' element.

static Element
createInputRadio(java.lang.String name)

Creates an HTML INPUT type='RADIO' element.

static Element
createInputText()

Creates an HTML INPUT type='TEXT' element.

static Element
createLabel()

Creates an HTML LABEL element.

static Element
createLegend()

Creates an HTML LEGEND element.

static Element
createOption()

Creates an HTML OPTION element.

static Element
createOptions()

Deprecated.

there is no "options" element; use createOption()
             instead

static Element
createSelect()

Creates a single-selection HTML SELECT element.

static Element
createSelect(boolean multiple)

Creates an HTML SELECT element.

static Element
createSpan()

Creates an HTML SPAN element.

static Element
createTable()

Creates an HTML TABLE element.

static Element
createTBody()

Creates an HTML TBODY element.

static Element
createTD()

Creates an HTML TD element.

static Element
createTextArea()

Creates an HTML TEXTAREA element.

static Element
createTFoot()

Creates an HTML TFOOT element.

static Element
createTH()

Creates an HTML TH element.

static Element
createTHead()

Creates an HTML THEAD element.

static Element
createTR()

Creates an HTML TR element.

static java.lang.String
createUniqueId()

Generates a unique DOM id.

static boolean
dispatchEvent(Event evt,
             Element elem)

This method is a similar to dispatchEvent(Event, Element, EventListener) but only
 dispatches if an event listener is set to element.

static void
dispatchEvent(Event evt,
             Element elem,
             EventListener listener)

This method is called directly by native code when any event is fired.

static void
eventCancelBubble(Event evt,
                 boolean cancel)

Cancels bubbling for the given event.

static boolean
eventGetAltKey(Event evt)

Deprecated.

Use NativeEvent.getAltKey() instead.

static int
eventGetButton(Event evt)

Deprecated.

Use NativeEvent.getButton() instead.

static int
eventGetClientX(Event evt)

Deprecated.

Use NativeEvent.getClientX() instead.

static int
eventGetClientY(Event evt)

Deprecated.

Use NativeEvent.getClientY() instead.

static boolean
eventGetCtrlKey(Event evt)

Deprecated.

Use NativeEvent.getCtrlKey() instead.

static Event
eventGetCurrentEvent()

Gets the current event that is being fired.

static Element
eventGetCurrentTarget(Event evt)

Gets the current target element of the given event.

static Element
eventGetFromElement(Event evt)

Gets the element from which the mouse pointer was moved (valid for
 Event.ONMOUSEOVER and Event.ONMOUSEOUT).

static int
eventGetKeyCode(Event evt)

Deprecated.

Use NativeEvent.getKeyCode() instead.

static boolean
eventGetMetaKey(Event evt)

Deprecated.

Use NativeEvent.getMetaKey() instead.

static int
eventGetMouseWheelVelocityY(Event evt)

Deprecated.

Use NativeEvent.getMouseWheelVelocityY() instead.

static boolean
eventGetRepeat(Event evt)

Deprecated.

not supported in any browser but IE

static int
eventGetScreenX(Event evt)

Deprecated.

Use NativeEvent.getScreenX() instead.

static int
eventGetScreenY(Event evt)

Deprecated.

Use NativeEvent.getScreenY() instead.

static boolean
eventGetShiftKey(Event evt)

Deprecated.

Use NativeEvent.getShiftKey() instead.

static Element
eventGetTarget(Event evt)

Returns the element that was the actual target of the given event.

static Element
eventGetToElement(Event evt)

Gets the element to which the mouse pointer was moved (only valid for
 Event.ONMOUSEOUT and Event.ONMOUSEOVER).

static int
eventGetType(Event evt)

Gets the enumerated type of this event (as defined in Event).

static java.lang.String
eventGetTypeString(Event evt)

Deprecated.

Use NativeEvent.getType() instead.

static void
eventPreventDefault(Event evt)

Deprecated.

Use NativeEvent.preventDefault() instead.

static void
eventSetKeyCode(Event evt,
               char key)

Deprecated.

this method only works in IE and should not have been added to
             the API

static java.lang.String
eventToString(Event evt)

Deprecated.

Use NativeEvent.getString() instead.

static int
getAbsoluteLeft(Element elem)

Deprecated.

Use Element.getAbsoluteLeft() instead.

static int
getAbsoluteTop(Element elem)

Deprecated.

Use Element.getAbsoluteTop() instead.

static java.lang.String
getAttribute(Element elem,
            java.lang.String attr)

Deprecated.

Use the more appropriately named
             Element.getPropertyString(String) instead.

static boolean
getBooleanAttribute(Element elem,
                   java.lang.String attr)

Deprecated.

Use the more appropriately named
             Element.getPropertyBoolean(String) instead.

static Element
getCaptureElement()

Gets the element that currently has mouse capture.

static Element
getChild(Element parent,
        int index)

Gets an element's n-th child element.

static int
getChildCount(Element parent)

Gets the number of child elements present in a given parent element.

static int
getChildIndex(Element parent,
             Element child)

Gets the index of a given child element within its parent.

static java.lang.String
getElementAttribute(Element elem,
                   java.lang.String attr)

Deprecated.

Use Element.getAttribute(String) instead.

static Element
getElementById(java.lang.String id)

Gets the element associated with the given unique id within the entire
 document.

static java.lang.String
getElementProperty(Element elem,
                  java.lang.String prop)

Deprecated.

Use Element#getProperty(String) instead.

static boolean
getElementPropertyBoolean(Element elem,
                         java.lang.String prop)

Deprecated.

Use Element.getPropertyBoolean(String) instead.

static int
getElementPropertyInt(Element elem,
                     java.lang.String prop)

Deprecated.

Use Element.getPropertyInt(String) instead.

static EventListener
getEventListener(Element elem)

Gets the EventListener that will receive events for the given
 element.

static int
getEventsSunk(Element elem)

Gets the current set of events sunk by a given element.

static Element
getFirstChild(Element elem)

Gets the first child element of the given element.

static java.lang.String
getImgSrc(Element img)

Gets the src attribute of an img element.

static java.lang.String
getInnerHTML(Element elem)

Deprecated.

Use Element.getInnerHTML() instead.

static java.lang.String
getInnerText(Element elem)

Deprecated.

Use Element.getInnerText() instead.

static int
getIntAttribute(Element elem,
               java.lang.String attr)

Deprecated.

Use the more appropriately named
             Element.getPropertyInt(String) instead.

static int
getIntStyleAttribute(Element elem,
                    java.lang.String attr)

Gets an integer attribute on a given element's style.

static Element
getNextSibling(Element elem)

Gets an element's next sibling element.

static Element
getParent(Element elem)

Gets an element's parent element.

static java.lang.String
getStyleAttribute(Element elem,
                 java.lang.String attr)

Deprecated.

Use Element.getStyle() and
             Style#getProperty(String) instead.

static void
insertBefore(Element parent,
            Element child,
            Element before)

Inserts an element as a child of the given parent element, before another
 child of that parent.

static void
insertChild(Element parent,
           Element child,
           int index)

Inserts an element as a child of the given parent element.

static void
insertListItem(Element selectElem,
              java.lang.String item,
              java.lang.String value,
              int index)

Creates an <option> element and inserts it as a child of
 the specified <select> element.

static boolean
isOrHasChild(Element parent,
            Element child)

Deprecated.

Use Element#isOrHasChild(Element) instead.

(package private) static void
maybeInitializeEventSystem()

Initialize the event system if it has not already been initialized.

static boolean
previewEvent(Event evt)

This method is called directly by native code when event preview is being
 used.

static void
releaseCapture(Element elem)

Releases mouse/touch/gesture capture on the given element.

static void
removeChild(Element parent,
           Element child)

Deprecated.

Use Element#removeChild(Element) instead.

static void
removeElementAttribute(Element elem,
                      java.lang.String attr)

Deprecated.

Use Element.removeAttribute(String) instead.

static void
removeEventPreview(EventPreview preview)

Deprecated.

use HandlerRegistration
             returned from
             Event.addNativePreviewHandler(Event.NativePreviewHandler)

static void
scrollIntoView(Element elem)

Deprecated.

Use Element.scrollIntoView() instead.

static void
setAttribute(Element elem,
            java.lang.String attr,
            java.lang.String value)

Deprecated.

Use the more appropriately named
             Element.setPropertyString(String, String) instead.

static void
setBooleanAttribute(Element elem,
                   java.lang.String attr,
                   boolean value)

Deprecated.

Use the more appropriately named
             Element.setPropertyBoolean(String, boolean)
             instead.

static void
setCapture(Element elem)

Sets mouse/touch/gesture capture on the given element.

static void
setElementAttribute(Element elem,
                   java.lang.String attr,
                   java.lang.String value)

Deprecated.

Use Element.setAttribute(String, String) instead.

static void
setElementProperty(Element elem,
                  java.lang.String prop,
                  java.lang.String value)

Deprecated.

Use Element.setPropertyString(String, String) instead.

static void
setElementPropertyBoolean(Element elem,
                         java.lang.String prop,
                         boolean value)

Deprecated.

Use Element.setPropertyBoolean(String, boolean) instead.

static void
setElementPropertyInt(Element elem,
                     java.lang.String prop,
                     int value)

Deprecated.

Use Element.setPropertyInt(String, int) instead.

static void
setEventListener(Element elem,
                EventListener listener)

Sets the EventListener to receive events for the given element.

static void
setImgSrc(Element img,
         java.lang.String src)

Sets the src attribute of an img element.

static void
setInnerHTML(Element elem,
            java.lang.String html)

Deprecated.

Use Element.setInnerHTML(String) instead.

static void
setInnerText(Element elem,
            java.lang.String text)

Deprecated.

Use Element.setInnerText(String) instead.

static void
setIntAttribute(Element elem,
               java.lang.String attr,
               int value)

Deprecated.

Use the more appropriately named
             Element.setPropertyInt(String, int) instead.

static void
setIntStyleAttribute(Element elem,
                    java.lang.String attr,
                    int value)

Sets an integer attribute on the given element's style.

static void
setOptionText(Element select,
             java.lang.String text,
             int index)

Sets the option text of the given select object.

static void
setStyleAttribute(Element elem,
                 java.lang.String attr,
                 java.lang.String value)

Deprecated.

Use Element.getStyle() and
             Style#setProperty(String, String) instead.

static void
sinkBitlessEvent(Element elem,
                java.lang.String eventTypeName)

Sinks a named event.

static void
sinkEvents(Element elem,
          int eventBits)

Sets the current set of events sunk by a given element.

static java.lang.String
toString(Element elem)

Deprecated.

Use Element.getString() instead.

static int
windowGetClientHeight()

Deprecated.

As of GWT 1.5, replaced by Window.getClientHeight()

static int
windowGetClientWidth()

Deprecated.

As of GWT 1.5, replaced by Window.getClientWidth()

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

impl

static final com.google.gwt.user.client.impl.DOMImpl impl

Constructor Detail

DOM

public DOM()

Method Detail

addEventPreview

@Deprecated
public static void addEventPreview(EventPreview preview)

Deprecated. replaced by
             Event.addNativePreviewHandler(Event.NativePreviewHandler)

Adds an event preview to the preview stack. As long as this preview remains
 on the top of the stack, it will receive all events before they are fired
 to their listeners. Note that the event preview will receive all
 events, including those received due to bubbling, whereas normal event
 handlers only receive explicitly sunk events.

Parameters:

preview - the event preview to be added to the stack.

appendChild

public static void appendChild(Element parent,
                               Element child)

Appends one element to another's list of children.

 If the child element is a PotentialElement, it is first
 resolved.

Parameters:

parent - the parent element

child - its new child

See Also:

PotentialElement.resolve(Element)

clone

public static Element clone(Element elem,
                            boolean deep)

Clones an element.

Parameters:

elem - the element to be cloned

deep - should children be cloned as well?

compare

@Deprecated
public static boolean compare(Element elem1,
                                          Element elem2)

Deprecated. Use identity comparison.

Compares two elements for equality. Note that this method is now deprecated
 because reference identity accurately reports equality.

Parameters:

elem1 - the first element to be compared

elem2 - the second element to be compared

Returns:

true if they are in fact the same element

createAnchor

public static Element createAnchor()

Creates an HTML A element.

Returns:

the newly-created element

createButton

public static Element createButton()

Creates an HTML BUTTON element.

Returns:

the newly-created element

createCaption

public static Element createCaption()

Creates an HTML CAPTION element.

Returns:

the newly-created element

createCol

public static Element createCol()

Creates an HTML COL element.

Returns:

the newly-created element

createColGroup

public static Element createColGroup()

Creates an HTML COLGROUP element.

Returns:

the newly-created element

createDiv

public static Element createDiv()

Creates an HTML DIV element.

Returns:

the newly-created element

createElement

public static Element createElement(java.lang.String tagName)

Creates an HTML element.

Parameters:

tagName - the HTML tag of the element to be created

Returns:

the newly-created element

createFieldSet

public static Element createFieldSet()

Creates an HTML FIELDSET element.

Returns:

the newly-created element

createForm

public static Element createForm()

Creates an HTML FORM element.

Returns:

the newly-created element

createIFrame

public static Element createIFrame()

Creates an HTML IFRAME element.

Returns:

the newly-created element

createImg

public static Element createImg()

Creates an HTML IMG element.

Returns:

the newly-created element

createInputCheck

public static Element createInputCheck()

Creates an HTML INPUT type='CHECK' element.

Returns:

the newly-created element

createInputPassword

public static Element createInputPassword()

Creates an HTML INPUT type='PASSWORD' element.

Returns:

the newly-created element

createInputRadio

public static Element createInputRadio(java.lang.String name)

Creates an HTML INPUT type='RADIO' element.

Parameters:

name - the name of the group with which this radio button will be
          associated

Returns:

the newly-created element

createInputText

public static Element createInputText()

Creates an HTML INPUT type='TEXT' element.

Returns:

the newly-created element

createLabel

public static Element createLabel()

Creates an HTML LABEL element.

Returns:

the newly-created element

createLegend

public static Element createLegend()

Creates an HTML LEGEND element.

Returns:

the newly-created element

createOption

public static Element createOption()

Creates an HTML OPTION element.

Returns:

the newly-created element

createOptions

@Deprecated
public static Element createOptions()

Deprecated. there is no "options" element; use createOption()
             instead

Creates an HTML OPTIONS element.

Returns:

the newly-created element

createSelect

public static Element createSelect()

Creates a single-selection HTML SELECT element. Equivalent to

 createSelect(false)

Returns:

the newly-created element

createSelect

public static Element createSelect(boolean multiple)

Creates an HTML SELECT element.

Parameters:

multiple - true if multiple selection of options is allowed

Returns:

the newly-created element

createSpan

public static Element createSpan()

Creates an HTML SPAN element.

Returns:

the newly-created element

createTable

public static Element createTable()

Creates an HTML TABLE element.

Returns:

the newly-created element

createTBody

public static Element createTBody()

Creates an HTML TBODY element.

Returns:

the newly-created element

createTD

public static Element createTD()

Creates an HTML TD element.

Returns:

the newly-created element

createTextArea

public static Element createTextArea()

Creates an HTML TEXTAREA element.

Returns:

the newly-created element

createTFoot

public static Element createTFoot()

Creates an HTML TFOOT element.

Returns:

the newly-created element

createTH

public static Element createTH()

Creates an HTML TH element.

Returns:

the newly-created element

createTHead

public static Element createTHead()

Creates an HTML THEAD element.

Returns:

the newly-created element

createTR

public static Element createTR()

Creates an HTML TR element.

Returns:

the newly-created element

createUniqueId

public static java.lang.String createUniqueId()

Generates a unique DOM id. The id is of the form "gwt-id-<unique integer>".

Returns:

a unique DOM id

eventCancelBubble

public static void eventCancelBubble(Event evt,
                                     boolean cancel)

Cancels bubbling for the given event. This will stop the event from being
 propagated to parent elements.

Parameters:

evt - the event on which to cancel bubbling

cancel - true to cancel bubbling

eventGetAltKey

@Deprecated
public static boolean eventGetAltKey(Event evt)

Deprecated. Use NativeEvent.getAltKey() instead.

Gets whether the ALT key was depressed when the given event occurred.

Parameters:

evt - the event to be tested

Returns:

true if ALT was depressed when the event occurred

eventGetButton

@Deprecated
public static int eventGetButton(Event evt)

Deprecated. Use NativeEvent.getButton() instead.

Gets the mouse buttons that were depressed when the given event occurred.

Parameters:

evt - the event to be tested

Returns:

a bit-field, defined by NativeEvent.BUTTON_LEFT,
         NativeEvent.BUTTON_MIDDLE, and NativeEvent.BUTTON_RIGHT

eventGetClientX

@Deprecated
public static int eventGetClientX(Event evt)

Deprecated. Use NativeEvent.getClientX() instead.

Gets the mouse x-position within the browser window's client area.

Parameters:

evt - the event to be tested

Returns:

the mouse x-position

eventGetClientY

@Deprecated
public static int eventGetClientY(Event evt)

Deprecated. Use NativeEvent.getClientY() instead.

Gets the mouse y-position within the browser window's client area.

Parameters:

evt - the event to be tested

Returns:

the mouse y-position

eventGetCtrlKey

@Deprecated
public static boolean eventGetCtrlKey(Event evt)

Deprecated. Use NativeEvent.getCtrlKey() instead.

Gets whether the CTRL key was depressed when the given event occurred.

Parameters:

evt - the event to be tested

Returns:

true if CTRL was depressed when the event occurred

eventGetCurrentEvent

public static Event eventGetCurrentEvent()

Gets the current event that is being fired. The current event is only
 available within the lifetime of the onBrowserEvent function. Once the
 onBrowserEvent method returns, the current event is reset to null.

Returns:

the current event

eventGetCurrentTarget

public static Element eventGetCurrentTarget(Event evt)

Gets the current target element of the given event. This is the element
 whose listener fired last, not the element which fired the event initially.

Parameters:

evt - the event

Returns:

the event's current target element

See Also:

eventGetTarget(Event)

eventGetFromElement

public static Element eventGetFromElement(Event evt)

Gets the element from which the mouse pointer was moved (valid for
 Event.ONMOUSEOVER and Event.ONMOUSEOUT).

Parameters:

evt - the event to be tested

Returns:

the element from which the mouse pointer was moved

eventGetKeyCode

@Deprecated
public static int eventGetKeyCode(Event evt)

Deprecated. Use NativeEvent.getKeyCode() instead.

Gets the key code associated with this event.

 For Event.ONKEYPRESS, this method returns the Unicode value of the
 character generated. For Event.ONKEYDOWN and Event.ONKEYUP,
 it returns the code associated with the physical key.

Parameters:

evt - the event to be tested

Returns:

the Unicode character or key code.

See Also:

KeyboardListener

eventGetMetaKey

@Deprecated
public static boolean eventGetMetaKey(Event evt)

Deprecated. Use NativeEvent.getMetaKey() instead.

Gets whether the META key was depressed when the given event occurred.

Parameters:

evt - the event to be tested

Returns:

true if META was depressed when the event occurred

eventGetMouseWheelVelocityY

@Deprecated
public static int eventGetMouseWheelVelocityY(Event evt)

Deprecated. Use NativeEvent.getMouseWheelVelocityY() instead.

Gets the velocity of the mouse wheel associated with the event along the Y
 axis.

 The velocity of the event is an artificial measurement for relative
 comparisons of wheel activity. It is affected by some non-browser factors,
 including choice of input hardware and mouse acceleration settings. The
 sign of the velocity measurement agrees with the screen coordinate system;
 negative values are towards the origin and positive values are away from
 the origin. Standard scrolling speed is approximately ten units per event.

Parameters:

evt - the event to be examined.

Returns:

The velocity of the mouse wheel.

eventGetRepeat

@Deprecated
public static boolean eventGetRepeat(Event evt)

Deprecated. not supported in any browser but IE

Gets the key-repeat state of this event. Only IE supports this attribute.

Parameters:

evt - the event to be tested

Returns:

true if this key event was an auto-repeat

eventGetScreenX

@Deprecated
public static int eventGetScreenX(Event evt)

Deprecated. Use NativeEvent.getScreenX() instead.

Gets the mouse x-position on the user's display.

Parameters:

evt - the event to be tested

Returns:

the mouse x-position

eventGetScreenY

@Deprecated
public static int eventGetScreenY(Event evt)

Deprecated. Use NativeEvent.getScreenY() instead.

Gets the mouse y-position on the user's display.

Parameters:

evt - the event to be tested

Returns:

the mouse y-position

eventGetShiftKey

@Deprecated
public static boolean eventGetShiftKey(Event evt)

Deprecated. Use NativeEvent.getShiftKey() instead.

Gets whether the shift key was depressed when the given event occurred.

Parameters:

evt - the event to be tested

Returns:

true if shift was depressed when the event occurred

eventGetTarget

public static Element eventGetTarget(Event evt)

Returns the element that was the actual target of the given event.

Parameters:

evt - the event to be tested

Returns:

the target element

eventGetToElement

public static Element eventGetToElement(Event evt)

Gets the element to which the mouse pointer was moved (only valid for
 Event.ONMOUSEOUT and Event.ONMOUSEOVER).

Parameters:

evt - the event to be tested

Returns:

the element to which the mouse pointer was moved

eventGetType

public static int eventGetType(Event evt)

Gets the enumerated type of this event (as defined in Event).

Parameters:

evt - the event to be tested

Returns:

the event's enumerated type, or -1 if not defined

eventGetTypeString

@Deprecated
public static java.lang.String eventGetTypeString(Event evt)

Deprecated. Use NativeEvent.getType() instead.

Gets the type of the given event as a string.

Parameters:

evt - the event to be tested

Returns:

the event's type name

eventPreventDefault

@Deprecated
public static void eventPreventDefault(Event evt)

Deprecated. Use NativeEvent.preventDefault() instead.

Prevents the browser from taking its default action for the given event.

Parameters:

evt - the event whose default action is to be prevented

eventSetKeyCode

@Deprecated
public static void eventSetKeyCode(Event evt,
                                               char key)

Deprecated. this method only works in IE and should not have been added to
             the API

Sets the key code associated with the given keyboard event.

Parameters:

evt - the event whose key code is to be set

key - the new key code

eventToString

@Deprecated
public static java.lang.String eventToString(Event evt)

Deprecated. Use NativeEvent.getString() instead.

Returns a stringized version of the event. This string is for debugging
 purposes and will NOT be consistent on different browsers.

Parameters:

evt - the event to stringize

Returns:

a string form of the event

getAbsoluteLeft

@Deprecated
public static int getAbsoluteLeft(Element elem)

Deprecated. Use Element.getAbsoluteLeft() instead.

Gets an element's absolute left coordinate in the document's coordinate
 system.

Parameters:

elem - the element to be measured

Returns:

the element's absolute left coordinate

getAbsoluteTop

@Deprecated
public static int getAbsoluteTop(Element elem)

Deprecated. Use Element.getAbsoluteTop() instead.

Gets an element's absolute top coordinate in the document's coordinate
 system.

Parameters:

elem - the element to be measured

Returns:

the element's absolute top coordinate

getAttribute

@Deprecated
public static java.lang.String getAttribute(Element elem,
                                                        java.lang.String attr)

Deprecated. Use the more appropriately named
             Element.getPropertyString(String) instead.

Gets any named property from an element, as a string.

Parameters:

elem - the element whose property is to be retrieved

attr - the name of the property

Returns:

the property's value

getBooleanAttribute

@Deprecated
public static boolean getBooleanAttribute(Element elem,
                                                      java.lang.String attr)

Deprecated. Use the more appropriately named
             Element.getPropertyBoolean(String) instead.

Gets a boolean property on the given element.

Parameters:

elem - the element whose property is to be set

attr - the name of the property to be set

Returns:

the property's value as a boolean

getCaptureElement

public static Element getCaptureElement()

Gets the element that currently has mouse capture.

Returns:

a handle to the capture element, or null if none
         exists

getChild

public static Element getChild(Element parent,
                               int index)

Gets an element's n-th child element.

Parameters:

parent - the element whose child is to be retrieved

index - the index of the child element

Returns:

the n-th child element

getChildCount

public static int getChildCount(Element parent)

Gets the number of child elements present in a given parent element.

Parameters:

parent - the element whose children are to be counted

Returns:

the number of children

getChildIndex

public static int getChildIndex(Element parent,
                                Element child)

Gets the index of a given child element within its parent.

Parameters:

parent - the parent element

child - the child element

Returns:

the child's index within its parent, or -1 if it is
         not a child of the given parent

getElementAttribute

@Deprecated
public static java.lang.String getElementAttribute(Element elem,
                                                               java.lang.String attr)

Deprecated. Use Element.getAttribute(String) instead.

Gets the named attribute from the element.

Parameters:

elem - the element whose property is to be retrieved

attr - the name of the attribute

Returns:

the value of the attribute

getElementById

public static Element getElementById(java.lang.String id)

Gets the element associated with the given unique id within the entire
 document.

Parameters:

id - the id whose associated element is to be retrieved

Returns:

the associated element, or null if none is found

getElementProperty

@Deprecated
public static java.lang.String getElementProperty(Element elem,
                                                              java.lang.String prop)

Deprecated. Use Element#getProperty(String) instead.

Gets any named property from an element, as a string.

Parameters:

elem - the element whose property is to be retrieved

prop - the name of the property

Returns:

the property's value

getElementPropertyBoolean

@Deprecated
public static boolean getElementPropertyBoolean(Element elem,
                                                            java.lang.String prop)

Deprecated. Use Element.getPropertyBoolean(String) instead.

Gets any named property from an element, as a boolean.

Parameters:

elem - the element whose property is to be retrieved

prop - the name of the property

Returns:

the property's value as a boolean

getElementPropertyInt

@Deprecated
public static int getElementPropertyInt(Element elem,
                                                    java.lang.String prop)

Deprecated. Use Element.getPropertyInt(String) instead.

Gets any named property from an element, as an int.

Parameters:

elem - the element whose property is to be retrieved

prop - the name of the property

Returns:

the property's value as an int

getEventListener

public static EventListener getEventListener(Element elem)

Gets the EventListener that will receive events for the given
 element. Only one such listener may exist for a single element.

Parameters:

elem - the element whose listener is to be set

Returns:

the element's event listener

getEventsSunk

public static int getEventsSunk(Element elem)

Gets the current set of events sunk by a given element.

Parameters:

elem - the element whose events are to be retrieved

Returns:

a bitfield describing the events sunk on this element (its possible
         values are described in Event)

getFirstChild

public static Element getFirstChild(Element elem)

Gets the first child element of the given element.

Parameters:

elem - the element whose child is to be retrieved

Returns:

the child element

getImgSrc

public static java.lang.String getImgSrc(Element img)

Gets the src attribute of an img element. This method is paired with
 setImgSrc(Element, String) so that it always returns the correct
 url.

Parameters:

img - a non-null img whose src attribute is to be read.

Returns:

the src url of the img

getInnerHTML

@Deprecated
public static java.lang.String getInnerHTML(Element elem)

Deprecated. Use Element.getInnerHTML() instead.

Gets an HTML representation of an element's children.

Parameters:

elem - the element whose HTML is to be retrieved

Returns:

the HTML representation of the element's children

getInnerText

@Deprecated
public static java.lang.String getInnerText(Element elem)

Deprecated. Use Element.getInnerText() instead.

Gets the text contained within an element. If the element has child
 elements, only the text between them will be retrieved.

Parameters:

elem - the element whose inner text is to be retrieved

Returns:

the text inside this element

getIntAttribute

@Deprecated
public static int getIntAttribute(Element elem,
                                              java.lang.String attr)

Deprecated. Use the more appropriately named
             Element.getPropertyInt(String) instead.

Gets an integer property on a given element.

Parameters:

elem - the element whose property is to be retrieved

attr - the name of the property to be retrieved

Returns:

the property's value as an integer

getIntStyleAttribute

public static int getIntStyleAttribute(Element elem,
                                       java.lang.String attr)

Gets an integer attribute on a given element's style.

Parameters:

elem - the element whose style attribute is to be retrieved

attr - the name of the attribute to be retrieved

Returns:

the style attribute's value as an integer

getNextSibling

public static Element getNextSibling(Element elem)

Gets an element's next sibling element.

Parameters:

elem - the element whose sibling is to be retrieved

Returns:

the sibling element

getParent

public static Element getParent(Element elem)

Gets an element's parent element.

Parameters:

elem - the element whose parent is to be retrieved

Returns:

the parent element

getStyleAttribute

@Deprecated
public static java.lang.String getStyleAttribute(Element elem,
                                                             java.lang.String attr)

Deprecated. Use Element.getStyle() and
             Style#getProperty(String) instead.

Gets an attribute of the given element's style.

Parameters:

elem - the element whose style attribute is to be retrieved

attr - the name of the style attribute to be retrieved

Returns:

the style attribute's value

insertBefore

public static void insertBefore(Element parent,
                                Element child,
                                Element before)

Inserts an element as a child of the given parent element, before another
 child of that parent.

 If the child element is a PotentialElement, it is first
 resolved.

Parameters:

parent - the parent element

child - the child element to add to parent

before - an existing child element of parent before which
          child will be inserted

See Also:

PotentialElement.resolve(Element)

insertChild

public static void insertChild(Element parent,
                               Element child,
                               int index)

Inserts an element as a child of the given parent element.

 If the child element is a PotentialElement, it is first
 resolved.

Parameters:

parent - the parent element

child - the child element to add to parent

index - the index before which the child will be inserted (any value
          greater than the number of existing children will cause the child
          to be appended)

See Also:

PotentialElement.resolve(Element)

insertListItem

public static void insertListItem(Element selectElem,
                                  java.lang.String item,
                                  java.lang.String value,
                                  int index)

Creates an <option> element and inserts it as a child of
 the specified <select> element. If the index is less
 than zero, or greater than or equal to the length of the list, then the
 option element will be appended to the end of the list.

Parameters:

selectElem - the <select> element

item - the text of the new item; cannot be null

value - the value attribute for the new
          <option>; cannot be null

index - the index at which to insert the child

isOrHasChild

@Deprecated
public static boolean isOrHasChild(Element parent,
                                               Element child)

Deprecated. Use Element#isOrHasChild(Element) instead.

Determine whether one element is equal to, or the child of, another.

Parameters:

parent - the potential parent element

child - the potential child element

Returns:

true if the relationship holds

releaseCapture

public static void releaseCapture(Element elem)

Releases mouse/touch/gesture capture on the given element. Calling this
 method has no effect if the element does not currently have
 mouse/touch/gesture capture.

Parameters:

elem - the element to release capture

See Also:

setCapture(Element)

removeChild

@Deprecated
public static void removeChild(Element parent,
                                           Element child)

Deprecated. Use Element#removeChild(Element) instead.

Removes a child element from the given parent element.

Parameters:

parent - the parent element

child - the child element to be removed

removeElementAttribute

@Deprecated
public static void removeElementAttribute(Element elem,
                                                      java.lang.String attr)

Deprecated. Use Element.removeAttribute(String) instead.

Removes the named attribute from the given element.

Parameters:

elem - the element whose attribute is to be removed

attr - the name of the element to remove

removeEventPreview

@Deprecated
public static void removeEventPreview(EventPreview preview)

Deprecated. use HandlerRegistration
             returned from
             Event.addNativePreviewHandler(Event.NativePreviewHandler)

Removes an element from the preview stack. This element will no longer
 capture events, though any preview underneath it will begin to do so.

Parameters:

preview - the event preview to be removed from the stack

scrollIntoView

@Deprecated
public static void scrollIntoView(Element elem)

Deprecated. Use Element.scrollIntoView() instead.

Scrolls the given element into view.

 This method crawls up the DOM hierarchy, adjusting the scrollLeft and
 scrollTop properties of each scrollable element to ensure that the
 specified element is completely in view. It adjusts each scroll position by
 the minimum amount necessary.

Parameters:

elem - the element to be made visible

setAttribute

@Deprecated
public static void setAttribute(Element elem,
                                            java.lang.String attr,
                                            java.lang.String value)

Deprecated. Use the more appropriately named
             Element.setPropertyString(String, String) instead.

Sets a property on the given element.

Parameters:

elem - the element whose property is to be set

attr - the name of the property to be set

value - the new property value

setBooleanAttribute

@Deprecated
public static void setBooleanAttribute(Element elem,
                                                   java.lang.String attr,
                                                   boolean value)

Deprecated. Use the more appropriately named
             Element.setPropertyBoolean(String, boolean)
             instead.

Sets a boolean property on the given element.

Parameters:

elem - the element whose property is to be set

attr - the name of the property to be set

value - the property's new boolean value

setCapture

public static void setCapture(Element elem)

Sets mouse/touch/gesture capture on the given element. This element will
 directly receive all mouse events until releaseCapture(Element) is
 called on it.

Parameters:

elem - the element on which to set mouse/touch/gesture capture

setElementAttribute

@Deprecated
public static void setElementAttribute(Element elem,
                                                   java.lang.String attr,
                                                   java.lang.String value)

Deprecated. Use Element.setAttribute(String, String) instead.

Sets an attribute on a given element.

Parameters:

elem - element whose attribute is to be set

attr - the name of the attribute

value - the value to which the attribute should be set

setElementProperty

@Deprecated
public static void setElementProperty(Element elem,
                                                  java.lang.String prop,
                                                  java.lang.String value)

Deprecated. Use Element.setPropertyString(String, String) instead.

Sets a property on the given element.

Parameters:

elem - the element whose property is to be set

prop - the name of the property to be set

value - the new property value

setElementPropertyBoolean

@Deprecated
public static void setElementPropertyBoolean(Element elem,
                                                         java.lang.String prop,
                                                         boolean value)

Deprecated. Use Element.setPropertyBoolean(String, boolean) instead.

Sets a boolean property on the given element.

Parameters:

elem - the element whose property is to be set

prop - the name of the property to be set

value - the new property value as a boolean

setElementPropertyInt

@Deprecated
public static void setElementPropertyInt(Element elem,
                                                     java.lang.String prop,
                                                     int value)

Deprecated. Use Element.setPropertyInt(String, int) instead.

Sets an int property on the given element.

Parameters:

elem - the element whose property is to be set

prop - the name of the property to be set

value - the new property value as an int

setEventListener

public static void setEventListener(Element elem,
                                    EventListener listener)

Sets the EventListener to receive events for the given element.
 Only one such listener may exist for a single element.

Parameters:

elem - the element whose listener is to be set

listener - the listener to receive events

setImgSrc

public static void setImgSrc(Element img,
                             java.lang.String src)

Sets the src attribute of an img element. This method ensures that imgs
 only ever have their contents requested one single time from the server.

Parameters:

img - a non-null img whose src attribute will be set.

src - a non-null url for the img

setInnerHTML

@Deprecated
public static void setInnerHTML(Element elem,
                                            java.lang.String html)

Deprecated. Use Element.setInnerHTML(String) instead.

Sets the HTML contained within an element.

Parameters:

elem - the element whose inner HTML is to be set

html - the new html

setInnerText

@Deprecated
public static void setInnerText(Element elem,
                                            java.lang.String text)

Deprecated. Use Element.setInnerText(String) instead.

Sets the text contained within an element. If the element already has
 children, they will be destroyed.

Parameters:

elem - the element whose inner text is to be set

text - the new text

setIntAttribute

@Deprecated
public static void setIntAttribute(Element elem,
                                               java.lang.String attr,
                                               int value)

Deprecated. Use the more appropriately named
             Element.setPropertyInt(String, int) instead.

Sets an integer property on the given element.

Parameters:

elem - the element whose property is to be set

attr - the name of the property to be set

value - the property's new integer value

setIntStyleAttribute

public static void setIntStyleAttribute(Element elem,
                                        java.lang.String attr,
                                        int value)

Sets an integer attribute on the given element's style.

Parameters:

elem - the element whose style attribute is to be set

attr - the name of the style attribute to be set

value - the style attribute's new integer value

setOptionText

public static void setOptionText(Element select,
                                 java.lang.String text,
                                 int index)

Sets the option text of the given select object.

Parameters:

select - the select object whose option text is being set

text - the text to set

index - the index of the option whose text should be set

setStyleAttribute

@Deprecated
public static void setStyleAttribute(Element elem,
                                                 java.lang.String attr,
                                                 java.lang.String value)

Deprecated. Use Element.getStyle() and
             Style#setProperty(String, String) instead.

Sets an attribute on the given element's style.

Parameters:

elem - the element whose style attribute is to be set

attr - the name of the style attribute to be set

value - the style attribute's new value

sinkBitlessEvent

public static void sinkBitlessEvent(Element elem,
                                    java.lang.String eventTypeName)

Sinks a named event. Events will be fired to the nearest
 EventListener specified on any of the element's parents.

Parameters:

elem - the element whose events are to be retrieved

eventTypeName - name of the event to sink on this element

sinkEvents

public static void sinkEvents(Element elem,
                              int eventBits)

Sets the current set of events sunk by a given element. These events will
 be fired to the nearest EventListener specified on any of the
 element's parents.

Parameters:

elem - the element whose events are to be retrieved

eventBits - a bitfield describing the events sunk on this element (its
          possible values are described in Event)

toString

@Deprecated
public static java.lang.String toString(Element elem)

Deprecated. Use Element.getString() instead.

Returns a stringized version of the element. This string is for debugging
 purposes and will NOT be consistent on different browsers.

Parameters:

elem - the element to stringize

Returns:

a string form of the element

windowGetClientHeight

@Deprecated
public static int windowGetClientHeight()

Deprecated. As of GWT 1.5, replaced by Window.getClientHeight()

windowGetClientWidth

@Deprecated
public static int windowGetClientWidth()

Deprecated. As of GWT 1.5, replaced by Window.getClientWidth()

dispatchEvent

public static void dispatchEvent(Event evt,
                                 Element elem,
                                 EventListener listener)

This method is called directly by native code when any event is fired.

Parameters:

evt - the handle to the event being fired.

elem - the handle to the element that received the event.

listener - the listener associated with the element that received the
          event.

dispatchEvent

public static boolean dispatchEvent(Event evt,
                                    Element elem)

This method is a similar to dispatchEvent(Event, Element, EventListener) but only
 dispatches if an event listener is set to element.

Parameters:

evt - the handle to the event being fired.

elem - the handle to the element that received the event.

Returns:

true if the event was dispatched

maybeInitializeEventSystem

static void maybeInitializeEventSystem()

Initialize the event system if it has not already been initialized.

previewEvent

public static boolean previewEvent(Event evt)

This method is called directly by native code when event preview is being
 used.

Parameters:

evt - a handle to the event being previewed

Returns:

false to cancel the event

asOld

public static Element asOld(Element elem)

Provided as a convenient way to upcast values statically typed as
 Element to Element.
 For easier upgrades in the future, it's recommended that this function
 only be called within a return statement.

 Does not throw a NullPointerException if elem is null.

Skip navigation links

Overview

Package

Class

Use

Deprecated

Help

GWT 2.8.0-rc1

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
/*
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */
package dk.statsbiblioteket.summa.common.filter.object;

import dk.statsbiblioteket.summa.common.Record;
import dk.statsbiblioteket.summa.common.configuration.Configuration;
import dk.statsbiblioteket.summa.common.filter.Filter;
import dk.statsbiblioteket.summa.common.filter.Payload;
import junit.framework.TestCase;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.rmi.RemoteException;
import java.util.NoSuchElementException;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Test-class that takes a stream and transforms received data into Records.
 */
public class DummyStreamToRecords extends TestCase implements ObjectFilter {
    private static final Log log =
            LogFactory.getLog(DummyStreamToRecords.class);

    public static final String CONF_DATA_SIZE = "dummystreamtorecords.datasize";

    private ObjectFilter source;
    private int dataSize = 100;
    private Record record;
    private static AtomicInteger idCounter = new AtomicInteger();

    public DummyStreamToRecords() {
        // for unit test purpose
    }

    public void testDummy() {
        assertTrue(true);
    }

    public DummyStreamToRecords(Configuration configuration) throws
                                                             RemoteException {
        log.trace("Constructing DummyStreamToRecords");
        dataSize = configuration.getInt(CONF_DATA_SIZE, dataSize);
        log.trace("DummyStreamToRecords uses data size " + dataSize);
    }

    @Override
    public boolean hasNext() {
        try {
            refreshRecord();
        } catch (IOException e) {
            throw new RuntimeException("IOException when checking for next ");
        }
        return record != null;
    }

    @Override
    public void setSource(Filter source) {
        if (source instanceof ObjectFilter) {
            this.source = (ObjectFilter)source;
        } else {
            throw new UnsupportedOperationException("Only ObjectFilter is legal"
                                                    + " as source");
        }
    }

    @Override
    public boolean pump() throws IOException {
        if (!hasNext()) {
            return false;
        }
        Payload next = next();
        if (next == null) {
            return false;
        }
        next.close();
        return true;
    }

    @Override
    public Payload next() {
        try {
            refreshRecord();
            if (record == null) {
                throw new NoSuchElementException("No next element");
            }
            Record newRecord = record;
            record = null;
            return new Payload(newRecord);
        } catch (IOException e) {
            throw new RuntimeException("IOException when requesting next "
                                       + "record", e);
        }
    }

    @Override
    public void remove() {
        throw new UnsupportedOperationException("No removal, okay?");
    }

    // Note: This ignores the length of the body's, which is okay for testing
    private void refreshRecord() throws IOException {
        if (record != null) {
            return;
        }

        ByteArrayOutputStream content = new ByteArrayOutputStream(dataSize);
        int value;
        record = source.hasNext() ? source.next().getRecord() : null;
        /*    content.write(value);
            if (content.size() == dataSize) break;
        }
        if (content.size() > 0) {
            record = new Record("DummyRecord_" + idCounter.getAndIncrement(),
                                "Dummy", content.toByteArray());
        } else {
            record = null;
        } */
    }

    @Override
    public void close(boolean success) {
        log.debug("Closing with success " + success);
        source.close(success);
    }

    public static int getIdCount() {
        return idCounter.get();
    }

    public static void clearIdCount() {
        idCounter.set(0);
    }
}

redpajama_set_name: RedPajamaGithub


text:
var noReplicasetStart = process.env['NO_REPLICASET_START'] != null ? true : false;

var testCase = require('../../deps/nodeunit').testCase,
  debug = require('util').debug,
  inspect = require('util').inspect,
  gleak = require('../../tools/gleak'),
  ReplicaSetManager = require('../tools/replica_set_manager').ReplicaSetManager,
  Db = require('../../lib/mongodb').Db,
  ReplSetServers = require('../../lib/mongodb').ReplSetServers,
  Server = require('../../lib/mongodb').Server,
  Step = require("../../deps/step/lib/step");

// Keep instance of ReplicaSetManager
var serversUp = false;
var retries = 120;
var RS = RS == null ? null : RS;

var ensureConnection = function(test, numberOfTries, callback) {
  // Replica configuration
  var replSet = new ReplSetServers( [
      new Server( RS.host, RS.ports[1], { auto_reconnect: true } ),
      new Server( RS.host, RS.ports[0], { auto_reconnect: true } ),
      new Server( RS.host, RS.ports[2], { auto_reconnect: true } )
    ],
    {rs_name:RS.name}
  );

  if(numberOfTries <= 0) return callback(new Error("could not connect correctly"), null);

  var db = new Db('integration_test_', replSet);
  db.open(function(err, p_db) {
    if(err != null) {
      db.close();
      // Wait for a sec and retry
      setTimeout(function() {
        numberOfTries = numberOfTries - 1;
        ensureConnection(test, numberOfTries, callback);
      }, 1000);
    } else {
      return callback(null, p_db);
    }
  })
}

module.exports = testCase({
  setUp: function(callback) {
    // Create instance of replicaset manager but only for the first call
    if(!serversUp && !noReplicasetStart) {
      serversUp = true;
      RS = new ReplicaSetManager({retries:120,
          arbiter_count:0,
          secondary_count:1,
          passive_count:0,
          kill_node_wait_time:50000});
      RS.startSet(true, function(err, result) {
        if(err != null) throw err;
        // Finish setup
        callback();
      });
    } else {
      RS.restartKilledNodes(function(err, result) {
        if(err != null) throw err;
        callback();
      })
    }
  },

  tearDown: function(callback) {
    RS.restartKilledNodes(function(err, result) {
      if(err != null) throw err;
      callback();
    })
  },

  shouldCorrectlyExecuteSafeFindAndModify : function(test) {
    // Replica configuration
    var replSet = new ReplSetServers( [
        new Server( RS.host, RS.ports[1], { auto_reconnect: true } ),
        new Server( RS.host, RS.ports[0], { auto_reconnect: true } ),
        // new Server( RS.host, RS.ports[2], { auto_reconnect: true } )
      ],
      {rs_name:RS.name, read_secondary:false}
    );

    // Insert some data
    var db = new Db('integration_test_', replSet);
    db.open(function(err, p_db) {
      // Check if we got an error
      if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err));

      // Drop collection on replicaset
      p_db.dropCollection('testsets', function(err, r) {
        if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err));
        // Recreate collection on replicaset
        p_db.createCollection('testsets', function(err, collection) {
          if(err != null) debug("shouldWorkCorrectlyWithInserts :: " + inspect(err));
          // Insert a dummy document
          collection.insert({a:20}, {safe: {w:1, wtimeout: 10000}}, function(err, r) {
            // Execute a findAndModify
            collection.findAndModify({'a':20}, [['a', 1]], {'$set':{'b':3}}, {'new':true, safe: {w:7, wtimeout: 10000}}, function(err, updated_doc) {
              test.equal('timeout', err.err)
              test.equal(true, err.wtimeout)
              test.done();
            });
          });
        });
      });
    });
  },

  noGlobalsLeaked : function(test) {
    var leaks = gleak.detectNew();
    test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', '));
    test.done();
  }
})


text:
module Softlayer
  module Security
    module Directory
      module Service
        autoload :Host, 'softlayer/security/directory/service/host'
      end
    end
  end
end


text:
import React, {Component} from 'react'
import Post from './Post'
import { Row, Button, ButtonGroup } from 'react-bootstrap'
import { connect } from 'react-redux'
import { changePostsOrder } from '../postsOrder/postOrderActions'
import sortBy from 'sort-by'

class PostList extends Component{
  render(){
    const { posts, postsOrder, changePostsOrder } = this.props

    const filter = this.props.match.params.category
    let curPosts = []
    if(filter){
      curPosts= posts && posts.filter((post)=> {
        return post.category === filter
      })
    } else {
      curPosts = posts
    }

    return (

        <Row>
          <ButtonGroup>
            <Button bsStyle={postsOrder === "author" ? "primary" : "default"} onClick={() => changePostsOrder("author")}>Author</Button>
            <Button bsStyle={postsOrder === "-author" ? "primary" : "default"} onClick={() => changePostsOrder("-author")}>Author</Button>
            <Button bsStyle={postsOrder === "-voteScore" ? "primary" : "default"} onClick={() => changePostsOrder("-voteScore")}>Votes</Button>
            <Button bsStyle={postsOrder === "voteScore" ? "primary" : "default"} onClick={() => changePostsOrder("voteScore")}>Votes</Button>
            <Button bsStyle={postsOrder === "-timestamp" ? "primary" : "default"} onClick={() => changePostsOrder("-timestamp")}>Timestamp</Button>
            <Button bsStyle={postsOrder === "timestamp" ? "primary" : "default"} onClick={() => changePostsOrder("timestamp")}>Timestamp</Button>
          </ButtonGroup>
        </Row>

        <Row>
          {
            curPosts.map((post) => (
              <Post key={post.id} post={post} />
          ))}
        </Row>

    )
  }
}

function mapStateToProps(state) {
  const { posts, categories, postsOrder } = state

  let filterPosts = posts.filter((post) => {return !post.deleted})
  let orderedPosts = filterPosts.sort(sortBy(postsOrder))

  return {
    posts: orderedPosts,
    postsOrder,
    categories
  }
}

export default connect(mapStateToProps, { changePostsOrder })(PostList)


text:
package demoapp.dom.types.primitive.floats.holder;

import org.apache.causeway.applib.annotation.Action;
import org.apache.causeway.applib.annotation.ActionLayout;
import org.apache.causeway.applib.annotation.MemberSupport;
import org.apache.causeway.applib.annotation.PromptStyle;
import org.apache.causeway.applib.annotation.SemanticsOf;

import lombok.RequiredArgsConstructor;

/* This file was GENERATED by the showcase generator (tooling). Do NOT edit! */
//tag::class[]
@Action(
        semantics = SemanticsOf.IDEMPOTENT
)
@ActionLayout(
        promptStyle = PromptStyle.INLINE
        , named = "Update"
        , associateWith = "readOnlyProperty"
        , sequence = "1")
@RequiredArgsConstructor
public class PrimitiveFloatHolder_updateReadOnlyProperty {

    private final PrimitiveFloatHolder holder;

    @MemberSupport public PrimitiveFloatHolder act(final float newValue) {
        holder.setReadOnlyProperty(newValue);
        return holder;
    }

    @MemberSupport public float default0Act() {
        return holder.getReadOnlyProperty();
    }

}
//end::class[]


text:
def application(environ, start_response):

    start_response(
        '200',
        [
            ('Content-Length', '0'),
            ('Query-String', environ.get('QUERY_STRING')),
        ],
    )
    return []


text:
<!DOCTYPE HTML>

		<title>W.I.L.L Admin Console</title>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1" />

		<link rel="stylesheet" href="{{ url_for("static", filename="assets/css/main.css") }}" />
        <link rel="shortcut icon" href="{{ url_for("static", filename="favicon.ico") }}" type="image/x-icon">

W.I.L.L

Home

								Menu

Settings

About W.I.L.L

Signup

Sign Up

Reports

Statistics about what's going on inside W.I.L.L

W.I.L.L

Uptime

W.I.L.L was started at {{ session["start-time"] }}

Commands

W.I.L.L has processed a total of {{ session["commands-processed"] }} commands

{{ session["success"] }} of these commands were successful and {{ session["errors"] }} were errored.

Users

There are {{ session["users-online"] }} users currently online with a total of {{ session["active-sessions"] }} active sessions

                                {{ session["users-list"] }}

©Will Beddow. All rights reserved.

Design: HTML5 UP


text:
import os
import random
import time
import hashlib
import warnings
from tempfile import mkdtemp
from shutil import rmtree
from six.moves.urllib.parse import urlparse
from six import BytesIO

from twisted.trial import unittest
from twisted.internet import defer

from scrapy.pipelines.files import FilesPipeline, FSFilesStore, S3FilesStore
from scrapy.item import Item, Field
from scrapy.http import Request, Response
from scrapy.settings import Settings
from scrapy.utils.python import to_bytes
from scrapy.utils.test import assert_aws_environ, get_s3_content_and_delete
from scrapy.utils.boto import is_botocore

from tests import mock

def _mocked_download_func(request, info):
    response = request.meta.get('response')
    return response() if callable(response) else response

class FilesPipelineTestCase(unittest.TestCase):

    def setUp(self):
        self.tempdir = mkdtemp()
        self.pipeline = FilesPipeline.from_settings(Settings({'FILES_STORE': self.tempdir}))
        self.pipeline.download_func = _mocked_download_func
        self.pipeline.open_spider(None)

    def tearDown(self):
        rmtree(self.tempdir)

    def test_file_path(self):
        file_path = self.pipeline.file_path
        self.assertEqual(file_path(Request("https://dev.mydeco.com/mydeco.pdf")),
                         'full/c9b564df929f4bc635bdd19fde4f3d4847c757c5.pdf')
        self.assertEqual(file_path(Request("http://www.maddiebrown.co.uk///catalogue-items//image_54642_12175_95307.txt")),
                         'full/4ce274dd83db0368bafd7e406f382ae088e39219.txt')
        self.assertEqual(file_path(Request("https://dev.mydeco.com/two/dirs/with%20spaces%2Bsigns.doc")),
                         'full/94ccc495a17b9ac5d40e3eabf3afcb8c2c9b9e1a.doc')
        self.assertEqual(file_path(Request("http://www.dfsonline.co.uk/get_prod_image.php?img=status_0907_mdm.jpg")),
                         'full/4507be485f38b0da8a0be9eb2e1dfab8a19223f2.jpg')
        self.assertEqual(file_path(Request("http://www.dorma.co.uk/images/product_details/2532/")),
                         'full/97ee6f8a46cbbb418ea91502fd24176865cf39b2')
        self.assertEqual(file_path(Request("http://www.dorma.co.uk/images/product_details/2532")),
                         'full/244e0dd7d96a3b7b01f54eded250c9e272577aa1')
        self.assertEqual(file_path(Request("http://www.dorma.co.uk/images/product_details/2532"),
                                   response=Response("http://www.dorma.co.uk/images/product_details/2532"),
                                   info=object()),
                         'full/244e0dd7d96a3b7b01f54eded250c9e272577aa1')

    def test_fs_store(self):
        assert isinstance(self.pipeline.store, FSFilesStore)
        self.assertEqual(self.pipeline.store.basedir, self.tempdir)

        path = 'some/image/key.jpg'
        fullpath = os.path.join(self.tempdir, 'some', 'image', 'key.jpg')
        self.assertEqual(self.pipeline.store._get_filesystem_path(path), fullpath)

    @defer.inlineCallbacks
    def test_file_not_expired(self):
        item_url = "http://example.com/file.pdf"
        item = _create_item_with_files(item_url)
        patchers = [
            mock.patch.object(FilesPipeline, 'inc_stats', return_value=True),
            mock.patch.object(FSFilesStore, 'stat_file', return_value={
                'checksum': 'abc', 'last_modified': time.time()}),
            mock.patch.object(FilesPipeline, 'get_media_requests',
                              return_value=[_prepare_request_object(item_url)])
        ]
        for p in patchers:
            p.start()

        result = yield self.pipeline.process_item(item, None)
        self.assertEqual(result['files'][0]['checksum'], 'abc')

        for p in patchers:
            p.stop()

    @defer.inlineCallbacks
    def test_file_expired(self):
        item_url = "http://example.com/file2.pdf"
        item = _create_item_with_files(item_url)
        patchers = [
            mock.patch.object(FSFilesStore, 'stat_file', return_value={
                'checksum': 'abc',
                'last_modified': time.time() - (self.pipeline.expires * 60 * 60 * 24 * 2)}),
            mock.patch.object(FilesPipeline, 'get_media_requests',
                              return_value=[_prepare_request_object(item_url)]),
            mock.patch.object(FilesPipeline, 'inc_stats', return_value=True)
        ]
        for p in patchers:
            p.start()

        result = yield self.pipeline.process_item(item, None)
        self.assertNotEqual(result['files'][0]['checksum'], 'abc')

        for p in patchers:
            p.stop()

class DeprecatedFilesPipeline(FilesPipeline):
    def file_key(self, url):
        media_guid = hashlib.sha1(to_bytes(url)).hexdigest()
        media_ext = os.path.splitext(url)[1]
        return 'empty/%s%s' % (media_guid, media_ext)

class DeprecatedFilesPipelineTestCase(unittest.TestCase):
    def setUp(self):
        self.tempdir = mkdtemp()

    def init_pipeline(self, pipeline_class):
        self.pipeline = pipeline_class.from_settings(Settings({'FILES_STORE': self.tempdir}))
        self.pipeline.download_func = _mocked_download_func
        self.pipeline.open_spider(None)

    def test_default_file_key_method(self):
        self.init_pipeline(FilesPipeline)
        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter('always')
            self.assertEqual(self.pipeline.file_key("https://dev.mydeco.com/mydeco.pdf"),
                             'full/c9b564df929f4bc635bdd19fde4f3d4847c757c5.pdf')
            self.assertEqual(len(w), 1)
            self.assertTrue('file_key(url) method is deprecated' in str(w[-1].message))

    def test_overridden_file_key_method(self):
        self.init_pipeline(DeprecatedFilesPipeline)
        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter('always')
            self.assertEqual(self.pipeline.file_path(Request("https://dev.mydeco.com/mydeco.pdf")),
                             'empty/c9b564df929f4bc635bdd19fde4f3d4847c757c5.pdf')
            self.assertEqual(len(w), 1)
            self.assertTrue('file_key(url) method is deprecated' in str(w[-1].message))

    def tearDown(self):
        rmtree(self.tempdir)

class FilesPipelineTestCaseFields(unittest.TestCase):

    def test_item_fields_default(self):
        class TestItem(Item):
            name = Field()
            file_urls = Field()
            files = Field()

        for cls in TestItem, dict:
            url = 'http://www.example.com/files/1.txt'
            item = cls({'name': 'item1', 'file_urls': [url]})
            pipeline = FilesPipeline.from_settings(Settings({'FILES_STORE': 's3://example/files/'}))
            requests = list(pipeline.get_media_requests(item, None))
            self.assertEqual(requests[0].url, url)
            results = [(True, {'url': url})]
            pipeline.item_completed(results, item, None)
            self.assertEqual(item['files'], [results[0][1]])

    def test_item_fields_override_settings(self):
        class TestItem(Item):
            name = Field()
            files = Field()
            stored_file = Field()

        for cls in TestItem, dict:
            url = 'http://www.example.com/files/1.txt'
            item = cls({'name': 'item1', 'files': [url]})
            pipeline = FilesPipeline.from_settings(Settings({
                'FILES_STORE': 's3://example/files/',
                'FILES_URLS_FIELD': 'files',
                'FILES_RESULT_FIELD': 'stored_file'
            }))
            requests = list(pipeline.get_media_requests(item, None))
            self.assertEqual(requests[0].url, url)
            results = [(True, {'url': url})]
            pipeline.item_completed(results, item, None)
            self.assertEqual(item['stored_file'], [results[0][1]])

class FilesPipelineTestCaseCustomSettings(unittest.TestCase):
    default_cls_settings = {
        "EXPIRES": 90,
        "FILES_URLS_FIELD": "file_urls",
        "FILES_RESULT_FIELD": "files"
    }
    file_cls_attr_settings_map = {
        ("EXPIRES", "FILES_EXPIRES", "expires"),
        ("FILES_URLS_FIELD", "FILES_URLS_FIELD", "files_urls_field"),
        ("FILES_RESULT_FIELD", "FILES_RESULT_FIELD", "files_result_field")
    }

    def setUp(self):
        self.tempdir = mkdtemp()

    def tearDown(self):
        rmtree(self.tempdir)

    def _generate_fake_settings(self, prefix=None):

        def random_string():
            return "".join([chr(random.randint(97, 123)) for _ in range(10)])

        settings = {
            "FILES_EXPIRES": random.randint(100, 1000),
            "FILES_URLS_FIELD": random_string(),
            "FILES_RESULT_FIELD": random_string(),
            "FILES_STORE": self.tempdir
        }
        if not prefix:
            return settings

        return {prefix.upper() + "_" + k if k != "FILES_STORE" else k: v for k, v in settings.items()}

    def _generate_fake_pipeline(self):

        class UserDefinedFilePipeline(FilesPipeline):
            EXPIRES = 1001
            FILES_URLS_FIELD = "alfa"
            FILES_RESULT_FIELD = "beta"

        return UserDefinedFilePipeline

    def test_different_settings_for_different_instances(self):
        """
        If there are different instances with different settings they should keep
        different settings.
        """
        custom_settings = self._generate_fake_settings()
        another_pipeline = FilesPipeline.from_settings(Settings(custom_settings))
        one_pipeline = FilesPipeline(self.tempdir)
        for pipe_attr, settings_attr, pipe_ins_attr in self.file_cls_attr_settings_map:
            default_value = self.default_cls_settings[pipe_attr]
            self.assertEqual(getattr(one_pipeline, pipe_attr), default_value)
            custom_value = custom_settings[settings_attr]
            self.assertNotEqual(default_value, custom_value)
            self.assertEqual(getattr(another_pipeline, pipe_ins_attr), custom_value)

    def test_subclass_attributes_preserved_if_no_settings(self):
        """
        If subclasses override class attributes and there are no special settings those values should be kept.
        """
        pipe_cls = self._generate_fake_pipeline()
        pipe = pipe_cls.from_settings(Settings({"FILES_STORE": self.tempdir}))
        for pipe_attr, settings_attr, pipe_ins_attr in self.file_cls_attr_settings_map:
            custom_value = getattr(pipe, pipe_ins_attr)
            self.assertNotEqual(custom_value, self.default_cls_settings[pipe_attr])
            self.assertEqual(getattr(pipe, pipe_ins_attr), getattr(pipe, pipe_attr))

    def test_subclass_attrs_preserved_custom_settings(self):
        """
        If file settings are defined but they are not defined for subclass
        settings should be preserved.
        """
        pipeline_cls = self._generate_fake_pipeline()
        settings = self._generate_fake_settings()
        pipeline = pipeline_cls.from_settings(Settings(settings))
        for pipe_attr, settings_attr, pipe_ins_attr in self.file_cls_attr_settings_map:
            value = getattr(pipeline, pipe_ins_attr)
            setting_value = settings.get(settings_attr)
            self.assertNotEqual(value, self.default_cls_settings[pipe_attr])
            self.assertEqual(value, setting_value)

    def test_no_custom_settings_for_subclasses(self):
        """
        If there are no settings for subclass and no subclass attributes, pipeline should use
        attributes of base class.
        """
        class UserDefinedFilesPipeline(FilesPipeline):
            pass

        user_pipeline = UserDefinedFilesPipeline.from_settings(Settings({"FILES_STORE": self.tempdir}))
        for pipe_attr, settings_attr, pipe_ins_attr in self.file_cls_attr_settings_map:
            # Values from settings for custom pipeline should be set on pipeline instance.
            custom_value = self.default_cls_settings.get(pipe_attr.upper())
            self.assertEqual(getattr(user_pipeline, pipe_ins_attr), custom_value)

    def test_custom_settings_for_subclasses(self):
        """
        If there are custom settings for subclass and NO class attributes, pipeline should use custom
        settings.
        """
        class UserDefinedFilesPipeline(FilesPipeline):
            pass

        prefix = UserDefinedFilesPipeline.__name__.upper()
        settings = self._generate_fake_settings(prefix=prefix)
        user_pipeline = UserDefinedFilesPipeline.from_settings(Settings(settings))
        for pipe_attr, settings_attr, pipe_inst_attr in self.file_cls_attr_settings_map:
            # Values from settings for custom pipeline should be set on pipeline instance.
            custom_value = settings.get(prefix + "_" + settings_attr)
            self.assertNotEqual(custom_value, self.default_cls_settings[pipe_attr])
            self.assertEqual(getattr(user_pipeline, pipe_inst_attr), custom_value)

    def test_custom_settings_and_class_attrs_for_subclasses(self):
        """
        If there are custom settings for subclass AND class attributes
        setting keys are preferred and override attributes.
        """
        pipeline_cls = self._generate_fake_pipeline()
        prefix = pipeline_cls.__name__.upper()
        settings = self._generate_fake_settings(prefix=prefix)
        user_pipeline = pipeline_cls.from_settings(Settings(settings))
        for pipe_cls_attr, settings_attr, pipe_inst_attr  in self.file_cls_attr_settings_map:
            custom_value = settings.get(prefix + "_" + settings_attr)
            self.assertNotEqual(custom_value, self.default_cls_settings[pipe_cls_attr])
            self.assertEqual(getattr(user_pipeline, pipe_inst_attr), custom_value)

    def test_cls_attrs_with_DEFAULT_prefix(self):
        class UserDefinedFilesPipeline(FilesPipeline):
            DEFAULT_FILES_RESULT_FIELD = "this"
            DEFAULT_FILES_URLS_FIELD = "that"

        pipeline = UserDefinedFilesPipeline.from_settings(Settings({"FILES_STORE": self.tempdir}))
        self.assertEqual(pipeline.files_result_field, "this")
        self.assertEqual(pipeline.files_urls_field, "that")

    def test_user_defined_subclass_default_key_names(self):
        """Test situation when user defines subclass of FilesPipeline,
        but uses attribute names for default pipeline (without prefixing
        them with pipeline class name).
        """
        settings = self._generate_fake_settings()

        class UserPipe(FilesPipeline):
            pass

        pipeline_cls = UserPipe.from_settings(Settings(settings))

        for pipe_attr, settings_attr, pipe_inst_attr in self.file_cls_attr_settings_map:
            expected_value = settings.get(settings_attr)
            self.assertEqual(getattr(pipeline_cls, pipe_inst_attr),
                             expected_value)

class TestS3FilesStore(unittest.TestCase):
    @defer.inlineCallbacks
    def test_persist(self):
        assert_aws_environ()
        uri = os.environ.get('S3_TEST_FILE_URI')
        if not uri:
            raise unittest.SkipTest("No S3 URI available for testing")
        data = b"TestS3FilesStore: \xe2\x98\x83"
        buf = BytesIO(data)
        meta = {'foo': 'bar'}
        path = ''
        store = S3FilesStore(uri)
        yield store.persist_file(
            path, buf, info=None, meta=meta,
            headers={'Content-Type': 'image/png'})
        s = yield store.stat_file(path, info=None)
        self.assertIn('last_modified', s)
        self.assertIn('checksum', s)
        self.assertEqual(s['checksum'], '3187896a9657a28163abb31667df64c8')
        u = urlparse(uri)
        content, key = get_s3_content_and_delete(
            u.hostname, u.path[1:], with_key=True)
        self.assertEqual(content, data)
        if is_botocore():
            self.assertEqual(key['Metadata'], {'foo': 'bar'})
            self.assertEqual(
                key['CacheControl'], S3FilesStore.HEADERS['Cache-Control'])
            self.assertEqual(key['ContentType'], 'image/png')
        else:
            self.assertEqual(key.metadata, {'foo': 'bar'})
            self.assertEqual(
                key.cache_control, S3FilesStore.HEADERS['Cache-Control'])
            self.assertEqual(key.content_type, 'image/png')

class ItemWithFiles(Item):
    file_urls = Field()
    files = Field()

def _create_item_with_files(*files):
    item = ItemWithFiles()
    item['file_urls'] = files
    return item

def _prepare_request_object(item_url):
    return Request(
        item_url,
        meta={'response': Response(item_url, status=200, body=b'data')})

if __name__ == "__main__":
    unittest.main()


text:
"use strict";
function async(fn) {
    return (done) => {
        let result = null;
        try {
            result = fn();
            if (result && 'then' in result) {
                result.then(done, done.fail);
            }
            else {
                done();
            }
        }
        catch (err) {
            done.fail(err);
        }
    };
}
function it(description, fn) {
    return global['it'](description, async(fn));
}
exports.it = it;
//# sourceMappingURL=/Users/hansl/Sources/angular-cli/packages/@angular/cli/lib/ast-tools/spec-utils.js.map


text:
package com.vladsch.md.nav.language;

import com.vladsch.flexmark.ext.attributes.AttributeImplicitName;
import com.vladsch.plugin.util.ui.ComboBoxAdaptable;
import com.vladsch.plugin.util.ui.ComboBoxAdapter;
import com.vladsch.plugin.util.ui.ComboBoxAdapterImpl;
import org.jetbrains.annotations.NotNull;

public enum AttributeImplicitIdType implements ComboBoxAdaptable<AttributeImplicitIdType> {
    AS_IS(0, CodeStyleBundle.message("attribute-name.id.as-is"), AttributeImplicitName.AS_IS),
    IMPLICIT_PREFERRED(1, CodeStyleBundle.message("attribute-name.id.implicit-preferred"), AttributeImplicitName.IMPLICIT_PREFERRED),
    EXPLICIT_PREFERRED(2, CodeStyleBundle.message("attribute-name.id.explicit-preferred"), AttributeImplicitName.EXPLICIT_PREFERRED),
    ;

    public final @NotNull String displayName;
    public final int intValue;
    public final AttributeImplicitName flexMarkEnum;

    AttributeImplicitIdType(int intValue, @NotNull String displayName, @NotNull AttributeImplicitName flexMarkEnum) {
        this.intValue = intValue;
        this.displayName = displayName;
        this.flexMarkEnum = flexMarkEnum;
    }

    public static Static<AttributeImplicitIdType> ADAPTER = new Static<>(new ComboBoxAdapterImpl<>(AS_IS));

    @NotNull
    @Override
    public ComboBoxAdapter<AttributeImplicitIdType> getAdapter() {
        return ADAPTER;
    }

    @Override
    public int getIntValue() { return intValue; }

    @NotNull
    public String getDisplayName() { return displayName; }

    @NotNull
    public AttributeImplicitIdType[] getValues() { return values(); }
}


text:
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Serialization;
using System.IO;

namespace Randoop // TODO change name to Common.
{
    /// <summary>
    /// Specifies the values for the variable parameters that affect
    /// the behavior of Randoop's input generation.
    ///
    /// The output directory must exist.
    /// </summary>
    [XmlRoot("RandoopConfiguration")]
    public class RandoopConfiguration : CommonSerializer<RandoopConfiguration>
    {
        public void CheckRep()
        {
            if (this.assemblies == null || this.assemblies.Count == 0)
            {
                string msg = "Configuration error: must specify at least one assembly (Assemblies element).";
                throw new ArgumentException(msg);
            }

            if (this.outputdir == null)
            {
                string msg = "Configuration error: must specify output directory (OutputDir element).";
                throw new ArgumentException(msg);
            }

            if (this.statsFile == null)
            {
                string msg = "Configuration error: must specify statistics file (StatsFile element).";
                throw new ArgumentException(msg);
            }

            foreach (SimpleTypeValues vs in this.simpleTypeValues)
            {
                if (Type.GetType(vs.simpleType) == null)
                {
                    string msg = "Invalid simple type: " + vs.simpleType;
                    throw new ArgumentException(msg);
                }
            }
        }

        [XmlElement("TimeLimit")]
        public int timelimit = 100;

        [XmlElement("Assemblies")]
        public Collection<FileName> assemblies = new Collection<FileName>();

        [XmlElement("ExecutionLog")]
        public string executionLog;

        [XmlElement("TypeMatchingMode")]
        public TypeMatchingMode typematchingmode = TypeMatchingMode.SubTypes;

        [XmlElement("RandomSeed")]
        public int randomseed = 0;

        [XmlElement("RandomSource")]
        public RandomSource randomSource = RandomSource.SystemRandom;

        [XmlElement("ArrayMaxSize")]
        public int arraymaxsize = 4;

        [XmlElement("MethodWeighing")]
        public MethodWeighing methodweighing = MethodWeighing.Uniform;

        [XmlElement("ForbidNull")]
        public bool forbidnull = true;

        [XmlElement("StartWithRoundRobin")]
        public bool startwithroundrobin = false;

        [XmlElement("StartWithRoundRobinTimes")]
        public int startwithroundrobintimes = 0;

        [XmlElement("UseInternal")]
        public bool useinternal = false;

        [XmlElement("UseStatic")]
        public bool usestatic = true;

        [XmlElement("Filter")]
        public string filter = "StandardReflectionFilter";

        [XmlElement("Monkey")]
        public bool monkey = false;

        [XmlElement("FairOpt")]
        public bool fairOpt = false;

        //when true, only use the receivers as argument to other methods, ignore parameters
        [XmlElement("ForbidParamObj")]
        public bool forbidparamobj = false;

        [XmlElement("TestFileWriter")]
        public string testfilewriter;

        [XmlElement("ExecutionMode")]
        public ExecutionMode executionmode = ExecutionMode.Reflection;

        [XmlElement("OutputNormalInputs")]
        public bool outputnormalinputs = false;

        [XmlElement("MethodName")]
        public string metnodname = "Test";

        [XmlElement("PlanStartId")]
        public int planstartid = 0;

        [XmlElement("SingleDir")]
        public bool singledir = false;

        [XmlElement("OutputDir")]
        public string outputdir;

        [XmlElement("SimpleTypeValues")]
        public Collection<SimpleTypeValues> simpleTypeValues = new Collection<SimpleTypeValues>();

        [XmlElement("require_typesFile")]
        public Collection<FileName> require_typesFiles = new Collection<FileName>();

        [XmlElement("require_membersFile")]
        public Collection<FileName> require_membersFiles = new Collection<FileName>();

        [XmlElement("require_fieldsFile")]
        public Collection<FileName> require_fieldsFiles = new Collection<FileName>();

        [XmlElement("forbid_typesFile")]
        public Collection<FileName> forbid_typesFiles = new Collection<FileName>();

        [XmlElement("forbid_membersFile")]
        public Collection<FileName> forbid_membersFiles = new Collection<FileName>();

        [XmlElement("forbid_fieldsFile")]
        public Collection<FileName> forbid_fieldsFiles = new Collection<FileName>();

        [XmlElement("StatsFile")]
        public FileName statsFile;

        [XmlElement("TestPrefix")]
        public string testPrefix;

    }

    /// <summary>
    /// Specifies type-based strategy for selecting sub-plans
    /// when constructing a new plan.
    /// </summary>
    public enum TypeMatchingMode { ExactType, SubTypes };

    /// <summary>
    /// Specifies execution mode for plans.
    /// </summary>
    public enum ExecutionMode { Reflection, DontExecute }

    /// <summary>
    /// Specifies strategy for selecting methods to use in
    /// creating new plans.
    /// </summary>
    public enum MethodWeighing
    {
        Uniform,
        RoundRobin
    }

    public enum RandomSource
    {
        SystemRandom,
        Crypto
    }

    /// <summary>
    /// Wrapper around a string that represents a file name.
    /// Used for XML serialization of a RandoopConfiguration.
    /// </summary>
    public class FileName
    {
        public FileName()
        {
            this.fileName = null;
        }

        public FileName(String fileName)
        {
            if (fileName == null) throw new ArgumentNullException("fileName");
            this.fileName = fileName;
        }

        [XmlAttribute("FileName")]
        public string fileName;
    }

    /// <summary>
    /// A set of strings that represent values for a given simple type or string type.
    /// </summary>
    public class SimpleTypeValues
    {
        [XmlAttribute("SimpleType")]
        public string simpleType;

        [XmlElement("FileName")]
        public Collection<FileName> fileNames;
    }

    /// <summary>
    /// Common routines for serializing and deserializing to a file
    /// Cribbed from PipelineUtils, Lewis Bruck (lbruck), Kathy Lu (kathylu).
    /// </summary>
    /// <typeparam name="T">data type to use</typeparam>
    public abstract class CommonSerializer<T>
    {
        /// <summary>
        /// Load the object values from the file
        /// </summary>
        /// <param name="fileName">name and path of the file</param>
        /// <returns></returns>
        public static T Load(string fileName)
        {
            T obj;

            XmlSerializer tl = new XmlSerializer(typeof(T));

            using (XmlReader reader = new XmlTextReader(fileName))
            {
                obj = (T)tl.Deserialize(reader);
            }

            return obj;
        }

        // TODO resource error handling
        public static void Save(object obj, string fileName)
        {
            XmlSerializer tl = new XmlSerializer(typeof(T));

            using (XmlTextWriter writer = new XmlTextWriter(fileName, Encoding.Unicode))
            {
                writer.Formatting = Formatting.Indented;
                writer.Indentation = 4;
                tl.Serialize(writer, obj);
            }
        }

        public static string GetXml(object obj)
        {
            XmlSerializer tl = new XmlSerializer(typeof(T));

            StringWriter sw = new StringWriter();
            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Indent = true;
            settings.Encoding = Encoding.Unicode;
            settings.IndentChars = "    ";
            settings.OmitXmlDeclaration = true;
            XmlWriter writer = XmlWriter.Create(sw, settings);

            tl.Serialize(writer, obj);

            return sw.ToString();
        }

        /// <summary>
        /// Save the object values to the file
        /// </summary>
        /// <param name="fileName">name and path of the file</param>
        /// TODO resource error handling.
        public void Save(string fileName)
        {
            if (fileName == null) throw new ArgumentNullException("fileName");
            Console.WriteLine("Creating xml configuration file " + fileName);
            Save(this, fileName);
        }

        public string GetXml()
        {
            return GetXml(this);
        }
    }

}


text: ![Program Analysis for Cybersecurity](./images/logo/pac-cover.png)


text:
namespace Casimodo.Mojen
{
    public class MojHttpRequestConfig
    {
        public MojDataGraphNode[] ReadGraph { get; set; }

        public MojProp[] ModelProps { get; set; }

        public bool IsLocalData { get; set; }

        public string ODataBaseUrl { get; set; }
        public string ODataReadBaseUrl { get; set; }
        public string ODataSelectUrl { get; set; }
        public string ODataCrudUrl { get; set; }
        public string ODataCreateUrl { get; set; }
        public string ODataUpdateUrlTemplate { get; set; }
        public string ODataDeleteUrl { get; set; }
        public string ODataFilterUrl { get; set; }
        public string AjaxUrl { get; set; }
    }
}


text:
package org.wso2.carbon.mdm.services.android.bean.wrapper;

import org.wso2.carbon.mdm.services.android.bean.DeviceLock;
import org.wso2.carbon.mdm.services.android.bean.Notification;

import java.util.List;

/**
 * This class is used to wrap the Notification bean with devices.
 */
public class DeviceLockBeanWrapper {

    private List<String> deviceIDs;
    private DeviceLock operation;

    public List<String> getDeviceIDs() {
        return deviceIDs;
    }

    public void setDeviceIDs(List<String> deviceIDs) {
        this.deviceIDs = deviceIDs;
    }

    public DeviceLock getOperation() {
        return operation;
    }

    public void setOperation(DeviceLock operation) {
        this.operation = operation;
    }
}


text:
using System.Collections.Generic;

using Aliyun.OSS.Model;

namespace Aliyun.OSS
{
    /// <summary>
    /// The result class of the operation to list buckets.
    /// </summary>
    public class ListBucketsResult : GenericResult
    {
        /// <summary>
        /// Gets or sets the bucket name prefix(optional).
        /// </summary>
        public string Prefix { get; internal set; }

        /// <summary>
        /// Gets or sets the bucket name marker.Its value should be same as the ListBucketsRequest.Marker.
        /// </summary>
        public string Marker { get; internal set; }

        /// <summary>
        /// Gets or sets the max entries to return.
        /// By default it's 100.
        /// </summary>
        public int? MaxKeys { get; internal set; }

        /// <summary>
        /// Gets or sets the flag of truncated. If it's true, means not all buckets have been returned.
        /// </summary>
        public bool? IsTruncated { get; internal set; }

        /// <summary>
        /// Gets the next marker's value. Assign this value to the next call's ListBucketRequest.marker.
        /// </summary>
        public string NextMaker { get; internal set; }

        /// <summary>
        /// Gets the bucket iterator.
        /// </summary>
        public IEnumerable<Bucket> Buckets { get; internal set; }
    }
}


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>

<!DOCTYPE html>

		<title>JOBS</title>
		<?php includeJQuery(); ?>
		<?php includeBootstrap(); ?>

		<?=$menu ?>

Pendientes

								Fecha
								ID
								Consultor
								Cliente
								Proyecto
								Título
								Tipo
								Estado
								Tiempo estimado

							<?php foreach($pendientes as $tarea){ ?>
								<?php if($tarea->idEstado==2){ ?>
								<tr
								onclick="location='<?php echo base_url().'index.php/Marcar_calificado_ctrl/traerTarea/'.($tarea->id); ?>'"
								class = "info"
								>
								<?php }else{ ?>
									<?php
										$taskDay = explode(" ",explode("-",$tarea->creacion)[2])[0];
										$curDay = date("d");
										if($taskDay == $curDay){
									?>
										<?php if(!$tarea->retrabajo){ ?>

										<?php }else{ ?>

										<?php } ?>
									<?php }else{ ?>

									<?php } ?>
								<?php } ?>
									<?php echo $tarea->creacion; ?>
									<?php echo $tarea->id; ?>
									<?php echo $tarea->responsable->nombre; ?>
									<?php echo $tarea->cliente->nombre; ?>
									<?php echo $tarea->proyecto->nombre; ?>
									<?php echo $tarea->titulo; ?>
									<?php echo ($tarea->retrabajo)? "Error" : "Tarea"; ?>
									<?php echo $tarea->estado->nombre; ?>
									<?php echo $tarea->tiempoEstimado; ?>

							<?php } ?>

Terminados

								Fecha
								ID
								Consultor
								Cliente
								Proyecto
								Título
								Tipo
								Estado
								Tiempo estimado
								Tiempo real

							<?php foreach($terminados as $tarea){ ?>
								<?php if($tarea->idEstado==2){ ?>
								<?php if(!$tarea->retrabajo){ ?>
									<tr
									onclick="location='<?php echo base_url().'index.php/Marcar_calificado_ctrl/traerTarea/'.($tarea->id); ?>'"
									class = "info"
									>
								<?php }else{ ?>
									<tr
									onclick="location='<?php echo base_url().'index.php/Marcar_calificado_ctrl/traerRetrabajo/'.($tarea->id); ?>'"
									class = "danger"
									>
								<?php } ?>
								<?php }else{ ?>

								<?php } ?>
									<?php echo $tarea->creacion; ?>
									<?php echo $tarea->id; ?>
									<?php echo $tarea->responsable->nombre; ?>
									<?php echo $tarea->cliente->nombre; ?>
									<?php echo $tarea->proyecto->nombre; ?>
									<?php echo $tarea->titulo; ?>
									<?php echo ($tarea->retrabajo)? "Error" : "Tarea"; ?>
									<?php echo $tarea->estado->nombre; ?>
									<?php echo $tarea->tiempoEstimado; ?>
									<?php echo $tarea->tiempo; ?>

							<?php } ?>

Calificados

						Desde

							<input class="form-control" id="fechaOrigen" type="text" readonly="readonly">

						Hasta

							<input class="form-control" id="fechaFin" type="text" readonly="readonly">

« Anterior

Siguiente »

								Fecha
								ID
								Consultor
								Cliente
								Proyecto
								Título
								Tipo
								Estado
								Tiempo estimado
								Tiempo real

Cargando

« Anterior

Siguiente »


text:
namespace _1._5._16
{
    partial class Form1
    {
        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows 窗体设计器生成的代码

        /// <summary>
        /// 设计器支持所需的方法 - 不要修改
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.label1 = new System.Windows.Forms.Label();
            this.button1 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(48, 99);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(323, 36);
            this.label1.TabIndex = 0;
            this.label1.Text = "绘图完成,按确定退出。";
            //
            // button1
            //
            this.button1.Location = new System.Drawing.Point(480, 88);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(157, 58);
            this.button1.TabIndex = 2;
            this.button1.Text = "确定";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(168F, 168F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
            this.ClientSize = new System.Drawing.Size(705, 236);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.label1);
            this.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.Name = "Form1";
            this.Text = "1.5.16";
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button button1;
    }
}