Java 类com.google.gwt.user.client.ui.HasAlignment 实例源码

项目:ephesoft    文件:CalendarWidget.java   
public NavBar(CalendarWidget calendar) {
    super();
    this.calendar = calendar;

    setWidget(bar);
    bar.setStyleName("navbar");
    title.setStyleName("header");

    HorizontalPanel prevButtons = new HorizontalPanel();
    prevButtons.add(prevMonth);
    prevButtons.add(prevYear);

    HorizontalPanel nextButtons = new HorizontalPanel();
    nextButtons.add(nextYear);
    nextButtons.add(nextMonth);

    bar.add(prevButtons, DockPanel.WEST);
    bar.setCellHorizontalAlignment(prevButtons, DockPanel.ALIGN_LEFT);
    bar.add(nextButtons, DockPanel.EAST);
    bar.setCellHorizontalAlignment(nextButtons, DockPanel.ALIGN_RIGHT);
    bar.add(title, DockPanel.CENTER);
    bar.setVerticalAlignment(DockPanel.ALIGN_MIDDLE);
    bar.setCellHorizontalAlignment(title, HasAlignment.ALIGN_CENTER);
    bar.setCellVerticalAlignment(title, HasAlignment.ALIGN_MIDDLE);
    bar.setCellWidth(title, "100%");
}
项目:document-management-system    文件:Status.java   
/**
 * The status
 */
public Status() {
    super(false, true);
    hPanel = new HorizontalPanel();
    image = new Image(OKMBundleResources.INSTANCE.indicator());
    msg = new HTML("");
    space = new HTML("");

    hPanel.add(image);
    hPanel.add(msg);
    hPanel.add(space);

    hPanel.setCellVerticalAlignment(image, HasAlignment.ALIGN_MIDDLE);
    hPanel.setCellVerticalAlignment(msg, HasAlignment.ALIGN_MIDDLE);
    hPanel.setCellHorizontalAlignment(image, HasAlignment.ALIGN_CENTER);
    hPanel.setCellWidth(image, "30px");
    hPanel.setCellWidth(space, "7px");

    hPanel.setHeight("25px");

    msg.setStyleName("okm-NoWrap");

    super.hide();
    setWidget(hPanel);
}
项目:document-management-system    文件:Status.java   
/**
 * Status
 */
public Status() {
    super(false, true);
    hPanel = new HorizontalPanel();
    image = new Image(OKMBundleResources.INSTANCE.indicator());
    msg = new HTML("");
    space = new HTML("");

    hPanel.add(image);
    hPanel.add(msg);
    hPanel.add(space);

    hPanel.setCellVerticalAlignment(image, HasAlignment.ALIGN_MIDDLE);
    hPanel.setCellVerticalAlignment(msg, HasAlignment.ALIGN_MIDDLE);
    hPanel.setCellHorizontalAlignment(image, HasAlignment.ALIGN_CENTER);
    hPanel.setCellWidth(image, "30px");
    hPanel.setCellWidth(space, "7px");

    hPanel.setHeight("25px");

    msg.setStyleName("okm-NoWrap");

    super.hide();
    setWidget(hPanel);
}
项目:Peergos    文件:DynaTableWidget.java   
public NavBar() {
  initWidget(bar);
  bar.setStyleName("navbar");
  status.setStyleName("status");

  HorizontalPanel buttons = new HorizontalPanel();
  buttons.add(gotoFirst);
  buttons.add(gotoPrev);
  buttons.add(gotoNext);
  bar.add(buttons, DockPanel.EAST);
  bar.setCellHorizontalAlignment(buttons, DockPanel.ALIGN_RIGHT);
  bar.add(status, DockPanel.CENTER);
  bar.setVerticalAlignment(DockPanel.ALIGN_MIDDLE);
  bar.setCellHorizontalAlignment(status, HasAlignment.ALIGN_RIGHT);
  bar.setCellVerticalAlignment(status, HasAlignment.ALIGN_MIDDLE);
  bar.setCellWidth(status, "100%");

  // Initialize prev & first button to disabled.
  //
  gotoPrev.setEnabled(false);
  gotoFirst.setEnabled(false);
}
项目:swarm    文件:DynaTableWidget.java   
public NavBar() {
  initWidget(bar);
  bar.setStyleName("navbar");
  status.setStyleName("status");

  HorizontalPanel buttons = new HorizontalPanel();
  buttons.add(gotoFirst);
  buttons.add(gotoPrev);
  buttons.add(gotoNext);
  bar.add(buttons, DockPanel.EAST);
  bar.setCellHorizontalAlignment(buttons, DockPanel.ALIGN_RIGHT);
  bar.add(status, DockPanel.CENTER);
  bar.setVerticalAlignment(DockPanel.ALIGN_MIDDLE);
  bar.setCellHorizontalAlignment(status, HasAlignment.ALIGN_RIGHT);
  bar.setCellVerticalAlignment(status, HasAlignment.ALIGN_MIDDLE);
  bar.setCellWidth(status, "100%");

  // Initialize prev & first button to disabled.
  //
  gotoPrev.setEnabled(false);
  gotoFirst.setEnabled(false);
}
项目:WebConsole    文件:AbsolutePanelComponent.java   
public AbsolutePanelComponent() {
    componentContainer = new HorizontalPanel();
    componentContainer.setWidth("100%");
    componentContainer.setHeight("100%");
    componentContainer.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
    componentContainer.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE);

    setPanelWidget(componentContainer);
}
项目:document-management-system    文件:LogScrollTable.java   
/**
 * Adds new user name row
 *
 * @param userName The user name value
 */
public void addRow(GWTActivity activity) {
    int rows = dataTable.getRowCount();
    dataTable.insertRow(rows);
    dataTable.setHTML(rows, 0, activity.getAction());
    dataTable.setHTML(rows, 1, activity.getUser());
    DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18n("general.date.pattern"));
    dataTable.setHTML(rows, 2, dtf.format(activity.getDate()));
    dataTable.setHTML(rows, 3, activity.getParams());
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 1, HasAlignment.ALIGN_CENTER);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 2, HasAlignment.ALIGN_CENTER);
}
项目:document-management-system    文件:WorkflowDetailTable.java   
/**
 * addRow
 *
 * @param instanceLogEntry
 */
public void addRow(GWTProcessInstanceLogEntry instanceLogEntry) {
    int rows = dataTable.getRowCount();
    dataTable.insertRow(rows);
    dataTable.setHTML(rows, 0, String.valueOf(instanceLogEntry.getProcessDefinitionId()));
    dataTable.setHTML(rows, 1, instanceLogEntry.getProcessDefinitionName());
    dataTable.setHTML(rows, 2, instanceLogEntry.getToken());
    DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18n("general.date.pattern"));
    dataTable.setHTML(rows, 3, dtf.format(instanceLogEntry.getDate()));
    dataTable.setHTML(rows, 4, instanceLogEntry.getType());
    dataTable.setHTML(rows, 5, instanceLogEntry.getInfo());
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 0, HasAlignment.ALIGN_CENTER);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 3, HasAlignment.ALIGN_CENTER);
}
项目:document-management-system    文件:ToolBarButton.java   
public ToolBarButton(Image image, String title, ClickHandler handler) {
    super();
    this.image = image;
    this.image.setTitle(title);
    addClickHandler(handler); // Adding clickhandler to widget

    add(image);
    setCellHorizontalAlignment(image, HasAlignment.ALIGN_CENTER);
    setCellVerticalAlignment(image, HasAlignment.ALIGN_MIDDLE);
    setSize("24", "24");
    setCellHeight(image, "24");
    setCellWidth(image, "24");

    sinkEvents(Event.ONCLICK | Event.MOUSEEVENTS);
}
项目:document-management-system    文件:UserNews.java   
/**
 * Adds a new row
 *
 * @param search The search value
 */
public void addRow(GWTQueryParams search) {
    int rows = table.getRowCount();

    data.put(dataIndexValue, search);

    if (!search.isShared()) {
        table.setHTML(rows, 0, " ");
    } else {
        table.setWidget(rows, 0, new Image(OKMBundleResources.INSTANCE.sharedQuery()));
    }

    table.setHTML(rows, 1, search.getQueryName());
    table.setHTML(rows, 2, "" + dataIndexValue++);
    table.setHTML(rows, 3, "");
    table.getFlexCellFormatter().setVisible(rows, 2, false);

    // The hidden column extends table to 100% width
    CellFormatter cellFormatter = table.getCellFormatter();
    cellFormatter.setWidth(rows, 0, "30px");
    cellFormatter.setHeight(rows, 0, "20px");
    cellFormatter.setHorizontalAlignment(rows, 0, HasAlignment.ALIGN_CENTER);
    cellFormatter.setVerticalAlignment(rows, 0, HasAlignment.ALIGN_MIDDLE);
    cellFormatter.setWidth(rows, 3, "100%");

    table.getRowFormatter().setStyleName(rows, "okm-userNews");
    setRowWordWarp(rows, 4, false);
}
项目:document-management-system    文件:SearchSaved.java   
/**
 * Adds a new row
 *
 * @param search Search parameters to be added.
 */
private void addRow(GWTQueryParams search) {
    int rows = table.getRowCount();

    data.put(new Long(dataIndexValue), search);

    if (!search.isShared()) {
        table.setHTML(rows, 0, " ");
    } else {
        table.setWidget(rows, 0, new Image(OKMBundleResources.INSTANCE.sharedQuery()));
    }

    table.setHTML(rows, 1, search.getQueryName());
    table.setHTML(rows, 2, "" + dataIndexValue++);
    table.setHTML(rows, 3, "");
    table.getCellFormatter().setVisible(rows, 2, false);

    // The hidden column extends table to 100% width
    CellFormatter cellFormatter = table.getCellFormatter();
    cellFormatter.setWidth(rows, 0, "30px");
    cellFormatter.setHeight(rows, 0, "20px");
    cellFormatter.setHorizontalAlignment(rows, 0, HasAlignment.ALIGN_CENTER);
    cellFormatter.setVerticalAlignment(rows, 0, HasAlignment.ALIGN_MIDDLE);
    cellFormatter.setWidth(rows, 3, "100%");

    table.getRowFormatter().setStyleName(rows, "okm-SearchSaved");
    setRowWordWarp(rows, 4, false);
}
项目:gerrit-ci    文件:ProjectConfigurationScreen.java   
public static DialogBox alertWidget(final String header, final String content) {
    final DialogBox dialogBox = new DialogBox();
    final VerticalPanel verticalPanel = new VerticalPanel();

    final Label emptyLabel = new Label("");
    emptyLabel.setSize("auto", "25px");

    dialogBox.setText(header);

    verticalPanel.add(emptyLabel);
    verticalPanel.add(new Label(content));
    verticalPanel.add(emptyLabel);

    final Button buttonClose = new Button("Close", new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            dialogBox.hide();
        }
    });
    buttonClose.setWidth("100px");
    verticalPanel.add(buttonClose);
    verticalPanel.setCellHorizontalAlignment(buttonClose, HasAlignment.ALIGN_CENTER);

    dialogBox.add(verticalPanel);
    dialogBox.setWidth("400px");
    return dialogBox;
}
项目:gerrit-ci    文件:ConfigurationScreen.java   
/**
 * Creates a DialogBox object with the specified header and content and
 * returns it to be displayed.
 *
 * @param header
 *            Title for the alert dialog
 * @param content
 *            Inner message content to display
 * @return A DialogBox object configured with the specified strings
 */
public static DialogBox alertWidget(final String header,
        final String content) {
    final DialogBox dialogBox = new DialogBox();
    final VerticalPanel verticalPanel = new VerticalPanel();

    final Label emptyLabel = new Label("");
    emptyLabel.setSize("auto", "25px");

    dialogBox.setText(header);

    verticalPanel.add(emptyLabel);
    verticalPanel.add(new Label(content));
    verticalPanel.add(emptyLabel);

    final Button buttonClose = new Button("Close", new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            dialogBox.hide();
        }
    });
    buttonClose.setWidth("100px");
    verticalPanel.add(buttonClose);
    verticalPanel.setCellHorizontalAlignment(buttonClose,
            HasAlignment.ALIGN_CENTER);

    dialogBox.add(verticalPanel);
    return dialogBox;
}
项目:yaph    文件:PasswordView.java   
/**
 * Defines the columns in the custom table. Maps the data in the
 * PasswordCard for each row into the appropriate column in the table, and
 * defines handlers for each column.
 */
private void initializeColumns(ListHandler<PasswordCard> sortHandler) {

    // Title.
    titleColumn = new Column<PasswordCard, String>(new TextCell()) {
        @Override
        public String getValue(PasswordCard object) {
            return object.getTitre();
        }
    };
    titleColumn.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
    titleColumn.setSortable(true);
    sortHandler.setComparator(titleColumn, new Comparator<PasswordCard>() {
        @Override
        public int compare(PasswordCard o1, PasswordCard o2) {
            return o1.getTitre().compareTo(o2.getTitre());
        }
    });
    titleColumn.setFieldUpdater(new FieldUpdater<PasswordCard, String>() {
        @Override
        public void update(int index, PasswordCard object, String value) {
            // Called when the user changes the value.
            object.setTitre(value);
            dataProvider.refresh();
        }
    });
    dataGrid.setColumnWidth(0, 25, Unit.PCT);

}
项目:appengine-gwtguestbook-namespaces-java    文件:Guestbook.java   
/**
 * This is the entry point method.
 */
public void onModuleLoad() {
  // Set up guest entries tables, first row for headers.
  guestEntries.setHTML(0, 0, "<b>Guest Name</b>");
  guestEntries.setHTML(0, 1, "<b>Message</b>");

  // Style the entries table.
  guestEntries.addStyleName("gb-GuestEntries");
  guestEntries.getRowFormatter().addStyleName(0, "gb-GuestEntriesHeader");
  guestEntries.getCellFormatter().addStyleName(0, 0, "gb-GuestHeader");
  guestEntries.getCellFormatter().addStyleName(0, 1, "gb-MessageHeader");

  // Attach components together.
  mainPanel.add(errorLabel);
  mainPanel.add(guestSignaturePanel);
  mainPanel.add(guestEntries);

  // Align the signature panel and entries table.
  mainPanel.setWidth("100%");
  mainPanel.setCellHorizontalAlignment(guestSignaturePanel,
      HasAlignment.ALIGN_CENTER);
  mainPanel.setCellHorizontalAlignment(guestEntries,
      HasAlignment.ALIGN_CENTER);
  mainPanel.setCellWidth(guestEntries, "550px");

  // Load and display existing guest entries.
  loadGuestEntries();

  // Attach handlers onto UI components.
  guestSignaturePanel.addEntryUpdateHandler(this);

  // Attach main panel to host HTML page.
  RootPanel.get().add(mainPanel);
}
项目:document-management-system    文件:TabWorkspace.java   
/**
 * TabWorkspace
 */
public TabWorkspace() {
    vPanel = new VerticalPanel();
    iframe = new Frame("about:blank");

    DOM.setElementProperty(iframe.getElement(), "frameborder", "0");
    DOM.setElementProperty(iframe.getElement(), "marginwidth", "0");
    DOM.setElementProperty(iframe.getElement(), "marginheight", "0");

    // Commented because on IE show clear if allowtransparency=true
    DOM.setElementProperty(iframe.getElement(), "allowtransparency", "false");
    DOM.setElementProperty(iframe.getElement(), "scrolling", "auto");

    iframe.setUrl(Main.CONTEXT + "/extra/index.jsp");
    iframe.setStyleName("okm-Iframe");

    vPanel.add(iframe);
    vPanel.setCellHorizontalAlignment(iframe, HasAlignment.ALIGN_CENTER);

    vPanel.setWidth("100%");
    vPanel.setHeight("100%");

    // User workspace values
    if (GeneralComunicator.getWorkspace() == null) {
        timer = new Timer() {
            @Override
            public void run() {
                if (GeneralComunicator.getWorkspace() == null) {
                    firstTimeLoadingWorkspace();
                } else {
                    init();
                }
            }
        };

        firstTimeLoadingWorkspace();
    } else {
        init();
    }

    initWidget(vPanel);
}
项目:appformer    文件:HorizImageListEditorView.java   
@Override
public ImageListEditorView<T> add(final SafeUri uri, final String width, final String height,
                                   final SafeHtml heading, final SafeHtml text, 
                                   final boolean selected, final Command clickCommand) {
    final VerticalPanel panel = new VerticalPanel();
    panel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE);
    panel.setHeight("100%");

    final Image image = new Image(uri);
    image.setWidth(width);
    image.setHeight(height);
    image.addStyleName(style.image());
    final double alpha = selected ? 1 : 0.2;
    image.getElement().setAttribute("style", "filter: alpha(opacity=5);opacity: " + alpha);

    final Tooltip tooltip = new Tooltip();
    tooltip.setTitle( text.asString() );
    tooltip.setWidget(image);
    tooltip.setContainer("body");
    tooltip.setPlacement(Placement.BOTTOM);
    tooltip.setIsAnimated(false);
    tooltip.setShowDelayMs(100);

    final HTML label = new HTML(heading.asString());
    final HorizontalPanel labelPanel = new HorizontalPanel();
    labelPanel.setWidth("100%");
    labelPanel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
    labelPanel.add(label);

    panel.add(tooltip);
    panel.add(labelPanel);        
    mainPanel.add(panel);

    image.addClickHandler(e -> {
        tooltip.hide();
        tooltip.destroy();
        clickCommand.execute();
    });

    return this;
}
项目:dashbuilder    文件:HorizImageListEditorView.java   
@Override
public ImageListEditorView<T> add(final SafeUri uri, final String width, final String height,
                                   final SafeHtml heading, final SafeHtml text, 
                                   final boolean selected, final Command clickCommand) {
    final VerticalPanel panel = new VerticalPanel();
    panel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE);
    panel.setHeight("100%");

    final Image image = new Image(uri);
    image.setWidth(width);
    image.setHeight(height);
    image.addStyleName(style.image());
    final double alpha = selected ? 1 : 0.2;
    image.getElement().setAttribute("style", "filter: alpha(opacity=5);opacity: " + alpha);

    final Tooltip tooltip = new Tooltip();
    tooltip.setTitle( text.asString() );
    tooltip.setWidget(image);
    tooltip.setContainer("body");
    tooltip.setPlacement(Placement.BOTTOM);
    tooltip.setIsAnimated(false);
    tooltip.setShowDelayMs(100);

    final HTML label = new HTML(heading.asString());
    final HorizontalPanel labelPanel = new HorizontalPanel();
    labelPanel.setWidth("100%");
    labelPanel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
    labelPanel.add(label);

    panel.add(tooltip);
    panel.add(labelPanel);        
    mainPanel.add(panel);

    image.addClickHandler(e -> {
        tooltip.hide();
        tooltip.destroy();
        clickCommand.execute();
    });

    return this;
}