forked from openhab/openhab-core
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for dashboard links to external services. (openhab#185)
* Added dashboard support for links to external services. Signed-off-by: Pauli Anttila <pauli.anttila@gmail.com> GitOrigin-RevId: ef8d0df
- Loading branch information
1 parent
90de577
commit dc1db54
Showing
2 changed files
with
111 additions
and
2 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
82 changes: 82 additions & 0 deletions
82
...hab.ui.dashboard/src/main/java/org/openhab/ui/dashboard/internal/ExternalServiceTile.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,82 @@ | ||
/** | ||
* Copyright (c) 2010-2017 by the respective copyright holders. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.openhab.ui.dashboard.internal; | ||
|
||
import org.openhab.ui.dashboard.DashboardTile; | ||
|
||
/** | ||
* The dashboard tile for external services. | ||
* | ||
* @author Pauli Anttila - Initial contribution | ||
*/ | ||
public class ExternalServiceTile implements DashboardTile { | ||
private String name; | ||
private String url; | ||
private String overlay; | ||
private String imageUrl; | ||
|
||
private ExternalServiceTile(DashboardTileBuilder builder) { | ||
this.name = builder.name; | ||
this.url = builder.url; | ||
this.overlay = builder.overlay; | ||
this.imageUrl = builder.imageUrl; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
@Override | ||
public String getUrl() { | ||
return url; | ||
} | ||
|
||
@Override | ||
public String getOverlay() { | ||
return overlay; | ||
} | ||
|
||
@Override | ||
public String getImageUrl() { | ||
return imageUrl; | ||
} | ||
|
||
public static class DashboardTileBuilder { | ||
|
||
private String name; | ||
private String url; | ||
private String overlay; | ||
private String imageUrl; | ||
|
||
public DashboardTileBuilder withName(String name) { | ||
this.name = name; | ||
return this; | ||
} | ||
|
||
public DashboardTileBuilder withUrl(String url) { | ||
this.url = url; | ||
return this; | ||
} | ||
|
||
public DashboardTileBuilder withOverlay(String overlay) { | ||
this.overlay = overlay; | ||
return this; | ||
} | ||
|
||
public DashboardTileBuilder withImageUrl(String imageUrl) { | ||
this.imageUrl = imageUrl; | ||
return this; | ||
} | ||
|
||
public ExternalServiceTile build() { | ||
return new ExternalServiceTile(this); | ||
} | ||
} | ||
} |