-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
79 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
40 changes: 40 additions & 0 deletions
40
user-interface/src/main/java/life/qbic/datamanager/views/general/CollapsableDetails.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package life.qbic.datamanager.views.general; | ||
|
||
import com.vaadin.flow.component.details.Details; | ||
import com.vaadin.flow.component.html.Div; | ||
import java.util.Objects; | ||
|
||
/** | ||
* <b>Collapsable Details</b> | ||
* | ||
* <p>Implementation of the {@link Collapsable} interface for the Vaadin component | ||
* {@link Details}.</p> | ||
* <p> | ||
* For the Vaadin {@link Details} component, it would not be necessary to provide a wrapper object. However | ||
* the interface gives a lot of flexibility to add collapsable elements wrapping other custom | ||
* components while exposing a unified behaviour. | ||
* <p> | ||
* Also we favor a more declarative and readable object API, like {@link #collapse()} or {@link #expand() } over | ||
* e.g. {@link Details#setOpened(boolean)}. | ||
* | ||
* @since 1.7.0 | ||
*/ | ||
public class CollapsableDetails extends Div implements Collapsable { | ||
|
||
private final Details details; | ||
|
||
public CollapsableDetails(Details details) { | ||
this.details = Objects.requireNonNull(details); | ||
add(details); | ||
} | ||
|
||
@Override | ||
public void collapse() { | ||
this.details.setOpened(false); | ||
} | ||
|
||
@Override | ||
public void expand() { | ||
this.details.setOpened(true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters