# Habpanel custom java code

**URL:** <https://community.openhab.org/t/habpanel-custom-java-code/64829>\
**Category:** HABPanel\
**Tags:** habpanel, openhabianpi\
**Created:** [January 19, 2019, 7:14pm UTC](https://community.openhab.org/t/habpanel-custom-java-code/64829 "2019-01-19T19:14:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![drmacro](https://community.openhab.org/letter_avatar_proxy/v4/letter/d/8edcca/32.png) [@drmacro](https://community.openhab.org/u/drmacro)\
**Post date:** [January 19, 2019, 7:14pm UTC](https://community.openhab.org/t/habpanel-custom-java-code/64829/1 "2019-01-19T19:14:59Z")

</div>

While figuring out how to get to a specific dashboard in a habpanel panel I found this discussion that eventually got to some javascript that would go back to a dashoard (in the example code it goes to the main dashboard).

> [@Habpanel with default panel](https://community.openhab.org/t/habpanel-with-default-panel/20173/5):
>
> In OH2 follow that steps : In Habpanel : Edit dashboard → Advanced settings → “Save the current configuration to a new panel configuration” with the name you want, ex: demo In Paper ui : Configuration-\>Services-\> UI Habpanel Configure [image] Fill the “Initial panel configuration” with the name in Habpanel. When you open Habpanel, the default panel will be set with the name panel you save. BR

I know little about using javascript and there is no discussion in that post about how to use the code example.

Where does one put the java code? Is there Openhab docs for this?

Thanks

---

<div class="post-metadata">

**Author:** ![luckymallari](https://community.openhab.org/user_avatar/community.openhab.org/luckymallari/32/15259_2.png) [@luckymallari](https://community.openhab.org/u/luckymallari)\
**Post date:** [January 19, 2019, 8:26pm UTC](https://community.openhab.org/t/habpanel-custom-java-code/64829/2 "2019-01-19T20:26:53Z")

</div>

When I get some more free time (rarely lol) I’ll try to incorporare what @ysc says in [https://github.com/openhab/org.openhab.ui.habpanel/pull/287](https://github.com/openhab/org.openhab.ui.habpanel/pull/287) Mostly cosmetics/coding style that’s why I didn’t bother fixing, but if I go get more time, yeah, I’ll incorporate it. Im also working on a HabPanel “extension” outside the main repo so I can code without worrying about convention/styles/etc.

---

<div class="post-metadata">

**Author:** ![drmacro](https://community.openhab.org/letter_avatar_proxy/v4/letter/d/8edcca/32.png) [@drmacro](https://community.openhab.org/u/drmacro)\
**Post date:** [January 20, 2019, 6:25pm UTC](https://community.openhab.org/t/habpanel-custom-java-code/64829/3 "2019-01-20T18:25:09Z")

</div>

It appears the screensaver is in git.

Is it a custom widget?

How do I find the json file to import? Or is there more to incorporating it in a running OH system?

---

<div class="post-metadata">

**Author:** ![David\_Graeff](https://community.openhab.org/user_avatar/community.openhab.org/david_graeff/32/61322_2.png) [@David\_Graeff](https://community.openhab.org/u/David_Graeff)\
**Post date:** [January 20, 2019, 6:55pm UTC](https://community.openhab.org/t/habpanel-custom-java-code/64829/4 "2019-01-20T18:55:14Z")

</div>

Java and java script are two totally different programming languages. It sounds like you confuse those a bit and using them interchangeable.

---

<div class="post-metadata">

**Author:** ![drmacro](https://community.openhab.org/letter_avatar_proxy/v4/letter/d/8edcca/32.png) [@drmacro](https://community.openhab.org/u/drmacro)\
**Post date:** [January 20, 2019, 7:25pm UTC](https://community.openhab.org/t/habpanel-custom-java-code/64829/5 "2019-01-20T19:25:17Z")

</div>

> [@David\_Graeff](#):
>
> Java and java script are two totally different programming languages. It sounds like you confuse those a bit and using them interchangeable.

I’m completely aware of the differences and I do use the terms interchangeably. 😊  
Please forgive me. 😔

That is because for the last 50 years of my coding career I was able to avoid both for all but minimal necessary exposures. 😉

I’ve been saying things that get the language lawyers riled up for a long, long, long time. You should have been around when I was the lead in a C++ shop. 🕶 And, years before that, dinner at a conference with Kernighan & Ritchie was a riot. 🤪

As for this thread, my original post linked another thread that had a reply with javascript. That thread had nothing (at least to me) that gave an indication of how to use it. Hence this thread.

@luckymallari then noted his github link for a Habpanel screensaver. The demo there looks like a great way to handle this, so, that led to my question of what to do with the contents.

Is it custom widget? Last one of those I tinkered with I got a .json file and imported it from the panel settings manage widgets. Does’t appear to that simple with the screensaver…

---

<div class="post-metadata">

**Author:** ![luckymallari](https://community.openhab.org/user_avatar/community.openhab.org/luckymallari/32/15259_2.png) [@luckymallari](https://community.openhab.org/u/luckymallari)\
**Post date:** [January 20, 2019, 9:20pm UTC](https://community.openhab.org/t/habpanel-custom-java-code/64829/6 "2019-01-20T21:20:52Z")

</div>

It’s the entire habpanel. I think you might need to refresh on newer jargons like pull requests and stuff 🙂 your post made me reminisce my c++ days writing device drivers

---

<div class="post-metadata">

**Author:** ![drmacro](https://community.openhab.org/letter_avatar_proxy/v4/letter/d/8edcca/32.png) [@drmacro](https://community.openhab.org/u/drmacro)\
**Post date:** [January 21, 2019, 5:08pm UTC](https://community.openhab.org/t/habpanel-custom-java-code/64829/7 "2019-01-21T17:08:36Z")

</div>

Yeah, pull requests. Well, I suspected when I looked at the gihub that it was a complete habpanel…

But, I’m not in the mood to play with replacing subsystems on my working system. 🙄

---

<div class="post-metadata">

**Author:** ![luckymallari](https://community.openhab.org/user_avatar/community.openhab.org/luckymallari/32/15259_2.png) [@luckymallari](https://community.openhab.org/u/luckymallari)\
**Post date:** [January 22, 2019, 5:31am UTC](https://community.openhab.org/t/habpanel-custom-java-code/64829/8 "2019-01-22T05:31:00Z")

</div>

Here.. had some free time.

> [@HPEx - HabPanel Extension](https://community.openhab.org/t/hpex-habpanel-extension/65122):
>
> HabPanel Extension Extending the functionality of HabPanel [https://github.com/LuckyMallari/hpex](https://github.com/LuckyMallari/hpex)Current Feature Toggable Drawer item Screen Saver Theater Mode Multi device Configuration Note on Upgrading If you have a previous installation of HabPanelEx, I have noticed that the browser may sometimes cache the javascript file. Always clear your browser’s cache when upgrading so you know you have the latest js file loaded. Setup: Import this Widget from Widget Gallery of HabPanel …
