Java Code Examples for com.google.gwt.user.client.ui.HTML#addClickHandler()

The following examples show how to use com.google.gwt.user.client.ui.HTML#addClickHandler() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public SearchTool(final Harvest harvest, final Index index, PlaceManager placeManager) {
    this.index = index;
    HTML root = new HTML("<i class=\"icon-search\" style='color:#CECECE'></i> " + Console.CONSTANTS.common_label_search());
    root.setTitle(Console.CONSTANTS.common_label_search() + "(" + getShortcut() + ")");
    root.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            showPopup();
        }
    });
    this.popup = new SearchPopup(harvest, index, placeManager);

    GlobalShortcuts.bind("mod+2", new Command() {
        @Override
        public void execute() {
            showPopup();
        }
    });

    initWidget(root);
    setStyleName("hal-searchTool");
}
 
Example 2
public ApplicationHeader(String title) {

        prefix = new HTML("");
        prefix.setStyleName("header-content");
        HTML changeButton = new HTML("(change)");

        changeButton.setStyleName("html-link");
        changeButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent clickEvent) {
                Window.alert("Changing profiles not implemented yet!");
            }
        });

        add(prefix);
        //add(changeButton);

        //changeButton.getElement().getParentElement().setAttribute("style", "vertical-align:middle");

        setProfileName(title);
    }
 
Example 3
Source Project: EasyML   File: StdPanel.java    License: Apache License 2.0 5 votes vote down vote up
protected void init(String msg, String title) {
	this.setTitle("stdErr");
	this.setGlassEnabled(true);

	HTML closeButton = new HTML("X");
	closeButton.setSize("10px", "10px");
	closeButton.setStyleName("closebtn");
	closeButton.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			StdPanel.this.hide();
		}
	});

	ScrollPanel scvp = new ScrollPanel();
	VerticalPanel verticalPanel = new VerticalPanel();

	verticalPanel.add(closeButton);
	verticalPanel.setCellHeight(closeButton, "30px");
	verticalPanel.setStyleName("vpanel");
	HTML desc = new HTML(title);
	desc.setStyleName("popupTitle");
	verticalPanel.add(desc);
	verticalPanel.setCellHeight(desc, "30px");

	TextArea label = new TextArea();
	label.setText(msg);
	label.setReadOnly(true);
	label.setSize("650px", "400px");
	verticalPanel.add(label);
	scvp.add(verticalPanel);
	this.add(scvp);
	this.setStyleName("loading_container");
	this.center();
	this.show();
}
 
Example 4
@Override
public Widget createWidget() {
    HTML refreshBtn = new HTML("<i class='icon-refresh'></i> Refresh Results");
                  refreshBtn.setStyleName("html-link");
                  refreshBtn.getElement().getStyle().setPosition(Style.Position.RELATIVE);
                  refreshBtn.getElement().getStyle().setTop(-80, Style.Unit.PX);
                  refreshBtn.getElement().getStyle().setMarginTop(10, Style.Unit.PX);
                  refreshBtn.getElement().getStyle().setFloat(Style.Float.RIGHT);
                  refreshBtn.getElement().getStyle().setLeft(80, Style.Unit.PCT);

    refreshBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_refresh_tXMetricViewImp());

    refreshBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            presenter.refresh();
        }
    });

    this.executionMetric = new TXExecutionView();
    this.rollbackMetric = new TXRollbackView();
    this.statisticsInfo = new GeneralView();

    SimpleLayout layout = new SimpleLayout()
            .setTitle("Transaction Manager")
            .setHeadline("Transaction Metrics")
            .setDescription(Console.CONSTANTS.subys_tx_metric_desc())
            .addContent("", refreshBtn)
            .addContent("General Info", statisticsInfo.asWidget())
            .addContent("Executions", executionMetric.asWidget())
            .addContent("Rollbacks", rollbackMetric.asWidget());


    return layout.build();
}
 
Example 5
@Override
public Widget createWidget() {

    SimpleLayout layout = new SimpleLayout()
                           .setTitle(Console.CONSTANTS.subsys_naming_jndiView())
                           .setHeadline(Console.CONSTANTS.subsys_naming_jndiBindings());

    HTML refreshButton = new HTML("<i class='icon-refresh'></i> Refresh Results");
    refreshButton.setStyleName("html-link");
    refreshButton.getElement().getStyle().setPosition(Style.Position.RELATIVE);
    refreshButton.getElement().getStyle().setTop(-10, Style.Unit.PX);
    refreshButton.getElement().getStyle().setFloat(Style.Float.RIGHT);
    refreshButton.getElement().getStyle().setLeft(88, Style.Unit.PCT);

    layout.addContent("", refreshButton);

    refreshButton.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_refresh_jndiView());

    refreshButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            presenter.refresh();
        }
    });

    container = new VerticalPanel();
    container.setStyleName("fill-layout");

    layout.addContent("", container);

    return layout.build();
}
 
Example 6
private void updateBreadcrump() {
    breadcrumb.clear();

    int i=1;
    for(final Entry item : history)
    {
        String name = item.getName().equals("/") ? "/Root" : item.getName();
        HTML link = new HTML(name);
        link.addClickHandler(new BreadcrumbClick(i, item));
        breadcrumb.add(link);
        i++;
    }

}
 
Example 7
Source Project: core   File: Header.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
private Widget getLinksSection() {
    linksPane = new HTMLPanel(createLinks());
    linksPane.getElement().setId("header-links-section");
    linksPane.getElement().setAttribute("role", "menubar");
    linksPane.getElement().setAttribute("aria-controls", "main-content-area");

    for (final ToplevelTabs.Config tlt : toplevelTabs) {
        final String id = "header-" + tlt.getToken();

        SafeHtmlBuilder html = new SafeHtmlBuilder();
        html.appendHtmlConstant("<div class='header-link-label'>");
        html.appendHtmlConstant("<span role='menuitem'>");
        html.appendHtmlConstant(tlt.getTitle());
        html.appendHtmlConstant("</span>");
        html.appendHtmlConstant("</div>");
        HTML widget = new HTML(html.toSafeHtml());
        widget.setStyleName("fill-layout");

        widget.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                // navigate either child directly or parent if revealed the first time
                /*boolean hasChild = perspectiveStore.hasChild(tlt.getToken());
                String token = hasChild ?
                        perspectiveStore.getChild(tlt.getToken()) : tlt.getToken();
                boolean updateToken = hasChild ? true : tlt.isUpdateToken();*/

                String token = tlt.getToken();
                placeManager.revealPlace(
                        new PlaceRequest.Builder().nameToken(token).build(), tlt.isUpdateToken()
                );
            }
        });
        linksPane.add(widget, id);

    }

    return linksPane;
}
 
Example 8
public static void build(final HasTreeItems subsysTree, List<SubsystemRecord> subsystems)
{

    SubsystemRegistry registry = Console.getSubsystemRegistry();

    Map<String, List<SubsystemExtensionMetaData>> grouped = new HashMap<String, List<SubsystemExtensionMetaData>>();
    List<String> groupNames = new ArrayList<String>();
    for(SubsystemExtensionMetaData ext : registry.getExtensions())
    {
        if(!grouped.containsKey(ext.getGroup()))
        {
            groupNames.add(ext.getGroup());
            grouped.put(ext.getGroup(), new ArrayList<SubsystemExtensionMetaData>());
        }

        grouped.get(ext.getGroup()).add(ext);
    }

    int includedSubsystems = 0;


    Collections.sort(groupNames);

    // build groups first
    for(String groupName : groupNames)
    {
        List<SubsystemExtensionMetaData> items = grouped.get(groupName);

        final GroupItem groupTreeItem = new GroupItem(groupName);

        for(SubsystemExtensionMetaData candidate : items)
        {
            boolean match = false;
            for(SubsystemRecord actual: subsystems)
            {
                if(actual.getKey().equals(candidate.getKey()))
                {
                    includedSubsystems++;

                    final LHSNavTreeItem link = new LHSNavTreeItem(candidate.getName(), candidate.getToken());
                    link.setKey(candidate.getKey());
                    link.getElement().setAttribute("title", candidate.getName()+" "+
                            actual.getMajor()+"."+
                            actual.getMinor()+"."+
                            actual.getMicro());

                    if(compatibleVersion(actual, candidate)) {
                        groupTreeItem.addItem(link);
                        match = true;
                    }

                }
            }
            /*if (!match) {
                System.out.println("Skip subsystem " + candidate.getKey() + ", " + candidate.getName() + ", #" + candidate.getToken());
            }*/
        }


        // skip empty groups
        if(groupTreeItem.getChildCount()>0)
            subsysTree.addItem(groupTreeItem);

    }

    // fallback in case no manageable subsystems exist
    if(includedSubsystems==0)
    {
        HTML explanation = new HTML("No manageable subsystems exist.");
        explanation.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                displaySubsystemHelp(subsysTree);
            }
        });
        subsysTree.addItem(new TreeItem(explanation));
    }
}
 
Example 9
@Override
public Widget createWidget() {

    LayoutPanel layout = new LayoutPanel();

    FakeTabPanel titleBar = new FakeTabPanel("Virtual Machine Status");
    layout.add(titleBar);

    ClickHandler refreshHandler = new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            presenter.refresh();
        }
    };

    // ----

    VerticalPanel vpanel = new VerticalPanel();
    vpanel.setStyleName("rhs-content-panel");

    ScrollPanel scroll = new ScrollPanel(vpanel);
    layout.add(scroll);

    layout.setWidgetTopHeight(titleBar, 0, Style.Unit.PX, 40, Style.Unit.PX);
    layout.setWidgetTopHeight(scroll, 40, Style.Unit.PX, 100, Style.Unit.PCT);

    // ------------------------

    osName = new HTML();
    processors = new HTML();
    uptime = new HTML();

    HorizontalPanel header = new HorizontalPanel();
    header.setStyleName("fill-layout-width");
    vmName = new ContentHeaderLabel("");
    header.add(vmName);

    HTML refreshBtn = new HTML("<i class='icon-refresh'></i> Refresh Results");
    refreshBtn.setStyleName("html-link");
    refreshBtn.addClickHandler(refreshHandler);

    osPanel = new VerticalPanel();
    osPanel.add(refreshBtn);

    header.add(osPanel);

    vpanel.add(header);
    vpanel.add(osName);
    vpanel.add(processors);
    vpanel.add(uptime);

    // 50/50
    osPanel.getElement().getParentElement().setAttribute("style", "width:50%; vertical-align:top;padding-right:15px;");
    osPanel.getElement().getParentElement().setAttribute("align", "right");
    vmName.getElement().getParentElement().setAttribute("style", "width:50%; vertical-align:top");




    // --

    heapChart = new HeapChartView("Heap Usage") ;
    nonHeapChart = new HeapChartView("Non Heap Usage", false) ;

    vpanel.add(heapChart.asWidget());
    Widget widget = nonHeapChart.asWidget();
    //vpanel.add(widget);

    // --

    threadChart = new ThreadChartView("Thread Usage");
    vpanel.add(threadChart.asWidget());
    //threadPanel.add(osPanel);

    return layout;
}
 
Example 10
/**
 * Update root node. Basicaly a refresh of the tree.
 *
 * @param address
 * @param modelNodes
 */
public void updateRootTypes(ModelNode address, List<ModelNode> modelNodes) {

    deck.showWidget(CHILD_VIEW);
    tree.clear();
    descView.clearDisplay();
    formView.clearDisplay();
    offsetDisplay.clear();

    // IMPORTANT: when pin down is active, we need to consider the offset to calculate the real address
    addressOffset = address;
    nodeHeader.updateDescription(address);

    List<Property> offset = addressOffset.asPropertyList();
    if(offset.size()>0)
    {
        String parentName = offset.get(offset.size() - 1).getName();
        HTML parentTag = new HTML("<div class='gwt-ToggleButton gwt-ToggleButton-down' title='Remove Filter'>&nbsp;" + parentName + "&nbsp;<i class='icon-remove'></i></div>");
        parentTag.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                presenter.onPinTreeSelection(null);
            }
        });
        offsetDisplay.add(parentTag);
    }

    TreeItem rootItem = null;
    String rootTitle = null;
    String key = null;
    if(address.asList().isEmpty())
    {
        rootTitle = DEFAULT_ROOT;
        key = DEFAULT_ROOT;
    }
    else
    {
        List<ModelNode> tuples = address.asList();
        rootTitle = tuples.get(tuples.size() - 1).asProperty().getValue().asString();
        key = rootTitle;
    }

    SafeHtmlBuilder html = new SafeHtmlBuilder().appendEscaped(rootTitle);
    rootItem = new ModelTreeItem(html.toSafeHtml(), key, address, false);
    tree.addItem(rootItem);


    deck.showWidget(RESOURCE_VIEW);
    rootItem.setSelected(true);

    currentRootKey = key;

    addChildrenTypes((ModelTreeItem)rootItem, modelNodes);
}
 
Example 11
public Widget asWidget()
{

    HorizontalPanel layout = new HorizontalPanel();
    layout.getElement().setAttribute("title", "Notification Center");
    layout.setStyleName("notification-center");

    messageButton = new HTML(MESSAGE_LABEL+": "+messageCenter.getNewMessageCount());
    messageButton.addStyleName("notification-button");

    ClickHandler clickHandler = new ClickHandler() {
        public void onClick(ClickEvent event) {

            int numMessages = fetchMessages(messagePopup);
            if(numMessages==0)numMessages=1;

            int width = 250;
            int height = numMessages*35;

            int btnRight = messageButton.getAbsoluteLeft()+messageButton.getOffsetWidth();

            messagePopup.setPopupPosition(
                    btnRight-width,// - (width+10- messageButton.getOffsetWidth()) ,
                    messageButton.getAbsoluteTop() + 25
            );

            messagePopup.show();
            Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
                @Override
                public void execute() {
                    messagePopup.focusOnFirstMessage();
                }
            });


            messagePopup.setWidth(width+"px");
            messagePopup.setHeight(height+"px");
        }
    };

    messageButton.addClickHandler(clickHandler);

    messageDisplay = new HorizontalPanel();
    messageDisplay.getElement().setAttribute("role", "log");
    messageDisplay.getElement().setAttribute("aria-live", "polite");
    messageDisplay.getElement().setAttribute("aria-atomic", "true");

    layout.add(messageDisplay);
    layout.add(messageButton);

    messageDisplay.getElement().getParentElement().setAttribute("style", "width:100%;padding-right:5px");
    messageDisplay.getElement().getParentElement().setAttribute("align", "right");

    messageButton.getElement().getParentElement().setAttribute("style", "width:60px");
    messageButton.getElement().getParentElement().setAttribute("align", "right");

    // register listener
    messageCenter.addMessageListener(this);
    Console.getEventBus().addHandler(ReloadEvent.TYPE, this);

    return layout;
}