code
stringlengths 23
201k
| docstring
stringlengths 17
96.2k
| func_name
stringlengths 0
235
| language
stringclasses 1
value | repo
stringlengths 8
72
| path
stringlengths 11
317
| url
stringlengths 57
377
| license
stringclasses 7
values |
|---|---|---|---|---|---|---|---|
@Override
public void add(T value) {
Node<T> n = new Node<T>(value);
Node<T> t = tail;
tail = n;
size++;
t.set(n); // releases both the tail and size
trim();
}
|
Abstraction over a buffer that receives events and replays them to
individual Observers.
|
add
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
public void trimHead() {
Node<T> h = head;
if (h.value != null) {
Node<T> n = new Node<T>(null);
n.lazySet(h.get());
head = n;
}
}
|
Replace a non-empty head node with an empty one to
allow the GC of the inaccessible old value.
|
trimHead
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
@Nullable
@SuppressWarnings("unchecked")
public T getValue() {
Node<T> h = head;
for (;;) {
Node<T> next = h.get();
if (next == null) {
break;
}
h = next;
}
return h.value;
}
|
Replace a non-empty head node with an empty one to
allow the GC of the inaccessible old value.
|
getValue
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
@SuppressWarnings("unchecked")
public T[] getValues(T[] array) {
Node<T> h = head;
int s = size();
if (s == 0) {
if (array.length != 0) {
array[0] = null;
}
} else {
if (array.length < s) {
array = (T[]) Array.newInstance(array.getClass().getComponentType(), s);
}
int i = 0;
while (i != s) {
Node<T> next = h.get();
array[i] = next.value;
i++;
h = next;
}
if (array.length > s) {
array[s] = null;
}
}
return array;
}
|
Replace a non-empty head node with an empty one to
allow the GC of the inaccessible old value.
|
getValues
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
@SuppressWarnings("unchecked")
public void replay(ReplayDisposable<T> rs) {
if (rs.getAndIncrement() != 0) {
return;
}
int missed = 1;
final Observer<? super T> a = rs.downstream;
Node<T> index = (Node<T>)rs.index;
if (index == null) {
index = head;
}
for (;;) {
for (;;) {
if (rs.cancelled) {
rs.index = null;
return;
}
Node<T> n = index.get();
if (n == null) {
break;
}
a.onNext(n.value);
index = n;
}
if (index.get() != null) {
continue;
}
rs.index = index;
missed = rs.addAndGet(-missed);
if (missed == 0) {
break;
}
}
}
|
Replace a non-empty head node with an empty one to
allow the GC of the inaccessible old value.
|
replay
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
public int size() {
int s = 0;
Node<T> h = head;
while (s != Integer.MAX_VALUE) {
Node<T> next = h.get();
if (next == null) {
break;
}
s++;
h = next;
}
return s;
}
|
Replace a non-empty head node with an empty one to
allow the GC of the inaccessible old value.
|
size
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
void trim() {
if (size > maxSize) {
size--;
TimedNode<T> h = head;
head = h.get();
}
long limit = scheduler.now(unit) - maxAge;
TimedNode<T> h = head;
for (;;) {
if (size <= 1) {
head = h;
break;
}
TimedNode<T> next = h.get();
if (next == null) {
head = h;
break;
}
if (next.time > limit) {
head = h;
break;
}
h = next;
size--;
}
}
|
Replace a non-empty head node with an empty one to
allow the GC of the inaccessible old value.
|
trim
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
public void add(T value) {
TimedNode<T> n = new TimedNode<T>(value, scheduler.now(unit));
TimedNode<T> t = tail;
tail = n;
size++;
t.set(n); // releases both the tail and size
trim();
}
|
Replace a non-empty head node with an empty one to
allow the GC of the inaccessible old value.
|
add
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
public void trimHead() {
TimedNode<T> h = head;
if (h.value != null) {
TimedNode<T> n = new TimedNode<T>(null, 0);
n.lazySet(h.get());
head = n;
}
}
|
Replace a non-empty head node with an empty one to
allow the GC of the inaccessible old value.
|
trimHead
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
@Nullable
@SuppressWarnings("unchecked")
public T getValue() {
TimedNode<T> h = head;
for (;;) {
TimedNode<T> next = h.get();
if (next == null) {
break;
}
h = next;
}
long limit = scheduler.now(unit) - maxAge;
if (h.time < limit) {
return null;
}
return h.value;
}
|
Replace a non-empty head node with an empty one to
allow the GC of the inaccessible old value.
|
getValue
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
TimedNode<T> getHead() {
TimedNode<T> index = head;
// skip old entries
long limit = scheduler.now(unit) - maxAge;
TimedNode<T> next = index.get();
while (next != null) {
long ts = next.time;
if (ts > limit) {
break;
}
index = next;
next = index.get();
}
return index;
}
|
Replace a non-empty head node with an empty one to
allow the GC of the inaccessible old value.
|
getHead
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
@SuppressWarnings("unchecked")
public T[] getValues(T[] array) {
TimedNode<T> h = getHead();
int s = size(h);
if (s == 0) {
if (array.length != 0) {
array[0] = null;
}
} else {
if (array.length < s) {
array = (T[]) Array.newInstance(array.getClass().getComponentType(), s);
}
int i = 0;
while (i != s) {
TimedNode<T> next = h.get();
array[i] = next.value;
i++;
h = next;
}
if (array.length > s) {
array[s] = null;
}
}
return array;
}
|
Replace a non-empty head node with an empty one to
allow the GC of the inaccessible old value.
|
getValues
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
@SuppressWarnings("unchecked")
public void replay(ReplayDisposable<T> rs) {
if (rs.getAndIncrement() != 0) {
return;
}
int missed = 1;
final Observer<? super T> a = rs.downstream;
TimedNode<T> index = (TimedNode<T>)rs.index;
if (index == null) {
index = getHead();
}
for (;;) {
if (rs.cancelled) {
rs.index = null;
return;
}
for (;;) {
if (rs.cancelled) {
rs.index = null;
return;
}
TimedNode<T> n = index.get();
if (n == null) {
break;
}
T o = n.value;
a.onNext(o);
index = n;
}
if (index.get() != null) {
continue;
}
rs.index = index;
missed = rs.addAndGet(-missed);
if (missed == 0) {
break;
}
}
}
|
Replace a non-empty head node with an empty one to
allow the GC of the inaccessible old value.
|
replay
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
public int size() {
return size(getHead());
}
|
Replace a non-empty head node with an empty one to
allow the GC of the inaccessible old value.
|
size
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
int size(TimedNode<T> h) {
int s = 0;
while (s != Integer.MAX_VALUE) {
TimedNode<T> next = h.get();
if (next == null) {
break;
}
s++;
h = next;
}
return s;
}
|
Replace a non-empty head node with an empty one to
allow the GC of the inaccessible old value.
|
size
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/ReplayRelay.java
|
Apache-2.0
|
@Override
protected void subscribeActual(Observer<? super T> observer) {
actual.subscribe(observer);
}
|
Constructor that wraps an actual relay.
|
subscribeActual
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/SerializedRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/SerializedRelay.java
|
Apache-2.0
|
@Override
public void accept(@NonNull T value) {
synchronized (this) {
if (emitting) {
AppendOnlyLinkedArrayList<T> q = queue;
if (q == null) {
q = new AppendOnlyLinkedArrayList<T>(4);
queue = q;
}
q.add(value);
return;
}
emitting = true;
}
actual.accept(value);
emitLoop();
}
|
Constructor that wraps an actual relay.
|
accept
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/SerializedRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/SerializedRelay.java
|
Apache-2.0
|
private void emitLoop() {
for (;;) {
AppendOnlyLinkedArrayList<T> q;
synchronized (this) {
q = queue;
if (q == null) {
emitting = false;
return;
}
queue = null;
}
q.accept(actual);
}
}
|
Loops until all notifications in the queue has been processed.
|
emitLoop
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/SerializedRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/SerializedRelay.java
|
Apache-2.0
|
@Override
public boolean hasObservers() {
return actual.hasObservers();
}
|
Loops until all notifications in the queue has been processed.
|
hasObservers
|
java
|
JakeWharton/RxRelay
|
src/main/java/com/jakewharton/rxrelay3/SerializedRelay.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/main/java/com/jakewharton/rxrelay3/SerializedRelay.java
|
Apache-2.0
|
@SuppressWarnings("unchecked")
public static <T> io.reactivex.rxjava3.core.Observer<T> mockObserver() {
return mock(io.reactivex.rxjava3.core.Observer.class);
}
|
Mocks an Observer with the proper receiver type.
@param <T> the value type
@return the mocked observer
|
mockObserver
|
java
|
JakeWharton/RxRelay
|
src/test/java/com/jakewharton/rxrelay3/TestHelper.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/test/java/com/jakewharton/rxrelay3/TestHelper.java
|
Apache-2.0
|
public static void race(final Runnable r1, final Runnable r2, Scheduler s) {
final AtomicInteger count = new AtomicInteger(2);
final CountDownLatch cdl = new CountDownLatch(2);
final Throwable[] errors = { null, null };
s.scheduleDirect(new Runnable() {
@Override
public void run() {
if (count.decrementAndGet() != 0) {
while (count.get() != 0) { }
}
try {
try {
r1.run();
} catch (Throwable ex) {
errors[0] = ex;
}
} finally {
cdl.countDown();
}
}
});
if (count.decrementAndGet() != 0) {
while (count.get() != 0) { }
}
try {
try {
r2.run();
} catch (Throwable ex) {
errors[1] = ex;
}
} finally {
cdl.countDown();
}
try {
if (!cdl.await(5, TimeUnit.SECONDS)) {
throw new AssertionError("The wait timed out!");
}
} catch (InterruptedException ex) {
throw new RuntimeException(ex);
}
if (errors[0] != null && errors[1] == null) {
throw ExceptionHelper.wrapOrThrow(errors[0]);
}
if (errors[0] == null && errors[1] != null) {
throw ExceptionHelper.wrapOrThrow(errors[1]);
}
if (errors[0] != null && errors[1] != null) {
throw new CompositeException(errors);
}
}
|
Synchronizes the execution of two runnables (as much as possible)
to test race conditions.
<p>The method blocks until both have run to completion.
@param r1 the first runnable
@param r2 the second runnable
@param s the scheduler to use
|
race
|
java
|
JakeWharton/RxRelay
|
src/test/java/com/jakewharton/rxrelay3/TestHelper.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/test/java/com/jakewharton/rxrelay3/TestHelper.java
|
Apache-2.0
|
@Override
public void run() {
if (count.decrementAndGet() != 0) {
while (count.get() != 0) { }
}
try {
try {
r1.run();
} catch (Throwable ex) {
errors[0] = ex;
}
} finally {
cdl.countDown();
}
}
|
Synchronizes the execution of two runnables (as much as possible)
to test race conditions.
<p>The method blocks until both have run to completion.
@param r1 the first runnable
@param r2 the second runnable
@param s the scheduler to use
|
run
|
java
|
JakeWharton/RxRelay
|
src/test/java/com/jakewharton/rxrelay3/TestHelper.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/test/java/com/jakewharton/rxrelay3/TestHelper.java
|
Apache-2.0
|
public static void checkDisposed(io.reactivex.rxjava3.core.Observable<?> source) {
final Boolean[] b = { null, null };
final CountDownLatch cdl = new CountDownLatch(1);
source.subscribe(new io.reactivex.rxjava3.core.Observer<Object>() {
@Override public void onSubscribe(Disposable d) {
try {
b[0] = d.isDisposed();
d.dispose();
b[1] = d.isDisposed();
d.dispose();
} finally {
cdl.countDown();
}
}
@Override public void onNext(Object value) {
// ignored
}
@Override public void onError(Throwable e) {
// ignored
}
@Override public void onComplete() {
// ignored
}
});
try {
assertTrue("Timed out", cdl.await(5, TimeUnit.SECONDS));
} catch (InterruptedException ex) {
throw ExceptionHelper.wrapOrThrow(ex);
}
assertEquals("Reports disposed upfront?", false, b[0]);
assertEquals("Didn't report disposed after?", true, b[1]);
}
|
Checks if the upstream's Disposable sent through the onSubscribe reports
isDisposed properly before and after calling dispose.
@param source the source to test
|
checkDisposed
|
java
|
JakeWharton/RxRelay
|
src/test/java/com/jakewharton/rxrelay3/TestHelper.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/test/java/com/jakewharton/rxrelay3/TestHelper.java
|
Apache-2.0
|
@Override public void onSubscribe(Disposable d) {
try {
b[0] = d.isDisposed();
d.dispose();
b[1] = d.isDisposed();
d.dispose();
} finally {
cdl.countDown();
}
}
|
Checks if the upstream's Disposable sent through the onSubscribe reports
isDisposed properly before and after calling dispose.
@param source the source to test
|
onSubscribe
|
java
|
JakeWharton/RxRelay
|
src/test/java/com/jakewharton/rxrelay3/TestHelper.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/test/java/com/jakewharton/rxrelay3/TestHelper.java
|
Apache-2.0
|
@Override public void onNext(Object value) {
// ignored
}
|
Checks if the upstream's Disposable sent through the onSubscribe reports
isDisposed properly before and after calling dispose.
@param source the source to test
|
onNext
|
java
|
JakeWharton/RxRelay
|
src/test/java/com/jakewharton/rxrelay3/TestHelper.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/test/java/com/jakewharton/rxrelay3/TestHelper.java
|
Apache-2.0
|
@Override public void onError(Throwable e) {
// ignored
}
|
Checks if the upstream's Disposable sent through the onSubscribe reports
isDisposed properly before and after calling dispose.
@param source the source to test
|
onError
|
java
|
JakeWharton/RxRelay
|
src/test/java/com/jakewharton/rxrelay3/TestHelper.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/test/java/com/jakewharton/rxrelay3/TestHelper.java
|
Apache-2.0
|
@Override public void onComplete() {
// ignored
}
|
Checks if the upstream's Disposable sent through the onSubscribe reports
isDisposed properly before and after calling dispose.
@param source the source to test
|
onComplete
|
java
|
JakeWharton/RxRelay
|
src/test/java/com/jakewharton/rxrelay3/TestHelper.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/test/java/com/jakewharton/rxrelay3/TestHelper.java
|
Apache-2.0
|
@Override
public void dispose() {
}
|
Basic scheduler that produces an ever increasing {@link #now(TimeUnit)} value.
Use this scheduler only as a time source!
|
dispose
|
java
|
JakeWharton/RxRelay
|
src/test/java/com/jakewharton/rxrelay3/TimesteppingScheduler.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/test/java/com/jakewharton/rxrelay3/TimesteppingScheduler.java
|
Apache-2.0
|
@Override
public boolean isDisposed() {
return false;
}
|
Basic scheduler that produces an ever increasing {@link #now(TimeUnit)} value.
Use this scheduler only as a time source!
|
isDisposed
|
java
|
JakeWharton/RxRelay
|
src/test/java/com/jakewharton/rxrelay3/TimesteppingScheduler.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/test/java/com/jakewharton/rxrelay3/TimesteppingScheduler.java
|
Apache-2.0
|
@Override
public Disposable schedule(Runnable run, long delay, TimeUnit unit) {
run.run();
return Disposable.disposed();
}
|
Basic scheduler that produces an ever increasing {@link #now(TimeUnit)} value.
Use this scheduler only as a time source!
|
schedule
|
java
|
JakeWharton/RxRelay
|
src/test/java/com/jakewharton/rxrelay3/TimesteppingScheduler.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/test/java/com/jakewharton/rxrelay3/TimesteppingScheduler.java
|
Apache-2.0
|
@Override
public long now(TimeUnit unit) {
return time++;
}
|
Basic scheduler that produces an ever increasing {@link #now(TimeUnit)} value.
Use this scheduler only as a time source!
|
now
|
java
|
JakeWharton/RxRelay
|
src/test/java/com/jakewharton/rxrelay3/TimesteppingScheduler.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/test/java/com/jakewharton/rxrelay3/TimesteppingScheduler.java
|
Apache-2.0
|
@Override
public Worker createWorker() {
return new TimesteppingWorker();
}
|
Basic scheduler that produces an ever increasing {@link #now(TimeUnit)} value.
Use this scheduler only as a time source!
|
createWorker
|
java
|
JakeWharton/RxRelay
|
src/test/java/com/jakewharton/rxrelay3/TimesteppingScheduler.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/test/java/com/jakewharton/rxrelay3/TimesteppingScheduler.java
|
Apache-2.0
|
@Override
public long now(TimeUnit unit) {
return time++;
}
|
Basic scheduler that produces an ever increasing {@link #now(TimeUnit)} value.
Use this scheduler only as a time source!
|
now
|
java
|
JakeWharton/RxRelay
|
src/test/java/com/jakewharton/rxrelay3/TimesteppingScheduler.java
|
https://github.com/JakeWharton/RxRelay/blob/master/src/test/java/com/jakewharton/rxrelay3/TimesteppingScheduler.java
|
Apache-2.0
|
public JComponent initUi() {
myValueLabel = new JLabel() {
@Override
public String getText() {
return getCurrentText();
}
};
setDefaultForeground();
setFocusable(true);
setBorder(createUnfocusedBorder());
setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
add(myValueLabel);
add(Box.createHorizontalStrut(GAP_BEFORE_ARROW));
add(new JLabel(AllIcons.Ide.Statusbar_arrows));
installChangeListener(() -> {
myValueLabel.revalidate();
myValueLabel.repaint();
});
showPopupMenuOnClick();
showPopupMenuFromKeyboard();
indicateHovering();
indicateFocusing();
return this;
}
|
Fork of the filter select component in VCS Tool window of Intellij
@see com.intellij.vcs.log.ui.filter.VcsLogPopupComponent
|
initUi
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
@Override
public String getText() {
return getCurrentText();
}
|
Fork of the filter select component in VCS Tool window of Intellij
@see com.intellij.vcs.log.ui.filter.VcsLogPopupComponent
|
getText
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
private String getCurrentText() {
NbPerPage nbPerPage = pagination.getNbPerPage();
return getText(nbPerPage);
}
|
Fork of the filter select component in VCS Tool window of Intellij
@see com.intellij.vcs.log.ui.filter.VcsLogPopupComponent
|
getCurrentText
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
private static String getText(NbPerPage nbPerPage) {
return NbPerPage.ALL.equals(nbPerPage)
? String.format("%s docs", NbPerPage.ALL.label)
: String.format("%s docs / page", nbPerPage.label);
}
|
Fork of the filter select component in VCS Tool window of Intellij
@see com.intellij.vcs.log.ui.filter.VcsLogPopupComponent
|
getText
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
private ActionGroup createActionGroup() {
DefaultActionGroup actionGroup = new DefaultActionGroup();
for (NbPerPage nbPerPage : NbPerPage.values()) {
actionGroup.add(new NbPerPageAction(nbPerPage));
}
return actionGroup;
}
|
Create popup actions available under this filter.
|
createActionGroup
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
private void indicateFocusing() {
addFocusListener(new FocusAdapter() {
@Override
public void focusGained(@NotNull FocusEvent e) {
setBorder(createFocusedBorder());
}
@Override
public void focusLost(@NotNull FocusEvent e) {
setBorder(createUnfocusedBorder());
}
});
}
|
Create popup actions available under this filter.
|
indicateFocusing
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
@Override
public void focusGained(@NotNull FocusEvent e) {
setBorder(createFocusedBorder());
}
|
Create popup actions available under this filter.
|
focusGained
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
@Override
public void focusLost(@NotNull FocusEvent e) {
setBorder(createUnfocusedBorder());
}
|
Create popup actions available under this filter.
|
focusLost
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
private void showPopupMenuFromKeyboard() {
addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(@NotNull KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_DOWN) {
showPopupMenu();
}
}
});
}
|
Create popup actions available under this filter.
|
showPopupMenuFromKeyboard
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
@Override
public void keyPressed(@NotNull KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_DOWN) {
showPopupMenu();
}
}
|
Create popup actions available under this filter.
|
keyPressed
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
private void showPopupMenuOnClick() {
new ClickListener() {
@Override
public boolean onClick(@NotNull MouseEvent event, int clickCount) {
showPopupMenu();
return true;
}
}.installOn(this);
}
|
Create popup actions available under this filter.
|
showPopupMenuOnClick
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
@Override
public boolean onClick(@NotNull MouseEvent event, int clickCount) {
showPopupMenu();
return true;
}
|
Create popup actions available under this filter.
|
onClick
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
private void indicateHovering() {
addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(@NotNull MouseEvent e) {
setOnHoverForeground();
}
@Override
public void mouseExited(@NotNull MouseEvent e) {
setDefaultForeground();
}
});
}
|
Create popup actions available under this filter.
|
indicateHovering
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
@Override
public void mouseEntered(@NotNull MouseEvent e) {
setOnHoverForeground();
}
|
Create popup actions available under this filter.
|
mouseEntered
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
@Override
public void mouseExited(@NotNull MouseEvent e) {
setDefaultForeground();
}
|
Create popup actions available under this filter.
|
mouseExited
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
private void setDefaultForeground() {
myValueLabel.setForeground(UIUtil.isUnderDarcula() ? UIUtil.getLabelForeground() : UIUtil.getInactiveTextColor().darker().darker());
}
|
Create popup actions available under this filter.
|
setDefaultForeground
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
private void setOnHoverForeground() {
myValueLabel.setForeground(UIUtil.isUnderDarcula() ? UIUtil.getLabelForeground() : UIUtil.getTextFieldForeground());
}
|
Create popup actions available under this filter.
|
setOnHoverForeground
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
private void showPopupMenu() {
ListPopup popup = createPopupMenu();
popup.showInCenterOf(this);
}
|
Create popup actions available under this filter.
|
showPopupMenu
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
@NotNull
private ListPopup createPopupMenu() {
return JBPopupFactory.getInstance().
createActionGroupPopup(null, createActionGroup(), DataManager.getInstance().getDataContext(this),
JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);
}
|
Create popup actions available under this filter.
|
createPopupMenu
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
private static Border createFocusedBorder() {
return BorderFactory.createCompoundBorder(new RoundedLineBorder(UIUtil.getHeaderActiveColor(), 10, BORDER_SIZE), JBUI.Borders.empty(2));
}
|
Create popup actions available under this filter.
|
createFocusedBorder
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
private static Border createUnfocusedBorder() {
return BorderFactory
.createCompoundBorder(BorderFactory.createEmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE), JBUI.Borders.empty(2));
}
|
Create popup actions available under this filter.
|
createUnfocusedBorder
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
pagination.setNbPerPage(nbPerPage);
}
|
Create popup actions available under this filter.
|
actionPerformed
|
java
|
dboissier/mongo4idea
|
src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
https://github.com/dboissier/mongo4idea/blob/master/src/main/java/org/codinjutsu/tools/mongo/view/PaginationPopupComponent.java
|
Apache-2.0
|
public static int darkenColor(int color) {
float[] hsv = new float[3];
Color.colorToHSV(color, hsv);
hsv[2] *= 0.8f;
return Color.HSVToColor(hsv);
}
|
The FAB button's Y position when it is hidden.
|
darkenColor
|
java
|
faizmalkani/Fabulous
|
FloatingActionButton/src/com/faizmalkani/floatingactionbutton/FloatingActionButton.java
|
https://github.com/faizmalkani/Fabulous/blob/master/FloatingActionButton/src/com/faizmalkani/floatingactionbutton/FloatingActionButton.java
|
MIT
|
public void setColor(int color) {
mColor = color;
mButtonPaint.setColor(mColor);
invalidate();
}
|
The FAB button's Y position when it is hidden.
|
setColor
|
java
|
faizmalkani/Fabulous
|
FloatingActionButton/src/com/faizmalkani/floatingactionbutton/FloatingActionButton.java
|
https://github.com/faizmalkani/Fabulous/blob/master/FloatingActionButton/src/com/faizmalkani/floatingactionbutton/FloatingActionButton.java
|
MIT
|
public void setDrawable(Drawable drawable) {
mBitmap = ((BitmapDrawable) drawable).getBitmap();
invalidate();
}
|
The FAB button's Y position when it is hidden.
|
setDrawable
|
java
|
faizmalkani/Fabulous
|
FloatingActionButton/src/com/faizmalkani/floatingactionbutton/FloatingActionButton.java
|
https://github.com/faizmalkani/Fabulous/blob/master/FloatingActionButton/src/com/faizmalkani/floatingactionbutton/FloatingActionButton.java
|
MIT
|
public void setShadow(float radius, float dx, float dy, int color) {
mButtonPaint.setShadowLayer(radius, dx, dy, color);
invalidate();
}
|
The FAB button's Y position when it is hidden.
|
setShadow
|
java
|
faizmalkani/Fabulous
|
FloatingActionButton/src/com/faizmalkani/floatingactionbutton/FloatingActionButton.java
|
https://github.com/faizmalkani/Fabulous/blob/master/FloatingActionButton/src/com/faizmalkani/floatingactionbutton/FloatingActionButton.java
|
MIT
|
@Override
protected void onDraw(Canvas canvas) {
canvas.drawCircle(getWidth() / 2, getHeight() / 2, (float) (getWidth() / 2.6), mButtonPaint);
if (null != mBitmap) {
canvas.drawBitmap(mBitmap, (getWidth() - mBitmap.getWidth()) / 2,
(getHeight() - mBitmap.getHeight()) / 2, mDrawablePaint);
}
}
|
The FAB button's Y position when it is hidden.
|
onDraw
|
java
|
faizmalkani/Fabulous
|
FloatingActionButton/src/com/faizmalkani/floatingactionbutton/FloatingActionButton.java
|
https://github.com/faizmalkani/Fabulous/blob/master/FloatingActionButton/src/com/faizmalkani/floatingactionbutton/FloatingActionButton.java
|
MIT
|
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
// Perform the default behavior
super.onLayout(changed, left, top, right, bottom);
if (mLeftDisplayed == -1) {
mLeftDisplayed = left;
mRightDisplayed = right;
mTopDisplayed = top;
mBottomDisplayed = bottom;
}
// Store the FAB button's displayed Y position if we are not already aware of it
if (mYDisplayed == -1) {
mYDisplayed = ViewHelper.getY(this);
}
}
|
The FAB button's Y position when it is hidden.
|
onLayout
|
java
|
faizmalkani/Fabulous
|
FloatingActionButton/src/com/faizmalkani/floatingactionbutton/FloatingActionButton.java
|
https://github.com/faizmalkani/Fabulous/blob/master/FloatingActionButton/src/com/faizmalkani/floatingactionbutton/FloatingActionButton.java
|
MIT
|
@Override
public boolean onTouchEvent(MotionEvent event) {
int color;
if (event.getAction() == MotionEvent.ACTION_UP) {
color = mColor;
} else {
color = darkenColor(mColor);
rect = new Rect(mLeftDisplayed, mTopDisplayed, mRightDisplayed, mBottomDisplayed);
}
if (event.getAction() == MotionEvent.ACTION_MOVE){
if (!rect.contains(mLeftDisplayed + (int) event.getX(), mTopDisplayed + (int) event.getY())){
color = mColor;
}
}
mButtonPaint.setColor(color);
invalidate();
return super.onTouchEvent(event);
}
|
The FAB button's Y position when it is hidden.
|
onTouchEvent
|
java
|
faizmalkani/Fabulous
|
FloatingActionButton/src/com/faizmalkani/floatingactionbutton/FloatingActionButton.java
|
https://github.com/faizmalkani/Fabulous/blob/master/FloatingActionButton/src/com/faizmalkani/floatingactionbutton/FloatingActionButton.java
|
MIT
|
public void hide(boolean hide) {
// If the hidden state is being updated
if (mHidden != hide) {
// Store the new hidden state
mHidden = hide;
// Animate the FAB to it's new Y position
ObjectAnimator animator = ObjectAnimator.ofFloat(this, "y", mHidden ? mYHidden : mYDisplayed).setDuration(500);
animator.setInterpolator(mInterpolator);
animator.start();
}
}
|
The FAB button's Y position when it is hidden.
|
hide
|
java
|
faizmalkani/Fabulous
|
FloatingActionButton/src/com/faizmalkani/floatingactionbutton/FloatingActionButton.java
|
https://github.com/faizmalkani/Fabulous/blob/master/FloatingActionButton/src/com/faizmalkani/floatingactionbutton/FloatingActionButton.java
|
MIT
|
public void listenTo(AbsListView listView) {
if (null != listView) {
listView.setOnScrollListener(new DirectionScrollListener(this));
}
}
|
The FAB button's Y position when it is hidden.
|
listenTo
|
java
|
faizmalkani/Fabulous
|
FloatingActionButton/src/com/faizmalkani/floatingactionbutton/FloatingActionButton.java
|
https://github.com/faizmalkani/Fabulous/blob/master/FloatingActionButton/src/com/faizmalkani/floatingactionbutton/FloatingActionButton.java
|
MIT
|
public View fromClass(Context c, Class<? extends View> viewClass) {
try {
return viewClass.getConstructor(Context.class).newInstance(c);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
} catch (InstantiationException e) {
throw new RuntimeException(e);
}
}
|
This method is a place to define the structure of your layout, its view
properties and data bindings.
|
fromClass
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
public View fromXml(ViewGroup parent, int xmlId) {
return LayoutInflater.from(parent.getContext()).inflate(xmlId, parent, false);
}
|
This method is a place to define the structure of your layout, its view
properties and data bindings.
|
fromXml
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
public static void registerViewFactory(ViewFactory viewFactory) {
if (!viewFactories.contains(viewFactory)) {
viewFactories.add(0, viewFactory);
}
}
|
This method is a place to define the structure of your layout, its view
properties and data bindings.
|
registerViewFactory
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
public static void registerAttributeSetter(AttributeSetter setter) {
if (!attributeSetters.contains(setter)) {
attributeSetters.add(0, setter);
}
}
|
This method is a place to define the structure of your layout, its view
properties and data bindings.
|
registerAttributeSetter
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
public static void set(View v, String key, Object value) {
Map<String, Object> attrs = tags.get(v);
if (attrs == null) {
attrs = new HashMap<>();
tags.put(v, attrs);
}
attrs.put(key, value);
}
|
Tags: arbitrary data bound to specific views, such as last cached attribute values
|
set
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
public static Object get(View v, String key) {
Map<String, Object> attrs = tags.get(v);
if (attrs == null) {
return null;
}
return attrs.get(key);
}
|
Tags: arbitrary data bound to specific views, such as last cached attribute values
|
get
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
public static void render() {
// If Anvil.render() is called on a non-UI thread, use UI Handler
if (Looper.myLooper() != Looper.getMainLooper()) {
synchronized (Anvil.class) {
if (anvilUIHandler == null) {
anvilUIHandler = new Handler(Looper.getMainLooper());
}
}
anvilUIHandler.removeCallbacksAndMessages(null);
anvilUIHandler.post(anvilRenderRunnable);
return;
}
Set<Mount> set = new HashSet<>();
set.addAll(mounts.values());
for (Mount m : set) {
render(m);
}
}
|
Starts the new rendering cycle updating all mounted
renderables. Update happens in a lazy manner, only the values that has
been changed since last rendering cycle will be actually updated in the
views. This method can be called from any thread, so it's safe to use
{@code Anvil.render()} in background services.
|
render
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
public static <T extends View> T mount(T v, Renderable r) {
Mount m = new Mount(v, r);
mounts.put(v, m);
render(v);
return v;
}
|
Mounts a renderable function defining the layout into a View. If host is a
viewgroup it is assumed to be empty, so the Renderable would define what
its child views would be.
@param v a View into which the renderable r will be mounted
@param r a Renderable to mount into a View
|
mount
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
public static void unmount(View v) {
unmount(v, true);
}
|
Unmounts a mounted renderable. This would also clean up all the child
views inside the parent ViewGroup, which acted as a mount point.
@param v A mount point to unmount from its View
|
unmount
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
public static void unmount(View v, boolean removeChildren) {
Mount m = mounts.get(v);
if (m != null) {
mounts.remove(v);
if (v instanceof ViewGroup) {
ViewGroup viewGroup = (ViewGroup) v;
int childCount = viewGroup.getChildCount();
for (int i = 0; i < childCount; i++) {
unmount(viewGroup.getChildAt(i));
}
if (removeChildren) {
viewGroup.removeViews(0, childCount);
}
}
}
}
|
Unmounts a mounted renderable. This would also clean up all the child
views inside the parent ViewGroup, which acted as a mount point.
@param v A mount point to unmount from its View
|
unmount
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
static Mount currentMount() {
return currentMount;
}
|
Returns currently rendered Mount point. Must be called from the
Renderable's view() method, otherwise it returns null
@return current mount point
|
currentMount
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
@SuppressWarnings("unchecked")
public static <T extends View> T currentView() {
if (currentMount == null) {
return null;
}
return (T) currentMount.iterator.currentView();
}
|
Returns currently rendered View. It allows to access the real view from
inside the Renderable.
@return currently rendered View
|
currentView
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
public static void render(View v) {
Mount m = mounts.get(v);
if (m == null) {
return;
}
render(m);
}
|
Returns currently rendered View. It allows to access the real view from
inside the Renderable.
@return currently rendered View
|
render
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
static void render(Mount m) {
if (m.lock) {
return;
}
m.lock = true;
Mount prev = currentMount;
currentMount = m;
m.iterator.start();
if (m.renderable != null) {
m.renderable.view();
}
m.iterator.end();
currentMount = prev;
m.lock = false;
}
|
Returns currently rendered View. It allows to access the real view from
inside the Renderable.
@return currently rendered View
|
render
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
private void start() {
assert views.size() == 0;
assert indices.size() == 0;
indices.push(0);
View v = rootView.get();
if (v != null) {
views.push(v);
}
}
|
Mount describes a mount point. Mount point is a Renderable function
attached to some ViewGroup. Mount point keeps track of the virtual layout
declared by Renderable
|
start
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
void start(Class<? extends View> c, int layoutId, Object key) {
int i = indices.peek();
View parentView = views.peek();
if (parentView == null) {
return;
}
if (!(parentView instanceof ViewGroup)) {
throw new RuntimeException("child views are allowed only inside view groups");
}
ViewGroup vg = (ViewGroup) parentView;
View v = null;
if (i < vg.getChildCount()) {
v = vg.getChildAt(i);
}
Context context = rootView.get().getContext();
if (c != null && (v == null || !v.getClass().equals(c))) {
vg.removeView(v);
for (ViewFactory vf : viewFactories) {
v = vf.fromClass(context, c);
if (v != null) {
set(v, "_anvil", 1);
vg.addView(v, i);
break;
}
}
} else if (c == null && (v == null || !Integer.valueOf(layoutId).equals(get(v, "_layoutId")))) {
vg.removeView(v);
for (ViewFactory vf : viewFactories) {
v = vf.fromXml(vg, layoutId);
if (v != null) {
set(v, "_anvil", 1);
set(v, "_layoutId", layoutId);
vg.addView(v, i);
break;
}
}
}
assert v != null;
views.push(v);
indices.push(indices.pop() + 1);
indices.push(0);
}
|
Mount describes a mount point. Mount point is a Renderable function
attached to some ViewGroup. Mount point keeps track of the virtual layout
declared by Renderable
|
start
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
void end() {
int index = indices.peek();
View v = views.peek();
if (v != null && v instanceof ViewGroup &&
get(v, "_layoutId") == null &&
(mounts.get(v) == null || mounts.get(v) == Mount.this)) {
ViewGroup vg = (ViewGroup) v;
if (index < vg.getChildCount()) {
removeNonAnvilViews(vg, index, vg.getChildCount() - index);
}
}
indices.pop();
if (v != null){
views.pop();
}
}
|
Mount describes a mount point. Mount point is a Renderable function
attached to some ViewGroup. Mount point keeps track of the virtual layout
declared by Renderable
|
end
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
<T> void attr(String name, T value) {
View currentView = views.peek();
if (currentView == null) {
return;
}
@SuppressWarnings("unchecked")
T currentValue = (T) get(currentView, name);
if (currentValue == null || !currentValue.equals(value)) {
for (AttributeSetter setter : attributeSetters) {
if (setter.set(currentView, name, value, currentValue)) {
set(currentView, name, value);
return;
}
}
}
}
|
Mount describes a mount point. Mount point is a Renderable function
attached to some ViewGroup. Mount point keeps track of the virtual layout
declared by Renderable
|
attr
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
private void removeNonAnvilViews(ViewGroup vg, int start, int count) {
final int end = start + count - 1;
for (int i = end; i >= start; i--) {
View v = vg.getChildAt(i);
if (get(v, "_anvil") != null) {
vg.removeView(v);
}
}
}
|
Mount describes a mount point. Mount point is a Renderable function
attached to some ViewGroup. Mount point keeps track of the virtual layout
declared by Renderable
|
removeNonAnvilViews
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
public void skip() {
int i;
ViewGroup vg = (ViewGroup) views.peek();
for (i = indices.pop(); i < vg.getChildCount(); i++) {
View v = vg.getChildAt(i);
if (get(v, "_anvil") != null) {
indices.push(i);
return;
}
}
indices.push(i);
}
|
Mount describes a mount point. Mount point is a Renderable function
attached to some ViewGroup. Mount point keeps track of the virtual layout
declared by Renderable
|
skip
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
public View currentView() {
return views.peek();
}
|
Mount describes a mount point. Mount point is a Renderable function
attached to some ViewGroup. Mount point keeps track of the virtual layout
declared by Renderable
|
currentView
|
java
|
anvil-ui/anvil
|
anvil/src/main/java/trikita/anvil/Anvil.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/main/java/trikita/anvil/Anvil.java
|
MIT
|
public static BaseDSL.ViewClassResult fragmentBreadCrumbs() {
return BaseDSL.v(FragmentBreadCrumbs.class);
}
|
DSL for creating views and settings their attributes.
This file has been generated by {@code gradle generateSDK15DSL}.
It contains views and their setters from API level 15.
Please, don't edit it manually unless for debugging.
|
fragmentBreadCrumbs
|
java
|
anvil-ui/anvil
|
anvil/src/sdk15/java/trikita/anvil/DSL.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/sdk15/java/trikita/anvil/DSL.java
|
MIT
|
public static Void fragmentBreadCrumbs(Anvil.Renderable r) {
return BaseDSL.v(FragmentBreadCrumbs.class, r);
}
|
DSL for creating views and settings their attributes.
This file has been generated by {@code gradle generateSDK15DSL}.
It contains views and their setters from API level 15.
Please, don't edit it manually unless for debugging.
|
fragmentBreadCrumbs
|
java
|
anvil-ui/anvil
|
anvil/src/sdk15/java/trikita/anvil/DSL.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/sdk15/java/trikita/anvil/DSL.java
|
MIT
|
public static BaseDSL.ViewClassResult appWidgetHostView() {
return BaseDSL.v(AppWidgetHostView.class);
}
|
DSL for creating views and settings their attributes.
This file has been generated by {@code gradle generateSDK15DSL}.
It contains views and their setters from API level 15.
Please, don't edit it manually unless for debugging.
|
appWidgetHostView
|
java
|
anvil-ui/anvil
|
anvil/src/sdk15/java/trikita/anvil/DSL.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/sdk15/java/trikita/anvil/DSL.java
|
MIT
|
public static Void appWidgetHostView(Anvil.Renderable r) {
return BaseDSL.v(AppWidgetHostView.class, r);
}
|
DSL for creating views and settings their attributes.
This file has been generated by {@code gradle generateSDK15DSL}.
It contains views and their setters from API level 15.
Please, don't edit it manually unless for debugging.
|
appWidgetHostView
|
java
|
anvil-ui/anvil
|
anvil/src/sdk15/java/trikita/anvil/DSL.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/sdk15/java/trikita/anvil/DSL.java
|
MIT
|
public static BaseDSL.ViewClassResult gestureOverlayView() {
return BaseDSL.v(GestureOverlayView.class);
}
|
DSL for creating views and settings their attributes.
This file has been generated by {@code gradle generateSDK15DSL}.
It contains views and their setters from API level 15.
Please, don't edit it manually unless for debugging.
|
gestureOverlayView
|
java
|
anvil-ui/anvil
|
anvil/src/sdk15/java/trikita/anvil/DSL.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/sdk15/java/trikita/anvil/DSL.java
|
MIT
|
public static Void gestureOverlayView(Anvil.Renderable r) {
return BaseDSL.v(GestureOverlayView.class, r);
}
|
DSL for creating views and settings their attributes.
This file has been generated by {@code gradle generateSDK15DSL}.
It contains views and their setters from API level 15.
Please, don't edit it manually unless for debugging.
|
gestureOverlayView
|
java
|
anvil-ui/anvil
|
anvil/src/sdk15/java/trikita/anvil/DSL.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/sdk15/java/trikita/anvil/DSL.java
|
MIT
|
public static BaseDSL.ViewClassResult extractEditText() {
return BaseDSL.v(ExtractEditText.class);
}
|
DSL for creating views and settings their attributes.
This file has been generated by {@code gradle generateSDK15DSL}.
It contains views and their setters from API level 15.
Please, don't edit it manually unless for debugging.
|
extractEditText
|
java
|
anvil-ui/anvil
|
anvil/src/sdk15/java/trikita/anvil/DSL.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/sdk15/java/trikita/anvil/DSL.java
|
MIT
|
public static Void extractEditText(Anvil.Renderable r) {
return BaseDSL.v(ExtractEditText.class, r);
}
|
DSL for creating views and settings their attributes.
This file has been generated by {@code gradle generateSDK15DSL}.
It contains views and their setters from API level 15.
Please, don't edit it manually unless for debugging.
|
extractEditText
|
java
|
anvil-ui/anvil
|
anvil/src/sdk15/java/trikita/anvil/DSL.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/sdk15/java/trikita/anvil/DSL.java
|
MIT
|
public static BaseDSL.ViewClassResult keyboardView() {
return BaseDSL.v(KeyboardView.class);
}
|
DSL for creating views and settings their attributes.
This file has been generated by {@code gradle generateSDK15DSL}.
It contains views and their setters from API level 15.
Please, don't edit it manually unless for debugging.
|
keyboardView
|
java
|
anvil-ui/anvil
|
anvil/src/sdk15/java/trikita/anvil/DSL.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/sdk15/java/trikita/anvil/DSL.java
|
MIT
|
public static Void keyboardView(Anvil.Renderable r) {
return BaseDSL.v(KeyboardView.class, r);
}
|
DSL for creating views and settings their attributes.
This file has been generated by {@code gradle generateSDK15DSL}.
It contains views and their setters from API level 15.
Please, don't edit it manually unless for debugging.
|
keyboardView
|
java
|
anvil-ui/anvil
|
anvil/src/sdk15/java/trikita/anvil/DSL.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/sdk15/java/trikita/anvil/DSL.java
|
MIT
|
public static BaseDSL.ViewClassResult gLSurfaceView() {
return BaseDSL.v(GLSurfaceView.class);
}
|
DSL for creating views and settings their attributes.
This file has been generated by {@code gradle generateSDK15DSL}.
It contains views and their setters from API level 15.
Please, don't edit it manually unless for debugging.
|
gLSurfaceView
|
java
|
anvil-ui/anvil
|
anvil/src/sdk15/java/trikita/anvil/DSL.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/sdk15/java/trikita/anvil/DSL.java
|
MIT
|
public static Void gLSurfaceView(Anvil.Renderable r) {
return BaseDSL.v(GLSurfaceView.class, r);
}
|
DSL for creating views and settings their attributes.
This file has been generated by {@code gradle generateSDK15DSL}.
It contains views and their setters from API level 15.
Please, don't edit it manually unless for debugging.
|
gLSurfaceView
|
java
|
anvil-ui/anvil
|
anvil/src/sdk15/java/trikita/anvil/DSL.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/sdk15/java/trikita/anvil/DSL.java
|
MIT
|
public static BaseDSL.ViewClassResult surfaceView() {
return BaseDSL.v(SurfaceView.class);
}
|
DSL for creating views and settings their attributes.
This file has been generated by {@code gradle generateSDK15DSL}.
It contains views and their setters from API level 15.
Please, don't edit it manually unless for debugging.
|
surfaceView
|
java
|
anvil-ui/anvil
|
anvil/src/sdk15/java/trikita/anvil/DSL.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/sdk15/java/trikita/anvil/DSL.java
|
MIT
|
public static Void surfaceView(Anvil.Renderable r) {
return BaseDSL.v(SurfaceView.class, r);
}
|
DSL for creating views and settings their attributes.
This file has been generated by {@code gradle generateSDK15DSL}.
It contains views and their setters from API level 15.
Please, don't edit it manually unless for debugging.
|
surfaceView
|
java
|
anvil-ui/anvil
|
anvil/src/sdk15/java/trikita/anvil/DSL.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/sdk15/java/trikita/anvil/DSL.java
|
MIT
|
public static BaseDSL.ViewClassResult textureView() {
return BaseDSL.v(TextureView.class);
}
|
DSL for creating views and settings their attributes.
This file has been generated by {@code gradle generateSDK15DSL}.
It contains views and their setters from API level 15.
Please, don't edit it manually unless for debugging.
|
textureView
|
java
|
anvil-ui/anvil
|
anvil/src/sdk15/java/trikita/anvil/DSL.java
|
https://github.com/anvil-ui/anvil/blob/master/anvil/src/sdk15/java/trikita/anvil/DSL.java
|
MIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.