Java Code Examples for com.google.gwt.user.client.ui.HasHorizontalAlignment

The following are top voted examples for showing how to use com.google.gwt.user.client.ui.HasHorizontalAlignment. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: unitimes   File: CurriculaTable.java   Source Code and License 6 votes vote down vote up
public HorizontalAlignmentConstant getColumnAlignment(CurriculumColumn column) {
	switch (column) {
	case SELECT:
		return HasHorizontalAlignment.ALIGN_CENTER;
	case LAST_LIKE:
	case PROJECTION:
	case REQUESTED:
	case ENROLLED:
	case SNAPSHOT_REQUESTED:
	case SNAPSHOT_PROJECTION:
	case REGISTERED:
		return HasHorizontalAlignment.ALIGN_RIGHT;
	default:
		return HasHorizontalAlignment.ALIGN_LEFT;
	}
}
 
Example 2
Project: sig-seguimiento-vehiculos   File: BasicToolBar.java   Source Code and License 6 votes vote down vote up
private void initializew3wPanel() {
	w3wPanel = new HorizontalPanel();
	w3wPanel.setSpacing(5);
	w3wPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
	StyleInjector.inject(".w3wPanel { " + "background: #E0ECF8;"
			+ "border-radius: 5px 10px;" + "opacity: 0.8}");
	w3wPanel.setStyleName("w3wPanel");
	w3wPanel.setWidth("415px");

	wordsLabel = new Label();
	w3wAnchor = new AnchorBuilder().setHref("https://what3words.com/")
			.setText(UIMessages.INSTANCE.what3Words())
			.setTitle("https://what3words.com/").build();
	w3wAnchor.getElement().getStyle().setColor("#FF0000");
	w3wAnchor.setVisible(false);
	w3wPanel.add(w3wAnchor);
	w3wPanel.add(wordsLabel);
}
 
Example 3
Project: sig-seguimiento-vehiculos   File: JoinDataDialog.java   Source Code and License 6 votes vote down vote up
private void createSeparatorPanel() {
	separatorPanel = new HorizontalPanel();
	separatorPanel.setSpacing(1);
	separatorPanel.setWidth("100%");
	separatorPanel.addStyleName(ThemeStyles.get().style().borderTop());
	separatorPanel.addStyleName(ThemeStyles.get().style().borderBottom());
	separatorPanel
			.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	separatorPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	separatorPanel.add(new Label(UIMessages.INSTANCE
			.separator(DEFAULT_CSV_SEPARATOR)));
	separatorTextField = new TextField();
	separatorTextField.setText(DEFAULT_CSV_SEPARATOR);
	separatorTextField.setWidth(30);

	separatorPanel.add(separatorTextField);
}
 
Example 4
Project: sig-seguimiento-vehiculos   File: LayerCatalogDialog.java   Source Code and License 6 votes vote down vote up
private ColumnModel<LayerDef> createColumnList(LayerDefProperties props, 
		RowExpander<LayerDef> rowExpander) {
	
	rowExpander.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	rowExpander.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	
	ColumnConfig<LayerDef, String> nameColumn = new ColumnConfig<LayerDef, String>(
			props.name(), 200, SafeHtmlUtils.fromTrustedString("<b>"
					+ UIMessages.INSTANCE.layerManagerToolText() + "</b>"));
	nameColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);		
	
	ColumnConfig<LayerDef, String> typeColumn = new ColumnConfig<LayerDef, String>(
			props.type(), 75, UICatalogMessages.INSTANCE.type());
	typeColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	typeColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);		
	
	ColumnConfig<LayerDef, ImageResource> iconColumn = new ColumnConfig<LayerDef, ImageResource>(
			props.icon(), 32, "");
	iconColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	iconColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	iconColumn.setCell(new ImageResourceCell() {
		@Override
		public void render(Context context, ImageResource value, SafeHtmlBuilder sb) {
			super.render(context, value, sb);
		}
	});
			
	List<ColumnConfig<LayerDef, ?>> columns = new ArrayList<ColumnConfig<LayerDef, ?>>();
	columns.add(rowExpander);
	columns.add(iconColumn);		
	columns.add(nameColumn);
	columns.add(typeColumn);		
	
	return new ColumnModel<LayerDef>(columns);
}
 
Example 5
Project: sig-seguimiento-vehiculos   File: StatusPanelWidget.java   Source Code and License 6 votes vote down vote up
private void initializeStatusPanel() {
	String comboWidth = "125px";
	statusPanel = new VerticalPanel();
	StyleInjector.inject(".statusPanelStyle { " + "background: #E0ECF8;"
			+ "border-radius: 5px 10px;" + "opacity: 0.8}");
	statusPanel.setStyleName("statusPanelStyle");

	statusPanel.setSpacing(5);
	statusPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

	initializeLayerCombo(comboWidth);
	initializeEpsgCombo(comboWidth);
	initializeStatusGrid();

	statusPanel.add(new FieldLabel(layerCombo, UIMessages.INSTANCE
			.sbSelectLayerLabel()));
	statusPanel.add(new FieldLabel(epsgCombo, UIMessages.INSTANCE
			.sbEpsgLabel()));
	statusPanel.add(statusGrid);

	statusPanel.setVisible(false);
}
 
Example 6
Project: LAS   File: LASAnnotationsPanel.java   Source Code and License 6 votes vote down vote up
public LASAnnotationsPanel() {
	super();
	layoutPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
	borderPanel.add(layoutPanel, DockPanel.CENTER);
	layoutPanel.setSize("100%", "100%");
	initWidget(borderPanel);
	borderPanel.setBorderWidth(1);
	layoutPanel.setBorderWidth(0);
	// setWidth(CONSTANTS.DEFAULT_ANNOTATION_PANEL_WIDTH());
	layoutPanel.setTitle(DEFAULT_TOOLTIP);
	closeButton.setTitle(DEFAULT_CLOSE_BUTTON_TOOLTIP);
	closeButton.getElement().getStyle().setProperty("textAlign", "center");
	closeButton.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			setOpenAndPublish(false);
		}
	});
	layoutPanel.add(closeButton, DockPanel.EAST);
	layoutPanel.setCellHeight(closeButton, "1em");
	layoutPanel.setCellWidth(closeButton, "1em");
	closeButton.setSize("1em", "1em");
	layoutPanel.setCellHorizontalAlignment(closeButton,
			HasHorizontalAlignment.ALIGN_RIGHT);
}
 
Example 7
Project: LAS   File: BaseUI.java   Source Code and License 6 votes vote down vote up
/**
 * @param flexTable
 * 
 */
void setTopLeftAlignment(FlexTable flexTable) {
    if (flexTable != null) {
        int rows = flexTable.getRowCount();
        for (int row = 0; row < rows; row++) {
            int cellCount = flexTable.getCellCount(row);
            for (int col = 0; col < cellCount; col++) {
                if (flexTable.isCellPresent(row, col)) {
                    flexTable.getCellFormatter().setHorizontalAlignment(row, col, HasHorizontalAlignment.ALIGN_LEFT);
                    flexTable.getCellFormatter().setVerticalAlignment(row, col, HasVerticalAlignment.ALIGN_TOP);
                    Widget widget = flexTable.getWidget(row, col);
                    if ((widget != null) && (widget.getClass().getName().equals("FlexTable"))) {
                        try {
                            setTopLeftAlignment((FlexTable) widget);
                        } catch (Exception e) {
                           // e.printStackTrace();
                        }
                    }
                }
            }
        }
    }
}
 
Example 8
Project: gwt-uploader   File: SourceCodePopupPanel.java   Source Code and License 6 votes vote down vote up
public SourceCodePopupPanel() {
  // PopupPanel's constructor takes 'auto-hide' as its boolean parameter.
  // If this is set, the panel closes itself automatically when the user
  // clicks outside of it.
  super(true);
  // Set the dialog box's caption.
  setText("Source Code");

  // Enable animation.
  setAnimationEnabled(true);

  // Enable glass background.
  setGlassEnabled(true);
  Button btnClose = new Button("Close");
  btnClose.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      hide();
    }
  });
  VerticalPanel panel = new VerticalPanel();
  panel.add(html);
  panel.add(btnClose);
  panel.setCellHorizontalAlignment(btnClose, HasHorizontalAlignment.ALIGN_RIGHT);
  setWidget(panel);
}
 
Example 9
Project: Wiab.pro   File: DialogBox.java   Source Code and License 6 votes vote down vote up
/**
 * Creates dialog box.
 *
 * @param popup - UniversalPopup on which the dialog is based
 * @param title - title placed in the title bar
 * @param innerWidget - the inner widget of the dialog
 * @param dialogButtons - buttons
 */
public static void create(UniversalPopup popup, String title, Widget innerWidget,
    DialogButton[] dialogButtons) {
  // Title
  popup.getTitleBar().setTitleText(title);

  VerticalPanel contents = new VerticalPanel();
  popup.add(contents);

  // Message
  contents.add(innerWidget);

  // Buttons
  HorizontalPanel buttonPanel = new HorizontalPanel();
  for (DialogButton dialogButton : dialogButtons) {
    Button button = new Button(dialogButton.getTitle());
    button.setStyleName(Dialog.getCss().dialogButton());
    buttonPanel.add(button);
    dialogButton.link(button);
  }
  contents.add(buttonPanel);
  buttonPanel.setStyleName(Dialog.getCss().dialogButtonPanel());
  contents.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_RIGHT);
}
 
Example 10
Project: firefly   File: PackageReadyWidget.java   Source Code and License 6 votes vote down vote up
PackageReadyWidget(MonitorItem monItem, int idx, boolean markAlreadyActivated) {
    _monItem= monItem;
    _idx= idx;
    BackgroundStatus bgStat= monItem.getStatus();
    PackageProgress bundle= bgStat.getPartProgress(idx);
    FlexTable fp= new FlexTable();
    HTMLTable.CellFormatter formatter= fp.getCellFormatter();

    String desc= bgStat.getPackageCount()==1 ? "" :  ZIP_ROOT_TXT + (idx+1);
    fp.setWidget(0,0,makeDownloadNowButton(bundle.getURL(),desc,idx));
    formatter.setWidth(0,0,"100px");

    fp.setWidget(0,4,_icon);
    setShowRetrivedIcon(markAlreadyActivated ? FileDownloadStatus.DONE : FileDownloadStatus.NONE);
    formatter.setWidth(0,4,"20px");
    formatter.setHorizontalAlignment(0,4, HasHorizontalAlignment.ALIGN_RIGHT);
    Label dSize= new Label(StringUtils.getSizeAsString(bundle.getFinalCompressedBytes(),true));
    fp.setWidget(0,2,dSize);
    formatter.setWidth(0,2,"65px");
    formatter.setHorizontalAlignment(0,2, HasHorizontalAlignment.ALIGN_RIGHT);
    initWidget(fp);
}
 
Example 11
Project: x-cure-chat   File: ForumMessageWidget.java   Source Code and License 6 votes vote down vote up
/**
 * Allows to add a horizontal panel with various sharing links to the forum messages.
 * All of the forum messages get a web link to the post.
 * THe regular posts get also sharing links for Twitter, Mail.ru and Facebook.
 * @param panel the panel to add the panel to.
 */
private void addForumMessageSharingLinks( HorizontalPanel panel ) {
	final String forumMessageURL = getForumMessageURL( messageData );
	final String forumMessageTitle = messageData.messageTitle;
	
	HorizontalPanel linksPanel = new HorizontalPanel();
	linksPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_BOTTOM );
	linksPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_RIGHT );
	//Add the post link
	linksPanel.add( new ShareMessageLinkURL( forumMessageURL, forumMessageTitle, i18nTitles.forumPostLinkTitle() ) );
	
	//If it is a regular forum post then add the sharing links
	if( ! messageData.isForumSectionMessage() && ! messageData.isForumTopicMessage() ) {
		linksPanel.add( new HTML("&nbsp;") );
		linksPanel.add( new ShareMessageTwitterURL( forumMessageURL, forumMessageTitle, i18nTitles.shareInTwitterLinkTitle() ) );
		linksPanel.add( new HTML("&nbsp;") );
		linksPanel.add( new ShareMessageVKontakteURL( forumMessageURL, forumMessageTitle, i18nTitles.shareInVKontakteLinkTitle() ) );
		linksPanel.add( new HTML("&nbsp;") );
		linksPanel.add( new ShareMessageMailRuURL( forumMessageURL, forumMessageTitle, i18nTitles.shareInMyWorldLinkTitle() ) );
		linksPanel.add( new HTML("&nbsp;") );
		linksPanel.add( new ShareMessageFacebookURL( forumMessageURL, forumMessageTitle, i18nTitles.shareInInFacebookLinkTitle() ) );
	}
	
	panel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_RIGHT );
	panel.add( linksPanel );
}
 
Example 12
Project: x-cure-chat   File: MessagesStackNavigator.java   Source Code and License 6 votes vote down vote up
private void populate() {
	//Add the scroll panel
	elementPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_LEFT );
	elementPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_BOTTOM );
	scrollPanel.add( elementPanel );
	
	//Initialize the widget
	scrollPanel.setWidth("100%");
	scrollPanel.setStyleName( CommonResourcesContainer.SCROLLABLE_SIMPLE_PANEL );
	scrollPanel.addStyleName( CommonResourcesContainer.STACK_NAVIGATOR_SCROLL_PANEL_ELEMENT_STYLE );
	
	//Set the simple panel
	setComponentWidget( scrollPanel );
	
	//Set the height of the panel to be 40 pixels
	addDecPanelStyle(CommonResourcesContainer.STACK_NAVIGATOR_DEC_PANEL_ELEMENT_STYLE);
}
 
Example 13
Project: firefly   File: GwtUtil.java   Source Code and License 6 votes vote down vote up
public static HorizontalPanel makeHoriPanel(HasHorizontalAlignment.HorizontalAlignmentConstant halign,
                                            HasVerticalAlignment.VerticalAlignmentConstant valign,
                                            Widget... widgets) {
    HorizontalPanel hp = new HorizontalPanel();
    for (Widget w : widgets) {
        hp.add(w);
    }
    if (halign != null) {
        hp.setHorizontalAlignment(halign);
        hp.setWidth("100%");
    }
    if (valign != null) {
        hp.setVerticalAlignment(valign);
    }
    return hp;
}
 
Example 14
Project: x-cure-chat   File: SimpleHorizontalProgressBarUI.java   Source Code and License 6 votes vote down vote up
/**
 * This constructor should be only visible inside of the package.
 * Note that to initialize the progress bar one has to bind it to the text base object.
 * This should be done using the method bindProgressBar(...).
 */
public SimpleHorizontalProgressBarUI( final int progressBarWidthPixels,  final int progressBarHeightPixels,
							   final int maximumProgressBarCapacity, final int currentProgressBarValue ) {
	//Initialize the progress bar content first
	progressBarPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );
	progressBarPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_MIDDLE );
	progressBarPanel.add( leftBar );
	progressBarPanel.add( rightBar );
	
	PROGRESS_BAR_WIDTH_IN_PIXELS = progressBarWidthPixels;
	progressBarPanel.setWidth( PROGRESS_BAR_WIDTH_IN_PIXELS + "px");
	MAX_PROGRESSBAR_CAPACITY = maximumProgressBarCapacity;
	HEIGHT_INNER_IN_PIXELS = progressBarHeightPixels;
	
	//Update the progress bar
	forceProgressUpdate( currentProgressBarValue );
	
	//Initialize the composite
	initWidget( progressBarPanel );
}
 
Example 15
Project: unitime   File: CurriculaTable.java   Source Code and License 6 votes vote down vote up
public HorizontalAlignmentConstant getColumnAlignment(CurriculumColumn column) {
	switch (column) {
	case SELECT:
		return HasHorizontalAlignment.ALIGN_CENTER;
	case LAST_LIKE:
	case PROJECTION:
	case REQUESTED:
	case ENROLLED:
	case SNAPSHOT_REQUESTED:
	case SNAPSHOT_PROJECTION:
	case REGISTERED:
		return HasHorizontalAlignment.ALIGN_RIGHT;
	default:
		return HasHorizontalAlignment.ALIGN_LEFT;
	}
}
 
Example 16
Project: x-cure-chat   File: ViewUserProfileDialogUI.java   Source Code and License 6 votes vote down vote up
/**
 * Fills the main grid data
 */
protected void populateDialog(){
	addMainDataFields();
	addImagesDataGrid();
	addOptionalDataFields();
	addAboutMyselfPanel();
	//Add send message and is friend grid if we are not browsing ourselves
	if( SiteManager.getUserID() != userID ) { 
		addSendMsgAddRemoveFriendActionFields();
	} else {
		//Add the progress bar for viewing ourselve's profile
		addNewGrid( 1, 1, false, "", false);
		HorizontalPanel progressBarPanel = new HorizontalPanel();
		progressBarPanel.setWidth("100%");
		progressBarPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );
		progressBarPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_MIDDLE );
		progressBarPanel.add( progressBarUI );
		addToGrid( FIRST_COLUMN_INDEX, progressBarPanel, false , false );
	}
}
 
Example 17
Project: x-cure-chat   File: ActionGridDialog.java   Source Code and License 6 votes vote down vote up
/**
 * Add a new widget to the compulsory dialog-form grid 
 * @param gridIndex the index of the Grid which we will add elements to
 * @param column the column to add to
 * @param colspan the colump span, for the widget taking more than one column 
 * @param w the widget to add
 * @param isNewRow if true then we will add it to the new row
 * @param setFocus true to set focus on the given Widget
 */
protected void addToGrid( int gridIndex, int column, int colspan, Widget w, boolean isNewRow, boolean hasFocus ) {
	FlexTable currentGrid = indexToGrid.get( gridIndex );
	int currentRowIndex = indexToCurrentRow.get( gridIndex );
	int gridSize = indexToGridSize.get( gridIndex );
	if( currentRowIndex < gridSize ) {
		if( isNewRow ){
			currentRowIndex += 1;
		}
		currentGrid.getFlexCellFormatter().setColSpan( currentRowIndex, column, colspan );
		//In case we are adding a button, then we center it inside the cell
		if( canCenterInCell( colspan, w ) ) {
			currentGrid.getFlexCellFormatter().setHorizontalAlignment( currentRowIndex, column, HasHorizontalAlignment.ALIGN_CENTER );
		}
		currentGrid.setWidget(currentRowIndex, column, w );
		if( hasFocus ) {
			setFocus( w );
		}
	} else {
		Window.alert("An internal error, trying to add an element to a non-existing row.");
	}
	indexToCurrentRow.put( gridIndex, currentRowIndex );
}
 
Example 18
Project: x-cure-chat   File: ShortUserInfoPopupPanel.java   Source Code and License 6 votes vote down vote up
/**
 * Allows to add a small panel containing the "View Full Profile" link,
 * this is made for those who are not smart enough to click on the login
 * name in this dialog again, to get to a full profile view  
 */
private void addViewUserProfileLink() {
	//Initialize the link
	Label userProfileLink = new Label(I18NManager.getTitles().viewFullUserProfileLinkTitle());
	userProfileLink.setWordWrap(false);
	userProfileLink.setStyleName( CommonResourcesContainer.DIALOG_LINK_RED_STYLE );
	userProfileLink.addClickHandler( this.userProfileShowHandler );
	
	//Initialize the panel
	HorizontalPanel userProfileLinkPanel = new HorizontalPanel();
	userProfileLinkPanel.setStyleName( CommonResourcesContainer.VIEW_USER_PROFILE_LINK_PANEL_STYLE );
	userProfileLinkPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );
	userProfileLinkPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_MIDDLE );
	userProfileLinkPanel.add( userProfileLink );
	
	//Add the profile view link panel to the main panel
	mainInfoVPanel.add( userProfileLinkPanel );
}
 
Example 19
Project: x-cure-chat   File: ChatMessageAvatarUI.java   Source Code and License 6 votes vote down vote up
/**
 * The basic constructor
 * @param roomID the id of the room in which this avatar is shown
 */
private ChatMessageAvatarUI( final int roomID ) {
	mainVerticalPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );
	mainVerticalPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_BOTTOM );
	avatarWrapperPanel.add( avatarImageWidget );
	mainVerticalPanel.add( avatarWrapperPanel );
	mainVerticalPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_TOP );
	avatarTitleLabel.setWordWrap( false );
	avatarTitleLabel.setStyleName( CommonResourcesContainer.USER_NAME_AVATAR_STYLE );
	mainVerticalPanel.add( avatarTitleLabel );
	mainFocusPanel.add( mainVerticalPanel );
	
	this.roomID = roomID;
	
	//All composites must call initWidget() in their constructors.
	initWidget( mainFocusPanel );		
}
 
Example 20
Project: ephesoft   File: KV_PP_DetailPresenter.java   Source Code and License 6 votes vote down vote up
private void setProperties() {
	int row = 0;
	Collection<BatchClassPluginConfigDTO> values = controller.getSelectedPlugin().getBatchClassPluginConfigs();
	if (values != null) {
		for (BatchClassPluginConfigDTO pluginDTO : values) {
			if (!pluginDTO.getPluginConfig().getFieldName().equals(BatchClassManagementConstants.KV_PAGE_PROCESS_CONFIG_NAME)) {
				viewTable.setWidget(row, 0, new Label(pluginDTO.getDescription() + BatchClassManagementConstants.COLON));
				viewTable.setWidget(row, 2, new Label(pluginDTO.getValue()));
				viewTable.getFlexCellFormatter().addStyleName(row, 0, "bold_text");
				viewTable.getFlexCellFormatter().setAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT,
						HasVerticalAlignment.ALIGN_MIDDLE);
				row++;
			}
		}
	}
}
 
Example 21
Project: ephesoft   File: DocumentTree.java   Source Code and License 6 votes vote down vote up
/**
 * @param pageTypeBean
 * @param image
 * @return
 */
private VerticalPanel setImagesForTree(final Page pageTypeBean, final RotatableImage image) {
	PageImage pageImage = new PageImage(pageTypeBean, image);
	addPageImage(pageImage);

	Label pageId = new Label(pageImage.pageTitle);
	pageId.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

	VerticalPanel imagePanel = new VerticalPanel();
	imagePanel.setWidth("70px");
	imagePanel.setHeight("82px");
	image.setWidth("66px");
	image.setHeight("66px");

	image.setTitle(pageImage.pageTitle);

	pageId.setWidth("66px");
	pageId.setHeight("12px");

	imagePanel.add(image);
	imagePanel.add(pageId);
	return imagePanel;
}
 
Example 22
Project: ephesoft   File: FolderTableView.java   Source Code and License 6 votes vote down vote up
/**
 * This method adds message to table when no content is present at selected location.
 */
public void addNoContentLabel() {
	Label noContentLabel = new Label(LocaleDictionary.get().getMessageValue(FolderManagementMessages.NO_CONTENT_MESSAGE));
	final Label emptyLabelCol1 = new Label();
	final Label emptyLabelCol3 = new Label();
	final Label emptyLabelCol4 = new Label();
	
	emptyLabelCol1.setWidth(PERCENTAGE_FIVE);
	emptyLabelCol3.setWidth(PERCENTAGE_TWENTY_EIGHT);
	emptyLabelCol4.setWidth(PERCENTAGE_NINE);
	folderDisplayTable.setWidget(0, 0, emptyLabelCol1);
	folderDisplayTable.setWidget(0, 2, emptyLabelCol3);
	folderDisplayTable.setWidget(0, 3, emptyLabelCol4);
	folderDisplayTable.setWidget(0, 1, noContentLabel);
	folderDisplayTable.getCellFormatter()
			.setAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT, HasVerticalAlignment.ALIGN_MIDDLE);
	setEnableAttributeForTableContent(false);
}
 
Example 23
Project: sandbox-frame   File: ProjectViewImpl.java   Source Code and License 6 votes vote down vote up
@Override
public void setFeatures(List<Feature> features) {
    for (int i=0;i<features.size();i++) {
        Feature feature = features.get(i);
        Image image = new Image(Utils.getFeatureIcon(feature));
        image.setTitle(Utils.getFeatureText(feature));
        image.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
        Label label = new Label(Utils.getFeatureText(feature));
        featuresPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        featuresPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        featuresPanel.add(image);
        featuresPanel.setCellWidth(image, "32px");
        featuresPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
        featuresPanel.add(label);
        if (i < features.size()-1) {
            label.getElement().getStyle().setPaddingRight(10, Unit.PX);
        }
        label.getElement().getStyle().setPaddingLeft(8, Unit.PX);
        
    }
}
 
Example 24
Project: sandbox-frame   File: ProjectBundleViewImpl.java   Source Code and License 6 votes vote down vote up
@Override
public void setSdkLanguages(List<SdkLanguage> sdkLanguages) {
       for (int i=0;i<sdkLanguages.size();i++) {
       	SdkLanguage sdkLanguage  = sdkLanguages.get(i);
           Image image = new Image(Utils.getSdkLanguageIcon(sdkLanguage));
           image.setTitle(Utils.getSdkLanguageText(sdkLanguage));
           image.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
           Label label = new Label(Utils.getSdkLanguageText(sdkLanguage));
           sdkLanguagesPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
           sdkLanguagesPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
           sdkLanguagesPanel.add(image);
           sdkLanguagesPanel.setCellWidth(image, "32px");
           sdkLanguagesPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
           sdkLanguagesPanel.add(label);
           if (i < sdkLanguages.size()-1) {
               label.getElement().getStyle().setPaddingRight(10, Unit.PX);
           }
           label.getElement().getStyle().setPaddingLeft(8, Unit.PX);
       }
}
 
Example 25
Project: sandbox-frame   File: ProjectBundleViewImpl.java   Source Code and License 6 votes vote down vote up
@Override
public void setPlatforms(List<Platform> platforms) {
    for (int i=0;i<platforms.size();i++) {
    	Platform platform  = platforms.get(i);
        Image image = new Image(Utils.getPlatformIcon(platform));
        image.setTitle(Utils.getPlatformText(platform));
        image.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
        Label label = new Label(Utils.getPlatformText(platform));
        platformsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        platformsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        platformsPanel.add(image);
        platformsPanel.setCellWidth(image, "32px");
        platformsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
        platformsPanel.add(label);
        if (i < platforms.size()-1) {
            label.getElement().getStyle().setPaddingRight(10, Unit.PX);
        }
        label.getElement().getStyle().setPaddingLeft(8, Unit.PX);
    }
}
 
Example 26
Project: aggregate   File: OdkTablesManageAppLevelFilesSubTab.java   Source Code and License 6 votes vote down vote up
/**
 * Sets up the View Table subtab.
 */
public OdkTablesManageAppLevelFilesSubTab(OdkTablesTabUI parent) {
  this.parent = parent;

  addFileButton = new ServletPopupButton(ADD_FILE_BUTTON_TXT, ADD_FILE_TXT,
      UIConsts.APP_LEVEL_FILE_UPLOAD_SERVLET_ADDR, this, ADD_FILE_TOOLTIP_TXT, ADD_FILE_BALLOON_TXT);

  setStylePrimaryName(UIConsts.VERTICAL_FLOW_PANEL_STYLENAME);

  tableFileData = new OdkTablesViewAppLevelFileInfo(this);

  selectTablePanel = new FlexTable();
  selectTablePanel.getElement().setId("app_level_panel");
  selectTablePanel.setHTML(0, 0, "<h2> Application Level Files </h2>");
  if ( AggregateUI.getUI().getUserInfo().getGrantedAuthorities().contains(GrantedAuthorityName.ROLE_ADMINISTER_TABLES)) {
    selectTablePanel.setWidget(1, 0, addFileButton);
  }

  topPanel = new HorizontalPanel();
  topPanel.add(selectTablePanel);
  topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_JUSTIFY);
  add(topPanel);
  add(tableFileData);
}
 
Example 27
Project: firefly   File: WebMouseReadout.java   Source Code and License 6 votes vote down vote up
private void reinitGridSize(int rows, int col) {
    _currentRows = rows+1;
    _currentCols = col;
    int rowMin= wide ? 0 : 1;
    int rowMax= wide ? WIDE_MAX_ROWS : (rows+1);
    _grid.resize(rowMax, col * 2);
    for (int i = rowMin; (i < rowMax); i++) {
        for (int j = 0; (j < col * 2); j += 2) {
            _grid.getCellFormatter().setHorizontalAlignment(i, j, HasHorizontalAlignment.ALIGN_RIGHT);
        }
    }
    if (wide) {
        if (rows-WIDE_MAX_ROWS>0) {
            gridWide.resize(rows-WIDE_MAX_ROWS, col * 2);
            for (int i=0; (i < rows-WIDE_MAX_ROWS); i++) {
                for (int j = 0; (j < col * 2); j += 2) {
                    gridWide.getCellFormatter().setHorizontalAlignment(i, j, HasHorizontalAlignment.ALIGN_RIGHT);
                }
            }
        }
    }
}
 
Example 28
Project: firefly   File: BaseDialog.java   Source Code and License 6 votes vote down vote up
private void createButtons()  {

        _buttons.addStyleName("base-dialog-buttons");
        _buttons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);


        boolean addHelp= false;
        if (_type.getIDs()!=null) {
            for(ButtonID id : _type.getIDs()) {
                if (id==ButtonID.HELP) addHelp= true;
                else  addButton(id);
            }
        }
        if (_helpID!=null || addHelp) {
            _buttons.add(HelpManager.makeHelpIcon(_helpID));
            
        }
    }
 
Example 29
Project: unitimes   File: SimpleEditPage.java   Source Code and License 5 votes vote down vote up
@Override
public HorizontalAlignmentConstant getCellAlignment() {
	switch (iField.getType()) {
	case toggle:
		return HasHorizontalAlignment.ALIGN_CENTER;
	case students:
		return HasHorizontalAlignment.ALIGN_RIGHT;
	default:
		return HasHorizontalAlignment.ALIGN_LEFT;
	}
}
 
Example 30
Project: unitimes   File: ClassificationsEdit.java   Source Code and License 5 votes vote down vote up
public MyCell(CurriculumInterface curriculum, CurriculumClassificationInterface classification) {
	iCurriculum	= curriculum;
	iClasf = classification;
	
	iPanel = new HorizontalPanel();
	
	iTextBox = new UniTimeTextBox(6, ValueBoxBase.TextAlignment.RIGHT);
	iTextBox.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			try {
				if (iTextBox.getText().isEmpty()) {
					iClasf.setExpected(null);
				} else {
					iClasf.setExpected(Integer.valueOf(iTextBox.getText()));
				}
			} catch (Exception e) {
				iClasf.setExpected(null);
			}
			update();
			for (MySumCell sum: iSums)
				sum.update();
		}
	});
	
	iRearLabel = new HTML("", false);
	iRearLabel.setWidth("50px");
	iRearLabel.setStyleName("unitime-Label");
	iRearLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
	
	iPanel.add(iTextBox);
	iPanel.setCellVerticalAlignment(iTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
	
	iPanel.add(iRearLabel);
	iPanel.setCellVerticalAlignment(iRearLabel, HasVerticalAlignment.ALIGN_MIDDLE);

	initWidget(iPanel);	
	
	update();
}
 
Example 31
Project: unitimes   File: ClassificationsEdit.java   Source Code and License 5 votes vote down vote up
public MySumCell(List<MyCell> cells) {
	iCells = cells;
	for (MyCell cell: iCells)
		cell.iSums.add(this);
	
	iPanel = new HorizontalPanel();
	
	iTextBox = new HTML("", false);
	iTextBox.setWidth("60px");
	iTextBox.setStyleName("unitime-Label");
	iTextBox.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
	
	iRearLabel = new HTML("", false);
	iRearLabel.setWidth("55px");
	iRearLabel.setStyleName("unitime-Label");
	iRearLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
	
	iPanel.add(iTextBox);
	iPanel.setCellVerticalAlignment(iTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
	
	iPanel.add(iRearLabel);
	iPanel.setCellVerticalAlignment(iRearLabel, HasVerticalAlignment.ALIGN_MIDDLE);

	initWidget(iPanel);	
	
	update();
}
 
Example 32
Project: unitimes   File: RoomsTable.java   Source Code and License 5 votes vote down vote up
protected HorizontalAlignmentConstant getColumnAlignment(RoomsColumn column, int idx) {
	switch (column) {
	case CAPACITY:
	case EXAM_CAPACITY:
	case AREA:
		return HasHorizontalAlignment.ALIGN_RIGHT;
	default:
		return HasHorizontalAlignment.ALIGN_LEFT;
	}
}
 
Example 33
Project: unitimes   File: DataTable.java   Source Code and License 5 votes vote down vote up
@Override
public HorizontalAlignmentConstant getCellAlignment() {
	if (iHeader == null || iHeader.getAlignment() == null)
		return HasHorizontalAlignment.ALIGN_LEFT;
	switch (iHeader.getAlignment()) {
	case CENTER: return HasHorizontalAlignment.ALIGN_CENTER;
	case LEFT: return HasHorizontalAlignment.ALIGN_LEFT;
	case RIGHT: return HasHorizontalAlignment.ALIGN_RIGHT;
	default: return HasHorizontalAlignment.ALIGN_LEFT;
	}
}
 
Example 34
Project: sig-seguimiento-vehiculos   File: OpenProjectDialog.java   Source Code and License 5 votes vote down vote up
private Widget createUrlToShareAnchor() {
	urlPanel = new HorizontalPanel();
	urlPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
	urlPanel.setSpacing(1);
	urlToShareAnchor = new AnchorBuilder().build();
	urlPanel.add(urlToShareAnchor);
	Image img = new Image(ImageProvider.INSTANCE.externalLink16());
	urlPanel.add(img);
	urlPanel.setVisible(false);
	return urlPanel;
}
 
Example 35
Project: sig-seguimiento-vehiculos   File: JoinDataDialog.java   Source Code and License 5 votes vote down vote up
private Widget createPanel() {
	final VerticalPanel vPanel = new VerticalPanel();
	vPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_JUSTIFY);

	vPanel.add(createTabPanel());
	vPanel.add(separatorPanel);
	vPanel.add(loadFileButton);
	vPanel.add(comboPanel);
	vPanel.add(layerAttributeComboPanel);

	return vPanel;
}
 
Example 36
Project: sig-seguimiento-vehiculos   File: GeoDataImportDialog.java   Source Code and License 5 votes vote down vote up
private Widget createUrlToShareAnchor() {
	urlPanel = new HorizontalPanel();
	urlPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
	urlPanel.setSpacing(1);
	urlToShareAnchor = new AnchorBuilder().build();
	urlPanel.add(urlToShareAnchor);
	Image img = new Image(ImageProvider.INSTANCE.externalLink16());
	urlPanel.add(img);
	urlPanel.setVisible(false);
	return urlPanel;
}
 
Example 37
Project: appinventor-extensions   File: YoungAndroidPalettePanel.java   Source Code and License 5 votes vote down vote up
private void initExtensionPanel() {
  Anchor addComponentAnchor = new Anchor(MESSAGES.importExtensionMenuItem());
  addComponentAnchor.setStylePrimaryName("ode-ExtensionAnchor");
  addComponentAnchor.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      new ComponentImportWizard().center();
    }
  });

  categoryPanels.get(ComponentCategory.EXTENSION).add(addComponentAnchor);
  categoryPanels.get(ComponentCategory.EXTENSION).setCellHorizontalAlignment(
      addComponentAnchor, HasHorizontalAlignment.ALIGN_CENTER);
}
 
Example 38
Project: WebConsole   File: SlidingToolbar.java   Source Code and License 5 votes vote down vote up
private SlidingToolbar(PanelSizeInfo sizeInfo) {
	HorizontalPanel container = new HorizontalPanel();
	this.initWidget(container);
	setWidth("340px");
	setStylePrimaryName("toolbar");
	setHeight("100%");
	container.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	DOM.setStyleAttribute(getElement(), "marginLeft", "-320px");
	mainPanel = new VerticalPanel();
	mainPanel.setStylePrimaryName("mainToolbarPanel");
	tab = new Label(">");
	tab.setStylePrimaryName("tabToolbarPanel");
	container.add(mainPanel);
	container.add(tab);
	
	// Configure Main Panel
	mainPanel.setHeight("80%");
	mainPanel.setWidth("320px");
	mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	Element mainElem = mainPanel.getElement();
	DOM.setStyleAttribute(mainElem, "paddingLeft", "70px");
	DOM.setStyleAttribute(mainElem, "paddingTop", "20px");
	DOM.setStyleAttribute(mainElem, "paddingRight", "20px");
	DOM.setStyleAttribute(mainElem, "paddingBottom", "20px");
	
	// Configure Tab
	tab.setWidth("20px");
	tab.setHeight("50px");
	tab.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	Element tabElem = tab.getElement();
	DOM.setStyleAttribute(tabElem, "lineHeight", "50px");
	
	// Add to Window
	RootPanel.get().add(this, 0, 0);
	
	addAnimation();
	
	createToolbarContent(sizeInfo);
}
 
Example 39
Project: WebConsole   File: GridPanelComponent.java   Source Code and License 5 votes vote down vote up
@Override
public void onRender(int width, int height, List<DataValuePairContainer> data) {
	FlexTable grid = (FlexTable)getWidget();
	int colWidth = (int)Math.round((double)width / cols);
	int rowHeight = (int)Math.round((double)height / rows);

	for (int i=0; i<rows; i++) {
		for (int j=0; j<cols; j++) {
			CellData cellData = cellDataArr[i][j];
			if (cellData != null) {
				if (!cellData.ignore) {
					FlexCellFormatter formatter = grid.getFlexCellFormatter();
					int cellWidth = cellData.colSpan * colWidth;
					int cellHeight = cellData.rowSpan * rowHeight;
					formatter.setRowSpan(i, j, cellData.rowSpan);
					formatter.setColSpan(i, j, cellData.colSpan);
					formatter.setHeight(i, j, cellHeight + "px");
					formatter.setWidth(i, j, cellWidth + "px");
					formatter.setHorizontalAlignment(i, j, HasHorizontalAlignment.ALIGN_CENTER);
					formatter.setVerticalAlignment(i, j, HasVerticalAlignment.ALIGN_MIDDLE);
					
					Widget widget = grid.getWidget(i, j);
					if (widget != null) {
						ConsoleComponent component = (ConsoleComponent)widget;
						if (component != null) {
							component.onAdd(cellWidth, cellHeight);
						}
					} else {
						// Just add an empty cell
						this.setComponent(i, j, null);
					}
				}
			}
		}
	}
}
 
Example 40
Project: WebConsole   File: ScreenIndicator.java   Source Code and License 5 votes vote down vote up
public ScreenIndicator(List<Integer> screenIds) {
	super(new HorizontalPanel(), CLASS_NAME);
	HorizontalPanel container = (HorizontalPanel)getWidget();
	DOM.setIntStyleAttribute(getElement(), "zIndex", 1000 );
	DOM.setStyleAttribute(getElement(), "overflow", "hidden");
	container.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
	this.screenIds = screenIds;
	screenIndicators = new ArrayList<Widget>();
	
	if (screenIds != null) {
		width = INDICATOR_SIZE * ((screenIds.size()*2) - 1);
		setWidth(width + "px");
		setHeight(INDICATOR_SIZE + "px");
		height = INDICATOR_SIZE;
		
		// Add a simple div for each screen
		for (int i=0; i<screenIds.size(); i++) {
			int cellWidth = INDICATOR_SIZE;
			//cellWidth = i != screenIds.size()-1 ? cellWidth + INDICATOR_SPACING : cellWidth;
			Widget screenIndicator = new SimplePanel();
			screenIndicator.setWidth(INDICATOR_SIZE + "px");
			screenIndicator.setHeight(INDICATOR_SIZE + "px");
			screenIndicator.setStylePrimaryName(ITEM_CLASS_NAME);
			screenIndicators.add(screenIndicator);
			container.add(screenIndicator);
			container.setCellWidth(screenIndicator, cellWidth + "px");
			
			if (i<screenIds.size()-1) {
				// Add a spacer
				Widget spacer = new SimplePanel();
				spacer.setWidth(INDICATOR_SIZE + "px");
				spacer.setHeight(INDICATOR_SIZE + "px");
				spacer.setStylePrimaryName(SPACER_CLASS_NAME);
				container.add(spacer);
				container.setCellWidth(spacer, cellWidth + "px");
			}
		}
	}
}