Skip to content

Commit

Permalink
general enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
vegegoku committed Dec 29, 2024
1 parent 077b291 commit 7ffed09
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
15 changes: 15 additions & 0 deletions domino-ui/src/main/java/org/dominokit/domino/ui/dnd/Draggable.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static org.dominokit.domino.ui.utils.ElementsFactory.elements;

import elemental2.dom.*;
import java.util.Objects;
import java.util.function.Consumer;
import org.dominokit.domino.ui.IsElement;
import org.dominokit.domino.ui.utils.DominoElement;
Expand Down Expand Up @@ -167,4 +168,18 @@ public String getId() {
public interface DraggableConfig {
boolean isEnabled();
}

@Override
public boolean equals(Object o) {
if (!(o instanceof Draggable)) {
return false;
}
Draggable<?> draggable = (Draggable<?>) o;
return Objects.equals(id, draggable.id);
}

@Override
public int hashCode() {
return Objects.hashCode(id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
*/
package org.dominokit.domino.ui.utils.meta;

import static java.util.Objects.nonNull;

import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
import java.util.function.Consumer;
import org.dominokit.domino.ui.utils.ComponentMeta;
import org.dominokit.domino.ui.utils.HasMeta;

Expand All @@ -29,7 +34,8 @@
public class AttributeMeta<T> implements ComponentMeta {

private String key;
private final T value;
private T value;
private Set<Consumer<T>> changeHandlers = new HashSet<>();

/**
* Creates a new instance of {@code AttributeMeta} with the specified key and value.
Expand Down Expand Up @@ -76,6 +82,17 @@ public T getValue() {
return value;
}

/**
* Gets the value stored as metadata.
*
* @return The value associated with this metadata item.
*/
public AttributeMeta<T> setValue(T value) {
this.value = value;
this.changeHandlers.forEach(c -> c.accept(this.value));
return this;
}

/**
* Gets the key associated with this metadata item.
*
Expand All @@ -85,4 +102,11 @@ public T getValue() {
public String getKey() {
return key;
}

public AttributeMeta<T> onValueChanged(Consumer<T> handler) {
if (nonNull(handler)) {
this.changeHandlers.add(handler);
}
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@ textarea.dui-field-input {
outline-offset: var(--dui-form-field-checkbox-outline-offset);
}

.dui-form-radio-group[readonly] .dui-form-radio,
.dui-form-radio[readonly] {
pointer-events: none;
}

.dui-disable-transition .dui-form-checkbox .dui-checkbox-label:before,
.dui-form-checkbox .dui-checkbox-label.dui-disable-transition :before,
.dui-form-checkbox.dui-disable-transition .dui-checkbox-label:before {
Expand Down

0 comments on commit 7ffed09

Please sign in to comment.