Example usage for com.google.gwt.user.client.ui HTML HTML

List of usage examples for com.google.gwt.user.client.ui HTML HTML

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui HTML HTML.

Prototype

protected HTML(Element element) 

Source Link

Document

This constructor may be used by subclasses to explicitly use an existing element.

Usage

From source file:com.cms.gwt.fs.client.view.calendar.ExtMonthPanel.java

License:Apache License

private void buildPanel() {
    if (renderer.enableDragAndDrop()) {
        for (int i = 0; i < dropControllers.size(); i++) {
            final MonthPanelDropController real = dropControllers.get(i);
            dragController.unregisterDropController(real);
        }/*from   w ww .  j  a va 2  s  .  c om*/
        dropControllers.clear();
    }

    monthPanel.clear();
    DOM.setStyleAttribute(monthPanel.getElement(), "width", "100%");
    DOM.setStyleAttribute(monthPanel.getElement(), "height", "100%");

    helperCal.setFirstDayOfWeek(firstDayOfWeek);
    xPos = 0;
    yPos = 0;
    final Calendar today = new GregorianCalendar();
    final DateTimeFormat dayFormatter = DateTimeFormat.getFormat("EEEE");
    for (int i = firstDayOfWeek; i < 7 + firstDayOfWeek; i++) {
        helperCal.set(Calendar.DAY_OF_WEEK, i);
        HTML heading = new HTML(dayFormatter.format(helperCal.getTime()));
        heading.setStyleName("Calendar-MonthHeading");
        monthPanel.setWidget(yPos, xPos, heading);
        monthPanel.getCellFormatter().setHorizontalAlignment(yPos, xPos, HorizontalPanel.ALIGN_CENTER);
        monthPanel.getCellFormatter().setHeight(yPos, xPos, "9%");
        monthPanel.getColumnFormatter().setWidth(xPos, "12%");
        xPos++;
    }
    yPos++;

    // set logical first day of the month
    helperCal.setTime(current.getTime());
    helperCal.set(Calendar.DAY_OF_MONTH, 1);
    helperCal.set(Calendar.HOUR_OF_DAY, 0);
    helperCal.set(Calendar.MINUTE, 0);
    helperCal.set(Calendar.SECOND, 0);
    helperCal.set(Calendar.MILLISECOND, 0);
    firstLogical = helperCal.getTime();
    // set logical last day of the month
    helperCal.add(Calendar.MONTH, 1);
    helperCal.add(Calendar.MILLISECOND, -1);
    lastLogical = helperCal.getTime();
    // now loop over full weeks for showing days
    helperCal.setTime(current.getTime());
    helperCal.add(Calendar.DAY_OF_MONTH, -(helperCal.get(Calendar.DAY_OF_MONTH)));
    while (helperCal.get(Calendar.DAY_OF_WEEK) != helperCal.getFirstDayOfWeek()) {
        helperCal.add(Calendar.DAY_OF_MONTH, -1);
    }
    firstShow = helperCal.getTime();
    for (int y = 1; y < 8; y++) {
        for (int x = 0; x < 7; x++) {
            monthPanel.getCellFormatter().setHeight(y, x, "13%");
            monthPanel.getCellFormatter().addStyleName(y, x, "Calendar-Month-Height");
            final ExtMonthPanelDayPanel result = makeDayPanel(helperCal);

            // apply styles here for last month's days, today and next
            // month's days
            if (DateUtils.isSameDay(today, helperCal)) {
                result.addStyleName("Calendar-Month-Today");

            } else if (current.get(Calendar.MONTH) == helperCal.get(Calendar.MONTH)) {
                result.addStyleName("Calendar-Month-CurrentMonth");

            } else {
                result.addStyleName("Calendar-Month-OtherMonth");
            }

            monthPanel.setWidget(y, x, result);
            // we do NOT have dragging enabled
            // if (renderer.enableDragAndDrop() && dragController != null) {
            // final MonthPanelDropController dropController = new
            // MonthPanelDropController(
            // result);
            // dropControllers.add(dropController);
            // dragController.registerDropController(dropController);
            // }
            helperCal.add(Calendar.DAY_OF_MONTH, 1);
        }
    }
    lastShow = helperCal.getTime();
    Window.addResizeHandler(this);
}

From source file:com.cms.gwt.fs.client.view.calendar.ExtMultiView.java

License:Apache License

public ExtMultiView(EventController newController, DateRenderer newRenderer, int defaultType,
        boolean alignNavigationCenter, boolean displayTodayButton) {

    super();//from   w  w  w .ja v  a2 s. c  om
    super.setSpacing(0);
    super.setStyleName(FtrGwtDateCss.DATE_TYPE_PANEL);

    renderer = newRenderer;
    controller = newController;

    topPanel.setSpacing(0);
    topPanel.setBorderWidth(0);
    topPanel.setStyleName(FtrGwtDateCss.DATE_TYPE_PANEL);
    topPanel.setWidth("100%");
    if (alignNavigationCenter) {
        topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    }

    prevMore.addClickHandler(this);
    DOM.setStyleAttribute(prevMore.getElement(), "cursor", "pointer");
    prev.addClickHandler(this);
    DOM.setStyleAttribute(prev.getElement(), "cursor", "pointer");
    next.addClickHandler(this);
    DOM.setStyleAttribute(next.getElement(), "cursor", "pointer");
    nextMore.addClickHandler(this);
    DOM.setStyleAttribute(nextMore.getElement(), "cursor", "pointer");
    today.addClickHandler(this);

    navigation.setSpacing(0);
    navigation.addStyleName("Calendar-Navigation");
    navigation.setVerticalAlignment(ALIGN_MIDDLE);
    if (alignNavigationCenter) {
        navigation.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    }

    if (renderer.useShowMore()) {
        navigation.add(prevMore);
        navigation.setCellVerticalAlignment(prevMore, ALIGN_MIDDLE);
        navigation.add(new HTML("&nbsp;"));
    }
    navigation.add(prev);
    navigation.setCellVerticalAlignment(prev, ALIGN_MIDDLE);
    navigation.add(new HTML("&nbsp;"));
    navigation.add(dayInfo);
    dayInfo.setStyleName("Calendar-DayInfo");
    navigation.setCellVerticalAlignment(dayInfo, ALIGN_MIDDLE);
    navigation.add(new HTML("&nbsp;"));
    navigation.add(next);
    navigation.setCellVerticalAlignment(next, ALIGN_MIDDLE);
    navigation.add(new HTML("&nbsp;"));
    if (renderer.useShowMore()) {
        navigation.add(nextMore);
        navigation.setCellVerticalAlignment(nextMore, ALIGN_MIDDLE);
        navigation.add(new HTML("&nbsp;"));
    }
    if (displayTodayButton) {
        navigation.add(today);
        today.addStyleName("Calendar-BtnToday");
        today.setSize(55);
        navigation.setCellVerticalAlignment(today, ALIGN_MIDDLE);
        navigation.add(new HTML("&nbsp;"));
    }

    navigation.add(eventInfo);
    eventInfo.setStyleName("Calendar-EventInfo");

    topPanel.add(navigation);
    topPanel.setCellVerticalAlignment(navigation, HorizontalPanel.ALIGN_BOTTOM);

    topPanel.add(viewType);
    topPanel.setCellHorizontalAlignment(viewType, HorizontalPanel.ALIGN_RIGHT);
    topPanel.setCellVerticalAlignment(viewType, HorizontalPanel.ALIGN_BOTTOM);

    super.add(topPanel, DockPanel.NORTH);
    super.setCellHeight(topPanel, "15px");

    viewType.setSpacing(0);
    viewType.setBorderWidth(0);
    viewType.setStyleName(FtrGwtDateCss.DATE_TYPE_PANEL);
    viewType.addStyleName("Calendar-ViewType");

    int tabCount = 0;
    if (renderer.supportDayView()) {
        tabCount++;
    }
    if (renderer.supportWeekView()) {
        tabCount++;
    }
    if (renderer.supportMonthView()) {
        tabCount++;
    }

    if (tabCount > 1) {
        if (renderer.supportDayView()) {
            addTab(dayRounded, day);
        }
        if (renderer.supportWeekView()) {
            addTab(weekRounded, week);
        }
        if (renderer.supportMonthView()) {
            addTab(monthRounded, month);
        }
        viewType.add(new HTML("&nbsp;"));
        viewType.add(new HTML("&nbsp;"));
    }

    super.add(body, DockPanel.CENTER);
    super.setCellVerticalAlignment(body, DockPanel.ALIGN_TOP);

    final HTML space = new HTML("&nbsp;");
    super.add(space, DockPanel.SOUTH);
    space.setHeight("10px");

    // do NOT initialize in constructor. Implementor is responsible for
    // setting the initial center date and initial view type.
    // setType(defaultType);
}

From source file:com.cms.gwt.fs.client.view.calendar.ExtMultiView.java

License:Apache License

private void addTab(RoundedPanel label, Label button) {
    items.add(label);// ww  w  .j  a v a  2  s  .co  m
    items.add(button);
    button.addClickHandler(this);
    viewType.add(new HTML("&nbsp;"));
    label.addStyleName("Calendar-ViewTypeOptions");
    viewType.add(label);
}

From source file:com.cognitivemedicine.metricsdashboard.client.adminconsole.AdminConsole.java

License:Apache License

public AdminConsole(DashboardController controller) {
    this.controller = controller;
    tabPanel = new TabLayoutPanel(2.5, Unit.EM);
    tabPanel.setAnimationDuration(200);//from   w w  w  . java2  s  .  c o m
    // tabPanel.getElement().getStyle().setMarginBottom(10.0, Unit.PX);

    HTML metricGroupText = new HTML("METRIC GROUPS");
    tabPanel.add(new MetricsTab(controller), metricGroupText);

    HTML rolesText = new HTML("ROLES");
    tabPanel.add(new RolesTab(controller), rolesText);

    // Add a tab
    HTML moreInfo = new HTML("CHARTS");
    tabPanel.add(new ChartsTab(controller), moreInfo);

    // Return the content
    tabPanel.selectTab(0);
    // tabPanel.ensureDebugId("cwTabPanel");

    HorizontalPanel buttonPanel = new HorizontalPanel();
    // buttonPanel.setWidth("20%");
    buttonPanel.setSpacing(4);
    Image image = new Image(MdConstants.IMG_OK_CHECK);
    image.setSize("24px", "24px");
    PushButton saveButton = new PushButton(image);

    saveButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            AdminConsole.this.hide();
        }
    });

    image = new Image(MdConstants.IMG_CANCEL_X);
    image.setSize("24px", "24px");
    PushButton closeButton = new PushButton(image);
    closeButton.setTitle("Cancel");
    closeButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            AdminConsole.this.hide();
        }
    });
    buttonPanel.add(saveButton);
    buttonPanel.add(closeButton);

    VerticalPanel mainPanel = new VerticalPanel();
    // mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.add(tabPanel);
    mainPanel.add(buttonPanel);

    mainPanel.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_CENTER);

    tabPanel.setHeight("400px");
    tabPanel.setWidth("700px");

    this.setHeight("400px");
    this.setWidth("550px");
    this.setText("Admin Console");
    this.setWidget(mainPanel);
    this.setModal(true);
    this.setGlassEnabled(true);

    this.center();
}

From source file:com.cognitivemedicine.metricsdashboard.client.adminconsole.ChartsTab.java

License:Apache License

public ChartsTab(DashboardController controller) {
    this.controller = controller;

    this.add(new HTML("Charts"));
}

From source file:com.cognitivemedicine.metricsdashboard.client.adminconsole.MetricsTab.java

License:Apache License

private VerticalPanel createLabeledList(String labelText, ListBox listBox) {
    VerticalPanel panel = new VerticalPanel();
    panel.setBorderWidth(2);/*www  . java  2s  .  c o m*/
    HTML label = new HTML(labelText);

    panel.add(label);
    panel.add(listBox);
    return panel;
}

From source file:com.cognitivemedicine.metricsdashboard.client.adminconsole.RolesTab.java

License:Apache License

public RolesTab(DashboardController controller) {
    this.controller = controller;

    this.add(new HTML("Charts"));
}

From source file:com.cognitivemedicine.metricsdashboard.client.charts.ChartEditorPanel.java

License:Apache License

public ChartEditorPanel(ChartWidget parent, DashboardController dashboardController,
        DashboardSettings dashboardSettings, ChartSettings chartSettings) {
    this.parentWidget = parent;
    this.controller = dashboardController;

    String parentId = parent.getElement().getId();

    titleBox = new TextBox();
    titleBox.getElement().setId(parentId + "chartTitleBox");

    periodList = new ListBox();
    periodList.setVisibleItemCount(1);/*from   w w  w  .j  a  v a 2  s .co  m*/
    periodList.getElement().setId(parentId + "periodList");
    for (Period p : Period.values()) {
        periodList.addItem(p.getDisplayValue(), p.getSymbol());
    }

    datetimePicker = new CalendarPicker(parentId, true);

    granularityList = new ListBox();
    granularityList.setVisibleItemCount(1);
    granularityList.getElement().setId(parentId + "granularityList");
    granularityList.addItem("", "");
    for (Granularity g : Granularity.values()) {
        granularityList.addItem(g.getDisplayValue(), g.getSymbol());
    }

    metricGroupList = new ListBox();
    metricGroupList.setVisibleItemCount(1);
    metricGroupList.getElement().setId(parentId + "groupList");
    //        for (MetricGroup g : controller.getMetricsGroups().values()) {
    //            metricGroupList.addItem(g.getName(), g.getName());
    //        }
    metricGroupList.addItem(ALL_METRICS);
    for (String g : controller.getMetaGroupMap().keySet()) {
        metricGroupList.addItem(g, g);
    }
    metricGroupList.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            metricGroupListChanged();
        }
    });

    availableMetricsList = new MultiSelectListBox();
    availableMetricsList.setVisibleItemCount(6);
    availableMetricsList.getElement().setId(parentId + "availableMetricsList");
    //        for (Metric m : controller.getAvailableMetrics().values()) {
    //            availableMetricsList.addItem(m.getName(), m.getName());
    //        }
    for (MetaDefinition m : controller.getMetaDefinitions()) {
        availableMetricsList.addItem(m.toString(), m.toString());
    }

    chartTypeList = new ListBox();
    chartTypeList.setVisibleItemCount(1);
    chartTypeList.getElement().setId(parentId + "chartTypeList");
    for (ChartType c : ChartType.values()) {
        chartTypeList.addItem(c.name());
    }

    liveUpdatesCheckBox = new CheckBox("Live Updates");
    liveUpdatesCheckBox.getElement().setId(parentId + "liveUpdatesCheckBox");

    if (chartSettings != null) {
        loadChartSettings(chartSettings);
    }

    dashboardSettingsUpdated(dashboardSettings);

    mainPanel = new VerticalPanel();
    mainPanel.setSpacing(4);
    mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    // this.add(createFormPanel("Title", titleBox));
    HorizontalPanel titlePanel = new HorizontalPanel();
    HTML titleLabel = new HTML("Title" + ": ");
    titleLabel.setWidth("115px");
    titleBox.setWidth("265px");
    titlePanel.add(titleLabel);
    titlePanel.add(titleBox);
    titlePanel.setCellHorizontalAlignment(titleLabel, HasHorizontalAlignment.ALIGN_RIGHT);
    mainPanel.add(titlePanel);
    mainPanel.add(new HTML("<hr>"));
    mainPanel.add(createFormPanel("Metric", metricGroupList));
    mainPanel.add(createFormPanel("Supported Queries", availableMetricsList));
    //        mainPanel.add(createFormPanel("Chart Type", chartTypeList));
    mainPanel.add(new HTML("<hr>"));
    mainPanel.add(createFormPanel("Period", periodList));
    mainPanel.add(datetimePicker);
    mainPanel.add(new HTML("<hr>"));
    mainPanel.add(createFormPanel("Granularity", granularityList));
    // mainPanel.add(new HTML("<hr>"));
    HorizontalPanel updatePanel = new HorizontalPanel();
    HTML updateLabel = new HTML("Live Updates: ");
    updateLabel.setWidth("115px");
    //        titleBox.setWidth("190px");
    // updatePanel.add(updateLabel);
    updatePanel.add(liveUpdatesCheckBox);
    updatePanel.setCellHorizontalAlignment(updateLabel, HasHorizontalAlignment.ALIGN_RIGHT);
    // mainPanel.add(updatePanel);

    this.setHeight("100%");
    this.setWidth("100%");
    this.add(mainPanel);
    this.setCellHorizontalAlignment(mainPanel, HasHorizontalAlignment.ALIGN_CENTER);
    this.setCellVerticalAlignment(mainPanel, HasVerticalAlignment.ALIGN_MIDDLE);

    // this.add(new HTML(, liveUpdatesCheckBox));
    // this.add(buttonPanel);
    // this.setCellHorizontalAlignment(buttonPanel,HasHorizontalAlignment.ALIGN_CENTER);
}

From source file:com.cognitivemedicine.metricsdashboard.client.charts.ChartEditorPanel.java

License:Apache License

private HorizontalPanel createFormPanel(String fieldName, ListBox list) {
    HorizontalPanel panel = new HorizontalPanel();
    HTML nameLabel = new HTML(fieldName + ": ");
    nameLabel.setWidth("115px");
    list.setWidth("275px");
    // panel.setCellHorizontalAlignment(nameLabel, HasHorizontalAlignment.ALIGN_RIGHT);
    // this.setCellVerticalAlignment(checkBox, HasVerticalAlignment.ALIGN_MIDDLE);
    panel.add(nameLabel);/*from  w  w w.j av a  2 s . c om*/
    panel.add(list);
    panel.setCellHorizontalAlignment(nameLabel, HasHorizontalAlignment.ALIGN_RIGHT);
    return panel;
}

From source file:com.cognitivemedicine.metricsdashboard.client.dashboard.DashboardMainPanel.java

License:Apache License

private void initUi() {
    mainPanel = new VerticalPanel();
    mainPanel.setWidth("300px");
    mainPanel.setSpacing(4);//from   www.  j a v  a 2 s. co m

    VerticalPanel titlePanel = new VerticalPanel();
    titlePanel.setWidth("100%");
    HorizontalPanel logoutPanel = new HorizontalPanel();
    Image logoutImage = new Image(MdConstants.IMG_LOGOUT);
    logoutImage.getElement().getStyle().setCursor(Cursor.POINTER);
    logoutImage.setSize("16px", "16px");
    logoutImage.setTitle("Log Out");
    logoutImage.getElement().getStyle().setProperty("cursor", "hand");
    logoutImage.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            controller.logOut();
        }
    });

    HTML logOutLabel = new HTML("<u><font size=-2>Log Out </font></u>");
    logOutLabel.setHeight("10px");
    // logOutLabel.setStyleName("logoutButton");
    logOutLabel.setStylePrimaryName("logoutButton");
    logOutLabel.getElement().getStyle().setProperty("right", "5px");
    // logOutLabel.getElement().getStyle().setProperty("cursor", "hand");
    logOutLabel.getElement().getStyle().setCursor(Cursor.POINTER);
    logOutLabel.setWidth("100%");
    logOutLabel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            controller.logOut();
        }
    });

    logoutPanel.add(logOutLabel);
    logoutPanel.add(logoutImage);
    logoutPanel.setSpacing(2);

    logoutPanel.setCellHorizontalAlignment(logoutImage, HasHorizontalAlignment.ALIGN_RIGHT);
    logoutPanel.setCellHorizontalAlignment(logOutLabel, HasHorizontalAlignment.ALIGN_RIGHT);

    titlePanel.getElement().getStyle().setProperty("marginLeft", "50");
    titleLabel = new HTML("<font size=4>&nbsp;</font>");
    titleLabel.getElement().setId("dashboardTitleLabel");

    titlePanel.add(logoutPanel);
    titlePanel.add(titleLabel);

    titlePanel.setCellHorizontalAlignment(logoutPanel, HasHorizontalAlignment.ALIGN_RIGHT);

    DecoratorPanel titleDecor = new DecoratorPanel();
    titleDecor.setWidth("250px");
    titleDecor.setHeight("30px");
    mainPanel.add(titlePanel);

    mainPanel.setCellVerticalAlignment(logOutLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    mainPanel.setCellHorizontalAlignment(logOutLabel, HasHorizontalAlignment.ALIGN_RIGHT);
    mainPanel.setCellHorizontalAlignment(titleLabel, HasHorizontalAlignment.ALIGN_LEFT);
    mainPanel.setCellVerticalAlignment(titleLabel, HasVerticalAlignment.ALIGN_MIDDLE);

    Image image = new Image(MdConstants.IMG_TOOLS);
    image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    adminConsoleButton = new PushButton(image);
    adminConsoleButton.getElement().setId("adminConsoleButton");
    adminConsoleButton.setSize("50px", MdConstants.IMG_SIZE);
    adminConsoleButton.setTitle("Show Admin Console");
    adminConsoleButton.setEnabled(false);
    adminConsoleButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            AdminConsole console = new AdminConsole(controller);
        }
    });

    editorDecorator = new DecoratorPanel();
    editorDecorator.setTitle("Dashboard Editor");
    editorDecorator.setWidth("315px");

    toolstripPanel = new DashboardToolStripBar(this);

    dashboardListBox = new ListBox(false);
    dashboardListBox.getElement().setId("dashboardListBox");
    dashboardListBox.setWidth("295px");
    dashboardListBox.setVisibleItemCount(10);
    dashboardListBox.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            dashboardListChanged();
        }
    });

    notesArea = new TextArea();
    notesArea.setVisibleLines(2);
    notesArea.setWidth("290px");
    notesArea.setHeight("50px");
    notesArea.getElement().setId("notesTextArea");

    VerticalPanel editorVerticalPanel = new VerticalPanel();
    editorVerticalPanel.setSpacing(4);
    editorVerticalPanel.add(toolstripPanel);
    editorVerticalPanel.add(dashboardListBox);
    editorVerticalPanel.add(new HTML("<font size=-1><b>Dashboard Notes:</b></font></br>"));
    editorVerticalPanel.add(notesArea);
    editorVerticalPanel.setCellVerticalAlignment(toolstripPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    editorVerticalPanel.setCellHorizontalAlignment(toolstripPanel, HasHorizontalAlignment.ALIGN_CENTER);
    editorDecorator.setWidget(editorVerticalPanel);

    settingsPanel = new DashboardSettingsPanel(this);

    mainPanel.add(editorDecorator);
    mainPanel.add(settingsPanel);
    // mainPanel.add(adminConsoleButton);

    mainPanel.setCellVerticalAlignment(editorDecorator, HasVerticalAlignment.ALIGN_MIDDLE);
    mainPanel.setCellHorizontalAlignment(editorDecorator, HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.setCellVerticalAlignment(settingsPanel, HasVerticalAlignment.ALIGN_TOP);
    mainPanel.setCellHorizontalAlignment(settingsPanel, HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.setCellVerticalAlignment(adminConsoleButton, HasVerticalAlignment.ALIGN_MIDDLE);
    mainPanel.setCellHorizontalAlignment(adminConsoleButton, HasHorizontalAlignment.ALIGN_CENTER);

    this.add(mainPanel);
}