repo
stringclasses
1k values
file_url
stringlengths
96
373
file_path
stringlengths
11
294
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
6 values
commit_sha
stringclasses
1k values
retrieved_at
stringdate
2026-01-04 14:45:56
2026-01-04 18:30:23
truncated
bool
2 classes
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/com/google/collide/client/ui/panel/PanelState_CustomFieldSerializer.java
client/src/main/java/com/google/collide/client/ui/panel/PanelState_CustomFieldSerializer.java
package com.google.collide.client.ui.panel; public class PanelState_CustomFieldSerializer { }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/com/google/collide/client/ui/panel/HeaderBuilder.java
client/src/main/java/com/google/collide/client/ui/panel/HeaderBuilder.java
package com.google.collide.client.ui.panel; import elemental.dom.Element; public interface HeaderBuilder { Element buildHeader(String title, Panel.Css css, Panel<?,?> into); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/com/google/collide/client/ui/panel/AbstractPanelPositioner.java
client/src/main/java/com/google/collide/client/ui/panel/AbstractPanelPositioner.java
package com.google.collide.client.ui.panel; import java.util.Comparator; import java.util.Iterator; import xapi.fu.itr.MappedIterable; import xapi.util.api.ConvertsValue; import xapi.util.api.RemovalHandler; import collide.client.util.Elements; import com.google.collide.client.util.ResizeBounds; import com.google.collide.client.util.logging.Log; import com.google.collide.json.client.JsoArray; import com.google.collide.json.client.JsoStringMap; import elemental.dom.Element; /** * A default implementation of the {@link PanelPositioner} interface. * * This positioner will attempt to fill horizontal space with new panels, * and will close the oldest visible panel (that is closable) when there is not enough space. * * This positioner will be using the document viewport for maximum sizes; * override {@link #getMaxHeight()} and {@link #getMaxWidth()} to change this behaviour. * * @author "James X. Nelson (james@wetheinter.net)" * */ public class AbstractPanelPositioner implements PanelPositioner{ public static class PanelNode { float x, y, w, h; public final Panel<?, ?> panel; public PanelNode(Panel<?, ?> panel) { this.panel = panel; } PanelNode[] onLeft; PanelNode[] onRight; PanelNode[] onTop; PanelNode[] onBottom; void setPosition(float x, float y) { this.x = x; this.y = y; panel.setPosition(x, y); } void setSize(float w, float h) { this.w = w; this.h = h; panel.setSize(w, h); } public MappedIterable<PanelNode> toTheLeft() { return () -> new SiblingIterator(this, IterateLeft); } public MappedIterable<PanelNode> toTheRight() { return () -> new SiblingIterator(this, IterateRight); } public float offerWidth(float deltaW) { ResizeBounds bounds = panel.getBounds(); if (deltaW > 0) { // We are being offered width float maxWidth = bounds.getMaxWidth(); Log.info(getClass(), panel.getId()+" Offered width "+deltaW+"; maxWidth: "+maxWidth+"; w: "+w); if (w < maxWidth) { float consume = w + deltaW - maxWidth; if (consume <= 0) { w += deltaW; panel.setSize(w, h); Log.info(getClass(), "Consuming "+deltaW); return 0; } Log.info(getClass(), "Consume "+consume+" ; "+(deltaW - consume)); w += consume; panel.setSize(w, h); return deltaW - consume; } } else { // We are being asked for width float minWidth = bounds.getMinWidth(); Log.info(getClass(), panel.getId()+" Asked for width "+deltaW+"; minWidth: "+minWidth+"; w: "+w); if (w > minWidth) { float available = w - minWidth; if (available + deltaW > 0) { w += deltaW; panel.setSize(w, h); return 0; } w -= available; panel.setSize(w, h); return deltaW + available; } } return deltaW; } } private static final PanelNode[] empty = new PanelNode[0]; private static final ConvertsValue<PanelNode, PanelNode[]> IterateLeft = new ConvertsValue<PanelNode, PanelNode[]>() { @Override public PanelNode[] convert(PanelNode node) { PanelNode[] onLeft = node.onLeft; if (onLeft == null) { return empty; } else { int len = onLeft.length; if (len > 1) { // make sure the first node is the most left node of all float mostLeft = onLeft[0].x; int mostLeftIndex = 0; while (len --> 1) { if (onLeft[len].x < mostLeft) { mostLeft = onLeft[len].x; mostLeftIndex = len; } } if (mostLeftIndex != 0) { PanelNode swap = onLeft[mostLeftIndex]; onLeft[mostLeftIndex] = onLeft[0]; onLeft[0] = swap; } } } return onLeft; } }; private static final ConvertsValue<PanelNode, PanelNode[]> IterateRight = new ConvertsValue<PanelNode, PanelNode[]>() { @Override public PanelNode[] convert(PanelNode node) { PanelNode[] onRight = node.onRight; if (onRight == null) { return empty; } else { int len = onRight.length; if (len > 1) { // make sure the first node is the most right node of all float mostRight = onRight[0].x + onRight[0].w; int mostRightIndex = 0; while (len --> 1) { float right = onRight[len].x + onRight[len].w; if (right > mostRight) { mostRight = right; mostRightIndex = len; } } if (mostRightIndex != 0) { PanelNode swap = onRight[mostRightIndex]; onRight[mostRightIndex] = onRight[0]; onRight[0] = swap; } } } return onRight; } }; private static final Comparator<? super PanelNode> sorter = new Comparator<PanelNode>() { @Override public int compare(PanelNode o1, PanelNode o2) { float delta = o1.x - o2.x; if (delta < 0) return -1; if (delta > 0) return 1; delta = o1.y - o2.y; if (delta < 0) return -1; if (delta > 0) return 1; return o1.hashCode() - o2.hashCode(); } }; protected static class SiblingIterator implements Iterator<PanelNode> { private final JsoArray<PanelNode> flattened; int pos = 0; public SiblingIterator(PanelNode node, ConvertsValue<PanelNode, PanelNode[]> provider) { flattened = JsoArray.create(); JsoStringMap<PanelNode> seen = JsoStringMap.create(); recurse(node, provider, seen); } private void recurse(PanelNode node, ConvertsValue<PanelNode, PanelNode[]> provider, JsoStringMap<PanelNode> seen) { for (PanelNode sibling : provider.convert(node)) { if (sibling.panel.isHidden())continue; if (!seen.containsKey(sibling.panel.getId())) { seen.put(node.panel.getId(), node); recurse(sibling, provider, seen); flattened.add(sibling); } } } @Override public boolean hasNext() { return pos < flattened.size(); } @Override public PanelNode next() { Log.info(getClass(), "Recursing into "+flattened.get(pos).panel.getId()); return flattened.get(pos++); } @Override public void remove() { throw new UnsupportedOperationException(); } } PanelNode leftMost, rightMost; JsoStringMap<PanelNode> panels = JsoStringMap.create(); public RemovalHandler addPanel(final Panel<?, ?> panel) { if (panels.size() == 0) { positionFirstPanel(( leftMost = rightMost = newNode(panel) )); } else { PanelNode existing = panels.get(panel.getId()); if (existing == null) { addNewPanel(panel); } else { if (existing.panel != panel) { removePanel(existing.panel); addNewPanel(panel); } else { // focusPanel(existing); } } } return new RemovalHandler() { @Override public void remove() { removePanel(panel); } }; } protected void addNewPanel(Panel<?, ?> panel) { PanelNode node = newNode(panel); panels.put(panel.getId(), node); if (!panel.isHidden()) focusPanel(node); } protected float makeRoomOnRight(float prefWidth, float maxRight) { Log.info(getClass(), "Making room on right", maxRight); return 0; } protected float makeRoomOnLeft(float prefWidth, float maxRight) { // Starting at the right-most panel, Log.info(getClass(), "Making room on left", maxRight); return 0; } protected PanelNode newNode(Panel<?, ?> panel) { return new PanelNode(panel); } public void focusPanel(PanelNode toFocus) { assert panels.containsKey(toFocus.panel.getId()); Panel<?, ?> panel = toFocus.panel; final Element el = panel.getView().getElement(); Log.info(getClass(), "Focusing panel "+toFocus.panel.getId()); // First, try to get off easy. // If nothing else is visible, we can just open centered on screen. JsoArray<String> keys = panels.getKeys(); JsoArray<PanelNode> visible = JsoArray.create(); for (int i = 0, m = keys.size(); i < m; i++) { PanelNode node = panels.get(keys.get(i)); if (node != toFocus && !node.panel.isHidden()) visible.add(node); } if (visible.isEmpty()) { // Nothing else is showing. Let's fill the screen. centerOnScreen(toFocus); } ResizeBounds bounds = panel.getBounds(); float leftest = leftMost.x; float minLeft = getMinLeft(); float minTop = getMinTop(); float maxHeight = getMaxHeight(); float maxWidth = getMaxWidth(); float prefWidth = bounds.getPreferredWidth(); float prefHeight = bounds.getPreferredHeight(); if (prefWidth < 0) prefWidth = maxWidth + prefWidth; if (prefHeight < 0) prefHeight = maxHeight + prefHeight; float maxRight = maxWidth + minLeft; // Try to get off easy: float deltaLeft = leftest - prefWidth; if (deltaLeft > minLeft) { Log.info(getClass(), "Leftest: "+leftest+"; deltaLeft: "+deltaLeft+"; minLeft: "+minLeft); // simplest case; there's room on the left, just dump in a new panel. toFocus.setPosition(deltaLeft, minTop); toFocus.setSize(prefWidth, Math.min(maxHeight, minTop + prefHeight)); leftMost.onLeft = new PanelNode[]{toFocus}; leftMost = toFocus; return; } // No room on the left; maybe room on the right? float rightest = rightMost.x + rightMost.w; float deltaRight = rightest + prefWidth; if (deltaRight < maxRight) { Log.info(getClass(), "Rightest: "+rightest+"; deltaRight: "+deltaRight+"; maxRight: "+maxRight); toFocus.setPosition(deltaLeft, minTop); toFocus.setSize(prefWidth, Math.min(maxHeight, minTop + prefHeight)); rightMost.onRight = new PanelNode[]{toFocus}; rightMost = toFocus; return; } // No free space on either side. Start squishing to make room boolean squishRight = ((maxRight - deltaRight) > (minLeft - deltaLeft)); if (squishRight) { // First, slide everything to the right to make more room. float roomMade = makeRoomOnLeft(prefWidth, minLeft); } else { // Slide everything to the left to make more roomt float roomMade = makeRoomOnRight(prefWidth, maxRight); } // // ClientRect bounds = fileNav.getBoundingClientRect(); // // First, chose whether to add to the left or the right based on // // where there is more room. // float middle = parent.getLeft() + parent.getWidth()/2; // // rather than duplicate the moving code, we're just going to collect // // up movable elements, as well as the amount of left they must move // float delta; // ArrayOf<Element> toMove = Collections.arrayOf(); // boolean goingLeft = bounds.getLeft() + bounds.getWidth() / 2 > middle; // if (goingLeft) { // // place new panel to the left // // everything currently to the left must slide left (-delta) // delta = -el.getClientWidth()-20; // // } else { // // place new panel to the right; all other panels slide right (+delta) // delta = el.getClientWidth()+20; // } // el.getStyle().setLeft(bounds.getLeft()+delta, "px"); // float minBound = goingLeft ? parent.getLeft() + parent.getWidth() : parent.getLeft(); // JsoArray<String> keys = positioner.keys(); // Panel<?, ?> edge = fileNavPanel; // for (int i = 0; i < keys.size(); i++ ) { // String key = keys.get(i); // Panel<?, ?> other = positioner.getPanel(key).panel; // if (other == panel) // continue; // ClientRect otherBounds = other.getView().getElement().getBoundingClientRect(); // if (goingLeft) { // if (otherBounds.getLeft() < minBound) { // edge = other; // minBound = otherBounds.getLeft(); // X_Log.info(edge, minBound); // } // } else { // if (otherBounds.getRight() > minBound) { // edge = other; // minBound = otherBounds.getRight(); // X_Log.info(minBound, edge); // } // } // } // ResizeBounds desired = panel.getBounds(); // double w = desired.getPreferredWidth()+40;//throw in padding // if (goingLeft) { // if (minBound - w < 0) { // el.getStyle().setLeft(0, "px"); // if (w - minBound > desired.getMinWidth()) { // el.getStyle().setWidth((w-minBound-20)+"px"); // } else { // el.getStyle().setWidth(desired.getMinWidth()+"px"); // } // } else { // el.getStyle().setWidth((w-20)+"px"); // el.getStyle().setLeft((minBound - w)+"px"); // } // } else { // if (minBound + w > parent.getRight()) { // // } // } // middle = parent.getTop() + parent.getHeight() / 2; // float top = bounds.getTop(), bottom = bounds.getBottom(); // el.getStyle().setTop(5,"px"); // el.getStyle().setHeight(bounds.getBottom()-15,"px"); } protected void centerOnScreen(PanelNode toFocus) { ResizeBounds bounds = toFocus.panel.getBounds(); float screenWidth = getMaxWidth(); float screenHeight = getMaxHeight(); float maxWidth = bounds.getMaxWidth(); float maxHeight = bounds.getMaxWidth(); // Normalize negative anchors if (maxWidth < 0) { maxWidth = screenWidth + maxWidth; } if (maxHeight < 0) { maxHeight = screenHeight + maxHeight; } // Set constrained bounds toFocus.setSize( Math.min(maxWidth, screenWidth*7/8), Math.min(maxHeight, screenHeight*7/8) ); // Apply position toFocus.setPosition( getMinLeft() + (maxWidth-toFocus.w)/2f, getMinTop() + (maxHeight-toFocus.h)/2f ); if (toFocus.panel.isHidden()) toFocus.panel.show(); } protected void positionFirstPanel(PanelNode panelNode) { // Our default implementation starts at top right and expands left. panels.put(panelNode.panel.getId(), panelNode); float end = getMaxWidth(); ResizeBounds bounds = panelNode.panel.getBounds(); // first panel always gets its preferred size panelNode.setSize( bounds.getPreferredWidth(), bounds.getPreferredHeight() ); panelNode.setPosition( end - panelNode.w - getMinLeft(), panelNode.y = 0 - getMinTop() ); } @Override public boolean adjustHorizontal(Panel<?, ?> panel, float deltaX, float deltaW) { PanelNode node = panels.get(panel.getId()); if (node == null) return false; boolean newWidth = Math.abs(deltaW) > 0.001; deltaW = -deltaW;// when our node grows, we offer siblings the negative value of our change if (deltaX > 0.001f) { // moving right, pull anyone to the left with us, squish anyone to the right node.x += deltaX; float left = deltaX; for (PanelNode onLeft : node.toTheLeft()) { Log.info(getClass(), "Moving right "+deltaX+ " : "+onLeft.panel.getId()); float consumes = onLeft.offerWidth(left); if (consumes != left) { deltaX -= (left - consumes); left = consumes; } onLeft.setPosition(onLeft.x + deltaX, onLeft.y); } if (newWidth) { for (PanelNode onRight : node.toTheRight()) { Log.info(getClass(), "Go right "+deltaX+ " : "+onRight.panel.getId()); deltaW = onRight.offerWidth(deltaW); if (deltaW >= 0) return true; } } } else if (deltaX < -0.001f) { // moving left; bring anyone to the right with us, squish anyone on the left Log.info(getClass(), "Moving left "+deltaX); for (PanelNode onLeft : node.toTheLeft()) { onLeft.setPosition(onLeft.x + deltaX, onLeft.y); if (newWidth) { deltaW = onLeft.offerWidth(deltaW); if (deltaW == 0) { newWidth = false; } } } return newWidth == false; } else if (newWidth) { // No delta in position, this is a drag resize event (on right or bottom axis). for (PanelNode onRight : node.toTheRight()) { deltaW = onRight.offerWidth(deltaW); if (Math.abs(deltaW) < 0.001) return true; } for (PanelNode onLeft : node.toTheLeft()) { deltaW = onLeft.offerWidth(deltaW); if (Math.abs(deltaW) < 0.001) return true; } } return false; } @Override public boolean adjustVertical(Panel<?, ?> panel, float deltaY, float deltaH) { // TODO Auto-generated method stub return false; } public void removePanel(Panel<?, ?> panel) { } protected float getMinLeft() { return 0; } protected float getMinTop() { return 0; } protected float getMaxWidth() { return Elements.getWindow().getInnerWidth(); } protected float getMaxHeight() { return Elements.getWindow().getInnerHeight(); } public boolean hasPanel(String namespace) { return panels.containsKey(namespace); } public PanelNode getPanel(String namespace) { return panels.get(namespace); } public JsoArray<String> keys() { return panels.getKeys(); } public void recalculate() { // Iterate through all panels, and make sure they are all sorted correctly. // If there are any changes, we should redraw (but avoid unneccessary layout()) JsoArray<String> keys = panels.getKeys(); JsoArray<PanelNode> visible = JsoArray.create(); for (String key : keys.asIterable()) { PanelNode node = panels.get(key); if (!node.panel.isHidden()) visible.add(node); } if (visible.size() < 2) return; visible.sort(sorter); PanelNode onLeft = visible.remove(0); onLeft.onLeft = empty; PanelNode next = null; while (visible.size() > 0) { next = visible.remove(0); onLeft.onRight = new PanelNode[]{next}; next.onLeft = new PanelNode[]{onLeft}; onLeft = next; } next.onRight = empty; } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/com/google/collide/client/ui/panel/PanelPositioner.java
client/src/main/java/com/google/collide/client/ui/panel/PanelPositioner.java
package com.google.collide.client.ui.panel; import xapi.util.api.RemovalHandler; public interface PanelPositioner { RemovalHandler addPanel(Panel<?, ?> panel); boolean adjustHorizontal(Panel<?, ?> panel, float deltaX, float deltaW); boolean adjustVertical(Panel<?, ?> panel, float deltaY, float deltaH); void removePanel(Panel<?, ?> panel); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/com/google/collide/client/ui/panel/ContentReceiver.java
client/src/main/java/com/google/collide/client/ui/panel/ContentReceiver.java
package com.google.collide.client.ui.panel; public interface ContentReceiver { PanelContent getContent(); void setContent(PanelContent panelContent); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/com/google/collide/client/ui/panel/MultiPanel.java
client/src/main/java/com/google/collide/client/ui/panel/MultiPanel.java
package com.google.collide.client.ui.panel; import collide.client.util.CssUtils; import com.google.collide.client.ui.panel.PanelModel.Builder; import com.google.collide.mvp.CompositeView; import com.google.collide.mvp.ShowableUiComponent; import com.google.collide.mvp.UiComponent; import elemental.dom.Element; public abstract class MultiPanel <M extends PanelModel, V extends MultiPanel.View<M>> extends UiComponent<V> { public MultiPanel(V view) { super(view); } public abstract static class View<M extends PanelModel> extends CompositeView<M> { public View(Element element, boolean detached) { setElement(element); } public abstract Element getContentElement(); public abstract Element getHeaderElement(); } protected PanelContent currentContent; public PanelContent getCurrentContent() { return currentContent; } public abstract PanelModel.Builder<M> newBuilder(); /** * Sets the contents of the content area under the header. * * @param panelContent the content to display, or null to clear content * @param settings - our immutable settings pojo. */ public void setContent(PanelContent panelContent, PanelModel settings) { if (currentContent == panelContent) { return; } if (currentContent != null) { currentContent.onContentDestroyed(); currentContent.getContentElement().removeFromParent(); } getContentElement().setInnerHTML(""); if (panelContent != null) { getContentElement().appendChild(panelContent.getContentElement()); } currentContent = panelContent; currentContent.onContentDisplayed(); if (settings.isClearNavigator()) { clearNavigator(); } setHeaderVisibility(true); } protected Element getContentElement() { return getView().getContentElement(); } public void clearNavigator() { } /** * Sets the contents of the content area under the header. Assumes content can display history and shows * history icon. (Use {@link #setContent(PanelContent, PanelModel)} to customize). * * @param panelContent the content to display, or null to clear content */ public void setContent(PanelContent panelContent) { setContent(panelContent, PanelModel.newBasicModel().setHistoryIcon(true).build()); } public void setHeaderVisibility(boolean visible) { Element el = getView().getHeaderElement(); if (el == null) return; el = el.getFirstElementChild(); if (el == null) return; CssUtils.setDisplayVisibility2(el, visible); } public void destroy() { if (currentContent != null) { currentContent.onContentDestroyed(); currentContent.getContentElement().removeFromParent(); currentContent = null; } getView().getContentElement().setInnerHTML(""); } public abstract ShowableUiComponent<?> getToolBar(); public Builder<PanelModel> defaultBuilder() { return PanelModel.newBasicModel(); } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/com/google/collide/client/ui/panel/PanelContent.java
client/src/main/java/com/google/collide/client/ui/panel/PanelContent.java
package com.google.collide.client.ui.panel; import elemental.dom.Element; /** * Type for things that can be added to the content area of the CodePerspective. */ public interface PanelContent { static interface HiddenContent extends PanelContent{} /** * @return The {@link Element} that we set as the contents of the content area. */ Element getContentElement(); /** * Called when the content is displayed. It's possible that element returned by * {@link #getContentElement()} was removed from DOM and re-added, so this callback is a good place to * re-initialize any values that may have been cleared. * @param content */ void onContentDisplayed(); /** * Called when the content is destroyed. Any time a displayed panel is destroyed, this method will be * called. Useful if you have panels with maps and listeners to clear. */ void onContentDestroyed(); public static class AbstractContent implements PanelContent { private final Element contentElement; public AbstractContent(Element contentElement) { this.contentElement = contentElement; } /** * @return the contentElement */ public Element getContentElement() { return contentElement; } @Override public void onContentDisplayed() { } @Override public void onContentDestroyed() { } } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/com/google/collide/client/ui/button/ImageButton.java
client/src/main/java/com/google/collide/client/ui/button/ImageButton.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.client.ui.button; import collide.client.common.CommonResources; import collide.client.util.CssUtils; import collide.client.util.Elements; import com.google.collide.client.util.ImageResourceUtils; import com.google.collide.mvp.CompositeView; import com.google.collide.mvp.UiComponent; import com.google.gwt.resources.client.ImageResource; import elemental.dom.Element; import elemental.events.Event; import elemental.events.EventListener; import elemental.html.AnchorElement; import elemental.html.DivElement; /** * A button containing and image and text. */ public class ImageButton extends UiComponent<ImageButton.View> { /** * Creates an {@link ImageButton}. */ public static class Builder { private final CommonResources.BaseResources res; private ImageResource image; private String text; private AnchorElement element; public Builder(CommonResources.BaseResources res) { this.res = res; } public Builder setImage(ImageResource image) { this.image = image; return this; } public Builder setText(String text) { this.text = text; return this; } public Builder setElement(AnchorElement element) { this.element = element; return this; } public ImageButton build() { // Create an element if one is not specified. AnchorElement anchor = element; if (anchor == null) { anchor = Elements.createAnchorElement(res.baseCss().button()); anchor.setHref("javascript:;"); } View view = new View(res, anchor); ImageButton button = new ImageButton(view); button.setImageAndText(image, text); return button; } } /** * Called when the button is clicked. */ public interface Listener { void onClick(); } /** * The View for the Header. */ public static class View extends CompositeView<ViewEvents> { /** * The spacing between the image and the text. */ private static final int ICON_SPACING = 8; private final CommonResources.BaseCss baseCss; private final DivElement imageElem; private final DivElement imagePositioner; private final DivElement textElem; public View(CommonResources.BaseResources res, AnchorElement button) { baseCss = res.baseCss(); // Create an outer element. setElement(button); button.getStyle().setPosition("relative"); // Create a centered element to position the image. imagePositioner = Elements.createDivElement(); button.appendChild(imagePositioner); imagePositioner.getStyle().setPosition("absolute"); imagePositioner.getStyle().setTop("50%"); // Add the image. imageElem = Elements.createDivElement(); imagePositioner.appendChild(imageElem); imageElem.addClassName(baseCss.buttonImage()); imageElem.getStyle().setPosition("absolute"); // Override the margins set in base.css. Those margins are a hack. imageElem.getStyle().setMargin("0"); // Add the text. textElem = Elements.createDivElement(); textElem.getStyle().setHeight("100%"); button.appendChild(textElem); attachEventListeners(); } @Override public AnchorElement getElement() { return (AnchorElement) super.getElement(); } public Element getImageElement() { return imageElem; } @SuppressWarnings("null") private void setImageAndText(ImageResource image, String text) { // Update the image. boolean hasImage = (image != null); CssUtils.setDisplayVisibility2(imageElem, hasImage); if (hasImage) { ImageResourceUtils.applyImageResource(imageElem, image); } // Update the text. boolean hasText = (text != null && text.length() > 0); textElem.setTextContent(hasText ? text : ""); // Position the image. if (hasImage) { imageElem.getStyle().setTop(image.getHeight() / -2, "px"); if (hasText) { // Left align the image if we have text. imagePositioner.getStyle().setLeft(baseCss.buttonHorizontalPadding(), "px"); imageElem.getStyle().setLeft(0, "px"); } else { // Horizontally center the image if we do not have text. imagePositioner.getStyle().setLeft("50%"); imageElem.getStyle().setLeft(image.getWidth() / -2, "px"); } } /* * Position the text. Even if there is no text, we use the text element to * force the button element to be wide enough to contain the image. */ int left = 0; if (hasImage) { left += image.getWidth(); } if (hasText) { left += ICON_SPACING; } textElem.getStyle().setPaddingLeft(left, "px"); } private void attachEventListeners() { getElement().addEventListener(Event.CLICK, new EventListener() { @Override public void handleEvent(Event evt) { if (getDelegate() != null) { getDelegate().onButtonClicked(); } } }, false); } } /** * Events reported by the View. */ private interface ViewEvents { void onButtonClicked(); } private Listener listener; private ImageResource image; private boolean isImageHidden; private String text; private ImageButton(View view) { super(view); handleEvents(); } public void setListener(Listener listener) { this.listener = listener; } public void setImage(ImageResource image) { setImageAndText(image, this.text); } public void clearImage() { setImageAndText(null, this.text); } public void setText(String text) { setImageAndText(this.image, text); } public void clearText() { setImageAndText(this.image, null); } public void setImageAndText(ImageResource image, String text) { this.image = image; this.text = text; updateView(); } /** * Shows or hides the image. */ public void setImageHidden(boolean isHidden) { this.isImageHidden = isHidden; updateView(); } private void updateView() { getView().setImageAndText(isImageHidden ? null : image, text); } private void handleEvents() { getView().setDelegate(new ViewEvents() { @Override public void onButtonClicked() { if (listener != null) { listener.onClick(); } } }); } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/com/google/collide/client/ui/button/ImageButton2.java
client/src/main/java/com/google/collide/client/ui/button/ImageButton2.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.client.ui.button; import collide.client.util.CssUtils; import collide.client.util.Elements; import com.google.collide.client.ui.dropdown.DropdownWidgets.Resources; import com.google.collide.shared.util.StringUtils; import com.google.gwt.resources.client.ImageResource; import elemental.css.CSSStyleDeclaration; import elemental.events.Event; import elemental.events.EventListener; import elemental.html.ButtonElement; /** * A button which centers an image inside of a button. This class is special since it uses multiple * background images to achieve the desired effect. NOTE: Would be significantly better if we just * used a less-style CSS parser for GWT. It is important that you call * {@link #initializeAfterAttachedToDom()} after creation. */ public class ImageButton2 { private final ButtonElement buttonElement; private final String ourTopLayer; public ImageButton2(Resources res, ImageResource img) { this(Elements.createButtonElement(res.baseCss().button()), img); } public ImageButton2(ButtonElement buttonElement, ImageResource img) { this.ourTopLayer = "url(" + img.getSafeUri().asString() + ") no-repeat 50% 50%"; this.buttonElement = buttonElement; attachEvents(); } private void attachEvents() { EventListener listener = new EventListener() { @Override public void handleEvent(Event evt) { refresh(); } }; // we support over/pressed buttonElement.addEventListener(Event.MOUSEDOWN, listener, false); buttonElement.addEventListener(Event.MOUSEUP, listener, false); buttonElement.addEventListener(Event.MOUSEOVER, listener, false); buttonElement.addEventListener(Event.MOUSEOUT, listener, false); } /** * Initializes the button after it's button has been attached to the DOM. This means fully * attached to the document body not just appended to a container. */ public void initializeAfterAttachedToDom() { refresh(); } /** * Refreshes the background image of the image button. */ private void refresh() { CSSStyleDeclaration declaration = CssUtils.getComputedStyle(buttonElement); if (StringUtils.isNullOrEmpty(declaration.getPropertyValue("background"))) { // bail if we're not attached to the dom return; } buttonElement.getStyle().removeProperty("background"); String currentBackgroundImage = declaration.getPropertyValue("background"); buttonElement.getStyle().setProperty("background", ourTopLayer + "," + currentBackgroundImage); } public ButtonElement getButtonElement() { return buttonElement; } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/com/google/collide/client/ui/dropdown/DropdownController.java
client/src/main/java/com/google/collide/client/ui/dropdown/DropdownController.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.client.ui.dropdown; import collide.client.common.CommonResources.BaseResources; import collide.client.util.Elements; import com.google.collide.client.ui.dropdown.DropdownWidgets.Resources; import com.google.collide.client.ui.list.KeyboardSelectionController; import com.google.collide.client.ui.list.SimpleList; import com.google.collide.client.ui.list.SimpleList.ListItemRenderer; import com.google.collide.client.ui.menu.AutoHideComponent.AutoHideHandler; import com.google.collide.client.ui.menu.AutoHideController; import com.google.collide.client.ui.menu.PositionController; import com.google.collide.client.ui.menu.PositionController.Positioner; import com.google.collide.client.ui.menu.PositionController.PositionerBuilder; import com.google.collide.client.ui.menu.PositionController.VerticalAlign; import com.google.collide.client.ui.tooltip.Tooltip; import com.google.collide.json.shared.JsonArray; import elemental.css.CSSStyleDeclaration; import elemental.dom.Element; import elemental.events.Event; import elemental.events.EventListener; /** * A controller that can add a dropdown to any element. * */ public class DropdownController<M> { /** * Simplifies construction of a dropdown controller by setting reasonable * defaults for most options. * */ public static class Builder<M> { /** Indicates the width of the dropdown's anchor should be used. */ public final static int WIDTH_OF_ANCHOR = -1; private Element input; private Tooltip anchorTooltip; private boolean autoFocus = true; private boolean enableKeyboardSelection = false; private int maxHeight; private int maxWidth; private final Resources res; private final Listener<M> listener; private final ListItemRenderer<M> renderer; private final Positioner positioner; private final Element trigger; /** * @see DropdownPositionerBuilder */ public Builder(Positioner positioner, Element trigger, DropdownWidgets.Resources res, Listener<M> listener, SimpleList.ListItemRenderer<M> renderer) { this.positioner = positioner; this.res = res; this.listener = listener; this.renderer = renderer; this.trigger = trigger; } public Builder<M> setInputTargetElement(Element inputTarget) { this.input = inputTarget; return this; } public Builder<M> setAnchorTooltip(Tooltip tooltip) { this.anchorTooltip = tooltip; return this; } public Builder<M> setShouldAutoFocusOnOpen(boolean autoFocus) { this.autoFocus = autoFocus; return this; } public Builder<M> setKeyboardSelectionEnabled(boolean enabled) { this.enableKeyboardSelection = enabled; return this; } public Builder<M> setMaxHeight(int maxHeight) { this.maxHeight = maxHeight; return this; } public Builder<M> setMaxWidth(int maxWidth) { this.maxWidth = maxWidth; return this; } public DropdownController<M> build() { return new DropdownController<M>(res, listener, renderer, positioner, trigger, input, anchorTooltip, autoFocus, enableKeyboardSelection, maxHeight, maxWidth); } } /** * A {@link PositionerBuilder} which starts with its {@link VerticalAlign} property set to * {@link VerticalAlign#BOTTOM} for convenience when building dropdowns. */ public static class DropdownPositionerBuilder extends PositionerBuilder { public DropdownPositionerBuilder() { setVerticalAlign(VerticalAlign.BOTTOM); } } /** * Base listener that provides default implementations (i.e. no-op) for the * Listener interface. This allows subclasses to only override the methods it * is interested in. */ public static class BaseListener<M> implements Listener<M> { @Override public void onItemClicked(M item) { } @Override public void onHide() { } @Override public void onShow() { } } public interface Listener<M> { void onItemClicked(M item); void onHide(); void onShow(); } private static final int DROPDOWN_ZINDEX = 20005; private final DropdownWidgets.Resources res; private final Listener<M> listener; private final ListItemRenderer<M> renderer; private JsonArray<M> itemsForLazyCreation; private SimpleList<M> list; private AutoHideController listAutoHider; // if null, keyboard selection is disabled private KeyboardSelectionController keyboardSelectionController = null; private final Element inputTarget; private final Element trigger; private final Tooltip anchorTooltip; private final boolean shouldAutoFocusOnOpen; private final boolean enableKeyboardSelection; private final int maxHeight; private final int maxWidth; private final Positioner positioner; private PositionController positionController; private boolean isDisabled; /** * Creates a DropdownController which appears relative to an anchor. * * @param res the {@link BaseResources} * @param listener a {@link Listener} for dropdown events. * @param renderer the {@link ListItemRenderer} for rendering each list item * @param positioner the {@link Positioner} used by {@link PositionController} to position the * dropdown. * @param trigger the item (usually a button) for which to show the menu (optional) * @param inputTarget the element used to record input from for keyboard navigation * @param shouldAutoFocusOnOpen autofocuses the list on open for keyboard navigation */ private DropdownController(DropdownWidgets.Resources res, Listener<M> listener, SimpleList.ListItemRenderer<M> renderer, Positioner positioner, Element trigger, Element inputTarget, Tooltip anchorTooltip, boolean shouldAutoFocusOnOpen, boolean enableKeyboardSelection, int maxHeight, int maxWidth) { this.res = res; this.listener = listener; this.renderer = renderer; this.positioner = positioner; this.inputTarget = inputTarget; this.trigger = trigger; this.anchorTooltip = anchorTooltip; this.shouldAutoFocusOnOpen = shouldAutoFocusOnOpen; this.enableKeyboardSelection = enableKeyboardSelection; this.maxHeight = maxHeight; this.maxWidth = maxWidth; if (trigger != null) { attachEventHandlers(trigger); } } private void attachEventHandlers(Element trigger) { trigger.addEventListener(Event.CLICK, new EventListener() { @Override public void handleEvent(Event evt) { if (listAutoHider == null || !listAutoHider.isShowing()) { show(); } else { hide(); } } }, false); } public void setItems(JsonArray<M> items) { if (list != null) { list.render(items); } else { itemsForLazyCreation = items; } } /** * Sets the tooltip associated with the element so it can be disabled while * the dropdown is showing. */ public void setElementTooltip(Tooltip tooltip) { listAutoHider.setTooltip(tooltip); } /** * Show the controller relative to the anchor. */ public void show() { if (!isDisabled && preShowCheck()) { updatePositionAndSize(); postShow(); } } public boolean isShowing() { return listAutoHider != null && listAutoHider.isShowing(); } /** * Hides the dropdown if it is showing. Shows it if it is hidden. */ public void toggle() { if (isShowing()) { hide(); } else { show(); } } /** * Will show the controller at the given position (ignoring the anchor). */ public void showAtPosition(int x, int y) { if (!isDisabled && preShowCheck()) { updatePositionAndSizeAtCoordinates(x, y); postShow(); } } /** * Do this before showing the dropdown * @return true if we should show, false otherwise */ private boolean preShowCheck() { ensureDropdownCreated(); return list.size() > 0; } private void postShow() { if (keyboardSelectionController != null) { keyboardSelectionController.setHandlerEnabled(true); } listAutoHider.show(); if (shouldAutoFocusOnOpen) { list.getView().focus(); } } public void hide() { if (keyboardSelectionController != null) { keyboardSelectionController.setHandlerEnabled(false); } if (listAutoHider != null) { // in case we can't hide before we've created the dropdown listAutoHider.hide(); } } /** * Returns the simple list container element */ public Element getElement() { // if they want the element we must ensure it has been created. ensureDropdownCreated(); return list.getView(); } public SimpleList<M> getList() { ensureDropdownCreated(); return list; } /** * Enables or disables the dropdown. Does not affect the current showing state. */ public void setDisabled(boolean isDisabled) { this.isDisabled = isDisabled; } private void ensureDropdownCreated() { if (list == null) { createDropdown(); } } /** * Prevents default on all mouse clicks the dropdown receives. There is no way * to remove the handler once it is set. */ public void preventDefaultOnMouseDown() { // Prevent the dropdown from taking focus on click getElement().addEventListener(Event.MOUSEDOWN, new EventListener() { @Override public void handleEvent(Event evt) { evt.preventDefault(); } }, false); } private void createDropdown() { SimpleList.View listView = (SimpleList.View) Elements.createDivElement(); listView.setTabIndex(100); listView.getStyle().setZIndex(DROPDOWN_ZINDEX); SimpleList.ListEventDelegate<M> listEventDelegate = new SimpleList.ListEventDelegate<M>() { @Override public void onListItemClicked(Element listItemBase, M itemData) { handleItemClicked(itemData); } }; list = SimpleList.create(listView, res, renderer, listEventDelegate); if (itemsForLazyCreation != null) { list.render(itemsForLazyCreation); itemsForLazyCreation = null; } listAutoHider = AutoHideController.create(list.getView()); listAutoHider.setTooltip(anchorTooltip); // Don't actually autohide (we use it for outside click dismissal) listAutoHider.setDelay(-1); if (trigger != null) { listAutoHider.addPartnerClickTargets(trigger); } listAutoHider.setAutoHideHandler(new AutoHideHandler() { @Override public void onShow() { listener.onShow(); } @Override public void onHide() { listAutoHider.getView().getElement().removeFromParent(); listener.onHide(); } }); if (enableKeyboardSelection) { keyboardSelectionController = new KeyboardSelectionController( inputTarget == null ? listView : inputTarget, list.getSelectionModel()); } positionController = new PositionController(positioner, listView); } private void updatePositionAndSize() { Element dropdownElement = listAutoHider.getView().getElement(); updateWidthAndHeight(dropdownElement); positionController.updateElementPosition(0, 0); } private void updatePositionAndSizeAtCoordinates(int x, int y) { Element dropdownElement = listAutoHider.getView().getElement(); // ensure we're attached to the DOM Elements.getBody().appendChild(dropdownElement); updateWidthAndHeight(dropdownElement); positionController.updateElementPosition(x, y); } private void updateWidthAndHeight(Element dropdownElement) { /* * The 'outline' is drawn to the left of and above where the absolute top * and left are, so account for them in the top and right. */ CSSStyleDeclaration style = dropdownElement.getStyle(); /* * This width will either be 0 if we're being positioned by the mouse or the width of our * anchor. */ int widthOfAnchorOrZero = positioner.getMinimumWidth(); // set the minimum width int dropdownViewMinWidth = widthOfAnchorOrZero - (2 * res.defaultSimpleListCss().menuListBorderPx()); style.setProperty("min-width", dropdownViewMinWidth + "px"); // sets the maximum width boolean useWidthOfAnchor = maxWidth == Builder.WIDTH_OF_ANCHOR && widthOfAnchorOrZero != 0; if (maxWidth != 0 && useWidthOfAnchor) { int curMaxWidth = useWidthOfAnchor ? widthOfAnchorOrZero : maxWidth; style.setProperty("max-width", curMaxWidth + "px"); } if (maxHeight != 0) { style.setProperty("max-height", maxHeight + "px"); } } private void handleItemClicked(M item) { hide(); listener.onItemClicked(item); } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/com/google/collide/client/ui/dropdown/DropdownWidgets.java
client/src/main/java/com/google/collide/client/ui/dropdown/DropdownWidgets.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.client.ui.dropdown; import collide.client.common.CommonResources; import collide.client.util.Elements; import com.google.collide.client.ui.button.ImageButton2; import com.google.collide.client.ui.list.SimpleList; import com.google.gwt.resources.client.CssResource; import com.google.gwt.resources.client.ImageResource; import elemental.dom.Element; import elemental.html.DivElement; import elemental.html.InputElement; import elemental.html.SpanElement; /** * A collection of widgets for creating dropdowns */ public class DropdownWidgets { public interface Css extends CssResource { // Dropdown Button public String button(); public String buttonLabel(); public String buttonArrow(); // Dropdown Input public String inputContainer(); public String input(); public String inputArrow(); public String inputArrowActive(); // Split Button public String splitButtonLabel(); public String splitButtonArrow(); } public interface Resources extends CommonResources.BaseResources, SimpleList.Resources { @Source("DropdownWidgets.css") Css dropdownWidgetsCss(); } /** * Creates a button which functions as a dropdown. * */ public static class DropdownButton { private final DivElement button; private final DivElement label; public DropdownButton(Resources res) { Css css = res.dropdownWidgetsCss(); button = Elements.createDivElement(css.button()); button.addClassName(res.baseCss().button()); label = Elements.createDivElement(css.buttonLabel()); button.appendChild(label); Element arrow = Elements.createDivElement(css.buttonArrow()); button.appendChild(arrow); } public DivElement getButton() { return button; } public DivElement getLabel() { return label; } } /** * An input box that displays with a clickable dropdown arrow. This is not modeled as a proper UI * component since it is fairly light weight. * */ public static class DropdownInput { private final DivElement container; private final InputElement inputElement; private final SpanElement indicatorArrow; public DropdownInput(Resources res) { Css css = res.dropdownWidgetsCss(); container = Elements.createDivElement(css.inputContainer()); indicatorArrow = Elements.createSpanElement(css.inputArrow()); indicatorArrow.setTextContent("\u00A0"); container.appendChild(indicatorArrow); inputElement = Elements.createInputTextElement(res.baseCss().textInput()); inputElement.addClassName(res.dropdownWidgetsCss().input()); container.appendChild(inputElement); } public DivElement getContainer() { return container; } public SpanElement getButton() { return indicatorArrow; } public InputElement getInput() { return inputElement; } } /** * Creates a split button which has an image in the left and right. The left side is considered * the label and the right side is typically a trigger for a dropdown menu. */ public static class SplitDropdownButton { private final ImageButton2 labelButton; private final ImageButton2 triggerButton; public SplitDropdownButton(Resources res, Element container, ImageResource labelImage) { CommonResources.BaseCss baseCss = res.baseCss(); Css css = res.dropdownWidgetsCss(); labelButton = new ImageButton2(res, labelImage); labelButton.getButtonElement().addClassName(css.splitButtonLabel()); container.appendChild(labelButton.getButtonElement()); triggerButton = new ImageButton2(res, res.disclosureArrowDkGreyDown()); triggerButton.getButtonElement().addClassName(css.splitButtonArrow()); container.appendChild(triggerButton.getButtonElement()); } public void initializeAfterAttachedToDom() { labelButton.initializeAfterAttachedToDom(); triggerButton.initializeAfterAttachedToDom(); } public ImageButton2 getLabelButton() { return labelButton; } public ImageButton2 getTriggerButton() { return triggerButton; } } private DropdownWidgets() { // can't instantiate this class } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/com/google/collide/client/ui/dropdown/AutocompleteController.java
client/src/main/java/com/google/collide/client/ui/dropdown/AutocompleteController.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.client.ui.dropdown; import com.google.collide.json.shared.JsonArray; import com.google.gwt.user.client.Timer; import elemental.events.Event; import elemental.events.EventListener; import elemental.events.KeyboardEvent; import elemental.events.KeyboardEvent.KeyCode; import elemental.html.InputElement; /** * Provides autocomplete functionality for an input using simple list. * */ public class AutocompleteController<M> { /* * hide long enough for the click to be caught by handlers but not long enough * to be noticable by the user. */ private static final int HIDE_DELAY = 100; public static <M> AutocompleteController<M> create( InputElement inputBox, DropdownController<M> controller, AutocompleteHandler<M> callback) { return new AutocompleteController<M>(inputBox, controller, callback); } public interface AutocompleteHandler<M> { public JsonArray<M> doCompleteQuery(String query); public void onItemSelected(M item); } /** * The amount of time to wait after the user has finished typing before * updating autocompletion results. */ private static final int AUTOCOMPLETE_DELAY = 30; private final InputElement inputBox; private final DropdownController<M> dropdown; private final AutocompleteHandler<M> callback; private int minimumCharactersBeforeCompletion = 1; public AutocompleteController( InputElement inputBox, DropdownController<M> dropdown, AutocompleteHandler<M> callback) { this.inputBox = inputBox; this.dropdown = dropdown; this.callback = callback; dropdown.preventDefaultOnMouseDown(); attachHandlers(); } public DropdownController<M> getDropdown() { return dropdown; } /** * Specifies the minimum number of characters to be typed in before completion * will take place. */ public void setMinimumCharactersBeforeCompletion(int minimum) { minimumCharactersBeforeCompletion = minimum; } private void attachHandlers() { inputBox.addEventListener(Event.INPUT, new EventListener() { final Timer deferredShow = new Timer() { @Override public void run() { JsonArray<M> items = callback.doCompleteQuery(inputBox.getValue()); if (items.size() > 0) { dropdown.setItems(items); dropdown.show(); } else { dropdown.hide(); } } }; @Override public void handleEvent(Event evt) { KeyboardEvent event = (KeyboardEvent) evt; if (inputBox.getValue().length() < minimumCharactersBeforeCompletion) { dropdown.hide(); } else { deferredShow.cancel(); deferredShow.schedule(AUTOCOMPLETE_DELAY); } } }, false); inputBox.addEventListener(Event.BLUR, new EventListener() { @Override public void handleEvent(Event evt) { dropdown.hide(); } }, false); inputBox.addEventListener(Event.KEYUP, new EventListener() { @Override public void handleEvent(Event evt) { KeyboardEvent event = (KeyboardEvent) evt; if (event.getKeyCode() == KeyCode.ESC) { dropdown.hide(); } } }, false); } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/com/google/collide/client/ui/dropdown/TextContentsController.java
client/src/main/java/com/google/collide/client/ui/dropdown/TextContentsController.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.client.ui.dropdown; import elemental.dom.Element; /** * A controller to set the text on an element, optionally supporting a hint. */ public class TextContentsController { private static final String ATTR_VALUE = "value"; public enum Setter { INNER_TEXT, VALUE } private final Element element; private final Setter setter; private boolean hasText; private String hint; public TextContentsController(Element element, Setter setter) { this.element = element; this.setter = setter; } public void setHint(String hint) { this.hint = hint; if (!hasText) { set(hint); } } /** * Clears the text of the element and reverts it to the hint specified in * #setHint(String) */ public void clearText() { set(hint); } public void setText(String text) { hasText = !text.isEmpty(); if (hasText) { set(text); } else { set(hint); } } public String getText() { switch (setter) { case INNER_TEXT: return element.getInnerText(); case VALUE: return element.getAttribute(ATTR_VALUE); default: throw new IllegalStateException(); } } private void set(String text) { switch (setter) { case INNER_TEXT: element.setInnerText(text); break; case VALUE: element.setAttribute(ATTR_VALUE, text); break; } } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/com/google/collide/client/ui/menu/MenuItem.java
client/src/main/java/com/google/collide/client/ui/menu/MenuItem.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.client.ui.menu; import collide.client.util.Elements; import elemental.dom.Element; import elemental.events.EventListener; /** * Simple tuple of a label and an action. * */ public class MenuItem<T> { /** * Behavior invoked for a MenuItem. */ public interface MenuAction<T> { /** * @param context the context, or null if the action is being performed on the root */ public void doAction(T context); } /** * Allows for custom rendering of a MenuItem. */ public interface MenuItemRenderer<T> { /** * Called when the menu item is to be created. Any returned element will * automatically have the menuItem css style added. * * @return The menu item element. */ public Element render(MenuItem<T> item); /** * Called as the menu item is being shown so that it can make conditional * modifications to the rendered menu item. */ public void onShowing(MenuItem<T> item, T context); } protected final MenuAction<T> action; private final String label; private boolean enabled = true; private Element element; private MenuItemRenderer<T> renderer; public MenuItem(String label, MenuAction<T> action) { this.action = action; this.label = label; } /** * @return the label */ public String getLabel() { return label; } public void setMenuItemRenderer(MenuItemRenderer<T> renderer) { this.renderer = renderer; } /** * Dispatches the menu action if the MenuItem is enabled and we have a valid * MenuAction to dispatch. * * A <code>null</code> context implies that this action refers to the Tree's * root. */ public void dispatchAction(T context) { if (isEnabled() && action != null) { action.doAction(context); } } public void dispatchShowing(T context) { if (isEnabled() && renderer != null) { renderer.onShowing(this, context); } } /** * @param enabled the enabled to set */ public void setEnabled(boolean enabled) { this.enabled = enabled; setEnabledStyle(); } /** * @return the enabled */ public boolean isEnabled() { return enabled; } /** * Creates the DOM structure of a given element, using the given event handler * as the "appropriate" callback. * * @return the element of the new menu item */ public Element createDom( String menuItemCss, EventListener clickListener, EventListener mouseDownListener) { if (getElement() == null) { if (renderer != null) { element = renderer.render(this); element.addClassName(menuItemCss); } else { element = Elements.createDivElement(menuItemCss); element.setTextContent(getLabel()); } if (clickListener != null) { element.setOnclick(clickListener); } if (mouseDownListener != null) { element.setOnmousedown(mouseDownListener); } setEnabledStyle(); } return element; } /** * Gets the DOM element, or null if not initialized */ public Element getElement() { return element; } private void setEnabledStyle() { if (getElement() != null) { element.setAttribute("enabled", enabled ? "true" : "false"); } } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/com/google/collide/client/ui/menu/AutoHideController.java
client/src/main/java/com/google/collide/client/ui/menu/AutoHideController.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.client.ui.menu; import elemental.dom.Element; /* * FIXME: this 'controller' is an 'AutoHideComponent', which is * weird, but less code than creating a bunch of delegates to an encapsulated * AutoHideComponent. We can fix this if it starts getting ugly. */ /** * A controller that wraps the given element in a {@link AutoHideComponent}. * */ public class AutoHideController extends AutoHideComponent<AutoHideView<Void>, AutoHideComponent.AutoHideModel> { public static AutoHideController create(Element element) { AutoHideView<Void> view = new AutoHideView<Void>(element); AutoHideModel model = new AutoHideModel(); return new AutoHideController(view, model); } private AutoHideController(AutoHideView<Void> view, AutoHideComponent.AutoHideModel model) { super(view, model); } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/com/google/collide/client/ui/menu/AutoHideComponent.java
client/src/main/java/com/google/collide/client/ui/menu/AutoHideComponent.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.client.ui.menu; import collide.client.util.Elements; import com.google.collide.client.ui.tooltip.Tooltip; import com.google.collide.client.util.HoverController; import com.google.collide.client.util.HoverController.UnhoverListener; import com.google.collide.json.shared.JsonArray; import com.google.collide.mvp.UiComponent; import com.google.collide.shared.util.JsonCollections; import elemental.dom.Element; import elemental.dom.Node; import elemental.events.Event; import elemental.events.EventListener; import elemental.events.EventRemover; import elemental.util.Timer; /** * Component that can automatically hide its View when the mouse is not over it. * Alternatively, this can be used to have a pop-up that closes when clicked * outside. * * WARNING: If you happen to detach the AutoHideComponent's View from the DOM * while it is visible, you must remember to call forceHide(). If you don't you * will never get a mouse out event, and thus will have a dangling global click * listener that has leaked and will trap the next click. * * @param <V> component view class * @param <M> component model class */ public abstract class AutoHideComponent<V extends AutoHideView<?>, M extends AutoHideComponent.AutoHideModel> extends UiComponent<V> { /** * Handler used to catch auto hide events. * */ public static interface AutoHideHandler { void onShow(); /** * Called when the element is hidden, in response to an auto hide event or * programatically. */ void onHide(); } /** * Instance state */ public static class AutoHideModel { boolean hidden = true; } // Capture clicks on the body to close the popup. private AutoHideHandler autoHideHandler; private final EventListener outsideClickListener = new EventListener() { @Override public void handleEvent(Event evt) { for (int i = 0; i < clickTargets.size(); i++) { if (clickTargets.get(i).contains((Node) evt.getTarget())) { return; } } forceHide(); if (stopOutsideClick) { evt.stopPropagation(); } } }; private EventRemover outsideClickListenerRemover; private final M model; private boolean hideBlocked = false; private boolean stopOutsideClick = true; private final HoverController hoverController; private final JsonArray<Element> clickTargets = JsonCollections.createArray(); private final Timer hideTimer = new Timer() { @Override public void run() { forceHide(); } }; /** A tooltip that should be disabled while this element is showing */ private Tooltip elementTooltip; /** * Constructor. * * @param view * @param model */ protected AutoHideComponent(V view, M model) { super(view); this.model = model; // Setup the hover controller to handle hover events. hoverController = new HoverController(); hoverController.addPartner(view.getElement()); hoverController.setUnhoverListener(new UnhoverListener() { @Override public void onUnhover() { if (isShowing()) { hide(); } } }); // Add ourselves to the valid click targets clickTargets.add(view.getElement()); } /** * Sets the tooltip to be disabled when this component is visible. */ public void setTooltip(Tooltip tooltip) { this.elementTooltip = tooltip; } /** * Add a partner element to the component. Partners are hover * targets that will keep the component visible. If the user hovers over a * partner element, the component will not be hidden. */ public void addPartner(Element element) { hoverController.addPartner(element); } /** * Removes a partner element from the component. */ public void removePartner(Element element) { hoverController.removePartner(element); } /** * Add one or more partner elements that when clicked when not cause the * auto-hide component to hide automatically. This is useful for toggle * buttons that have a dropdown or similar. */ public void addPartnerClickTargets(Element... elems) { if (elems != null) { for (Element e : elems) { clickTargets.add(e); } } } public void removePartnerClickTargets(Element... elems) { if (elems != null) { for (Element e : elems) { clickTargets.remove(e); } } } public M getModel() { return model; } /** * Cancels any pending deferred hide. */ public void cancelPendingHide() { hoverController.cancelUnhoverTimer(); } /** * Hides the View immediately. * * WARNING: If you happen to detach the AutoHideComponent's View from the DOM * while it is visible, you must remember to call forceHide(). If you don't * you will never get a mouse out event, and thus will have a dangling global * click listener that has leaked and will trap the next click. */ public void forceHide() { if (outsideClickListenerRemover != null) { outsideClickListenerRemover.remove(); outsideClickListenerRemover = null; } AutoHideModel model = getModel(); // If the thing is already hidden, then we don't need to do anything. if (isShowing()) { model.hidden = true; hideView(); if (autoHideHandler != null) { autoHideHandler.onHide(); } } // Force the unhover timer to fire. This is a no-op because we are already // hidden, but it resets the hover controller state. hoverController.flushUnhoverTimer(); if (elementTooltip != null) { elementTooltip.setEnabled(true); } } /** * @return true if in the showing state, even if still animating closed */ public boolean isShowing() { return !getModel().hidden; } /** * Hides the View for this component if the mouse isn't over, or if we don't * have a pending deferred hide. * * @return whether or not we forced the hide. If the mouse is still over the * popup, then we don't hide and thus return false. */ public boolean hide() { if (!hideBlocked) { forceHide(); return true; } return false; } /** * Prevents hiding, for example if a cascaded AutoHideComponent or the * file-selection box of a form is showing. */ public void setHideBlocked(boolean block) { this.hideBlocked = block; } /** * Sets the delay in ms for how long the Component waits before being hidden. * Negative delay will make this component waiting until the outside click. * * @param delay time in ms before hiding */ public void setDelay(int delay) { hoverController.setUnhoverDelay(delay); } /** * Set the {@link AutoHideHandler} associated with an element. */ public void setAutoHideHandler(AutoHideHandler handler) { this.autoHideHandler = handler; } /** * Set to True if this component should capture and prevent clicks outside the * component when it closes itself. */ public void setCaptureOutsideClickOnClose(boolean close) { stopOutsideClick = close; } /** * Makes the View visible and schedules it to be re-hidden if the user does * not mouse over. */ public void show() { if (elementTooltip != null) { elementTooltip.setEnabled(false); } // Nothing to do if it is showing. if (isShowing()) { return; } getView().show(); getModel().hidden = false; // Catch clicks that are outside the autohide component to trigger a hide. outsideClickListenerRemover = Elements.getBody().addEventListener(Event.MOUSEDOWN, outsideClickListener, true); if (autoHideHandler != null) { autoHideHandler.onShow(); } } /** * Displays the autohide component for a maximum of forceHideAfterMs */ public void show(int forceHideAfterMs) { show(); hideTimer.schedule(forceHideAfterMs); } protected HoverController getHoverController() { return hoverController; } protected void hideView() { getView().hide(); } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/com/google/collide/client/ui/menu/AutoHideView.java
client/src/main/java/com/google/collide/client/ui/menu/AutoHideView.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.client.ui.menu; import com.google.collide.client.util.AnimationController; import com.google.collide.mvp.CompositeView; import elemental.dom.Element; /** * The View for AutoHideComponent. * * @param <D> event delegate class */ public class AutoHideView<D> extends CompositeView<D> { private AnimationController animationController = AnimationController.NO_ANIMATION_CONTROLLER; public AutoHideView(final Element elem) { super(elem); } /** * Constructor to allow subclasses to use UiBinder. */ protected AutoHideView() { } /** * Hides the view, using the animation controller. */ public void hide() { animationController.hide(getElement()); } /** * Shows the view, using the animation controller. */ public void show() { animationController.show(getElement()); } public void setAnimationController(AnimationController controller) { this.animationController = controller; } @Override protected void setElement(Element element) { /* * Start in the hidden state. animationController may not be initialized if * this method is called from the constructor, so use the default animation * controller. */ AnimationController.NO_ANIMATION_CONTROLLER.hideWithoutAnimating(element); super.setElement(element); } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/com/google/collide/client/ui/menu/PositionController.java
client/src/main/java/com/google/collide/client/ui/menu/PositionController.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.client.ui.menu; import collide.client.util.CssUtils; import collide.client.util.Elements; import com.google.collide.client.AppContext; import com.google.collide.client.util.RelativeClientRect; import com.google.common.base.Preconditions; import com.google.gwt.user.client.Window; import elemental.css.CSSStyleDeclaration; import elemental.css.CSSStyleDeclaration.Unit; import elemental.dom.Element; import elemental.html.ClientRect; /** * A controller which handles positioning an element relative to another element. This controller is * aware of the screen position and will attempt to keep an element on the screen if it would * otherwise run off. As an additional wrinkle, if flipping it does not produce a valid screen * position it will just set the offending dimension to 0 . * */ /* * TODO: In the case where things don't fit on screen we perform a few extra layouts, this * could be fixed by offsetting the original rect until we find a position that works then * performing a second layout to actually move it. */ public class PositionController { /** * A builder which specifies positioning options for a {@link PositionController}.It defaults to * using {@link VerticalAlign#TOP}, {@link HorizontalAlign#LEFT}, and {@link Position#OVERLAP}. */ public static class PositionerBuilder { private VerticalAlign verticalAlignment = VerticalAlign.TOP; private HorizontalAlign horizontalAlignment = HorizontalAlign.LEFT; private Position position = Position.OVERLAP; public PositionerBuilder setVerticalAlign(VerticalAlign verticalAlignment) { this.verticalAlignment = verticalAlignment; return this; } public PositionerBuilder setHorizontalAlign(HorizontalAlign horizontalAlignment) { this.horizontalAlignment = horizontalAlignment; return this; } public PositionerBuilder setPosition(Position position) { this.position = position; return this; } /** * Creates a positioner which positions an element next to the provided anchor using gwt_root as * the container. This is the preferred method of positioning if the element is not going to * deal with scrolling in anyway and just needs to be positioned around an element. */ public Positioner buildAnchorPositioner(Element anchor) { return new AnchorPositioner(anchor, verticalAlignment, horizontalAlignment, position); } /** * Creates a positioner which positions an element next to the provided anchor using the anchors * offsetParent as the container. This is the preferred method of positioning if the parent is a * scrollable container. */ public Positioner buildOffsetFromParentPositioner(Element anchor) { return new OffsetPositioner(anchor, OffsetPositioner.ANCHOR_OFFSET_PARENT, verticalAlignment, horizontalAlignment, position); } /** * Creates a positioner which positions an element next to the provided anchor using the * supplied ancestor as the container. This is the preferred method of positioning if the * ancestor is a scrollable and anchor is not a direct child. */ public Positioner buildOffsetFromAncestorPositioner(Element anchor, Element ancestor) { return new OffsetPositioner( anchor, ancestor, verticalAlignment, horizontalAlignment, position); } /** * Creates a positioner which appends elements to the body of the document allowing positioning * absolutely at a given point in the viewport (typically mouse coordinates). */ public Positioner buildMousePositioner() { return new MousePositioner(verticalAlignment, horizontalAlignment, position); } } /** * The base functionality of a positioner. */ public abstract static class Positioner { private final VerticalAlign verticalAlignment; private final HorizontalAlign horizontalAlignment; private final Position position; private VerticalAlign curVerticalAlignment; private HorizontalAlign curHorizontalAlignment; public Positioner( VerticalAlign verticalAlignment, HorizontalAlign horizontalAlignment, Position position) { this.verticalAlignment = verticalAlignment; this.horizontalAlignment = horizontalAlignment; this.position = position; revert(); } public VerticalAlign getVerticalAlignment() { return curVerticalAlignment; } public HorizontalAlign getHorizontalAlignment() { return curHorizontalAlignment; } public Position getPosition() { return position; } /** Appends an element to the appropriate place in the DOM for this positioner */ abstract void appendElementToContainer(Element element); /** * Returns the minimum width that should be used by elements being positioned by this * positioner. The meaning of this value varies depending on the implementation. */ public abstract int getMinimumWidth(); abstract double getTop(ClientRect elementRect, int y); abstract double getLeft(ClientRect elementRect, int x); void flip(VerticalAlign verticalAlignment, HorizontalAlign horizontalAlignment) { curVerticalAlignment = verticalAlignment; curHorizontalAlignment = horizontalAlignment; } void revert() { curVerticalAlignment = verticalAlignment; curHorizontalAlignment = horizontalAlignment; } } /** * A positioner which positions an element next to another element. */ public static class AnchorPositioner extends Positioner { private final Element anchor; private AnchorPositioner(Element anchor, VerticalAlign verticalAlignment, HorizontalAlign horizontalAlignment, Position position) { super(verticalAlignment, horizontalAlignment, position); this.anchor = anchor; } /** * @return the width of the anchor used by this {@link Positioner}. */ @Override public int getMinimumWidth() { return (int) anchor.getBoundingClientRect().getWidth(); } /** Appends the element to the body of the DOM */ @Override void appendElementToContainer(Element element) { Element gwt = Elements.getElementById(AppContext.GWT_ROOT); gwt.appendChild(element); } @Override double getTop(ClientRect elementRect, int offsetY) { Element gwt = Elements.getElementById(AppContext.GWT_ROOT); ClientRect anchorRect = RelativeClientRect.relativeToRect( gwt.getBoundingClientRect(), anchor.getBoundingClientRect()); switch (getVerticalAlignment()) { case TOP: return anchorRect.getTop() - elementRect.getHeight() - offsetY; case MIDDLE: double anchory = anchorRect.getTop() + anchorRect.getHeight() / 2; return anchory - elementRect.getHeight() / 2 - offsetY; case BOTTOM: return anchorRect.getBottom() + offsetY; default: return 0; } } @Override double getLeft(ClientRect elementRect, int offsetX) { Element gwt = Elements.getElementById(AppContext.GWT_ROOT); ClientRect anchorRect = RelativeClientRect.relativeToRect( gwt.getBoundingClientRect(), anchor.getBoundingClientRect()); switch (getHorizontalAlignment()) { case LEFT: if (getPosition() == Position.OVERLAP) { return anchorRect.getLeft() + offsetX; } else { return anchorRect.getLeft() - elementRect.getWidth() - offsetX; } case MIDDLE: double anchorx = anchorRect.getLeft() + anchorRect.getWidth() / 2; return anchorx - elementRect.getWidth() / 2 - offsetX; case RIGHT: if (getPosition() == Position.OVERLAP) { return anchorRect.getRight() - elementRect.getWidth() - offsetX; } else { return anchorRect.getRight() + offsetX; } default: return 0; } } } public static class OffsetPositioner extends Positioner { /** Indicates that the offsetParent of the anchor should be used for positioning. */ public static final Element ANCHOR_OFFSET_PARENT = Elements.createDivElement(); private final Element anchor; private final Element offsetAncestor; private double anchorOffsetTop = -1; private double anchorOffsetLeft = -1; private OffsetPositioner(Element anchor, Element ancestor, VerticalAlign verticalAlignment, HorizontalAlign horizontalAlignment, Position position) { super(verticalAlignment, horizontalAlignment, position); this.anchor = anchor; this.offsetAncestor = ancestor; } /** * @return the width of the anchor used by this {@link Positioner}. */ @Override public int getMinimumWidth() { return (int) anchor.getBoundingClientRect().getWidth(); } /** Appends the element to the specified ancestor of the anchor. */ @Override void appendElementToContainer(Element element) { Element container = getOffsetAnchestorForAnchor(); container.appendChild(element); } @Override double getTop(ClientRect elementRect, int offsetY) { // This rect is to only be used for width and height since the coordinates are relative to the // viewport and we are relative to an offsetParent. ClientRect anchorRect = anchor.getBoundingClientRect(); ensureOffsetCalculated(); switch (getVerticalAlignment()) { case TOP: return anchorOffsetTop - elementRect.getHeight() - offsetY; case MIDDLE: double anchory = anchorOffsetTop + anchorRect.getHeight() / 2; return anchory - elementRect.getHeight() / 2 - offsetY; case BOTTOM: double anchorBottom = anchorOffsetTop + anchorRect.getHeight(); return anchorBottom + offsetY; default: return 0; } } @Override double getLeft(ClientRect elementRect, int offsetX) { // This rect is to only be used for width and height since the coordinates are relative to the // viewport and we are relative to an offsetParent. ClientRect anchorRect = anchor.getBoundingClientRect(); ensureOffsetCalculated(); switch (getHorizontalAlignment()) { case LEFT: if (getPosition() == Position.OVERLAP) { return anchorOffsetLeft + offsetX; } else { return anchorOffsetLeft - elementRect.getWidth() - offsetX; } case MIDDLE: double anchorx = anchorOffsetLeft + anchorRect.getWidth() / 2; return anchorx - elementRect.getWidth() / 2 - offsetX; case RIGHT: double anchorRight = anchorOffsetLeft + anchorRect.getWidth(); if (getPosition() == Position.OVERLAP) { return anchorRight - elementRect.getWidth() - offsetX; } else { return anchorRight + offsetX; } default: return 0; } } private Element getOffsetAnchestorForAnchor() { Element e = offsetAncestor == ANCHOR_OFFSET_PARENT ? anchor.getOffsetParent() : offsetAncestor; return e == null ? Elements.getBody() : e; } private void ensureOffsetCalculated() { if (anchorOffsetTop >= 0 && anchorOffsetLeft >= 0) { return; } Element ancestor = getOffsetAnchestorForAnchor(); anchorOffsetTop = anchorOffsetLeft = 0; for (Element e = anchor; e != ancestor; e = e.getOffsetParent()) { Preconditions.checkNotNull(e, "Offset parent specified is not in ancestory chain"); anchorOffsetTop += e.getOffsetTop(); anchorOffsetLeft += e.getOffsetLeft(); } } } /** * A positioner which positions directly next to a point such as the mouse. */ public static class MousePositioner extends Positioner { private MousePositioner( VerticalAlign verticalAlignment, HorizontalAlign horizontalAlignment, Position position) { super(verticalAlignment, horizontalAlignment, position); } /** * @returns 0 since this is being positioned next to the mouse. */ @Override public int getMinimumWidth() { return 0; } /** Appends the element to the document body */ @Override void appendElementToContainer(Element element) { Elements.getBody().appendChild(element); } @Override double getTop(ClientRect elementRect, int mouseY) { double top; switch (getVerticalAlignment()) { case TOP: top = mouseY - elementRect.getHeight(); break; case MIDDLE: top = mouseY - elementRect.getHeight() / 2; break; case BOTTOM: default: top = mouseY; break; } return top; } @Override double getLeft(ClientRect elementRect, int mouseX) { double left; switch (getHorizontalAlignment()) { case LEFT: left = mouseX; break; case MIDDLE: left = mouseX - elementRect.getWidth() / 2; break; case RIGHT: default: left = mouseX - elementRect.getWidth(); break; } return left; } } public enum VerticalAlign { /** * Aligns the bottom of the element to the top of the anchor. */ TOP, /** * Aligns the top of the element to the bottom of the anchor. */ BOTTOM, /** * Aligns the middle of the element to the middle of the anchor. */ MIDDLE, } public enum HorizontalAlign { /** * Aligns to the left side of the anchor. */ LEFT, /** * Aligns to the horizontal middle of the anchor. */ MIDDLE, /** * Aligns to the right side of the anchor. */ RIGHT, } /** * Changes the position of the element. If the element is aligned with the RIGHT or LEFT side of * the anchor, Position will determine whether or not the element overlaps the anchor. */ public enum Position { OVERLAP, NO_OVERLAP } /** * Used to specify that a value should be ignored by * {@link #setElementLeftAndTop(double, double)}. */ private final static double IGNORE = -1; private final Element element; private final Positioner elementPositioner; public PositionController(Positioner positioner, Element element) { this.elementPositioner = positioner; this.element = element; } /** * Updates the element's position to move it to the correct location. */ public void updateElementPosition() { updateElementPosition(0, 0); } /** * Updates the element's position. If this controller is aligning next to an anchor then x and y * will be offsets, otherwise they will be treated as the absolute x and y position to align to. * * <p> * Note: If used as offsets x and y are relative to the aligned edge i.e. if you are aligned to * the right then x moves you left vs aligning to the left where x moves you to the right. * </p> */ public void updateElementPosition(int x, int y) { place(x, y); // check if we're at a valid place, if not temporarily flip the positioner // and place again. VerticalAlign originalVertical = elementPositioner.getVerticalAlignment(); HorizontalAlign originalHorizontal = elementPositioner.getHorizontalAlignment(); if (!checkPositionValidAndMaybeUpdatePositioner()) { place(x, y); boolean wasVerticalFlipped = originalVertical != elementPositioner.getVerticalAlignment(); boolean wasHorizontalFlipped = originalHorizontal != elementPositioner.getHorizontalAlignment(); // Check if the new position is valid, if (!checkPositionValidAndMaybeUpdatePositioner()) { /* * We try to make our best move here, if the element is off the screen in both dimensions * then the window is tiny and we try to move it to 0,0. if it's only one dimensions we move * it to either the top or left of the screen. */ if (wasVerticalFlipped) { setElementLeftAndTop(IGNORE, 0); } if (wasHorizontalFlipped) { setElementLeftAndTop(0, IGNORE); } } } // revert any temporary changes made to our positioner elementPositioner.revert(); } public Positioner getPositioner() { return elementPositioner; } /** * Checks if the element is completely visible on the screen, if not it will temporarily flip our * {@link #elementPositioner} with updated alignment values which might work to fix the problem. */ private boolean checkPositionValidAndMaybeUpdatePositioner() { // recalculate the element's dimensions and check to see if any of the edges // of the element are outside the window ClientRect elementRect = ensureVisibleAndGetRect(element); VerticalAlign updatedVerticalAlign = elementPositioner.getVerticalAlignment(); HorizontalAlign updatedHorizontalAlign = elementPositioner.getHorizontalAlignment(); if (elementRect.getBottom() > Window.getClientHeight()) { updatedVerticalAlign = VerticalAlign.TOP; } else if (elementRect.getTop() < 0) { updatedVerticalAlign = VerticalAlign.BOTTOM; } if (elementRect.getRight() > Window.getClientWidth()) { updatedHorizontalAlign = HorizontalAlign.RIGHT; } else if (elementRect.getLeft() < 0) { updatedHorizontalAlign = HorizontalAlign.LEFT; } if (updatedVerticalAlign != elementPositioner.getVerticalAlignment() || updatedHorizontalAlign != elementPositioner.getHorizontalAlignment()) { elementPositioner.flip(updatedVerticalAlign, updatedHorizontalAlign); return false; } return true; } /** * Place the element based on the given information. * * @param x the offset or location depending on the underlying positioner. * @param y the offset or location depending on the underlying positioner. */ private void place(int x, int y) { resetElementPosition(); ClientRect elementRect = ensureVisibleAndGetRect(element); double left = elementPositioner.getLeft(elementRect, x); double top = elementPositioner.getTop(elementRect, y); setElementLeftAndTop(left, top); } /** * Sets an elements left and top to the provided values. */ private void setElementLeftAndTop(double left, double top) { CSSStyleDeclaration style = element.getStyle(); if (left != IGNORE) { style.setLeft(left, Unit.PX); } if (top != IGNORE) { style.setTop(top, Unit.PX); } } /** * Resets an element's position by removing top/right/bottom/left and setting position to * absolute. */ private void resetElementPosition() { CSSStyleDeclaration style = element.getStyle(); style.setPosition("absolute"); style.clearTop(); style.clearRight(); style.clearBottom(); style.clearLeft(); elementPositioner.appendElementToContainer(element); } /** * Ensures that an element is not display: none and is just visibility hidden so we can get an * accurate client rect. */ private static ClientRect ensureVisibleAndGetRect(Element element) { // Try to get rect and see if it isn't all 0's ClientRect rect = element.getBoundingClientRect(); double rectSum = rect.getBottom() + rect.getTop() + rect.getLeft() + rect.getRight() + rect.getHeight() + rect.getWidth(); if (rectSum != 0) { return rect; } // We make an attempt to get an accurate measurement of the element CSSStyleDeclaration style = element.getStyle(); String visibility = CssUtils.setAndSaveProperty(element, "visibility", "hidden"); String display = style.getDisplay(); // if display set to none we remove it and let its normal style show through if (style.getDisplay().equals("none")) { style.removeProperty("display"); } else { // it's likely display: none in a css class so we just have to guess. // We guess display:block since that's common on containers. style.setDisplay("block"); } rect = element.getBoundingClientRect(); style.setDisplay(display); style.setVisibility(visibility); return rect; } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/com/google/gwt/dev/util/log/PrintWriterTreeLogger.java
client/src/main/java/com/google/gwt/dev/util/log/PrintWriterTreeLogger.java
/* * Copyright 2006 Google Inc. * * 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 com.google.gwt.dev.util.log; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.net.URL; /** * Tree logger that logs to a print writer. */ public final class PrintWriterTreeLogger extends AbstractTreeLogger { private final String indent; private final PrintWriter out; private final Object mutex = new Object(); public PrintWriterTreeLogger() { this(new PrintWriter(System.out, true)); } public PrintWriterTreeLogger(PrintWriter out) { this(out, ""); } public PrintWriterTreeLogger(File logFile) throws IOException { boolean existing = logFile.exists(); this.out = new PrintWriter(new FileWriter(logFile, true), true); this.indent = ""; if (existing) { out.println(); // blank line to mark relaunch } setMaxDetail(TRACE); } protected PrintWriterTreeLogger(PrintWriter out, String indent) { this.out = out; this.indent = indent; setMaxDetail(TRACE); } @Override protected AbstractTreeLogger doBranch() { return new PrintWriterTreeLogger(out, indent + " "); } @Override protected void doCommitBranch(AbstractTreeLogger childBeingCommitted, Type type, String msg, Throwable caught, HelpInfo helpInfo) { doLog(childBeingCommitted.getBranchedIndex(), type, msg, caught, helpInfo); } @Override protected void doLog(int indexOfLogEntryWithinParentLogger, Type type, String msg, Throwable caught, HelpInfo helpInfo) { synchronized (mutex) { // ensure thread interleaving... out.print(indent); out.print("["); out.print(type.getLabel()); out.print("] "); out.println(msg); if (helpInfo != null) { URL url = helpInfo.getURL(); if (url != null) { out.print(indent); out.println("For additional info see: " + url.toString()); } } if (caught != null) { caught.printStackTrace(out); } } } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/elemental/html/Window.java
client/src/main/java/elemental/html/Window.java
/* * Copyright 2012 Google Inc. * * 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 elemental.html; import elemental.css.CSSMatrix; import elemental.css.CSSRuleList; import elemental.css.CSSStyleDeclaration; import elemental.dom.Document; import elemental.dom.Element; import elemental.dom.MediaStream; import elemental.dom.MediaStreamTrackList; import elemental.dom.Node; import elemental.dom.RequestAnimationFrameCallback; import elemental.dom.ShadowRoot; import elemental.dom.SpeechGrammar; import elemental.dom.SpeechGrammarList; import elemental.dom.SpeechRecognition; import elemental.dom.TimeoutHandler; import elemental.events.Event; import elemental.events.EventListener; import elemental.events.EventRemover; import elemental.events.EventTarget; import elemental.events.MessageChannel; import elemental.util.Indexable; import elemental.util.IndexableNumber; import elemental.util.Mappable; import elemental.xml.XMLHttpRequest; import elemental.xml.XSLTProcessor; import elemental.xpath.DOMParser; import elemental.xpath.XMLSerializer; import elemental.xpath.XPathEvaluator; /** * */ public interface Window extends EventTarget { void clearOpener(); static final int PERSISTENT = 1; static final int TEMPORARY = 0; ApplicationCache getApplicationCache(); Navigator getClientInformation(); boolean isClosed(); Console getConsole(); Crypto getCrypto(); String getDefaultStatus(); void setDefaultStatus(String arg); String getDefaultstatus(); void setDefaultstatus(String arg); double getDevicePixelRatio(); Document getDocument(); Event getEvent(); Element getFrameElement(); Window getFrames(); History getHistory(); int getInnerHeight(); int getInnerWidth(); int getLength(); Storage getLocalStorage(); Location getLocation(); void setLocation(Location arg); BarProp getLocationbar(); BarProp getMenubar(); String getName(); void setName(String arg); Navigator getNavigator(); boolean isOffscreenBuffering(); EventListener getOnabort(); void setOnabort(EventListener arg); /** * Event listener for the window beforeclose event. */ interface BeforeUnloadEventListener { /** * Fired when the the user attempts to close or navigate away from the page. * * @param evt the event received * @return the message to display to the user to request that the user keep * the application open, or null not to display a message */ String handleEvent(elemental.events.Event evt); } BeforeUnloadEventListener getOnbeforeunload(); void setOnbeforeunload(BeforeUnloadEventListener arg); EventListener getOnblur(); void setOnblur(EventListener arg); EventListener getOncanplay(); void setOncanplay(EventListener arg); EventListener getOncanplaythrough(); void setOncanplaythrough(EventListener arg); EventListener getOnchange(); void setOnchange(EventListener arg); EventListener getOnclick(); void setOnclick(EventListener arg); EventListener getOncontextmenu(); void setOncontextmenu(EventListener arg); EventListener getOndblclick(); void setOndblclick(EventListener arg); EventListener getOndevicemotion(); void setOndevicemotion(EventListener arg); EventListener getOndeviceorientation(); void setOndeviceorientation(EventListener arg); EventListener getOndrag(); void setOndrag(EventListener arg); EventListener getOndragend(); void setOndragend(EventListener arg); EventListener getOndragenter(); void setOndragenter(EventListener arg); EventListener getOndragleave(); void setOndragleave(EventListener arg); EventListener getOndragover(); void setOndragover(EventListener arg); EventListener getOndragstart(); void setOndragstart(EventListener arg); EventListener getOndrop(); void setOndrop(EventListener arg); EventListener getOndurationchange(); void setOndurationchange(EventListener arg); EventListener getOnemptied(); void setOnemptied(EventListener arg); EventListener getOnended(); void setOnended(EventListener arg); EventListener getOnerror(); void setOnerror(EventListener arg); EventListener getOnfocus(); void setOnfocus(EventListener arg); EventListener getOnhashchange(); void setOnhashchange(EventListener arg); EventListener getOninput(); void setOninput(EventListener arg); EventListener getOninvalid(); void setOninvalid(EventListener arg); EventListener getOnkeydown(); void setOnkeydown(EventListener arg); EventListener getOnkeypress(); void setOnkeypress(EventListener arg); EventListener getOnkeyup(); void setOnkeyup(EventListener arg); EventListener getOnload(); void setOnload(EventListener arg); EventListener getOnloadeddata(); void setOnloadeddata(EventListener arg); EventListener getOnloadedmetadata(); void setOnloadedmetadata(EventListener arg); EventListener getOnloadstart(); void setOnloadstart(EventListener arg); EventListener getOnmessage(); void setOnmessage(EventListener arg); EventListener getOnmousedown(); void setOnmousedown(EventListener arg); EventListener getOnmousemove(); void setOnmousemove(EventListener arg); EventListener getOnmouseout(); void setOnmouseout(EventListener arg); EventListener getOnmouseover(); void setOnmouseover(EventListener arg); EventListener getOnmouseup(); void setOnmouseup(EventListener arg); EventListener getOnmousewheel(); void setOnmousewheel(EventListener arg); EventListener getOnoffline(); void setOnoffline(EventListener arg); EventListener getOnonline(); void setOnonline(EventListener arg); EventListener getOnpagehide(); void setOnpagehide(EventListener arg); EventListener getOnpageshow(); void setOnpageshow(EventListener arg); EventListener getOnpause(); void setOnpause(EventListener arg); EventListener getOnplay(); void setOnplay(EventListener arg); EventListener getOnplaying(); void setOnplaying(EventListener arg); EventListener getOnpopstate(); void setOnpopstate(EventListener arg); EventListener getOnprogress(); void setOnprogress(EventListener arg); EventListener getOnratechange(); void setOnratechange(EventListener arg); EventListener getOnreset(); void setOnreset(EventListener arg); EventListener getOnresize(); void setOnresize(EventListener arg); EventListener getOnscroll(); void setOnscroll(EventListener arg); EventListener getOnsearch(); void setOnsearch(EventListener arg); EventListener getOnseeked(); void setOnseeked(EventListener arg); EventListener getOnseeking(); void setOnseeking(EventListener arg); EventListener getOnselect(); void setOnselect(EventListener arg); EventListener getOnstalled(); void setOnstalled(EventListener arg); EventListener getOnstorage(); void setOnstorage(EventListener arg); EventListener getOnsubmit(); void setOnsubmit(EventListener arg); EventListener getOnsuspend(); void setOnsuspend(EventListener arg); EventListener getOntimeupdate(); void setOntimeupdate(EventListener arg); EventListener getOntouchcancel(); void setOntouchcancel(EventListener arg); EventListener getOntouchend(); void setOntouchend(EventListener arg); EventListener getOntouchmove(); void setOntouchmove(EventListener arg); EventListener getOntouchstart(); void setOntouchstart(EventListener arg); EventListener getOnunload(); void setOnunload(EventListener arg); EventListener getOnvolumechange(); void setOnvolumechange(EventListener arg); EventListener getOnwaiting(); void setOnwaiting(EventListener arg); EventListener getOnwebkitanimationend(); void setOnwebkitanimationend(EventListener arg); EventListener getOnwebkitanimationiteration(); void setOnwebkitanimationiteration(EventListener arg); EventListener getOnwebkitanimationstart(); void setOnwebkitanimationstart(EventListener arg); EventListener getOnwebkittransitionend(); void setOnwebkittransitionend(EventListener arg); Window getOpener(); int getOuterHeight(); int getOuterWidth(); PagePopupController getPagePopupController(); int getPageXOffset(); int getPageYOffset(); Window getParent(); Performance getPerformance(); BarProp getPersonalbar(); Screen getScreen(); int getScreenLeft(); int getScreenTop(); int getScreenX(); int getScreenY(); int getScrollX(); int getScrollY(); BarProp getScrollbars(); Window getSelf(); Storage getSessionStorage(); String getStatus(); void setStatus(String arg); BarProp getStatusbar(); StyleMedia getStyleMedia(); BarProp getToolbar(); Window getTop(); IDBFactory getWebkitIndexedDB(); NotificationCenter getWebkitNotifications(); StorageInfo getWebkitStorageInfo(); Window getWindow(); EventRemover addEventListener(String type, EventListener listener); EventRemover addEventListener(String type, EventListener listener, boolean useCapture); void alert(String message); String atob(String string); void blur(); String btoa(String string); void captureEvents(); void clearInterval(int handle); void clearTimeout(int handle); void close(); boolean confirm(String message); boolean dispatchEvent(Event evt); boolean find(String string, boolean caseSensitive, boolean backwards, boolean wrap, boolean wholeWord, boolean searchInFrames, boolean showDialog); void focus(); CSSStyleDeclaration getComputedStyle(Element element, String pseudoElement); CSSRuleList getMatchedCSSRules(Element element, String pseudoElement); Selection getSelection(); MediaQueryList matchMedia(String query); void moveBy(float x, float y); void moveTo(float x, float y); Window open(String url, String name); Window open(String url, String name, String options); Database openDatabase(String name, String version, String displayName, int estimatedSize, DatabaseCallback creationCallback); Database openDatabase(String name, String version, String displayName, int estimatedSize); void postMessage(Object message, String targetOrigin); void postMessage(Object message, String targetOrigin, Indexable messagePorts); void print(); String prompt(String message, String defaultValue); void releaseEvents(); void removeEventListener(String type, EventListener listener); void removeEventListener(String type, EventListener listener, boolean useCapture); void resizeBy(float x, float y); void resizeTo(float width, float height); void scroll(int x, int y); void scrollBy(int x, int y); void scrollTo(int x, int y); int setInterval(TimeoutHandler handler, int timeout); int setTimeout(TimeoutHandler handler, int timeout); Object showModalDialog(String url); Object showModalDialog(String url, Object dialogArgs); Object showModalDialog(String url, Object dialogArgs, String featureArgs); void stop(); void webkitCancelAnimationFrame(int id); void webkitCancelRequestAnimationFrame(int id); Point webkitConvertPointFromNodeToPage(Node node, Point p); Point webkitConvertPointFromPageToNode(Node node, Point p); void webkitPostMessage(Object message, String targetOrigin); void webkitPostMessage(Object message, String targetOrigin, Indexable transferList); int webkitRequestAnimationFrame(RequestAnimationFrameCallback callback); void webkitRequestFileSystem(int type, double size, FileSystemCallback successCallback, ErrorCallback errorCallback); void webkitRequestFileSystem(int type, double size, FileSystemCallback successCallback); void webkitResolveLocalFileSystemURL(String url, EntryCallback successCallback); void webkitResolveLocalFileSystemURL(String url); void webkitResolveLocalFileSystemURL(String url, EntryCallback successCallback, ErrorCallback errorCallback); AudioContext newAudioContext(); AudioElement newAudioElement(String src); CSSMatrix newCSSMatrix(String cssValue); DOMParser newDOMParser(); DOMURL newDOMURL(); DeprecatedPeerConnection newDeprecatedPeerConnection(String serverConfiguration, SignalingCallback signalingCallback); EventSource newEventSource(String scriptUrl); FileReader newFileReader(); FileReaderSync newFileReaderSync(); Float32Array newFloat32Array(int length); Float32Array newFloat32Array(IndexableNumber list); Float32Array newFloat32Array(ArrayBuffer buffer, int byteOffset, int length); Float64Array newFloat64Array(int length); Float64Array newFloat64Array(IndexableNumber list); Float64Array newFloat64Array(ArrayBuffer buffer, int byteOffset, int length); IceCandidate newIceCandidate(String label, String candidateLine); Int16Array newInt16Array(int length); Int16Array newInt16Array(IndexableNumber list); Int16Array newInt16Array(ArrayBuffer buffer, int byteOffset, int length); Int32Array newInt32Array(int length); Int32Array newInt32Array(IndexableNumber list); Int32Array newInt32Array(ArrayBuffer buffer, int byteOffset, int length); Int8Array newInt8Array(int length); Int8Array newInt8Array(IndexableNumber list); Int8Array newInt8Array(ArrayBuffer buffer, int byteOffset, int length); MediaController newMediaController(); MediaStream newMediaStream(MediaStreamTrackList audioTracks, MediaStreamTrackList videoTracks); MessageChannel newMessageChannel(); Notification newNotification(String title, Mappable options); OptionElement newOptionElement(String data, String value, boolean defaultSelected, boolean selected); PeerConnection00 newPeerConnection00(String serverConfiguration, IceCallback iceCallback); SessionDescription newSessionDescription(String sdp); ShadowRoot newShadowRoot(Element host); SharedWorker newSharedWorker(String scriptURL, String name); SpeechGrammar newSpeechGrammar(); SpeechGrammarList newSpeechGrammarList(); SpeechRecognition newSpeechRecognition(); TextTrackCue newTextTrackCue(String id, double startTime, double endTime, String text, String settings, boolean pauseOnExit); Uint16Array newUint16Array(int length); Uint16Array newUint16Array(IndexableNumber list); Uint16Array newUint16Array(ArrayBuffer buffer, int byteOffset, int length); Uint32Array newUint32Array(int length); Uint32Array newUint32Array(IndexableNumber list); Uint32Array newUint32Array(ArrayBuffer buffer, int byteOffset, int length); Uint8Array newUint8Array(int length); Uint8Array newUint8Array(IndexableNumber list); Uint8Array newUint8Array(ArrayBuffer buffer, int byteOffset, int length); Uint8ClampedArray newUint8ClampedArray(int length); Uint8ClampedArray newUint8ClampedArray(IndexableNumber list); Uint8ClampedArray newUint8ClampedArray(ArrayBuffer buffer, int byteOffset, int length); WebSocket newWebSocket(String url); Worker newWorker(String scriptUrl); XMLHttpRequest newXMLHttpRequest(); XMLSerializer newXMLSerializer(); XPathEvaluator newXPathEvaluator(); XSLTProcessor newXSLTProcessor(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/elemental/html/DataListElement.java
client/src/main/java/elemental/html/DataListElement.java
package elemental.html; import elemental.dom.Element; public interface DataListElement extends Element { HTMLCollection getOptions(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/elemental/html/DragEvent.java
client/src/main/java/elemental/html/DragEvent.java
/* * Copyright 2010 Google Inc. * * 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 elemental.html; import elemental.dom.DataTransferItem; public interface DragEvent extends elemental.events.MouseEvent { DataTransferItem getDataTransferItem(); void initDragEvent(String typeArg, boolean canBubbleArg, boolean cancelableArg, Object dummyArg, int detailArg, int screenXArg, int screenYArg, int clientXArg, int clientYArg, boolean ctrlKeyArg, boolean altKeyArg, boolean shiftKeyArg, boolean metaKeyArg, short buttonArg, elemental.events.EventTarget relatedTargetArg, DataTransferItem dataTransferArg); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/elemental/js/util/JsMapFromStringTo.java
client/src/main/java/elemental/js/util/JsMapFromStringTo.java
/* * Copyright 2010 Google Inc. * * 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 elemental.js.util; import com.google.gwt.core.client.JavaScriptObject; import elemental.util.MapFromStringTo; /** * JavaScript native implementation of {@link MapFromStringTo}. */ public final class JsMapFromStringTo<V> extends JavaScriptObject implements MapFromStringTo<V> { /** * Create a new empty map instance. */ public static native <T> JsMapFromStringTo<T> create() /*-{ return Object.create(null); }-*/; static native boolean hasKey(JavaScriptObject map, String key) /*-{ var p = @elemental.js.util.JsMapFromStringTo::propertyForKey(Ljava/lang/String;)(key); return map[p] !== undefined; }-*/; static native <T extends JavaScriptObject> T keys(JavaScriptObject object) /*-{ var data = []; for (var item in object) { if (Object.prototype.hasOwnProperty.call(object, item)) { var key = @elemental.js.util.JsMapFromStringTo::keyForProperty(Ljava/lang/String;)(item); data.push(key); } } return data; }-*/; static native void remove(JavaScriptObject map, String key) /*-{ var p = @elemental.js.util.JsMapFromStringTo::propertyForKey(Ljava/lang/String;)(key); delete map[p]; }-*/; static native <T extends JavaScriptObject> T values(JavaScriptObject object) /*-{ var data = []; for (var item in object) { if (Object.prototype.hasOwnProperty.call(object, item)) { data.push(object[item]); } } return data; }-*/; @SuppressWarnings("unused") // Called from JSNI. private static String keyForProperty(String property) { return property; } @SuppressWarnings("unused") // Called from JSNI. private static String propertyForKey(String key) { assert key != null : "native maps do not allow null key values."; return key; } protected JsMapFromStringTo() { } public native V get(String key) /*-{ var p = @elemental.js.util.JsMapFromStringTo::propertyForKey(Ljava/lang/String;)(key); return this[p]; }-*/; public boolean hasKey(String key) { return hasKey(this, key); } public JsArrayOfString keys() { return keys(this); } public native void put(String key, V value) /*-{ var p = @elemental.js.util.JsMapFromStringTo::propertyForKey(Ljava/lang/String;)(key); this[p] = value; }-*/; public void remove(String key) { remove(this, key); } public JsArrayOf<V> values() { return values(this); } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/elemental/js/html/JsWindow.java
client/src/main/java/elemental/js/html/JsWindow.java
/* * Copyright 2012 Google Inc. * * 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 elemental.js.html; import elemental.dom.Element; import elemental.dom.MediaStreamTrackList; import elemental.dom.Node; import elemental.dom.RequestAnimationFrameCallback; import elemental.dom.TimeoutHandler; import elemental.events.EventListener; import elemental.html.ArrayBuffer; import elemental.html.DatabaseCallback; import elemental.html.EntryCallback; import elemental.html.ErrorCallback; import elemental.html.FileSystemCallback; import elemental.html.IceCallback; import elemental.html.Location; import elemental.html.Point; import elemental.html.SignalingCallback; import elemental.html.Window; import elemental.js.css.JsCSSMatrix; import elemental.js.css.JsCSSRuleList; import elemental.js.css.JsCSSStyleDeclaration; import elemental.js.dom.JsDocument; import elemental.js.dom.JsElement; import elemental.js.dom.JsElementalMixinBase; import elemental.js.dom.JsMediaStream; import elemental.js.dom.JsShadowRoot; import elemental.js.dom.JsSpeechGrammar; import elemental.js.dom.JsSpeechGrammarList; import elemental.js.dom.JsSpeechRecognition; import elemental.js.events.JsEvent; import elemental.js.events.JsMessageChannel; import elemental.js.xml.JsXMLHttpRequest; import elemental.js.xml.JsXSLTProcessor; import elemental.js.xpath.JsDOMParser; import elemental.js.xpath.JsXMLSerializer; import elemental.js.xpath.JsXPathEvaluator; import elemental.util.Indexable; import elemental.util.IndexableNumber; import elemental.util.Mappable; public class JsWindow extends JsElementalMixinBase implements Window { protected JsWindow() {} public final native void clearOpener() /*-{ this.opener = null; }-*/; public final native JsApplicationCache getApplicationCache() /*-{ return this.applicationCache; }-*/; public final native JsNavigator getClientInformation() /*-{ return this.clientInformation; }-*/; public final native boolean isClosed() /*-{ return this.closed; }-*/; public final native JsConsole getConsole() /*-{ return this.console; }-*/; public final native JsCrypto getCrypto() /*-{ return this.crypto; }-*/; public final native String getDefaultStatus() /*-{ return this.defaultStatus; }-*/; public final native void setDefaultStatus(String param_defaultStatus) /*-{ this.defaultStatus = param_defaultStatus; }-*/; public final native String getDefaultstatus() /*-{ return this.defaultstatus; }-*/; public final native void setDefaultstatus(String param_defaultstatus) /*-{ this.defaultstatus = param_defaultstatus; }-*/; public final native double getDevicePixelRatio() /*-{ return this.devicePixelRatio; }-*/; public final native JsDocument getDocument() /*-{ return this.document; }-*/; public final native JsEvent getEvent() /*-{ return this.event; }-*/; public final native JsElement getFrameElement() /*-{ return this.frameElement; }-*/; public final native JsWindow getFrames() /*-{ return this.frames; }-*/; public final native JsHistory getHistory() /*-{ return this.history; }-*/; public final native int getInnerHeight() /*-{ return this.innerHeight; }-*/; public final native int getInnerWidth() /*-{ return this.innerWidth; }-*/; public final native int getLength() /*-{ return this.length; }-*/; public final native JsStorage getLocalStorage() /*-{ return this.localStorage; }-*/; public final native JsLocation getLocation() /*-{ return this.location; }-*/; public final native void setLocation(Location param_location) /*-{ this.location = param_location; }-*/; public final native JsBarProp getLocationbar() /*-{ return this.locationbar; }-*/; public final native JsBarProp getMenubar() /*-{ return this.menubar; }-*/; public final native String getName() /*-{ return this.name; }-*/; public final native void setName(String param_name) /*-{ this.name = param_name; }-*/; public final native JsNavigator getNavigator() /*-{ return this.navigator; }-*/; public final native boolean isOffscreenBuffering() /*-{ return this.offscreenBuffering; }-*/; public final native EventListener getOnabort() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onabort); }-*/; public final native void setOnabort(EventListener listener) /*-{ this.onabort = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native BeforeUnloadEventListener getOnbeforeunload() /*-{ // Copied from JsEventTarget. return this.onbeforeunload && this.onbeforeunload.listener; }-*/; public final native void setOnbeforeunload(BeforeUnloadEventListener listener) /*-{ if (listener == null) { this.onbeforeunload = null; return; } handler = $entry(function(event) { return listener.@elemental.html.Window.BeforeUnloadEventListener::handleEvent(Lelemental/events/Event;)(event); }); handler.listener = listener; this.onbeforeunload = handler; }-*/; public final native EventListener getOnblur() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onblur); }-*/; public final native void setOnblur(EventListener listener) /*-{ this.onblur = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOncanplay() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.oncanplay); }-*/; public final native void setOncanplay(EventListener listener) /*-{ this.oncanplay = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOncanplaythrough() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.oncanplaythrough); }-*/; public final native void setOncanplaythrough(EventListener listener) /*-{ this.oncanplaythrough = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnchange() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onchange); }-*/; public final native void setOnchange(EventListener listener) /*-{ this.onchange = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnclick() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onclick); }-*/; public final native void setOnclick(EventListener listener) /*-{ this.onclick = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOncontextmenu() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.oncontextmenu); }-*/; public final native void setOncontextmenu(EventListener listener) /*-{ this.oncontextmenu = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOndblclick() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ondblclick); }-*/; public final native void setOndblclick(EventListener listener) /*-{ this.ondblclick = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOndevicemotion() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ondevicemotion); }-*/; public final native void setOndevicemotion(EventListener listener) /*-{ this.ondevicemotion = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOndeviceorientation() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ondeviceorientation); }-*/; public final native void setOndeviceorientation(EventListener listener) /*-{ this.ondeviceorientation = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOndrag() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ondrag); }-*/; public final native void setOndrag(EventListener listener) /*-{ this.ondrag = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOndragend() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ondragend); }-*/; public final native void setOndragend(EventListener listener) /*-{ this.ondragend = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOndragenter() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ondragenter); }-*/; public final native void setOndragenter(EventListener listener) /*-{ this.ondragenter = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOndragleave() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ondragleave); }-*/; public final native void setOndragleave(EventListener listener) /*-{ this.ondragleave = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOndragover() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ondragover); }-*/; public final native void setOndragover(EventListener listener) /*-{ this.ondragover = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOndragstart() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ondragstart); }-*/; public final native void setOndragstart(EventListener listener) /*-{ this.ondragstart = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOndrop() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ondrop); }-*/; public final native void setOndrop(EventListener listener) /*-{ this.ondrop = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOndurationchange() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ondurationchange); }-*/; public final native void setOndurationchange(EventListener listener) /*-{ this.ondurationchange = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnemptied() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onemptied); }-*/; public final native void setOnemptied(EventListener listener) /*-{ this.onemptied = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnended() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onended); }-*/; public final native void setOnended(EventListener listener) /*-{ this.onended = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnerror() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onerror); }-*/; public final native void setOnerror(EventListener listener) /*-{ this.onerror = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnfocus() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onfocus); }-*/; public final native void setOnfocus(EventListener listener) /*-{ this.onfocus = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnhashchange() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onhashchange); }-*/; public final native void setOnhashchange(EventListener listener) /*-{ this.onhashchange = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOninput() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.oninput); }-*/; public final native void setOninput(EventListener listener) /*-{ this.oninput = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOninvalid() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.oninvalid); }-*/; public final native void setOninvalid(EventListener listener) /*-{ this.oninvalid = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnkeydown() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onkeydown); }-*/; public final native void setOnkeydown(EventListener listener) /*-{ this.onkeydown = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnkeypress() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onkeypress); }-*/; public final native void setOnkeypress(EventListener listener) /*-{ this.onkeypress = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnkeyup() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onkeyup); }-*/; public final native void setOnkeyup(EventListener listener) /*-{ this.onkeyup = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnload() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onload); }-*/; public final native void setOnload(EventListener listener) /*-{ this.onload = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnloadeddata() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onloadeddata); }-*/; public final native void setOnloadeddata(EventListener listener) /*-{ this.onloadeddata = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnloadedmetadata() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onloadedmetadata); }-*/; public final native void setOnloadedmetadata(EventListener listener) /*-{ this.onloadedmetadata = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnloadstart() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onloadstart); }-*/; public final native void setOnloadstart(EventListener listener) /*-{ this.onloadstart = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnmessage() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onmessage); }-*/; public final native void setOnmessage(EventListener listener) /*-{ this.onmessage = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnmousedown() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onmousedown); }-*/; public final native void setOnmousedown(EventListener listener) /*-{ this.onmousedown = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnmousemove() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onmousemove); }-*/; public final native void setOnmousemove(EventListener listener) /*-{ this.onmousemove = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnmouseout() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onmouseout); }-*/; public final native void setOnmouseout(EventListener listener) /*-{ this.onmouseout = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnmouseover() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onmouseover); }-*/; public final native void setOnmouseover(EventListener listener) /*-{ this.onmouseover = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnmouseup() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onmouseup); }-*/; public final native void setOnmouseup(EventListener listener) /*-{ this.onmouseup = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnmousewheel() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onmousewheel); }-*/; public final native void setOnmousewheel(EventListener listener) /*-{ this.onmousewheel = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnoffline() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onoffline); }-*/; public final native void setOnoffline(EventListener listener) /*-{ this.onoffline = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnonline() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ononline); }-*/; public final native void setOnonline(EventListener listener) /*-{ this.ononline = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnpagehide() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onpagehide); }-*/; public final native void setOnpagehide(EventListener listener) /*-{ this.onpagehide = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnpageshow() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onpageshow); }-*/; public final native void setOnpageshow(EventListener listener) /*-{ this.onpageshow = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnpause() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onpause); }-*/; public final native void setOnpause(EventListener listener) /*-{ this.onpause = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnplay() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onplay); }-*/; public final native void setOnplay(EventListener listener) /*-{ this.onplay = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnplaying() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onplaying); }-*/; public final native void setOnplaying(EventListener listener) /*-{ this.onplaying = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnpopstate() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onpopstate); }-*/; public final native void setOnpopstate(EventListener listener) /*-{ this.onpopstate = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnprogress() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onprogress); }-*/; public final native void setOnprogress(EventListener listener) /*-{ this.onprogress = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnratechange() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onratechange); }-*/; public final native void setOnratechange(EventListener listener) /*-{ this.onratechange = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnreset() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onreset); }-*/; public final native void setOnreset(EventListener listener) /*-{ this.onreset = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnresize() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onresize); }-*/; public final native void setOnresize(EventListener listener) /*-{ this.onresize = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnscroll() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onscroll); }-*/; public final native void setOnscroll(EventListener listener) /*-{ this.onscroll = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnsearch() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onsearch); }-*/; public final native void setOnsearch(EventListener listener) /*-{ this.onsearch = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnseeked() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onseeked); }-*/; public final native void setOnseeked(EventListener listener) /*-{ this.onseeked = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnseeking() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onseeking); }-*/; public final native void setOnseeking(EventListener listener) /*-{ this.onseeking = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnselect() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onselect); }-*/; public final native void setOnselect(EventListener listener) /*-{ this.onselect = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnstalled() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onstalled); }-*/; public final native void setOnstalled(EventListener listener) /*-{ this.onstalled = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnstorage() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onstorage); }-*/; public final native void setOnstorage(EventListener listener) /*-{ this.onstorage = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnsubmit() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onsubmit); }-*/; public final native void setOnsubmit(EventListener listener) /*-{ this.onsubmit = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnsuspend() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onsuspend); }-*/; public final native void setOnsuspend(EventListener listener) /*-{ this.onsuspend = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOntimeupdate() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ontimeupdate); }-*/; public final native void setOntimeupdate(EventListener listener) /*-{ this.ontimeupdate = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOntouchcancel() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ontouchcancel); }-*/; public final native void setOntouchcancel(EventListener listener) /*-{ this.ontouchcancel = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOntouchend() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ontouchend); }-*/; public final native void setOntouchend(EventListener listener) /*-{ this.ontouchend = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOntouchmove() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ontouchmove); }-*/; public final native void setOntouchmove(EventListener listener) /*-{ this.ontouchmove = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOntouchstart() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ontouchstart); }-*/; public final native void setOntouchstart(EventListener listener) /*-{ this.ontouchstart = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnunload() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onunload); }-*/; public final native void setOnunload(EventListener listener) /*-{ this.onunload = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnvolumechange() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onvolumechange); }-*/; public final native void setOnvolumechange(EventListener listener) /*-{ this.onvolumechange = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnwaiting() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onwaiting); }-*/; public final native void setOnwaiting(EventListener listener) /*-{ this.onwaiting = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnwebkitanimationend() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onwebkitanimationend); }-*/; public final native void setOnwebkitanimationend(EventListener listener) /*-{ this.onwebkitanimationend = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnwebkitanimationiteration() /*-{
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
true
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/elemental/js/html/JsDataListElement.java
client/src/main/java/elemental/js/html/JsDataListElement.java
/* * Copyright 2010 Google Inc. * * 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 elemental.js.html; import elemental.html.DataListElement; import elemental.js.dom.JsElement; public class JsDataListElement extends JsElement implements DataListElement { protected JsDataListElement() { } public final native JsHTMLCollection getOptions() /*-{ return this.options; }-*/; }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/elemental/js/html/JsDragEvent.java
client/src/main/java/elemental/js/html/JsDragEvent.java
/* * Copyright 2010 Google Inc. * * 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 elemental.js.html; import elemental.dom.DataTransferItem; import elemental.html.DragEvent; public class JsDragEvent extends elemental.js.events.JsMouseEvent implements DragEvent { protected JsDragEvent() { } @Override public final native DataTransferItem getDataTransferItem() /*-{ return this.dataTransfer; }-*/; public final native void initDragEvent(String typeArg, boolean canBubbleArg, boolean cancelableArg, Object dummyArg, int detailArg, int screenXArg, int screenYArg, int clientXArg, int clientYArg, boolean ctrlKeyArg, boolean altKeyArg, boolean shiftKeyArg, boolean metaKeyArg, short buttonArg, elemental.events.EventTarget relatedTargetArg, DataTransferItem dataTransferArg) /*-{ this.initDragEvent(typeArg, canBubbleArg, cancelableArg, dummyArg, detailArg, screenXArg, screenYArg, clientXArg, clientYArg, ctrlKeyArg, altKeyArg, shiftKeyArg, metaKeyArg, buttonArg, relatedTargetArg, dataTransferArg); }-*/; }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/elemental/js/dom/JsNode.java
client/src/main/java/elemental/js/dom/JsNode.java
/* * Copyright 2012 Google Inc. * * 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 elemental.js.dom; import elemental.dom.Element; import elemental.dom.Node; public class JsNode extends JsElementalMixinBase implements Node { protected JsNode() {} public final native JsNamedNodeMap getAttributes() /*-{ return this.attributes; }-*/; public final native String getBaseURI() /*-{ return this.baseURI; }-*/; public final native JsNodeList getChildNodes() /*-{ return this.childNodes; }-*/; public final native JsNode getFirstChild() /*-{ return this.firstChild; }-*/; public final native JsNode getLastChild() /*-{ return this.lastChild; }-*/; public final native String getLocalName() /*-{ return this.localName; }-*/; public final native String getNamespaceURI() /*-{ return this.namespaceURI; }-*/; public final native JsNode getNextSibling() /*-{ return this.nextSibling; }-*/; public final native String getNodeName() /*-{ return this.nodeName; }-*/; public final native int getNodeType() /*-{ return this.nodeType; }-*/; public final native String getNodeValue() /*-{ return this.nodeValue; }-*/; public final native void setNodeValue(String param_nodeValue) /*-{ this.nodeValue = param_nodeValue; }-*/; public final native JsDocument getOwnerDocument() /*-{ return this.ownerDocument; }-*/; public final native JsElement getParentElement() /*-{ return this.parentElement; }-*/; public final native JsNode getParentNode() /*-{ return this.parentNode; }-*/; public final native String getPrefix() /*-{ return this.prefix; }-*/; public final native void setPrefix(String param_prefix) /*-{ this.prefix = param_prefix; }-*/; public final native JsNode getPreviousSibling() /*-{ return this.previousSibling; }-*/; public final native String getTextContent() /*-{ return this.textContent; }-*/; public final native void setTextContent(String param_textContent) /*-{ this.textContent = param_textContent; }-*/; public final native JsNode appendChild(Node newChild) /*-{ return this.appendChild(newChild); }-*/; public final native JsNode cloneNode(boolean deep) /*-{ return this.cloneNode(deep); }-*/; public final native int compareDocumentPosition(Node other) /*-{ return this.compareDocumentPosition(other); }-*/; public final native boolean contains(Node other) /*-{ return this.contains(other); }-*/; public final native boolean hasAttributes() /*-{ return this.hasAttributes(); }-*/; public final native boolean hasChildNodes() /*-{ return this.hasChildNodes(); }-*/; public final native JsNode insertBefore(Node newChild, Node refChild) /*-{ return this.insertBefore(newChild, refChild); }-*/; public final native boolean isDefaultNamespace(String namespaceURI) /*-{ return this.isDefaultNamespace(namespaceURI); }-*/; public final native boolean isEqualNode(Node other) /*-{ return this.isEqualNode(other); }-*/; public final native boolean isSameNode(Node other) /*-{ return this.isSameNode(other); }-*/; public final native boolean isSupported(String feature, String version) /*-{ return this.isSupported(feature, version); }-*/; public final native String lookupNamespaceURI(String prefix) /*-{ return this.lookupNamespaceURI(prefix); }-*/; public final native String lookupPrefix(String namespaceURI) /*-{ return this.lookupPrefix(namespaceURI); }-*/; public final native void normalize() /*-{ this.normalize(); }-*/; public final native JsNode removeChild(Node oldChild) /*-{ return this.removeChild(oldChild); }-*/; public final native JsNode replaceChild(Node newChild, Node oldChild) /*-{ return this.replaceChild(newChild, oldChild); }-*/; public final void removeFromParent() { Element parent = getParentElement(); if (parent != null) { parent.removeChild(this); } } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/elemental/js/dom/JsElement.java
client/src/main/java/elemental/js/dom/JsElement.java
/* * Copyright 2012 Google Inc. * * 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 elemental.js.dom; import elemental.dom.Attr; import elemental.dom.Element; import elemental.events.EventListener; import elemental.js.css.JsCSSStyleDeclaration; import elemental.js.html.JsClientRect; import elemental.js.html.JsClientRectList; import elemental.js.html.JsHTMLCollection; import elemental.js.util.JsMappable; public class JsElement extends JsNode implements Element { protected JsElement() {} public final native String getAccessKey() /*-{ return this.accessKey; }-*/; public final native void setAccessKey(String param_accessKey) /*-{ this.accessKey = param_accessKey; }-*/; public final native JsHTMLCollection getChildren() /*-{ return this.children; }-*/; public final native JsDOMTokenList getClassList() /*-{ return this.classList; }-*/; public final native String getClassName() /*-{ return this.className; }-*/; public final native void setClassName(String param_className) /*-{ this.className = param_className; }-*/; public final native int getClientHeight() /*-{ return this.clientHeight; }-*/; public final native int getClientLeft() /*-{ return this.clientLeft; }-*/; public final native int getClientTop() /*-{ return this.clientTop; }-*/; public final native int getClientWidth() /*-{ return this.clientWidth; }-*/; public final native String getContentEditable() /*-{ return this.contentEditable; }-*/; public final native void setContentEditable(String param_contentEditable) /*-{ this.contentEditable = param_contentEditable; }-*/; public final native JsMappable getDataset() /*-{ return this.dataset; }-*/; public final native String getDir() /*-{ return this.dir; }-*/; public final native void setDir(String param_dir) /*-{ this.dir = param_dir; }-*/; public final native boolean isDraggable() /*-{ return this.draggable; }-*/; public final native void setDraggable(boolean param_draggable) /*-{ this.draggable = param_draggable; }-*/; public final native boolean isHidden() /*-{ return this.hidden; }-*/; public final native void setHidden(boolean param_hidden) /*-{ this.hidden = param_hidden; }-*/; public final native String getId() /*-{ return this.id; }-*/; public final native void setId(String param_id) /*-{ this.id = param_id; }-*/; public final native String getInnerHTML() /*-{ return this.innerHTML; }-*/; public final native void setInnerHTML(String param_innerHTML) /*-{ this.innerHTML = param_innerHTML; }-*/; public final native String getInnerText() /*-{ return this.innerText; }-*/; public final native void setInnerText(String param_innerText) /*-{ this.innerText = param_innerText; }-*/; public final native boolean isContentEditable() /*-{ return this.isContentEditable; }-*/; public final native String getLang() /*-{ return this.lang; }-*/; public final native void setLang(String param_lang) /*-{ this.lang = param_lang; }-*/; public final native int getOffsetHeight() /*-{ return this.offsetHeight; }-*/; public final native int getOffsetLeft() /*-{ return this.offsetLeft; }-*/; public final native JsElement getOffsetParent() /*-{ return this.offsetParent; }-*/; public final native int getOffsetTop() /*-{ return this.offsetTop; }-*/; public final native int getOffsetWidth() /*-{ return this.offsetWidth; }-*/; public final native EventListener getOnabort() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onabort); }-*/; public final native void setOnabort(EventListener listener) /*-{ this.onabort = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnbeforecopy() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onbeforecopy); }-*/; public final native void setOnbeforecopy(EventListener listener) /*-{ this.onbeforecopy = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnbeforecut() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onbeforecut); }-*/; public final native void setOnbeforecut(EventListener listener) /*-{ this.onbeforecut = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnbeforepaste() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onbeforepaste); }-*/; public final native void setOnbeforepaste(EventListener listener) /*-{ this.onbeforepaste = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnblur() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onblur); }-*/; public final native void setOnblur(EventListener listener) /*-{ this.onblur = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnchange() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onchange); }-*/; public final native void setOnchange(EventListener listener) /*-{ this.onchange = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnclick() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onclick); }-*/; public final native void setOnclick(EventListener listener) /*-{ this.onclick = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOncontextmenu() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.oncontextmenu); }-*/; public final native void setOncontextmenu(EventListener listener) /*-{ this.oncontextmenu = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOncopy() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.oncopy); }-*/; public final native void setOncopy(EventListener listener) /*-{ this.oncopy = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOncut() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.oncut); }-*/; public final native void setOncut(EventListener listener) /*-{ this.oncut = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOndblclick() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ondblclick); }-*/; public final native void setOndblclick(EventListener listener) /*-{ this.ondblclick = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOndrag() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ondrag); }-*/; public final native void setOndrag(EventListener listener) /*-{ this.ondrag = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOndragend() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ondragend); }-*/; public final native void setOndragend(EventListener listener) /*-{ this.ondragend = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOndragenter() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ondragenter); }-*/; public final native void setOndragenter(EventListener listener) /*-{ this.ondragenter = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOndragleave() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ondragleave); }-*/; public final native void setOndragleave(EventListener listener) /*-{ this.ondragleave = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOndragover() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ondragover); }-*/; public final native void setOndragover(EventListener listener) /*-{ this.ondragover = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOndragstart() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ondragstart); }-*/; public final native void setOndragstart(EventListener listener) /*-{ this.ondragstart = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOndrop() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ondrop); }-*/; public final native void setOndrop(EventListener listener) /*-{ this.ondrop = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnerror() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onerror); }-*/; public final native void setOnerror(EventListener listener) /*-{ this.onerror = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnfocus() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onfocus); }-*/; public final native void setOnfocus(EventListener listener) /*-{ this.onfocus = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOninput() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.oninput); }-*/; public final native void setOninput(EventListener listener) /*-{ this.oninput = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOninvalid() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.oninvalid); }-*/; public final native void setOninvalid(EventListener listener) /*-{ this.oninvalid = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnkeydown() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onkeydown); }-*/; public final native void setOnkeydown(EventListener listener) /*-{ this.onkeydown = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnkeypress() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onkeypress); }-*/; public final native void setOnkeypress(EventListener listener) /*-{ this.onkeypress = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnkeyup() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onkeyup); }-*/; public final native void setOnkeyup(EventListener listener) /*-{ this.onkeyup = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnload() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onload); }-*/; public final native void setOnload(EventListener listener) /*-{ this.onload = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnmousedown() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onmousedown); }-*/; public final native void setOnmousedown(EventListener listener) /*-{ this.onmousedown = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnmousemove() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onmousemove); }-*/; public final native void setOnmousemove(EventListener listener) /*-{ this.onmousemove = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnmouseout() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onmouseout); }-*/; public final native void setOnmouseout(EventListener listener) /*-{ this.onmouseout = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnmouseover() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onmouseover); }-*/; public final native void setOnmouseover(EventListener listener) /*-{ this.onmouseover = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnmouseup() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onmouseup); }-*/; public final native void setOnmouseup(EventListener listener) /*-{ this.onmouseup = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnmousewheel() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onmousewheel); }-*/; public final native void setOnmousewheel(EventListener listener) /*-{ this.onmousewheel = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnpaste() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onpaste); }-*/; public final native void setOnpaste(EventListener listener) /*-{ this.onpaste = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnreset() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onreset); }-*/; public final native void setOnreset(EventListener listener) /*-{ this.onreset = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnscroll() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onscroll); }-*/; public final native void setOnscroll(EventListener listener) /*-{ this.onscroll = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnsearch() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onsearch); }-*/; public final native void setOnsearch(EventListener listener) /*-{ this.onsearch = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnselect() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onselect); }-*/; public final native void setOnselect(EventListener listener) /*-{ this.onselect = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnselectstart() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onselectstart); }-*/; public final native void setOnselectstart(EventListener listener) /*-{ this.onselectstart = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnsubmit() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onsubmit); }-*/; public final native void setOnsubmit(EventListener listener) /*-{ this.onsubmit = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOntouchcancel() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ontouchcancel); }-*/; public final native void setOntouchcancel(EventListener listener) /*-{ this.ontouchcancel = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOntouchend() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ontouchend); }-*/; public final native void setOntouchend(EventListener listener) /*-{ this.ontouchend = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOntouchmove() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ontouchmove); }-*/; public final native void setOntouchmove(EventListener listener) /*-{ this.ontouchmove = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOntouchstart() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.ontouchstart); }-*/; public final native void setOntouchstart(EventListener listener) /*-{ this.ontouchstart = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnwebkitfullscreenchange() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onwebkitfullscreenchange); }-*/; public final native void setOnwebkitfullscreenchange(EventListener listener) /*-{ this.onwebkitfullscreenchange = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native EventListener getOnwebkitfullscreenerror() /*-{ return @elemental.js.dom.JsElementalMixinBase::getListenerFor(Lcom/google/gwt/core/client/JavaScriptObject;)(this.onwebkitfullscreenerror); }-*/; public final native void setOnwebkitfullscreenerror(EventListener listener) /*-{ this.onwebkitfullscreenerror = @elemental.js.dom.JsElementalMixinBase::getHandlerFor(Lelemental/events/EventListener;)(listener); }-*/; public final native String getOuterHTML() /*-{ return this.outerHTML; }-*/; public final native void setOuterHTML(String param_outerHTML) /*-{ this.outerHTML = param_outerHTML; }-*/; public final native String getOuterText() /*-{ return this.outerText; }-*/; public final native void setOuterText(String param_outerText) /*-{ this.outerText = param_outerText; }-*/; public final native int getScrollHeight() /*-{ return this.scrollHeight; }-*/; public final native int getScrollLeft() /*-{ return this.scrollLeft; }-*/; public final native void setScrollLeft(int param_scrollLeft) /*-{ this.scrollLeft = param_scrollLeft; }-*/; public final native int getScrollTop() /*-{ return this.scrollTop; }-*/; public final native void setScrollTop(int param_scrollTop) /*-{ this.scrollTop = param_scrollTop; }-*/; public final native int getScrollWidth() /*-{ return this.scrollWidth; }-*/; public final native boolean isSpellcheck() /*-{ return this.spellcheck; }-*/; public final native void setSpellcheck(boolean param_spellcheck) /*-{ this.spellcheck = param_spellcheck; }-*/; public final native JsCSSStyleDeclaration getStyle() /*-{ return this.style; }-*/; public final native int getTabIndex() /*-{ return this.tabIndex; }-*/; public final native void setTabIndex(int param_tabIndex) /*-{ this.tabIndex = param_tabIndex; }-*/; public final native String getTagName() /*-{ return this.tagName; }-*/; public final native String getTitle() /*-{ return this.title; }-*/; public final native void setTitle(String param_title) /*-{ this.title = param_title; }-*/; public final native boolean isTranslate() /*-{ return this.translate; }-*/; public final native void setTranslate(boolean param_translate) /*-{ this.translate = param_translate; }-*/; public final native String getWebkitRegionOverflow() /*-{ return this.webkitRegionOverflow; }-*/; public final native String getWebkitdropzone() /*-{ return this.webkitdropzone; }-*/; public final native void setWebkitdropzone(String param_webkitdropzone) /*-{ this.webkitdropzone = param_webkitdropzone; }-*/; public final native void blur() /*-{ this.blur(); }-*/; public final native void focus() /*-{ this.focus(); }-*/; public final native String getAttribute(String name) /*-{ return this.getAttribute(name); }-*/; public final native String getAttributeNS(String namespaceURI, String localName) /*-{ return this.getAttributeNS(namespaceURI, localName); }-*/; public final native JsAttr getAttributeNode(String name) /*-{ return this.getAttributeNode(name); }-*/; public final native JsAttr getAttributeNodeNS(String namespaceURI, String localName) /*-{ return this.getAttributeNodeNS(namespaceURI, localName); }-*/; public final native JsClientRect getBoundingClientRect() /*-{ return this.getBoundingClientRect(); }-*/; public final native JsClientRectList getClientRects() /*-{ return this.getClientRects(); }-*/; public final native JsNodeList getElementsByClassName(String name) /*-{ return this.getElementsByClassName(name); }-*/; public final native JsNodeList getElementsByTagName(String name) /*-{ return this.getElementsByTagName(name); }-*/; public final native JsNodeList getElementsByTagNameNS(String namespaceURI, String localName) /*-{ return this.getElementsByTagNameNS(namespaceURI, localName); }-*/; public final native boolean hasAttribute(String name) /*-{ return this.hasAttribute(name); }-*/; public final native boolean hasAttributeNS(String namespaceURI, String localName) /*-{ return this.hasAttributeNS(namespaceURI, localName); }-*/; public final native void removeAttribute(String name) /*-{ this.removeAttribute(name); }-*/; public final native void removeAttributeNS(String namespaceURI, String localName) /*-{ this.removeAttributeNS(namespaceURI, localName); }-*/; public final native JsAttr removeAttributeNode(Attr oldAttr) /*-{ return this.removeAttributeNode(oldAttr); }-*/; public final native void scrollByLines(int lines) /*-{ this.scrollByLines(lines); }-*/; public final native void scrollByPages(int pages) /*-{ this.scrollByPages(pages); }-*/; public final native void scrollIntoView() /*-{ this.scrollIntoView(); }-*/; public final native void scrollIntoView(boolean alignWithTop) /*-{ this.scrollIntoView(alignWithTop); }-*/; public final native void scrollIntoViewIfNeeded() /*-{ this.scrollIntoViewIfNeeded(); }-*/; public final native void scrollIntoViewIfNeeded(boolean centerIfNeeded) /*-{ this.scrollIntoViewIfNeeded(centerIfNeeded); }-*/; public final native void setAttribute(String name, String value) /*-{ this.setAttribute(name, value); }-*/; public final native void setAttributeNS(String namespaceURI, String qualifiedName, String value) /*-{ this.setAttributeNS(namespaceURI, qualifiedName, value); }-*/; public final native JsAttr setAttributeNode(Attr newAttr) /*-{ return this.setAttributeNode(newAttr); }-*/; public final native JsAttr setAttributeNodeNS(Attr newAttr) /*-{ return this.setAttributeNodeNS(newAttr); }-*/; public final native boolean webkitMatchesSelector(String selectors) /*-{ return this.webkitMatchesSelector(selectors); }-*/; public final native void webkitRequestFullScreen(int flags) /*-{ this.webkitRequestFullScreen(flags); }-*/; public final native void webkitRequestFullscreen() /*-{ this.webkitRequestFullscreen(); }-*/; public final native void click() /*-{ this.click(); }-*/; public final native JsElement insertAdjacentElement(String where, Element element) /*-{ return this.insertAdjacentElement(where, element); }-*/; public final native void insertAdjacentHTML(String where, String html) /*-{ this.insertAdjacentHTML(where, html); }-*/; public final native void insertAdjacentText(String where, String text) /*-{ this.insertAdjacentText(where, text); }-*/; public final boolean hasClassName(String className) { assert className != null : "Unexpected null class name"; String currentClassName = getClassName(); return (currentClassName != null) && (currentClassName.equals(className) || currentClassName.startsWith(className + " ") || currentClassName.endsWith(" " + className) || currentClassName.indexOf(" " + className + " ") != -1); } public final void addClassName(String className) { assert (className != null) : "Unexpectedly null class name"; className = className.trim(); assert (className.length() != 0) : "Unexpectedly empty class name"; // Get the current style string. String oldClassName = getClassName(); int idx = oldClassName.indexOf(className); // Calculate matching index. while (idx != -1) { if (idx == 0 || oldClassName.charAt(idx - 1) == ' ') { int last = idx + className.length(); int lastPos = oldClassName.length(); if ((last == lastPos) || ((last < lastPos) && (oldClassName.charAt(last) == ' '))) { break; } } idx = oldClassName.indexOf(className, idx + 1); } // Only add the style if it's not already present. if (idx == -1) { if (oldClassName.length() > 0) { oldClassName += " "; } setClassName(oldClassName + className); } } public final void removeClassName(String className) { assert (className != null) : "Unexpectedly null class name"; className = className.trim(); assert (className.length() != 0) : "Unexpectedly empty class name"; // Get the current style string. String oldStyle = getClassName(); int idx = oldStyle.indexOf(className); // Calculate matching index. while (idx != -1) { if (idx == 0 || oldStyle.charAt(idx - 1) == ' ') { int last = idx + className.length(); int lastPos = oldStyle.length(); if ((last == lastPos) || ((last < lastPos) && (oldStyle.charAt(last) == ' '))) { break; } } idx = oldStyle.indexOf(className, idx + 1); } // Don't try to remove the style if it's not there. if (idx != -1) { // Get the leading and trailing parts, without the removed name. String begin = oldStyle.substring(0, idx).trim(); String end = oldStyle.substring(idx + className.length()).trim(); // Some contortions to make sure we don't leave extra spaces. String newClassName; if (begin.length() == 0) { newClassName = end; } else if (end.length() == 0) { newClassName = begin; } else { newClassName = begin + " " + end; } setClassName(newClassName); } } public final void replaceClassName(String oldClassName, String newClassName) { removeClassName(oldClassName); addClassName(newClassName); } public final JsElement getFirstChildElement() { elemental.js.dom.JsNode child = getFirstChild(); while ((child != null) && child.getNodeType() != ELEMENT_NODE) { child = child.getNextSibling(); } return child.cast(); } public final JsElement getNextSiblingElement() { elemental.js.dom.JsNode sib = getNextSibling(); while ((sib != null) && sib.getNodeType() != ELEMENT_NODE) { sib = sib.getNextSibling(); } return sib.cast(); } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/elemental/dom/Node.java
client/src/main/java/elemental/dom/Node.java
/* * Copyright 2012 Google Inc. * * 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 elemental.dom; import elemental.events.Event; import elemental.events.EventListener; import elemental.events.EventRemover; import elemental.events.EventTarget; /** * A <code>Node</code> is an interface from which a number of DOM types inherit, and allows these various types to be treated (or tested) similarly.<br> The following all inherit this interface and its methods and properties (though they may return null in particular cases where not relevant; or throw an exception when adding children to a node type for which no children can exist): <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/Document">Document</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/Element">Element</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/Attr">Attr</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/CharacterData">CharacterData</a></code> (which <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/Text">Text</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/Comment">Comment</a></code> , and <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/CDATASection">CDATASection</a></code> inherit), <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/ProcessingInstruction">ProcessingInstruction</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/DocumentFragment">DocumentFragment</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/DocumentType">DocumentType</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/Notation">Notation</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/Entity">Entity</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/EntityReference">EntityReference</a></code> */ public interface Node extends EventTarget { static final int ATTRIBUTE_NODE = 2; static final int CDATA_SECTION_NODE = 4; static final int COMMENT_NODE = 8; static final int DOCUMENT_FRAGMENT_NODE = 11; static final int DOCUMENT_NODE = 9; static final int DOCUMENT_POSITION_CONTAINED_BY = 0x10; static final int DOCUMENT_POSITION_CONTAINS = 0x08; static final int DOCUMENT_POSITION_DISCONNECTED = 0x01; static final int DOCUMENT_POSITION_FOLLOWING = 0x04; static final int DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; static final int DOCUMENT_POSITION_PRECEDING = 0x02; static final int DOCUMENT_TYPE_NODE = 10; static final int ELEMENT_NODE = 1; static final int ENTITY_NODE = 6; static final int ENTITY_REFERENCE_NODE = 5; static final int NOTATION_NODE = 12; static final int PROCESSING_INSTRUCTION_NODE = 7; static final int TEXT_NODE = 3; NamedNodeMap getAttributes(); String getBaseURI(); NodeList getChildNodes(); Node getFirstChild(); Node getLastChild(); String getLocalName(); String getNamespaceURI(); Node getNextSibling(); String getNodeName(); int getNodeType(); String getNodeValue(); void setNodeValue(String arg); Document getOwnerDocument(); Element getParentElement(); Node getParentNode(); String getPrefix(); void setPrefix(String arg); Node getPreviousSibling(); String getTextContent(); void setTextContent(String arg); EventRemover addEventListener(String type, EventListener listener); EventRemover addEventListener(String type, EventListener listener, boolean useCapture); Node appendChild(Node newChild); Node cloneNode(boolean deep); int compareDocumentPosition(Node other); boolean contains(Node other); boolean dispatchEvent(Event event); boolean hasAttributes(); boolean hasChildNodes(); Node insertBefore(Node newChild, Node refChild); boolean isDefaultNamespace(String namespaceURI); boolean isEqualNode(Node other); boolean isSameNode(Node other); boolean isSupported(String feature, String version); String lookupNamespaceURI(String prefix); String lookupPrefix(String namespaceURI); void normalize(); Node removeChild(Node oldChild); void removeEventListener(String type, EventListener listener); void removeEventListener(String type, EventListener listener, boolean useCapture); void removeFromParent(); Node replaceChild(Node newChild, Node oldChild); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/client/src/main/java/elemental/dom/Element.java
client/src/main/java/elemental/dom/Element.java
/* * Copyright 2012 Google Inc. * * 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 elemental.dom; import elemental.css.CSSStyleDeclaration; import elemental.events.EventListener; import elemental.html.ClientRect; import elemental.html.ClientRectList; import elemental.html.HTMLCollection; import elemental.js.dom.JsElement; import elemental.util.Mappable; /** * <p>This chapter provides a brief reference for the general methods, properties, and events available to most HTML and XML elements in the Gecko DOM.</p> <p>Various W3C specifications apply to elements:</p> <ul> <li><a class="external" rel="external" href="http://www.w3.org/TR/DOM-Level-2-Core/" title="http://www.w3.org/TR/DOM-Level-2-Core/" target="_blank">DOM Core Specification</a>—describes the core interfaces shared by most DOM objects in HTML and XML documents</li> <li><a class="external" rel="external" href="http://www.w3.org/TR/DOM-Level-2-HTML/" title="http://www.w3.org/TR/DOM-Level-2-HTML/" target="_blank">DOM HTML Specification</a>—describes interfaces for objects in HTML and XHTML documents that build on the core specification</li> <li><a class="external" rel="external" href="http://www.w3.org/TR/DOM-Level-2-Events/" title="http://www.w3.org/TR/DOM-Level-2-Events/" target="_blank">DOM Events Specification</a>—describes events shared by most DOM objects, building on the DOM Core and <a class="external" rel="external" href="http://www.w3.org/TR/DOM-Level-2-Views/" title="http://www.w3.org/TR/DOM-Level-2-Views/" target="_blank">Views</a> specifications</li> <li><a class="external" title="http://www.w3.org/TR/ElementTraversal/" rel="external" href="http://www.w3.org/TR/ElementTraversal/" target="_blank">Element Traversal Specification</a>—describes the new attributes that allow traversal of elements in the DOM&nbsp;tree <span>New in <a rel="custom" href="https://developer.mozilla.org/en/Firefox_3.5_for_developers">Firefox 3.5</a></span> </li> </ul> <p>The articles listed here span the above and include links to the appropriate W3C DOM specification.</p> <p>While these interfaces are generally shared by most HTML and XML elements, there are more specialized interfaces for particular objects listed in the DOM HTML Specification. Note, however, that these HTML&nbsp;interfaces are "only for [HTML 4.01] and [XHTML 1.0] documents and are not guaranteed to work with any future version of XHTML." The HTML 5 draft does state it aims for backwards compatibility with these HTML&nbsp;interfaces but says of them that "some features that were formerly deprecated, poorly supported, rarely used or considered unnecessary have been removed." One can avoid the potential conflict by moving entirely to DOM&nbsp;XML attribute methods such as <code>getAttribute()</code>.</p> <p><code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLHtmlElement">Html</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLHeadElement">Head</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLLinkElement">Link</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLTitleElement">Title</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLMetaElement">Meta</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLBaseElement">Base</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/HTMLIsIndexElement" class="new">IsIndex</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLStyleElement">Style</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLBodyElement">Body</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLFormElement">Form</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLSelectElement">Select</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/HTMLOptGroupElement" class="new">OptGroup</a></code> , <a title="en/HTML/Element/HTMLOptionElement" rel="internal" href="https://developer.mozilla.org/en/HTML/Element/HTMLOptionElement" class="new ">Option</a>, <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLInputElement">Input</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLTextAreaElement">TextArea</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLButtonElement">Button</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLLabelElement">Label</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLFieldSetElement">FieldSet</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLLegendElement">Legend</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/HTMLUListElement" class="new">UList</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/OList" class="new">OList</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/DList" class="new">DList</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/Directory" class="new">Directory</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/Menu" class="new">Menu</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/LI" class="new">LI</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/Div" class="new">Div</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/Paragraph" class="new">Paragraph</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/Heading" class="new">Heading</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/Quote" class="new">Quote</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/Pre" class="new">Pre</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/BR" class="new">BR</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/BaseFont" class="new">BaseFont</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/Font" class="new">Font</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/HR" class="new">HR</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/Mod" class="new">Mod</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLAnchorElement">Anchor</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/Image" class="new">Image</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLObjectElement">Object</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/Param" class="new">Param</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/Applet" class="new">Applet</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/Map" class="new">Map</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/Area" class="new">Area</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/Script" class="new">Script</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLTableElement">Table</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/TableCaption" class="new">TableCaption</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/TableCol" class="new">TableCol</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/TableSection" class="new">TableSection</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLTableRowElement">TableRow</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/TableCell" class="new">TableCell</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/FrameSet" class="new">FrameSet</a></code> , <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/DOM/Frame" class="new">Frame</a></code> , <code><a rel="custom" href="https://developer.mozilla.org/en/DOM/HTMLIFrameElement">IFrame</a></code> </p> */ public interface Element extends Node, NodeSelector, ElementTraversal { static final int ALLOW_KEYBOARD_INPUT = 1; String getAccessKey(); void setAccessKey(String arg); /** * The number of child nodes that are elements. */ int getChildElementCount(); /** * A live <code><a rel="internal" href="https://developer.mozilla.org/Article_not_found?uri=en/XPCOM_Interface_Reference/nsIDOMNodeList&amp;ident=nsIDOMNodeList" class="new">nsIDOMNodeList</a></code> of the current child elements. */ HTMLCollection getChildren(); /** * Token list of class attribute */ DOMTokenList getClassList(); /** * Gets/sets the class of the element. */ String getClassName(); void setClassName(String arg); /** * The inner height of an element. */ int getClientHeight(); /** * The width of the left border of an element. */ int getClientLeft(); /** * The width of the top border of an element. */ int getClientTop(); /** * The inner width of an element. */ int getClientWidth(); /** * Gets/sets whether or not the element is editable. */ String getContentEditable(); void setContentEditable(String arg); /** * Allows access to read and write custom data attributes on the element. */ Mappable getDataset(); /** * Gets/sets the directionality of the element. */ String getDir(); void setDir(String arg); boolean isDraggable(); void setDraggable(boolean arg); /** * The first direct child element of an element, or <code>null</code> if the element has no child elements. */ Element getFirstElementChild(); boolean isHidden(); void setHidden(boolean arg); /** * Gets/sets the id of the element. */ String getId(); void setId(String arg); /** * Gets/sets the markup of the element's content. */ String getInnerHTML(); void setInnerHTML(String arg); String getInnerText(); void setInnerText(String arg); /** * Indicates whether or not the content of the element can be edited. Read only. */ boolean isContentEditable(); /** * Gets/sets the language of an element's attributes, text, and element contents. */ String getLang(); void setLang(String arg); /** * The last direct child element of an element, or <code>null</code> if the element has no child elements. */ Element getLastElementChild(); /** * The element immediately following the given one in the tree, or <code>null</code> if there's no sibling node. */ Element getNextElementSibling(); /** * The height of an element, relative to the layout. */ int getOffsetHeight(); /** * The distance from this element's left border to its <code>offsetParent</code>'s left border. */ int getOffsetLeft(); /** * The element from which all offset calculations are currently computed. */ Element getOffsetParent(); /** * The distance from this element's top border to its <code>offsetParent</code>'s top border. */ int getOffsetTop(); /** * The width of an element, relative to the layout. */ int getOffsetWidth(); EventListener getOnabort(); void setOnabort(EventListener arg); EventListener getOnbeforecopy(); void setOnbeforecopy(EventListener arg); EventListener getOnbeforecut(); void setOnbeforecut(EventListener arg); EventListener getOnbeforepaste(); void setOnbeforepaste(EventListener arg); /** * Returns the event handling code for the blur event. */ EventListener getOnblur(); void setOnblur(EventListener arg); /** * Returns the event handling code for the change event. */ EventListener getOnchange(); void setOnchange(EventListener arg); /** * Returns the event handling code for the click event. */ EventListener getOnclick(); void setOnclick(EventListener arg); /** * Returns the event handling code for the contextmenu event. */ EventListener getOncontextmenu(); void setOncontextmenu(EventListener arg); /** * Returns the event handling code for the copy event. */ EventListener getOncopy(); void setOncopy(EventListener arg); /** * Returns the event handling code for the cut event. */ EventListener getOncut(); void setOncut(EventListener arg); /** * Returns the event handling code for the dblclick event. */ EventListener getOndblclick(); void setOndblclick(EventListener arg); EventListener getOndrag(); void setOndrag(EventListener arg); EventListener getOndragend(); void setOndragend(EventListener arg); EventListener getOndragenter(); void setOndragenter(EventListener arg); EventListener getOndragleave(); void setOndragleave(EventListener arg); EventListener getOndragover(); void setOndragover(EventListener arg); EventListener getOndragstart(); void setOndragstart(EventListener arg); EventListener getOndrop(); void setOndrop(EventListener arg); EventListener getOnerror(); void setOnerror(EventListener arg); /** * Returns the event handling code for the focus event. */ EventListener getOnfocus(); void setOnfocus(EventListener arg); EventListener getOninput(); void setOninput(EventListener arg); EventListener getOninvalid(); void setOninvalid(EventListener arg); /** * Returns the event handling code for the keydown event. */ EventListener getOnkeydown(); void setOnkeydown(EventListener arg); /** * Returns the event handling code for the keypress event. */ EventListener getOnkeypress(); void setOnkeypress(EventListener arg); /** * Returns the event handling code for the keyup event. */ EventListener getOnkeyup(); void setOnkeyup(EventListener arg); EventListener getOnload(); void setOnload(EventListener arg); /** * Returns the event handling code for the mousedown event. */ EventListener getOnmousedown(); void setOnmousedown(EventListener arg); /** * Returns the event handling code for the mousemove event. */ EventListener getOnmousemove(); void setOnmousemove(EventListener arg); /** * Returns the event handling code for the mouseout event. */ EventListener getOnmouseout(); void setOnmouseout(EventListener arg); /** * Returns the event handling code for the mouseover event. */ EventListener getOnmouseover(); void setOnmouseover(EventListener arg); /** * Returns the event handling code for the mouseup event. */ EventListener getOnmouseup(); void setOnmouseup(EventListener arg); EventListener getOnmousewheel(); void setOnmousewheel(EventListener arg); /** * Returns the event handling code for the paste event. */ EventListener getOnpaste(); void setOnpaste(EventListener arg); EventListener getOnreset(); void setOnreset(EventListener arg); /** * Returns the event handling code for the scroll event. */ EventListener getOnscroll(); void setOnscroll(EventListener arg); EventListener getOnsearch(); void setOnsearch(EventListener arg); EventListener getOnselect(); void setOnselect(EventListener arg); EventListener getOnselectstart(); void setOnselectstart(EventListener arg); EventListener getOnsubmit(); void setOnsubmit(EventListener arg); EventListener getOntouchcancel(); void setOntouchcancel(EventListener arg); EventListener getOntouchend(); void setOntouchend(EventListener arg); EventListener getOntouchmove(); void setOntouchmove(EventListener arg); EventListener getOntouchstart(); void setOntouchstart(EventListener arg); EventListener getOnwebkitfullscreenchange(); void setOnwebkitfullscreenchange(EventListener arg); EventListener getOnwebkitfullscreenerror(); void setOnwebkitfullscreenerror(EventListener arg); /** * Gets the markup of the element including its content. When used as a setter, replaces the element with nodes parsed from the given string. */ String getOuterHTML(); void setOuterHTML(String arg); String getOuterText(); void setOuterText(String arg); /** * The element immediately preceding the given one in the tree, or <code>null</code> if there is no sibling element. */ Element getPreviousElementSibling(); /** * The scroll view height of an element. */ int getScrollHeight(); /** * Gets/sets the left scroll offset of an element. */ int getScrollLeft(); void setScrollLeft(int arg); /** * Gets/sets the top scroll offset of an element. */ int getScrollTop(); void setScrollTop(int arg); /** * The scroll view width of an element. */ int getScrollWidth(); /** * Controls <a title="en/Controlling_spell_checking_in_HTML_forms" rel="internal" href="https://developer.mozilla.org/en/HTML/Controlling_spell_checking_in_HTML_forms">spell-checking</a> (present on all HTML&nbsp;elements) */ boolean isSpellcheck(); void setSpellcheck(boolean arg); /** * An object representing the declarations of an element's style attributes. */ CSSStyleDeclaration getStyle(); /** * Gets/sets the position of the element in the tabbing order. */ int getTabIndex(); void setTabIndex(int arg); /** * The name of the tag for the given element. */ String getTagName(); /** * A string that appears in a popup box when mouse is over the element. */ String getTitle(); void setTitle(String arg); boolean isTranslate(); void setTranslate(boolean arg); String getWebkitRegionOverflow(); String getWebkitdropzone(); void setWebkitdropzone(String arg); /** * Removes keyboard focus from the current element. */ void blur(); /** * Gives keyboard focus to the current element. */ void focus(); /** * Retrieve the value of the named attribute from the current node. */ String getAttribute(String name); /** * Retrieve the value of the attribute with the specified name and namespace, from the current node. */ String getAttributeNS(String namespaceURI, String localName); /** * Retrieve the node representation of the named attribute from the current node. */ Attr getAttributeNode(String name); /** * Retrieve the node representation of the attribute with the specified name and namespace, from the current node. */ Attr getAttributeNodeNS(String namespaceURI, String localName); ClientRect getBoundingClientRect(); ClientRectList getClientRects(); NodeList getElementsByClassName(String name); /** * Retrieve a set of all descendant elements, of a particular tag name, from the current element. */ NodeList getElementsByTagName(String name); /** * Retrieve a set of all descendant elements, of a particular tag name and namespace, from the current element. */ NodeList getElementsByTagNameNS(String namespaceURI, String localName); /** * Check if the element has the specified attribute, or not. */ boolean hasAttribute(String name); /** * Check if the element has the specified attribute, in the specified namespace, or not. */ boolean hasAttributeNS(String namespaceURI, String localName); Element querySelector(String selectors); NodeList querySelectorAll(String selectors); /** * Remove the named attribute from the current node. */ void removeAttribute(String name); /** * Remove the attribute with the specified name and namespace, from the current node. */ void removeAttributeNS(String namespaceURI, String localName); /** * Remove the node representation of the named attribute from the current node. */ Attr removeAttributeNode(Attr oldAttr); void scrollByLines(int lines); void scrollByPages(int pages); /** * Scrolls the page until the element gets into the view. */ void scrollIntoView(); /** * Scrolls the page until the element gets into the view. */ void scrollIntoView(boolean alignWithTop); void scrollIntoViewIfNeeded(); void scrollIntoViewIfNeeded(boolean centerIfNeeded); /** * Set the value of the named attribute from the current node. */ void setAttribute(String name, String value); /** * Set the value of the attribute with the specified name and namespace, from the current node. */ void setAttributeNS(String namespaceURI, String qualifiedName, String value); /** * Set the node representation of the named attribute from the current node. */ Attr setAttributeNode(Attr newAttr); /** * Set the node representation of the attribute with the specified name and namespace, from the current node. */ Attr setAttributeNodeNS(Attr newAttr); /** * Returns whether or not the element would be selected by the specified selector string. */ boolean webkitMatchesSelector(String selectors); /** * Asynchronously asks the browser to make the element full-screen. */ void webkitRequestFullScreen(int flags); void webkitRequestFullscreen(); /** * Simulates a click on the current element. */ void click(); Element insertAdjacentElement(String where, Element element); /** * Parses the text as HTML or XML and inserts the resulting nodes into the tree in the position given. */ void insertAdjacentHTML(String where, String html); void insertAdjacentText(String where, String text); boolean hasClassName(String className); void addClassName(String className); void removeClassName(String className); void replaceClassName(String oldClassName, String newClassName); JsElement getFirstChildElement(); JsElement getNextSiblingElement(); void removeFromParent(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/collide/client/util/BrowserUtils.java
shared/src/main/java/collide/client/util/BrowserUtils.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 collide.client.util; import com.google.collide.shared.util.StringUtils; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.Window; /** * Utility methods relating to the browser. */ public abstract class BrowserUtils { private static final BrowserUtils INSTANCE = GWT.create(BrowserUtils.class); abstract boolean isFFox(); static class Chrome extends BrowserUtils { Chrome() { } @Override boolean isFFox() { return false; } } static class Firefox extends BrowserUtils { Firefox() { } @Override boolean isFFox() { return true; } } public static boolean isFirefox() { return INSTANCE.isFFox(); } public static boolean isChromeOs() { return Window.Navigator.getUserAgent().contains(" CrOS "); } public static boolean hasUrlParameter(String parameter) { return Window.Location.getParameter(parameter) != null; } public static boolean hasUrlParameter(String parameter, String value) { return StringUtils.equalNonEmptyStrings(Window.Location.getParameter(parameter), value); } private BrowserUtils() { } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/collide/client/util/CssUtils.java
shared/src/main/java/collide/client/util/CssUtils.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 collide.client.util; import elemental.css.CSSStyleDeclaration; import elemental.dom.Element; import com.google.gwt.dom.client.Style.Unit; /** * Utility methods for dealing with CSS. * */ public class CssUtils { public static boolean containsClassName( com.google.gwt.dom.client.Element element, String className) { return (" " + element.getClassName() + " ").contains(" " + className + " "); } /** * Walks the DOM ancestry to find a node with the specified className. * * @return the element with the specified className, or {@code null} if none * is found. */ public static Element getAncestorOrSelfWithClassName(Element element, String className) { while (element != null && !containsClassName(element, className)) { element = element.getParentElement(); } return element; } public static final void addClassName(Element e, String className) { assert (className != null) : "Unexpectedly null class name"; className = className.trim(); assert (className.length() != 0) : "Unexpectedly empty class name"; // Get the current style string. String oldClassName = e.getClassName(); int idx = oldClassName.indexOf(className); // Calculate matching index. while (idx != -1) { if (idx == 0 || oldClassName.charAt(idx - 1) == ' ') { int last = idx + className.length(); int lastPos = oldClassName.length(); if ((last == lastPos) || ((last < lastPos) && (oldClassName.charAt(last) == ' '))) { break; } } idx = oldClassName.indexOf(className, idx + 1); } // Only add the style if it's not already present. if (idx == -1) { if (oldClassName.length() > 0) { oldClassName += " "; } e.setClassName(oldClassName + className); } } public static void removeClassName(Element e, String className) { assert (className != null) : "Unexpectedly null class name"; className = className.trim(); assert (className.length() != 0) : "Unexpectedly empty class name"; // Get the current style string. String oldStyle = e.getClassName(); int idx = oldStyle.indexOf(className); // Calculate matching index. while (idx != -1) { if (idx == 0 || oldStyle.charAt(idx - 1) == ' ') { int last = idx + className.length(); int lastPos = oldStyle.length(); if ((last == lastPos) || ((last < lastPos) && (oldStyle.charAt(last) == ' '))) { break; } } idx = oldStyle.indexOf(className, idx + 1); } // Don't try to remove the style if it's not there. if (idx != -1) { // Get the leading and trailing parts, without the removed name. String begin = oldStyle.substring(0, idx).trim(); String end = oldStyle.substring(idx + className.length()).trim(); // Some contortions to make sure we don't leave extra spaces. String newClassName; if (begin.length() == 0) { newClassName = end; } else if (end.length() == 0) { newClassName = begin; } else { newClassName = begin + " " + end; } e.setClassName(newClassName); } } public static void replaceClassName(Element e, String oldClassName, String newClassName) { removeClassName(e, oldClassName); addClassName(e, newClassName); } public static boolean containsClassName(Element e, String className) { assert className != null : "Unexpected null class name"; String currentClassName = e.getClassName(); return (currentClassName != null) && (currentClassName.equals(className) || currentClassName.startsWith(className + " ") || currentClassName.endsWith(" " + className) || currentClassName.indexOf(" " + className + " ") != -1); } public static void setClassNameEnabled(Element element, String className, boolean enable) { if (enable) { addClassName(element, className); } else { removeClassName(element, className); } } /** * Test if the element his its {@code display} set to something other than * {@code none}. */ public static boolean isVisible(Element element) { return !element.getStyle().getDisplay().equals(CSSStyleDeclaration.Display.NONE); } /** * Parses the pixels from a value string in pixels, or returns 0 for an empty * value. */ public static int parsePixels(String value) { assert value.length() == 0 || isPixels(value); return value.length() == 0 ? 0 : Integer.parseInt( value.substring(0, value.length() - CSSStyleDeclaration.Unit.PX.length())); } /* * TODO: in a separate CL, move all clients of this one over to * the second version of this method (have to make sure they adhere by the new * contract -- to much work for this CL) */ /** * Sets the visibility of an element via the {@code display} CSS property. When visible, the * {@code display} will be set to {@code block}. */ @Deprecated public static void setDisplayVisibility(Element element, boolean visible) { if (visible) { element.getStyle().setDisplay(CSSStyleDeclaration.Display.BLOCK); } else { element.getStyle().setDisplay(CSSStyleDeclaration.Display.NONE); } } /** * Sets the visibility of an element via the {@code display} CSS property. * * @param defaultVisible if true, the element is visible by default (according to its classes) * @param displayVisibleValue if {@code defaultVisible} is false, this must be given. This is the * preferred 'display' value to make it visible */ public static void setDisplayVisibility2(Element element, boolean visible, boolean defaultVisible, String displayVisibleValue) { if (visible) { if (defaultVisible) { element.getStyle().removeProperty("display"); } else { element.getStyle().setDisplay(displayVisibleValue); } } else { if (defaultVisible) { element.getStyle().setDisplay(CSSStyleDeclaration.Display.NONE); } else { element.getStyle().removeProperty("display"); } } } /** * Sets the visibility of an element via the {@code display} CSS property. * This should not be used if the default CSS keeps the element 'display: none'. * * When hidden, the display property on the element style will be set to none, * when visible the display property will be removed. */ public static void setDisplayVisibility2(Element element, boolean visible) { setDisplayVisibility2(element, visible, true, null); } public static void setBoxShadow(Element element, String value) { element.getStyle().setProperty("-moz-box-shadow", value); element.getStyle().setProperty("-webkit-box-shadow", value); element.getStyle().setProperty("box-shadow", value); } public static void removeBoxShadow(Element element) { element.getStyle().removeProperty("-moz-box-shadow"); element.getStyle().removeProperty("-webkit-box-shadow"); element.getStyle().removeProperty("box-shadow"); } public static void setUserSelect(Element element, boolean selectable) { String value = selectable ? "text" : "none"; element.getStyle().setProperty("user-select", value); element.getStyle().setProperty("-moz-user-select", value); element.getStyle().setProperty("-webkit-user-select", value); } public static boolean isPixels(String value) { return value.toLowerCase().endsWith(CSSStyleDeclaration.Unit.PX); } public static native CSSStyleDeclaration getComputedStyle(Element element) /*-{ return window.getComputedStyle(element); }-*/; /** * Sets a CSS property on an element as the new value, returning the * previously set value. */ public static String setAndSaveProperty(Element element, String propertyName, String value) { String savedValue = element.getStyle().getPropertyValue(propertyName); element.getStyle().setProperty(propertyName, value); return savedValue; } public static void setTop(Element element, int value, Unit unit) { String topValue = Integer.toString(value) + unit; element.getStyle().setTop(topValue); } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/collide/client/util/Elements.java
shared/src/main/java/collide/client/util/Elements.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 collide.client.util; import com.google.collide.json.shared.JsonArray; import com.google.collide.shared.util.StringUtils; import elemental.client.Browser; import elemental.dom.Document; import elemental.dom.Element; import elemental.dom.Text; import elemental.html.*; import elemental.js.dom.JsElement; import elemental.ranges.Range; import com.google.gwt.regexp.shared.MatchResult; import com.google.gwt.regexp.shared.RegExp; import com.google.gwt.user.client.DOM; /** * Simple utility class for shortening frequent calls to Elemental libraries. * */ public class Elements { /** * A regular expression used by the {@link #markup(Element, String, String)} function to search * for http links and new lines. */ private static final RegExp REGEXP_MARKUP = RegExp.compile("(?:(?:(?:https?://)|(?:www\\.))[^\\s]+)|[\n]", "ig"); @SuppressWarnings("unchecked") public static <T extends com.google.gwt.dom.client.Element, R extends Element> R asJsElement( T element) { return (R) element.<JsElement>cast(); } public static AnchorElement createAnchorElement(String... classNames) { AnchorElement elem = getDocument().createAnchorElement(); addClassesToElement(elem, classNames); return elem; } public static ButtonElement createButtonElement(String... classNames) { ButtonElement elem = getDocument().createButtonElement(); addClassesToElement(elem, classNames); return elem; } public static BRElement createBRElement(String... classNames) { BRElement elem = getDocument().createBRElement(); addClassesToElement(elem, classNames); return elem; } public static CanvasElement createCanvas(String... classNames) { CanvasElement elem = getDocument().createCanvasElement(); addClassesToElement(elem, classNames); return elem; } public static DivElement createDivElement(String... classNames) { DivElement elem = getDocument().createDivElement(); addClassesToElement(elem, classNames); return elem; } public static Element createElement(String tagName, String... classNames) { Element elem = getDocument().createElement(tagName); addClassesToElement(elem, classNames); return elem; } public static FormElement createFormElement(String... classNames) { FormElement elem = getDocument().createFormElement(); addClassesToElement(elem, classNames); return elem; } public static TableElement createTableElement(String... classNames) { TableElement elem = getDocument().createTableElement(); addClassesToElement(elem, classNames); return elem; } public static TableRowElement createTRElement(String... classNames) { TableRowElement elem = getDocument().createTableRowElement(); addClassesToElement(elem, classNames); return elem; } public static TableCellElement createTDElement(String... classNames) { TableCellElement elem = getDocument().createTableCellElement(); addClassesToElement(elem, classNames); return elem; } public static InputElement createInputElement(String... classNames) { InputElement elem = getDocument().createInputElement(); addClassesToElement(elem, classNames); return elem; } public static InputElement createInputTextElement(String... classNames) { InputElement elem = getDocument().createInputElement(); addClassesToElement(elem, classNames); elem.setType("text"); return elem; } public static IFrameElement createIFrameElement(String... classNames) { IFrameElement elem = getDocument().createIFrameElement(); addClassesToElement(elem, classNames); return elem; } public static ImageElement createImageElement(String... classNames) { ImageElement elem = getDocument().createImageElement(); addClassesToElement(elem, classNames); return elem; } public static SpanElement createSpanElement(String... classNames) { SpanElement elem = getDocument().createSpanElement(); addClassesToElement(elem, classNames); return elem; } public static TextAreaElement createTextAreaElement(String... classNames) { TextAreaElement elem = getDocument().createTextAreaElement(); addClassesToElement(elem, classNames); return elem; } public static ParagraphElement createParagraphElement(String... classNames) { ParagraphElement elem = getDocument().createParagraphElement(); addClassesToElement(elem, classNames); return elem; } public static PreElement createPreElement(String... classNames) { PreElement elem = getDocument().createPreElement(); addClassesToElement(elem, classNames); return elem; } public static LIElement createLiElement(String... classNames) { LIElement elem = getDocument().createLIElement(); addClassesToElement(elem, classNames); return elem; } public static UListElement createUListElement(String... classNames) { UListElement elem = getDocument().createUListElement(); addClassesToElement(elem, classNames); return elem; } public static Text createTextNode(String data) { return getDocument().createTextNode(data); } public static Element getActiveElement() { return getDocument().getActiveElement(); } public static Document getDocument() { return Browser.getDocument(); } public static Window getWindow() { return Browser.getWindow(); } public static BodyElement getBody() { return getBody(getDocument()); } public static BodyElement getBody(Document document) { return (BodyElement)document.getBody(); } public static HeadElement getHead() { return getHead(getDocument()); } public static HeadElement getHead(Document document) { HeadElement result = document.getHead(); if (result == null) { // Some versions of Firefox return undefined for the document.head. result = (HeadElement) document.getElementsByTagName("head").item(0); } return result; } public static Element getElementById(String id) { return getDocument().getElementById(id); } public static void injectJs(String js) { Element scriptElem = createElement("script"); scriptElem.setAttribute("language", "javascript"); scriptElem.setTextContent(js); getBody().appendChild(scriptElem); } /** * Replaces the contents of an Element with the specified ID, with a single * element. * * @param id The ID of the Element that we will erase the contents of. * @param with The element that we will attach to the element that we just * erased the contents of. */ public static void replaceContents(String id, Element with) { Element parent = getElementById(id); replaceContents(parent, with); } /** * Replaces the contents of a container with the given contents. */ public static void replaceContents(Element container, Element contents) { container.setInnerHTML(""); container.appendChild(contents); } public static void setCollideTitle(String subtitle) { if (StringUtils.isNullOrEmpty(subtitle)) { getDocument().setTitle("Collide"); } else { getDocument().setTitle(subtitle + " - Collide"); } } /** * Scans a string converting any recognizable html links into an anchor tag and replacing newlines * with a &lt;br/&gt;. Once built the result is appended to the provided element. */ // TODO: Long term we need a markdown engine :) public static void markup(Element e, String text, String linkCssClass) { e.setInnerHTML(""); JsonArray<String> paragraphs = StringUtils.split(text, "\n\n"); for (int i = 0; i < paragraphs.size(); i++) { markupParagraph(e, paragraphs.get(i), linkCssClass); } } /** * Creates a paragraph tag and fills it with spans and anchor tags internally. */ private static void markupParagraph(Element parent, String text, String linkCssClass) { if (StringUtils.isNullOrWhitespace(text)) { // don't add any dom here return; } ParagraphElement myParagraph = createParagraphElement(); int index = 0; REGEXP_MARKUP.setLastIndex(0); SpanElement current = createSpanElement(); for (MatchResult match = REGEXP_MARKUP.exec(text); match != null; match = REGEXP_MARKUP.exec(text)) { current.setTextContent(text.substring(index, match.getIndex())); myParagraph.appendChild(current); current = createSpanElement(); /* * If our match is a \n we need to create a <br/> element to force a line break, otherwise we * matched an http/www link so let's make an anchor tag out of it. */ if (match.getGroup(0).equals("\n")) { myParagraph.appendChild(createBRElement()); } else { AnchorElement anchor = createAnchorElement(linkCssClass); anchor.setHref(match.getGroup(0)); anchor.setTarget("_blank"); anchor.setTextContent(match.getGroup(0)); myParagraph.appendChild(anchor); } index = match.getIndex() + match.getGroup(0).length(); } current.setTextContent(text.substring(index)); myParagraph.appendChild(current); parent.appendChild(myParagraph); } /** * Selects all text in the specified element. */ public static void selectAllText(Element e) { Range range = Browser.getDocument().createRange(); range.selectNode(e); Browser.getWindow().getSelection().addRange(range); } public static void addClassesToElement(Element e, String... classNames) { for (String className : classNames) { if (!StringUtils.isNullOrEmpty(className)) { CssUtils.addClassName(e, className); } } } private Elements() { } // COV_NF_LINE public static String getOrSetId(Element e) { String id = e.getId(); if (id.length() == 0) { id = DOM.createUniqueId(); e.setId(id); } return id; } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/collide/shared/manifest/YamlLineEater.java
shared/src/main/java/collide/shared/manifest/YamlLineEater.java
package collide.shared.manifest; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; public class YamlLineEater extends AbstractLineEater { private Map<String, Object> valueMap = new LinkedHashMap<String, Object>(); private List<Object> valueArray = new ArrayList<Object>(); boolean inArray; LineEater eater; String indent = ""; public YamlLineEater() { this(null); } public YamlLineEater(Stack parent) { super(parent); } @Override protected String isStartLine(String line) { if (inArray) { return null; } return line.endsWith(":") ? line.replaceAll(":$", "") : null; } @Override protected String isEndLine(String line) { if (inArray) { line = line.trim(); if (line.startsWith("-")) { return null; } return line; } return super.isEndLine(line); } @Override protected boolean addValue(String line) { int ind = line.indexOf(':'); if (ind == -1) { line = line.trim(); ind = line.indexOf('-'); if (ind == 0) { inArray = true; line = line.substring(ind+1).trim(); valueArray.add(line); return true; } else { inArray = false; } } else { inArray = false; String key = line.substring(0, ind).trim(); if (key.startsWith("-")) { key = key.substring(1).trim(); } String value = line.substring(ind+1).trim(); valueMap.put(key, value); return true; } return super.addValue(line); } @Override protected LineEater newChildEater(Stack stack, String name) { if (inArray) { tail = tail.parent; inArray = false; } YamlLineEater eater = new YamlLineEater(stack); eater.indent = indent + " "; valueMap.put(name.trim(), eater); return eater; } @Override public String toString() { StringBuilder b = new StringBuilder(); if (valueArray.size() > 0){ String startLine = indent;//+" "; for (Object o : valueArray) { b .append(startLine) .append("- ") .append(o); startLine = "\n"+indent;//+" "; } b.append("\n"); } if (valueMap.size() > 0) { for (String key : valueMap.keySet()) { b.append(indent); Object value = valueMap.get(key); if (value instanceof String) { b .append(key) .append(": ") .append(value) .append("\n"); } else { b .append(key) .append(":\n") .append(value); } } } return b.toString(); } public void eatAll(String string) { for (String line : string.split("\n")) { eat(line); } } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/collide/shared/manifest/LineEater.java
shared/src/main/java/collide/shared/manifest/LineEater.java
package collide.shared.manifest; public interface LineEater { boolean eat(String line); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/collide/shared/manifest/CollideManifest.java
shared/src/main/java/collide/shared/manifest/CollideManifest.java
package collide.shared.manifest; import static xapi.util.X_String.join; import xapi.gwtc.api.GwtManifest; import xapi.log.X_Log; import elemental.util.ArrayOf; import elemental.util.ArrayOfString; import elemental.util.Collections; import elemental.util.MapFromStringTo; public class CollideManifest { protected static final char separator = '\t';// use tabs as separator, so spaces can be used within items. protected static final String gwtEntry = "gwt"+separator; protected static final String gwtc = "gwtc\n"; public static class GwtEntry { public final String[] modules; public final String[] sources; public final String[] dependencies; public GwtEntry(String modules, String sourcepath, String classpath, String extra) { this.modules = modules.split("\\s+"); sources = sourcepath.split(";");// We use ; for path, so : can be used for maven artifacts dependencies = classpath.split(";"); } @Override public String toString() { return gwtEntry+join(" ", modules)+separator+join(";", sources)+separator+join(";", dependencies); } } ArrayOf<GwtEntry> gwtEntries = Collections.arrayOf(); MapFromStringTo<GwtManifest> gwtcEntries = Collections.mapFromStringTo(); public CollideManifest(String raw) { parse(raw); } protected void parse(String raw) { if (raw.length()==0)return; for (String cmd : raw.split("\n")) { addEntry(cmd); } } public void addEntry(String cmd) { cmd = cmd.replaceAll("\\s*$", ""); if (cmd.startsWith(gwtEntry)) { parseGwtEntry(cmd.substring(gwtEntry.length())); } } public void addGwtEntry(GwtEntry cmd) { for (int i = gwtEntries.length();i --> 0;){ if (equal(gwtEntries.get(i).modules, cmd.modules)) { gwtEntries.removeByIndex(i); break; } } gwtEntries.push(cmd); } private boolean equal(String[] arr1, String[] arr2) { int i = arr1.length; if (i != arr2.length) return false; for (;i-->0;) if (!arr1[i].equals(arr2[i])) return false; return true; } protected void parseGwtEntry(String entry) { int from = entry.indexOf(separator); if (from == -1 && bail("gwt-module",entry)) return; String modules = entry.substring(0, from); int to = entry.indexOf(separator, ++from); if (to == -1 && bail("gwt-sourcepath",entry)) return; String sourcepath = entry.substring(from, to); from = to+1; // keep the syntax sane to = entry.indexOf(separator, from); String classpath; String extra = ""; if (to == -1) { if (from == entry.length()){ bail("gwt-classpath",entry); return; } classpath = entry.substring(from); } else { classpath = entry.substring(from, to); to = entry.indexOf(separator, to+1); if (to != -1 && to < entry.length()) { extra = entry.substring(to+1); // There's some extra data to append } } addGwtEntry(new GwtEntry(modules, sourcepath, classpath, extra)); } private boolean bail(String type, String entry) { X_Log.error("Invalid " +type+" entry: "+entry); return true; } @Override public String toString() { StringBuilder b = new StringBuilder(); for (int i = 0, m = gwtEntries.length(); i < m; i++) { b.append(gwtEntries.get(i)); } ArrayOfString keys = gwtcEntries.keys(); for (int i = 0, m = keys.length(); i < m; i++) { b.append(gwtcEntries.get(keys.get(i))); } return b.toString(); } public ArrayOf<GwtEntry> getGwtEntries() { return gwtEntries.concat(Collections.<GwtEntry>arrayOf()); } public void addGwtc(GwtManifest gwtc) { gwtcEntries.put(gwtc.getModuleName(), gwtc); } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/collide/shared/manifest/AbstractLineEater.java
shared/src/main/java/collide/shared/manifest/AbstractLineEater.java
package collide.shared.manifest; public class AbstractLineEater implements LineEater { protected static final class Stack { LineEater eater; Stack parent; Stack next, prev; } protected final Stack head; protected Stack tail; protected LineEater eater; public AbstractLineEater() { this(null); } public AbstractLineEater(Stack parent) { tail = head = new Stack(); head.parent = parent; eater = head.eater = newStartSection(head); } private class StartSection implements LineEater { private String name; @Override public boolean eat(String line) { String startName = isStartLine(line); if (startName != null) { name = startName; Stack curTail = tail; assert curTail.next == null; curTail.next = new Stack(); eater = newChildEater(curTail, name); curTail.next.eater = eater; curTail.next.prev = tail; tail = curTail.next; return true; } String endName = isEndLine(line); if (endName != null) { if (head.parent != null) { tail = head.parent; eater = tail.eater; } if ("".equals(endName)) { return true; } return eater.eat(endName); } return addValue(line); } @Override public String toString() { return name+":\n"; } } @Override public final boolean eat(String line) { return eater.eat(line); } protected LineEater newChildEater(Stack tail, String name) { return this; } protected boolean addValue(String line) { return false; } protected String isEndLine(String line) { return line.trim().isEmpty() ? "" : null; } protected String isStartLine(String line) { return line.endsWith(":") ? line.replaceAll(":$", "").trim() : null; } protected LineEater newStartSection() { return new StartSection(); } protected LineEater newChildEater(String name) { return new AbstractLineEater(head); } protected LineEater newStartSection(Stack parent) { return new StartSection(); } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/collide/shared/collect/Collections.java
shared/src/main/java/collide/shared/collect/Collections.java
package collide.shared.collect; import com.google.collide.json.client.JsoArray; import com.google.collide.json.shared.JsonArray; import elemental.js.util.JsArrayOfString; import elemental.util.ArrayOf; import elemental.util.ArrayOfString; import elemental.util.impl.JreArrayOf; import elemental.util.impl.JreArrayOfString; import xapi.collect.X_Collect; import xapi.collect.api.IntTo; import xapi.gwt.collect.IntToListGwt; import xapi.util.X_Debug; import com.google.gwt.reflect.shared.GwtReflect; import java.util.ArrayList; import java.util.List; public class Collections { public static Iterable<String> asIterable(ArrayOfString strings) { return new ArrayOfStringIterable(strings); } public static <T> Iterable<T> asIterable(ArrayOf<T> objects) { return new ArrayOfIterable<T>(objects); } public static List<String> asList(ArrayOfString array) { // Always make a new copy if (array instanceof JreArrayOfString) { try { return asList(GwtReflect.<ArrayOf<String>>fieldGet(JreArrayOfString.class, "array", array)); } catch (Throwable e) { throw X_Debug.rethrow(e); } } else { List<String> ret = new ArrayList<String>(); for (String item : asIterable(array)) { ret.add(item); } return ret; } } public static <T> List<T> asList(ArrayOf<T> array) { List<T> ret = new ArrayList<T>(); if (array instanceof JreArrayOf) { try { ret.addAll(GwtReflect.<List<T>>fieldGet(JreArrayOf.class, "array", array)); } catch (Throwable e) { throw X_Debug.rethrow(e); } } else { for (T item : asIterable(array)) { ret.add(item); } } return ret; } public static IntTo<String> asArray(JsonArray<String> array) { if (array instanceof JsoArray) { return IntToListGwt.createFrom((JsoArray<String>)array); } else { IntTo<String> ret = X_Collect.newList(String.class); for (String value : array.asIterable()) { ret.push(value); } return ret; } } public static ArrayOfString asArray(IntTo<String> array) { if (array instanceof IntToListGwt) { return ((IntToListGwt<String>)array).rawArray().<JsArrayOfString>cast(); } else { ArrayOfString ret = elemental.util.Collections.arrayOfString(); for (String value : array.forEach()) { ret.push(value); } return ret; } } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/collide/shared/collect/ArrayOfStringIterable.java
shared/src/main/java/collide/shared/collect/ArrayOfStringIterable.java
package collide.shared.collect; import elemental.js.util.JsArrayOf; import elemental.js.util.JsArrayOfString; import elemental.util.ArrayOf; import elemental.util.ArrayOfString; import elemental.util.impl.JreArrayOfString; import xapi.log.X_Log; import com.google.gwt.reflect.shared.GwtReflect; import java.util.Iterator; public class ArrayOfStringIterable implements Iterable<String> { ArrayOf<String> array; public ArrayOfStringIterable(ArrayOfString strings) { if (strings == null) { throw new NullPointerException("Strings array cannot be null"); } if (strings instanceof JsArrayOfString) { array = ((JsArrayOfString) strings).<JsArrayOf<String>>cast(); } else { try { array = GwtReflect.fieldGet(JreArrayOfString.class, "array", strings); } catch (Exception e) { X_Log.error("Could not get inner array field of "+strings.getClass(), e); } } } @Override public Iterator<String> iterator() { return new ArrayOfIterator<String>(array); } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/collide/shared/collect/ArrayOfIterator.java
shared/src/main/java/collide/shared/collect/ArrayOfIterator.java
package collide.shared.collect; import java.util.Iterator; import elemental.util.ArrayOf; public class ArrayOfIterator<T> implements Iterator<T> { private final ArrayOf<T> array; private int pos; public ArrayOfIterator(ArrayOf<T> array) { this.array = array; } @Override public boolean hasNext() { return pos < array.length(); } @Override public T next() { assert pos >= 0; assert pos < array.length(); return array.get(pos++); } @Override public void remove() { assert pos > 0; assert pos <= array.length(); array.removeByIndex(--pos); } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/collide/shared/collect/ArrayOfIterable.java
shared/src/main/java/collide/shared/collect/ArrayOfIterable.java
package collide.shared.collect; import java.util.Iterator; import elemental.util.ArrayOf; public class ArrayOfIterable <T> implements Iterable<T> { private final ArrayOf<T> array; public ArrayOfIterable(ArrayOf<T> objects) { array = objects; } @Override public Iterator<T> iterator() { return new ArrayOfIterator<T>(array); } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/GetProjectById.java
shared/src/main/java/com/google/collide/dto/GetProjectById.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dto.WorkspaceInfo.WorkspaceType; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; /** * Request for the a specific project. */ @RoutingType(type = RoutingTypes.GETPROJECTBYID) public interface GetProjectById extends ClientToServerDto { String getProjectId(); WorkspaceType getWorkspaceType(); String getStartKey(); int getPageLength(); boolean getShouldLoadWorkspaces(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/RecoverFromMissedDocOpsResponse.java
shared/src/main/java/com/google/collide/dto/RecoverFromMissedDocOpsResponse.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; import com.google.collide.json.shared.JsonArray; /** * Provides the list of doc ops that have been applied on the server since some * revision. * */ @RoutingType(type = RoutingTypes.RECOVERFROMMISSEDDOCOPSRESPONSE) public interface RecoverFromMissedDocOpsResponse extends ServerToClientDto { String getWorkspaceId(); /** * The applied doc ops, ordered by revision. * * <p> * The first doc op here will be the client current's revision (as specified * by {@link RecoverFromMissedDocOps#getCurrentCcRevision()}) + 1. */ JsonArray<ServerToClientDocOp> getDocOps(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/SearchResponse.java
shared/src/main/java/com/google/collide/dto/SearchResponse.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; import com.google.collide.json.shared.JsonArray; /** * Response with one page of search results. */ @RoutingType(type = RoutingTypes.SEARCHRESPONSE) public interface SearchResponse extends ServerToClientDto { int getResultCount(); int getPage(); int getPageCount(); JsonArray<SearchResult> getResults(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/SetWorkspaceRole.java
shared/src/main/java/com/google/collide/dto/SetWorkspaceRole.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; /** * Message used to set the workspace role for one user. * */ @RoutingType(type = RoutingTypes.SETWORKSPACEROLE) public interface SetWorkspaceRole extends ClientToServerDto { String getProjectId(); String getWorkspaceId(); /** * Returns the user ID whose role is to be updated. */ String getUserId(); ChangeRoleInfo getChangeRoleInfo(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/GetProjectMembers.java
shared/src/main/java/com/google/collide/dto/GetProjectMembers.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; /** * Request the list of project members and pending project members. * */ @RoutingType(type = RoutingTypes.GETPROJECTMEMBERS) public interface GetProjectMembers extends ClientToServerDto { String getProjectId(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/FileContents.java
shared/src/main/java/com/google/collide/dto/FileContents.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dto.NodeConflictDto.ConflictHandle; import com.google.collide.json.shared.JsonArray; /** * DTO sent from the server to the client containing the contents of a File in * response to a {@link GetFileContents} message sent on the browser channel. */ public interface FileContents { public enum ContentType { TEXT, IMAGE, UNKNOWN_BINARY } /** * @return the (concurrency control) revision of the document */ int getCcRevision(); /** * The contents of the file encoded as a String. * * If the ContentType is IMAGE, then this will be a Base64 encoded version of * the file. * * If the ContentType is UNKNOWN_BINARY then this is null since we cannot do * anything useful yet with those bits. Consumers on the client can follow up * with a request in an iFrame or a tab or something. For now we don't handle * this in the Branch UI. */ String getContents(); ContentType getContentType(); /** * @return the mimeType that the server would have served this file up as if * it were fetched normally. */ String getMimeType(); /** * The key used for uniquely identifying this file's edit session. * * This is set only if the file is UTF-8 text. */ String getFileEditSessionKey(); /** * @return the file path for the file we are retrieving the contents for. */ String getPath(); /** * @return the set of conflict chunks resulting from a merge. */ JsonArray<ConflictChunk> getConflicts(); /** An opaque handle to an associate out of date conflict on this file. */ ConflictHandle getConflictHandle(); /** * The list of serialized DocumentSelection DTO selections for collaborators * in this file. */ JsonArray<String> getSelections(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/GwtRecompile.java
shared/src/main/java/com/google/collide/dto/GwtRecompile.java
package com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; import com.google.collide.json.shared.JsonArray; @RoutingType(type = RoutingTypes.GWTRECOMPILE) public interface GwtRecompile extends CodeModule, ClientToServerDto, ServerToClientDto{ JsonArray<GwtPermutation> getPermutations(); boolean getAutoOpen(); int getPort(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/GetSyncStateResponse.java
shared/src/main/java/com/google/collide/dto/GetSyncStateResponse.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; /** * Request the current sync state of a workspace. * */ @RoutingType(type = RoutingTypes.GETSYNCSTATERESPONSE) public interface GetSyncStateResponse extends ServerToClientDto { /** * The states that the syncing process can be in. Default is SHOULD_SYNC, * which is before the user selects to sync from parent. */ public enum SyncState { /** * We have no changes, and there is nothing to pull in from the parent. */ NOTHING_TO_SUBMIT, /** * There are changes available in the parent to be pulled in. Those changes * don't conflict with anything in our workspace. */ SHOULD_SYNC, // TODO: SHOULD_SYNC_HAS_CONFLICTS is unused until we have // the FE notifications of changes in parent. /** * There are changes available in the parent to be pulled in. Those changes * have one or more conflicts with changes in our workspace. */ SHOULD_SYNC_HAS_CONFLICTS, /** * We have synced, but there were conflicts. We are in the process of * resolving them. */ RESOLVING_CONFLICTS, /** * We have all the parents changes (synced to parent's tip), and have * changes to submit. */ READY_TO_SUBMIT; } SyncState getSyncState(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/HasModule.java
shared/src/main/java/com/google/collide/dto/HasModule.java
package com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; @RoutingType(type=RoutingTypes.HASMODULE) public interface HasModule extends ServerToClientDto, ClientToServerDto { String getModule(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/ChangeRoleInfo.java
shared/src/main/java/com/google/collide/dto/ChangeRoleInfo.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; /** * Information about a changed user role. Not a top level message, but a type * that is contained in some other messages. */ @RoutingType(type = RoutingTypes.CHANGEROLEINFO) public interface ChangeRoleInfo extends ClientToServerDto { /** * Returns the desired role for the users. */ Role getRole(); /** * Returns true if an email should be sent to all users. */ boolean emailUsers(); /** * Returns true if an email should be sent to the current user. */ boolean emailSelf(); /** * Returns an option private message to include in the email. */ String getEmailMessage(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/CodeReferences.java
shared/src/main/java/com/google/collide/dto/CodeReferences.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.json.shared.JsonArray; /** * Collection of references for a single file. * */ public interface CodeReferences { JsonArray<CodeReference> getReferences(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/CodeError.java
shared/src/main/java/com/google/collide/dto/CodeError.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; /** * Information about one coding error (syntax, bad reference, etc.). * */ public interface CodeError { /** * @return compiler message for this error */ String getMessage(); /** * @return file position where this error starts */ FilePosition getErrorStart(); /** * @return file position where this error ends (inclusive) */ FilePosition getErrorEnd(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/CodeModule.java
shared/src/main/java/com/google/collide/dto/CodeModule.java
package com.google.collide.dto; import xapi.gwtc.api.ObfuscationLevel; import xapi.gwtc.api.OpenAction; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; import com.google.collide.json.shared.JsonArray; import com.google.gwt.core.ext.TreeLogger; @RoutingType(type=RoutingTypes.CODEMODULE) public interface CodeModule extends HasModule, ClientToServerDto, ServerToClientDto { String getMessageKey(); String getManifestFile(); JsonArray<String> getExtraArgs(); boolean isRecompile(); TreeLogger.Type getLogLevel(); JsonArray<String> getSources(); JsonArray<String> getDependencies(); ObfuscationLevel getObfuscationLevel(); OpenAction getOpenAction(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/RefreshWorkspace.java
shared/src/main/java/com/google/collide/dto/RefreshWorkspace.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; /** * Notification to the client that it needs to refresh part of its workspace. * This might be needed, for example, if the workspace was involved in a merge. */ @RoutingType(type = RoutingTypes.REFRESHWORKSPACE) public interface RefreshWorkspace extends ServerToClientDto { String getWorkspaceId(); /** * Directory that needs to be refreshed. "/" is sent if the whole workspace * needs to be refreshed. */ String getBasePath(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/GetOwningProject.java
shared/src/main/java/com/google/collide/dto/GetOwningProject.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; /** * Request for getting the owning Project for a given Workspace ID. This should only be used for * debuggin/analysis purposes when you need to get a workspace and don't have the project ID. */ @RoutingType(type = RoutingTypes.GETOWNINGPROJECT) public interface GetOwningProject extends ClientToServerDto { String getWorkspaceId(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/UpdateWorkspace.java
shared/src/main/java/com/google/collide/dto/UpdateWorkspace.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; /** * Request to update the workspace description and title. * */ @RoutingType(type = RoutingTypes.UPDATEWORKSPACE) public interface UpdateWorkspace extends ClientToServerDto { String getProjectId(); String getWorkspaceId(); /** a {@link WorkspaceInfo} with just the field we want to change */ WorkspaceInfo getWorkspaceUpdates(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/WorkspaceTreeUpdate.java
shared/src/main/java/com/google/collide/dto/WorkspaceTreeUpdate.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.json.shared.JsonArray; /** * A list of mutations to the workspace tree to perform.These get sent to the FE, applied to the * file tree, and then broadcast to other active clients in the workspace. * * A rename is just a type of MOVE operation. */ @RoutingType(type = RoutingTypes.WORKSPACETREEUPDATE) public interface WorkspaceTreeUpdate extends ClientToServerDto { /** * The active client ID of the author of the mutation. */ String getAuthorClientId(); /** * The mutations */ JsonArray<Mutation> getMutations(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/TreeNodeInfo.java
shared/src/main/java/com/google/collide/dto/TreeNodeInfo.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; /** * Basic information common to files and directories. */ public interface TreeNodeInfo { public static final int DIR_TYPE = 0; public static final int FILE_TYPE = 1; String getName(); int getNodeType(); String getFileEditSessionKey(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/ConflictChunkResolved.java
shared/src/main/java/com/google/collide/dto/ConflictChunkResolved.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dto.NodeConflictDto.ConflictHandle; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; /** * Message sent to clients to indicate a change in the resolution status of a * conflict chunk in a text file. * */ @RoutingType(type = RoutingTypes.CONFLICTCHUNKRESOLVED) public interface ConflictChunkResolved extends ServerToClientDto { String getFileEditSessionKey(); /** * Array index of the conflict chunk within the file. */ int getConflictChunkIndex(); /** * Whether the conflict chunk is now resolved. */ boolean isResolved(); /** An opaque handle identifying an out of date conflict */ ConflictHandle getConflictHandle(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/Participant.java
shared/src/main/java/com/google/collide/dto/Participant.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; /** * Represents a participant in a Workspace session. * * <p> * The participant does not include any private information about the user, just * the user's ID. Each client must request the participants UserInfo separately * so the frontend can customize the results based on the participants privacy * settings. */ // TODO: Rename to ParticipantInfo to be consistent with WorkspaceInfo/ProjectInfo. public interface Participant { /** * Returns a unique ID for the user. */ String getUserId(); /** * @return the active client ID for this participant */ String getId(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/DiffChunkResponse.java
shared/src/main/java/com/google/collide/dto/DiffChunkResponse.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; /** * DTO to capture a diff chunk, which may span an entire line or part of it. * */ public interface DiffChunkResponse { public enum DiffType { /** * An unchanged chunk. */ UNCHANGED, /** * A modified chunk. */ CHANGED, /** * An added chunk. */ ADDED, /** * A removed chunk. */ REMOVED, /** * The unchanged part of a line that has a <code>CHANGED</code> portion. */ CHANGED_LINE, /** * The unchanged part of a line that has a <code>ADDED</code> portion. */ ADDED_LINE, /** * The unchanged part of a line that has a <code>REMOVED</code> portion. */ REMOVED_LINE; } String getAfterData(); String getBeforeData(); DiffType getDiffType(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/UpdateProject.java
shared/src/main/java/com/google/collide/dto/UpdateProject.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; /** * Request to update the project summary and name. * */ @RoutingType(type = RoutingTypes.UPDATEPROJECT) public interface UpdateProject extends ClientToServerDto { String getProjectId(); String getSummary(); String getName(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/CubePing.java
shared/src/main/java/com/google/collide/dto/CubePing.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; /** * Represents notification from Cube service to client. * The contents of this DTO may change in the future. * */ @RoutingType(type = RoutingTypes.CUBEPING) public interface CubePing extends ServerToClientDto { /** * @return The new freshness of full graph that was built on Cube recently, a string * representation of java long */ String getFullGraphFreshness(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/RunTarget.java
shared/src/main/java/com/google/collide/dto/RunTarget.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; /** * * A RunTarget describes a run target in Collide, eg * running the currently open file, or always run a URL. * */ public interface RunTarget { public enum RunMode { PREVIEW_CURRENT_FILE, ALWAYS_RUN, GWT_COMPILE, MAVEN_BUILD, ANT_BUILD } String getRunMode(); String getAlwaysRunFilename(); String getAlwaysRunUrlOrQuery(); String getGwtModule(); String getAntTarget(); String getMavenGoal(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/UndoLastSync.java
shared/src/main/java/com/google/collide/dto/UndoLastSync.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; /** * Reset the head of the workspace to point at the root prior to the most recent * sync. This operation will only succeed if the workspace is currently in * conflict. * */ @RoutingType(type = RoutingTypes.UNDOLASTSYNC) public interface UndoLastSync extends ClientToServerDto { String getWorkspaceId(); String getClientId(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/AddWorkspaceMembers.java
shared/src/main/java/com/google/collide/dto/AddWorkspaceMembers.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; /** * Message used to add members to a workspace. * */ @RoutingType(type = RoutingTypes.ADDWORKSPACEMEMBERS) public interface AddWorkspaceMembers extends ClientToServerDto { String getProjectId(); String getWorkspaceId(); /** * Returns a comma or newline delimited string of user email addresses. */ String getUserEmails(); ChangeRoleInfo getChangeRoleInfo(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/EmptyMessage.java
shared/src/main/java/com/google/collide/dto/EmptyMessage.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; @RoutingType(type = RoutingTypes.EMPTYMESSAGE) public interface EmptyMessage extends ServerToClientDto, ClientToServerDto { }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/DocOp.java
shared/src/main/java/com/google/collide/dto/DocOp.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.json.shared.JsonArray; // TODO: These should be moved to an Editor2-specific package /** * Models a document operation for the Collide code editor. * * A DocOp is a description for an operation to be performed on the document. It * consists of one or more components that together must span the entire length * of the document. * * For example, consider the following DocOp which spans the document with three * lines: {(RetainLine:1), (Insert:"Hello"), (Retain:5, true), (RetainLine:1)}. * It retains the first line, inserts "Hello" at the beginning of the second * line, retains the remaining 5 characters on that second line (including the * newline), and then retains the last line. * */ public interface DocOp { JsonArray<DocOpComponent> getComponents(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/GetDeployInformationResponse.java
shared/src/main/java/com/google/collide/dto/GetDeployInformationResponse.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; import com.google.collide.json.shared.JsonArray; /** * Response containing information for deploying a workspace (the app.yamls, app * ids, version ids, etc). This is done on the server side because the deploy * button is on the project landing page, where we can't get app.yamls from * workspaces easily. * */ @RoutingType(type = RoutingTypes.GETDEPLOYINFORMATIONRESPONSE) public interface GetDeployInformationResponse extends ServerToClientDto { public interface DeployInformation { // the path of the app.yaml file that this information came from. String getAppYamlPath(); // The app id from the app.yaml String getAppId(); // The app version from the app.yaml String getVersion(); } // An array of all the app.yaml's and their information // in the workspace. JsonArray<DeployInformation> getDeployInformation(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/GetWorkspaceParticipants.java
shared/src/main/java/com/google/collide/dto/GetWorkspaceParticipants.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.json.shared.JsonArray; /** * Request the current participants of a workspace. */ @RoutingType(type = RoutingTypes.GETWORKSPACEPARTICIPANTS) public interface GetWorkspaceParticipants extends ClientToServerDto { String getWorkspaceId(); /** * An array of participant IDs to request. The client only requests * participant info for participants that it has not seen. * * <p> * If the list of participants is null or not set, all participants are * requested. */ JsonArray<String> getParticipantIds(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/CreateProjectResponse.java
shared/src/main/java/com/google/collide/dto/CreateProjectResponse.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; /** */ @RoutingType(type = RoutingTypes.CREATEPROJECTRESPONSE) public interface CreateProjectResponse extends ServerToClientDto { ProjectInfo getProject(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/EnterWorkspaceResponse.java
shared/src/main/java/com/google/collide/dto/EnterWorkspaceResponse.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dto.GetSyncStateResponse.SyncState; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; import com.google.collide.json.shared.JsonArray; /** * Response to a client's request to enter a workspace. * */ @RoutingType(type = RoutingTypes.ENTERWORKSPACERESPONSE) public interface EnterWorkspaceResponse extends ServerToClientDto { boolean isReadOnly(); /** * @return the file tree */ GetDirectoryResponse getFileTree(); /** * @return the current workspace participants, including this user */ JsonArray<ParticipantUserDetails> getParticipants(); /** * @return the version of the participants returned by {@link #getParticipants()} */ String getParticipantsNextVersion(); /** * @return the sync state of the workspace */ SyncState getSyncState(); /** * @return the current user-specific workspace settings. */ GetWorkspaceMetaDataResponse getUserWorkspaceMetadata(); /** * @return the keep-alive timer's interval in ms. */ int getKeepAliveTimerIntervalMs(); /** * @return the workspaceId of this response */ String getWorkspaceId(); /** * @return retrieves the workspace info for this workspace */ WorkspaceInfo getWorkspaceInfo(); String getWorkspaceSessionHost(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/GetFileContents.java
shared/src/main/java/com/google/collide/dto/GetFileContents.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; /** * Request from client to server to request that the contents of a file be sent * over the browser channel. */ @RoutingType(type = RoutingTypes.GETFILECONTENTS) public interface GetFileContents extends ClientToServerDto { String getWorkspaceId(); // TODO: Make this a resource ID/EditSessionKey. String getPath(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/StackTraceElementDto.java
shared/src/main/java/com/google/collide/dto/StackTraceElementDto.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; /** * A single frame of a stack trace for a serialized exception. * */ @RoutingType(type = RoutingTypes.STACKTRACEELEMENTDTO) public interface StackTraceElementDto extends ClientToServerDto { String getClassName(); String getFileName(); String getMethodName(); int getLineNumber(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/GetWorkspaceMembersResponse.java
shared/src/main/java/com/google/collide/dto/GetWorkspaceMembersResponse.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; import com.google.collide.json.shared.JsonArray; /** * Response for requesting workspace members. */ @RoutingType(type = RoutingTypes.GETWORKSPACEMEMBERSRESPONSE) public interface GetWorkspaceMembersResponse extends ServerToClientDto { /** * Returns the list of current workspace members. This should always be * non-null. */ JsonArray<UserDetailsWithRole> getMembers(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/GetFileRevisionsResponse.java
shared/src/main/java/com/google/collide/dto/GetFileRevisionsResponse.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; import com.google.collide.json.shared.JsonArray; /** * List of revisions (plus revision information) for a file * * */ @RoutingType(type = RoutingTypes.GETFILEREVISIONSRESPONSE) public interface GetFileRevisionsResponse extends ServerToClientDto { JsonArray<Revision> getRevisions(); String getWorkspaceId(); String getPath(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/RecoverFromDroppedTangoInvalidation.java
shared/src/main/java/com/google/collide/dto/RecoverFromDroppedTangoInvalidation.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; /** * Lets the client request Tango invalidation payloads from a version onward. * */ @RoutingType(type = RoutingTypes.RECOVERFROMDROPPEDTANGOINVALIDATION) public interface RecoverFromDroppedTangoInvalidation extends ClientToServerDto { /** * The name from the TangoObjectId. */ String getTangoObjectIdName(); /** * Returns the version of the first payload the client is requesting. */ int getCurrentClientVersion(); /** * If using Tango emulation for the given object, this must be set. */ String getWorkspaceId(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/EnterWorkspace.java
shared/src/main/java/com/google/collide/dto/EnterWorkspace.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; /** * Request to enter a workspace. */ @RoutingType(type = RoutingTypes.ENTERWORKSPACE) public interface EnterWorkspace extends ClientToServerDto { String getProjectId(); String getWorkspaceId(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/GetWorkspaceResponse.java
shared/src/main/java/com/google/collide/dto/GetWorkspaceResponse.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; /** * Information about multiple workspaces. * */ @RoutingType(type = RoutingTypes.GETWORKSPACERESPONSE) public interface GetWorkspaceResponse extends ServerToClientDto { WorkspaceInfo getWorkspace(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/CodeBlock.java
shared/src/main/java/com/google/collide/dto/CodeBlock.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.CompactJsonDto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.SerializationIndex; import com.google.collide.dtogen.shared.ServerToClientDto; import com.google.collide.json.shared.JsonArray; /** * An interface representing a continuous namespace in the source code. It may * be a function, a class, an object or just anonymous namespace. * * Code blocks have start offset relative to the file start, length, * type and optional name. * * This interface is based on CodeBlock proto from Code Search */ @RoutingType(type = RoutingTypes.CODEBLOCK) public interface CodeBlock extends ServerToClientDto, CompactJsonDto { /** * Enumeration of currently supported code block types. */ public static enum Type { UNDEFINED(0), FUNCTION(1), FIELD(2), FILE(3), CLASS(4), UNRESOLVED_REFERENCE(5), PACKAGE(6); public static final int VALUE_UNDEFINED = 0; public static final int VALUE_FUNCTION = 1; public static final int VALUE_FIELD = 2; public static final int VALUE_FILE = 3; public static final int VALUE_CLASS = 4; public static final int VALUE_UNRESOLVED_REFERENCE = 5; public static final int VALUE_PACKAGE = 6; public final int value; public static Type valueOf(int value) { switch (value) { case VALUE_UNDEFINED: return UNDEFINED; case VALUE_FUNCTION: return FUNCTION; case VALUE_FIELD: return FIELD; case VALUE_FILE: return FILE; case VALUE_CLASS: return CLASS; case VALUE_UNRESOLVED_REFERENCE: return UNRESOLVED_REFERENCE; case VALUE_PACKAGE: return PACKAGE; } throw new IllegalStateException("Unknown type value: " + value); } Type(int serializedValue) { this.value = serializedValue; } } /** * The semantics of ID is different depending on code block type. * For FILE code blocks it is a workspace-unique long, for other code blocks * it is a file-unique int. Full ID will involve both components. * * @return id */ @SerializationIndex(1) String getId(); /** * @return the type of this code block */ @SerializationIndex(2) int getBlockType(); /** * @return the end column of this code block relative to the first column on the line */ @SerializationIndex(3) int getEndColumn(); /** * @return the end line number of this code block relative to the file start */ @SerializationIndex(4) int getEndLineNumber(); /** * @return the name of this code block or {@code null} if the code block * is anonymous */ @SerializationIndex(5) String getName(); /** * @return the start column of this code block relative to the first column on the line */ @SerializationIndex(6) int getStartColumn(); /** * @return the start line number of this code block relative to the file start */ @SerializationIndex(7) int getStartLineNumber(); /** * @return the list of the nested code blocks */ @SerializationIndex(8) JsonArray<CodeBlock> getChildren(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/SetStagingServerAppId.java
shared/src/main/java/com/google/collide/dto/SetStagingServerAppId.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; /** * * DTO for setting the user's mimic app id. * * */ @RoutingType(type = RoutingTypes.SETSTAGINGSERVERAPPID) public interface SetStagingServerAppId extends ClientToServerDto { String getStagingServerAppId(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/GetWorkspaceParticipantsResponse.java
shared/src/main/java/com/google/collide/dto/GetWorkspaceParticipantsResponse.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; import com.google.collide.json.shared.JsonArray; /** * Response for requesting workspace participants. */ @RoutingType(type = RoutingTypes.GETWORKSPACEPARTICIPANTSRESPONSE) public interface GetWorkspaceParticipantsResponse extends ServerToClientDto { /** * Returns the list of requested workspace participants who are still in the * workspace. */ JsonArray<ParticipantUserDetails> getParticipants(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/SetProjectRole.java
shared/src/main/java/com/google/collide/dto/SetProjectRole.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; /** * Message used to set the project role for one user. * */ @RoutingType(type = RoutingTypes.SETPROJECTROLE) public interface SetProjectRole extends ClientToServerDto { String getProjectId(); /** * Returns the user ID whose role is to be updated. */ String getUserId(); ChangeRoleInfo getChangeRoleInfo(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/GetProjectMembersResponse.java
shared/src/main/java/com/google/collide/dto/GetProjectMembersResponse.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; import com.google.collide.json.shared.JsonArray; /** * Response for requesting project members, and users requesting membership. */ @RoutingType(type = RoutingTypes.GETPROJECTMEMBERSRESPONSE) public interface GetProjectMembersResponse extends ServerToClientDto { /** * Returns the list of current project members. This should always be * non-null. */ JsonArray<UserDetailsWithRole> getMembers(); /** * Returns the list of users requesting project membership. This should always * be non-null. */ JsonArray<UserDetailsWithRole> getPendingMembers(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/ParticipantUserDetails.java
shared/src/main/java/com/google/collide/dto/ParticipantUserDetails.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; /** * Represents a participant in a Workspace session, including the participants * {@link UserDetails}. * */ public interface ParticipantUserDetails { /** * @return the participant info */ Participant getParticipant(); /** * @return the user details for the participant */ UserDetails getUserDetails(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/EndUploadSessionFinished.java
shared/src/main/java/com/google/collide/dto/EndUploadSessionFinished.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; import com.google.collide.json.shared.JsonArray; /** * Notification from server that it has finished processing the uploaded files in the * a session. * */ @RoutingType(type = RoutingTypes.ENDUPLOADSESSIONFINISHED) public interface EndUploadSessionFinished extends ServerToClientDto { public interface UnzipFailure { String getZipWorkspacePath(); JsonArray<String> getDisplayFailedWorkspacePaths(); } String getSessionId(); JsonArray<String> getFailedFileWorkspacePaths(); JsonArray<String> getFailedDirWorkspacePaths(); JsonArray<UnzipFailure> getUnzipFailures(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/GetFileContentsResponse.java
shared/src/main/java/com/google/collide/dto/GetFileContentsResponse.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; /** * Response from server to client that contains either the contents of a file or * a flag indicating the file was not found. */ @RoutingType(type = RoutingTypes.GETFILECONTENTSRESPONSE) public interface GetFileContentsResponse extends ServerToClientDto { /** * Returns the file contents if the file exists and is editable. */ FileContents getFileContents(); /** * Returns whether the file exists. */ boolean getFileExists(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/DocOpComponent.java
shared/src/main/java/com/google/collide/dto/DocOpComponent.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; // TODO: These should be moved to an Editor2-specific package /** * Models one component of a document operation for the Collide code editor. * * With exception of RetainLine, all DocOpComponents must only touch one line. * If there is a multiline insert, that must be split into multiple Inserts, one * per line. * * @see DocOp */ public interface DocOpComponent { /** * Models a deletion within a document operation. This contains the text to be * deleted. The deletion must not span multiple lines (can only contain a * maximum of one newline character, which must be the last character.) */ public interface Delete extends DocOpComponent { String getText(); } /** * Models an insertion within a document operation. This contains the text to * be inserted. The insertion must not span multiple lines (can only contain a * maximum of one newline character, which must be the last character.) */ public interface Insert extends DocOpComponent { String getText(); } /*- * The Retain must indicate whether it is covering the end of the line. This * is exposed by the hasTrailingNewline() method. * * Here's an example of why this is required: Imagine we are composing * operations A and B in a two line document: * "Hello\n" * "World" * * A is modifying the first line and second line, and B is modifying the * second line. * * A is * {(Insert:"This is line 1"), (Retain:6, true), (Insert:"2"), * (Retain:5)} * * B is * {(RetainLine:1), (Insert:"This is line 2"), Retain(6, false)}. * * The composer begins and sees B is retaining one line. It processes * A's components until A finishes the first line, at which point it can move * on to B's next component. If A's Retain did not contain the newline * flag, the composer would continue through to A's (Insert:"2") component * thinking that insertion is still on the first line. After that, it would * see RetainLine and think the composition is illegal since RetainLine * must span the entire line, but the previous component (Insert:"2") did * not end with a newline. */ /** * Models a retain within a document operation. This contains the number of * characters to be retained, and a flag indicating that the last character * being retained is a newline character. This retain must not span multiple * lines (the characters being retained can only have one newline character.) */ public interface Retain extends DocOpComponent { int getCount(); boolean hasTrailingNewline(); } /** * Models a retain through the rest of the line (or the entire line if it is * the only components on a line) within a document operation. The purpose of * this is allowing for a component that is agnostic to the actual number of * characters on some lines. This contains the number of lines to be retained. * This is the only DocOpComponent that can span multiple lines. * * The {@link #getLineCount()} must always be greater than 0. */ public interface RetainLine extends DocOpComponent { int getLineCount(); } /* * TODO: saw extreme weirdness when this was an enum. DevMode in * Chrome would overflow the stack when trying to JSON.stringify this. * console.logging this showed a seemingly infinite depth of Objects */ public static class Type { public static final int DELETE = 0; public static final int INSERT = 1; public static final int RETAIN = 2; public static final int RETAIN_LINE = 3; } public int getType(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/FileInfo.java
shared/src/main/java/com/google/collide/dto/FileInfo.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; /** * DTO class for client-visible file information. */ public interface FileInfo extends TreeNodeInfo { String getSize(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/WorkspaceInfo.java
shared/src/main/java/com/google/collide/dto/WorkspaceInfo.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; /** * Client-visible workspace information. */ @RoutingType(type = RoutingTypes.WORKSPACEINFO) public interface WorkspaceInfo extends ServerToClientDto, ClientToServerDto { /** * The type of this workspaces. */ public enum WorkspaceType { ACTIVE, SUBMITTED, TRUNK, } /** * The user-specific state of the workspace. */ public enum UserWorkspaceState { ACTIVE, ARCHIVED } String getOwningProjectId(); String getDescription(); String getId(); /** * The ID of the parent workspace that spawned this workspace, or -1 if one * does not exists. */ String getParentId(); String getCreatedTime(); String getArchivedTime(); String getSubmissionTime(); /** * Public workspaces are accessible to anyone with the link. */ Visibility getVisibility(); /** * This is the time that should be used for sorting. It is dependent on the * workspaceType. */ String getSortTime(); String getName(); RunTarget getRunTarget(); WorkspaceType getWorkspaceType(); /** * This field will be null for non-submitted workspaces. */ UserDetails getSubmitter(); /** * Returns the current user's {@link Role} for this workspace. If the user is * not a member of the workspace, the return value will be {@value Role#NONE}. */ Role getCurrentUserRole(); /** * Returns the current user's {@link Role} for the parent workspace of this * workspace. If the user is not a member of the workspace, the return value * will be {@value Role#NONE}. */ Role getCurrentUserRoleForParent(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/CodeGraph.java
shared/src/main/java/com/google/collide/dto/CodeGraph.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.json.shared.JsonArray; import com.google.collide.json.shared.JsonStringMap; /** * <p>Code graph structure which encapsulates a tree of code blocks, * and associations between code blocks. * * <p>An instance of this object may represent a subgraph, that is, some of * its components may be omitted. * */ public interface CodeGraph { /** * @return a mapping of file name to the file scope code block */ JsonStringMap<CodeBlock> getCodeBlockMap(); /** * @return the default package code block */ CodeBlock getDefaultPackage(); /** * @return inheritance associations between code blocks */ JsonArray<InheritanceAssociation> getInheritanceAssociations(); /** * @return type associations between code blocks */ JsonArray<TypeAssociation> getTypeAssociations(); /** * @return import associations between code blocks */ JsonArray<ImportAssociation> getImportAssociations(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/KeepAlive.java
shared/src/main/java/com/google/collide/dto/KeepAlive.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; /** * Tells the server that the client is still alive. * */ @RoutingType(type = RoutingTypes.KEEPALIVE) public interface KeepAlive extends ClientToServerDto { String getWorkspaceId(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/GetWorkspaceChangeSummary.java
shared/src/main/java/com/google/collide/dto/GetWorkspaceChangeSummary.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; /** * Client-visible workspace change summary. * */ @RoutingType(type = RoutingTypes.GETWORKSPACECHANGESUMMARY) public interface GetWorkspaceChangeSummary extends ClientToServerDto { String getProjectId(); String getWorkspaceId(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/CreateAppEngineAppStatus.java
shared/src/main/java/com/google/collide/dto/CreateAppEngineAppStatus.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; /** * * A DTO for responding to requests from the client for creating * GAE apps. See the SetupMimic DTO. * */ @RoutingType(type = RoutingTypes.CREATEAPPENGINEAPPSTATUS) public interface CreateAppEngineAppStatus extends ServerToClientDto { /** * The app creation status. */ public static enum Status { OK, APP_ID_UNAVAILABLE, MAX_APPS, // if the user has already created an app using app engine's create app api ALREADY_CREATED_APP, ERROR } Status getStatus(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/ServerError.java
shared/src/main/java/com/google/collide/dto/ServerError.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; /** * Notifies the client of an error on the frontend. * */ @RoutingType(type = RoutingTypes.SERVERERROR) public interface ServerError extends ServerToClientDto { /** * @return the error code */ FailureReason getFailureReason(); /** @return the error details (probably not suitable for end-user consumption) */ String getDetails(); /** * A list of errors shared by the server and the client. */ public static enum FailureReason { /** * Broadly covers any communication error between the client and server in * which a response is not received. */ COMMUNICATION_ERROR, /** * The server returned an error. */ SERVER_ERROR, /** * The server indicated that the current user is not authorized for the * requested service, most likely due to an ACL failure. */ UNAUTHORIZED, /** * The server indicated that the current user is not logged in to GAIA. */ NOT_LOGGED_IN, /** * The server indicated that the supplied XSRF token is invalid or out of * date. If the user is validly logged in, we deliver a new token with the * response XHR. */ INVALID_XSRF_TOKEN, /** * The server indicated that the request was unable to complete because the * client request was out of sync with the current state of some server * resource. This can include a missing workspace session. */ STALE_CLIENT, /** * The failure does not fit into any of the other categories. */ UNKNOWN, /** * No workspace session present when one is expected. */ MISSING_WORKSPACE_SESSION, /** * No file edit session where one is expected. */ MISSING_FILE_SESSION, /** * Client doc ops failed to apply on the server's document. */ DOC_OPS_FAILED, /** * The Client is talking to a Frontend that might speak different DTOs. */ CLIENT_FRONTEND_VERSION_SKEW } }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/GetFileDiffResponse.java
shared/src/main/java/com/google/collide/dto/GetFileDiffResponse.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.RoutingType; import com.google.collide.dtogen.shared.ServerToClientDto; import com.google.collide.json.shared.JsonArray; /** * Diff chunks for a file between two root nodes * * */ @RoutingType(type = RoutingTypes.GETFILEDIFFRESPONSE) public interface GetFileDiffResponse extends ServerToClientDto { JsonArray<DiffChunkResponse> getDiffChunks(); DiffStatsDto getDiffStats(); String getBeforeFilePath(); String getAfterFilePath(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/CreateWorkspace.java
shared/src/main/java/com/google/collide/dto/CreateWorkspace.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; /** * Request to create a project. * */ @RoutingType(type = RoutingTypes.CREATEWORKSPACE) public interface CreateWorkspace extends ClientToServerDto { // TODO: we need a way to express derivation from a golden branch, // or golden revision, not just tip-of-trunk /** * Returns either a workspace id in string form, or {@code null} to derive * from the project's trunk. * * @return workspace id, or {@code null}. */ String getBaseWorkspaceId(); String getProjectId(); String getName(); String getDescription(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/GetWorkspaceMembers.java
shared/src/main/java/com/google/collide/dto/GetWorkspaceMembers.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; import com.google.collide.dtogen.shared.ClientToServerDto; import com.google.collide.dtogen.shared.RoutingType; /** * Request the list of workspace members. * */ @RoutingType(type = RoutingTypes.GETWORKSPACEMEMBERS) public interface GetWorkspaceMembers extends ClientToServerDto { String getProjectId(); String getWorkspaceId(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false
WeTheInternet/collide
https://github.com/WeTheInternet/collide/blob/2136cfc9705a96d88c69356868dda5b95c35bc6d/shared/src/main/java/com/google/collide/dto/Mutation.java
shared/src/main/java/com/google/collide/dto/Mutation.java
// Copyright 2012 Google Inc. All Rights Reserved. // // 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 com.google.collide.dto; /** * Dual use. Used by clients to request tree mutations on the server, and broadcast by the server to * inform clients about mutations that happened. */ public interface Mutation { /** * The mutation to perform. Note that the server does not currently report copies, it simply sends * an {@link #ADD} mutation for the (maybe recursively) copied node. */ public enum Type { // TODO: This smells an awful lot like {@link NodeMutationDto}. // Explore combining them using inheritance or something. ADD, DELETE, MOVE, COPY; } /** * The String value of the {@link Type}. */ Mutation.Type getMutationType(); /** * During a request, this is (@code null} except for {@link Type#ADD} mutations. For an * {@link Type#ADD} mutation, this field's {@link TreeNodeInfo#getNodeType()} should be set to * specify whether to add a new file or directory. * * <p> * After the mutation is applied, this field is set to the mutated node and broadcast. * <ul> * <li>For an {@link Type#ADD} mutation, this node will be a complete tree (for example, in the * case of a recursive {@link Type#COPY}.</li> * <li>For a {@link Type#MOVE} mutation, this is the moved node. If the moved node is a directory * with children, it will be an incomplete node, since the client is expected to already know what * children original node had.</li> * <li>For {@link Type#DELETE} mutations, this will be {@code null}.</li> */ TreeNodeInfo getNewNodeInfo(); /** * The path to the changed node. This will be {@code null} for {@value Type#DELETE} mutations. */ String getNewPath(); /** * The old path of the node. This will be {@code null} for {@link Type#ADD} mutations. */ String getOldPath(); }
java
Apache-2.0
2136cfc9705a96d88c69356868dda5b95c35bc6d
2026-01-05T02:34:36.415338Z
false