chooser.getElement().getStyle().setWidth(90, Style.Unit.PX);
title.setStyleName("applet_title");
status.addStyleName("applet_status");
RootPanel.get("applet-bar").addDomHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (DOM.getElementById("main_panel").getClientWidth() > 805) {
DOM.getElementById("main_panel").getStyle()
.setMarginRight(157, Style.Unit.PX);
DOM.getElementById("applet-bar").getStyle()
.setWidth(140, Style.Unit.PX);
status.getElement().getStyle()
.setProperty("MozTransform", "rotate(0deg)");
status.getElement().getStyle()
.setProperty("WebkitTransform", "rotate(0deg)");
status.getElement().getStyle()
.setProperty("Transform", "rotate(0deg)");
status.getElement().getStyle()
.setMarginLeft(7, Style.Unit.PX);
status.getElement().getStyle()
.setMarginTop(15, Style.Unit.PX);
status.getElement().getStyle().setWidth(120, Style.Unit.PX);
button_container.getElement().getStyle().setOpacity(1);
title.getElement().getStyle().setOpacity(1);
} else if (DOM.getElementById("applet-bar").getClientWidth() < 80) {
DOM.getElementById("applet-bar").getStyle()
.setBackgroundColor("#fabebe");
}
}
}, MouseOverEvent.getType());
locker_r = RootPanel.get("applet-bar").addDomHandler(
new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
DOM.getElementById("applet-bar").getStyle()
.setBackgroundColor("#FFFFFF");
DOM.getElementById("main_panel").getStyle()
.setMarginRight(50, Style.Unit.PX);
DOM.getElementById("applet-bar").getStyle()
.setWidth(33, Style.Unit.PX);
status.getElement().getStyle()
.setProperty("MozTransform", "rotate(90deg)");
status.getElement()
.getStyle()
.setProperty("WebkitTransform", "rotate(90deg)");
status.getElement().getStyle()
.setProperty("Transform", "rotate(90deg)");
status.getElement().getStyle()
.setMarginLeft(-86, Style.Unit.PX);
status.getElement().getStyle()
.setMarginTop(60, Style.Unit.PX);
status.getElement().getStyle()
.setWidth(200, Style.Unit.PX);
button_container.getElement().getStyle().setOpacity(0);
title.getElement().getStyle().setOpacity(0);
}
}, MouseOutEvent.getType());
final Element lock = DOM.getElementById("lock");
DOM.setEventListener(lock, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
if (flag) {
lock.setAttribute("src", "images/lock.png");
locker_r.removeHandler();
flag = false;
} else {
lock.setAttribute("src", "images/unlock.png");
flag = true;
locker_r = RootPanel.get("applet-bar").addDomHandler(
new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
DOM.getElementById("applet-bar").getStyle()
.setBackgroundColor("#FFFFFF");
DOM.getElementById("main_panel").getStyle()
.setMarginRight(50, Style.Unit.PX);
DOM.getElementById("applet-bar").getStyle()
.setWidth(33, Style.Unit.PX);
status.getElement()
.getStyle()
.setProperty("MozTransform",
"rotate(90deg)");
status.getElement()
.getStyle()
.setProperty("WebkitTransform",
"rotate(90deg)");
status.getElement()
.getStyle()
.setProperty("Transform",
"rotate(90deg)");
status.getElement().getStyle()
.setMarginLeft(-86, Style.Unit.PX);
status.getElement().getStyle()
.setMarginTop(60, Style.Unit.PX);
status.getElement().getStyle()
.setWidth(200, Style.Unit.PX);
button_container.getElement().getStyle()
.setOpacity(0);
title.getElement().getStyle().setOpacity(0);
}
}, MouseOutEvent.getType());
}
}
});
DOM.sinkEvents(lock, Event.ONCLICK);
VerticalPanel tmp = new VerticalPanel();
tmp.add(rescan);
tmp.add(chooser);
button_container.add(tmp);
main.add(title);
main.add(status);
main.add(button_container);
main.add(on_off);
main.add(applet);
RootPanel.get("applet-bar").add(main);
on_off.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// send changeStatus signal
if (event.getRelativeElement().getStyle().getColor()
.equals("red")) {
event.getRelativeElement().getStyle().setColor("#38D12F");
} else {
event.getRelativeElement().getStyle().setColor("red");
}
AppletBar.APPLET_BAR.changeState();
}
});
on_off.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
event.getRelativeElement().getStyle()
.setCursor(Style.Cursor.POINTER);
}