com.google.gwt.user.client.ui.FlexTable Java Examples

The following examples show how to use com.google.gwt.user.client.ui.FlexTable. 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
Source File: WebTable.java    From unitime with Apache License 2.0 6 votes vote down vote up
public void setCell(int col, Cell cell) {
	iCells[col] = cell;
	if (iTable != null) {
		FlexTable t = iTable.iTable;
		cell.setColIdx(col);
		cell.setRow(this);
		if (cell.getWidget() == null)
			t.setHTML(getRowIdx() + iTable.getHeaderRowsCount(), col, (cell.getValue() == null || cell.getValue().isEmpty() ? " " : cell.getValue()));
		else
			t.setWidget(getRowIdx() + iTable.getHeaderRowsCount(), col, cell.getWidget());
		t.getFlexCellFormatter().setWordWrap(getRowIdx() + iTable.getHeaderRowsCount(), col, cell.getWordWrap());
		t.getFlexCellFormatter().setColSpan(getRowIdx() + iTable.getHeaderRowsCount(), col, cell.getColSpan());
		t.getFlexCellFormatter().setStyleName(getRowIdx() + iTable.getHeaderRowsCount(), col, cell.getStyleName());
		t.getFlexCellFormatter().setWidth(getRowIdx() + iTable.getHeaderRowsCount(), col, cell.getWidth());
		t.getFlexCellFormatter().setVerticalAlignment(getRowIdx() + iTable.getHeaderRowsCount(), col, cell.getVerticalAlignment());
		t.getFlexCellFormatter().setHorizontalAlignment(getRowIdx() + iTable.getHeaderRowsCount(), col, cell.getHorizontalAlignment());
		t.getFlexCellFormatter().getElement(getRowIdx() + iTable.getHeaderRowsCount(), col).setTitle(cell.getTitle());
	}
}
 
Example #2
Source File: CookieView.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void build() {
  // Add header row.
  table.setText(0, 0, "Cookie");
  table.setText(0, 1, "Value");
  table.setText(0, 2, "-");
  table.getRowFormatter().setStyleName(0, Utils.style() + "-cookiesHeader");

  // Add footer row.
  table.setWidget(1, 0, new CommandLink("Add a Cookie", new Command() {
    //@Override
    public void execute() {
      showAdd();
    }
  }, Utils.style() + "-link"));
  ((FlexTable.FlexCellFormatter) table.getCellFormatter()).setColSpan(1, 0, 3);

  for (String cookie : model.cookieNames()) {
    added(cookie, model.getCookie(cookie));
  }
}
 
Example #3
Source File: SettingsPanel.java    From swcv with MIT License 6 votes vote down vote up
private void addParseOptions(FlexTable layout, CellFormatter cf)
{
    cf.setStyleName(0, 4, "adv-cell-label");
    layout.setWidget(0, 4, createLabel("Remove Stop Words:"));
    layout.setWidget(0, 5, createCheckboxStopwords());

    cf.setStyleName(1, 4, "adv-cell-label");
    layout.setWidget(1, 4, createLabel("Remove Numbers:"));
    layout.setWidget(1, 5, createCheckboxRemoveNumbers());

    cf.setStyleName(2, 4, "adv-cell-label");
    layout.setWidget(2, 4, createLabel("Group Similar Words:"));
    layout.setWidget(2, 5, createCheckboxStem());

    cf.setStyleName(3, 4, "adv-cell-label");
    layout.setWidget(3, 4, createLabel("Shortest Word:"));
    layout.setWidget(3, 5, createMinLengthField());

}
 
Example #4
Source File: TabMailStapling.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public TabMailStapling() {
	title = GeneralComunicator.i18nExtension("stapling.tab.mail.title");

	vPanel = new VerticalPanel();
	scrollPanel = new ScrollPanel(vPanel);
	table = new FlexTable();
	vPanel.add(table);


	initWidget(scrollPanel);
}
 
Example #5
Source File: AdvisorCourseRequestLine.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void insert(FlexTable table, int row) {
	table.setWidget(row, 0, iP);
	table.getFlexCellFormatter().setColSpan(row, 0, 2);
	table.setWidget(row, 1, iCredit);
	table.getFlexCellFormatter().getElement(row, 1).getStyle().setWidth(45, Unit.PX);
	table.setWidget(row, 2, iNotes);
	table.getFlexCellFormatter().setColSpan(row, 2, 2);
	table.setWidget(row, 3, iButtons);
	table.getFlexCellFormatter().getElement(row, 3).getStyle().setWidth(75, Unit.PX);
}
 
Example #6
Source File: WikiPage.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * WikiPage
 */
public WikiPage() {
	table = new FlexTable();
	table.setWidth("100%");

	initWidget(table);
}
 
Example #7
Source File: SearchMetadata.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * SearchMetadata
 */
public SearchMetadata(HasPropertyHandler propertyHandler) {
	formManager = new FormManager(propertyHandler, null);
	table = new FlexTable();
	scrollPanel = new ScrollPanel(table);

	// Table padding and spacing properties
	formManager.getTable().setCellPadding(2);
	formManager.getTable().setCellSpacing(2);

	groupPopup = new GroupPopup();
	groupPopup.setWidth("300px");
	groupPopup.setHeight("125px");
	groupPopup.setStyleName("okm-Popup");
	groupPopup.addStyleName("okm-DisableSelect");

	addGroup = new Button(Main.i18n("search.add.property.group"), new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			groupPopup.show(UIDockPanelConstants.SEARCH);
		}
	});

	table.setWidget(0, 0, addGroup);
	table.setWidget(1, 0, formManager.getTable());

	addGroup.setStyleName("okm-AddButton");
	addGroup.addStyleName("okm-NoWrap");

	initWidget(scrollPanel);
}
 
Example #8
Source File: NotEmptyFlextTableValidator.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void invokeActions(ValidationResult result) {
	if (flexTable != null) {
		for (ValidationAction<FlexTable> va : this.getFailureActions())
			va.invoke(result, flexTable);
	}
}
 
Example #9
Source File: TabFolderStapling.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public TabFolderStapling() {
	title = GeneralComunicator.i18nExtension("stapling.tab.folder.title");

	vPanel = new VerticalPanel();
	scrollPanel = new ScrollPanel(vPanel);
	table = new FlexTable();
	vPanel.add(table);


	initWidget(scrollPanel);
}
 
Example #10
Source File: SettingsPanel.java    From swcv with MIT License 5 votes vote down vote up
private void addTooltips(FlexTable layout)
{
    for (int i = 0; i < layout.getRowCount(); i++)
    {
        layout.getWidget(i, 0).setTitle(layout.getWidget(i, 1).getTitle());
        layout.getWidget(i, 2).setTitle(layout.getWidget(i, 3).getTitle());
        layout.getWidget(i, 4).setTitle(layout.getWidget(i, 5).getTitle());
    }
}
 
Example #11
Source File: TabDocumentStapling.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public TabDocumentStapling() {
	title = GeneralComunicator.i18nExtension("stapling.tab.document.title");

	vPanel = new VerticalPanel();
	scrollPanel = new ScrollPanel(vPanel);
	table = new FlexTable();
	vPanel.add(table);


	initWidget(scrollPanel);
}
 
Example #12
Source File: HasFileStatInfoTablePage.java    From sc2gears with Apache License 2.0 4 votes vote down vote up
private void renderInfoRow( final FileStatInfo info, final FlexTable table, final ClickHandler googleAccountClickHandler ) {
	final CellFormatter cellFormatter = table.getCellFormatter();
	final RowFormatter  rowFormatter  = table.getRowFormatter();
	
	int column = 0;
	
	table.setWidget( row, column++, new Label( userCounter + "." ) );
	cellFormatter.setHorizontalAlignment( row, column-1, HasHorizontalAlignment.ALIGN_RIGHT );
	
	final VerticalPanel userPanel = new VerticalPanel();
	if ( info.getAddressedBy() != null )
		userPanel.add( ClientUtils.styledWidget( new Label( info.getAddressedBy() + ", "
			+ ( info.getCountry() == null ? "-" : info.getCountry() ) ), "explanation" ) );
	if ( googleAccountClickHandler == null || userCounter == 0 )
		userPanel.add( new Label( info.getGoogleAccount() ) );
	else {
		final Anchor googleAccountAnchor = new Anchor( info.getGoogleAccount() );
		googleAccountAnchor.setTitle( googleAccountClickHandler.toString() );
		googleAccountAnchor.addClickHandler( googleAccountClickHandler );
		userPanel.add( googleAccountAnchor );
	}
	userPanel.add( ClientUtils.styledWidget( ClientUtils.createTimestampWidget( "Updated: ", info.getUpdated() ), "explanation" ) );
	userPanel.add( ClientUtils.styledWidget( new Label(
		( info.getAccountCreated() == null ? "" : "Created: " + ClientUtils.DATE_FORMAT.format( info.getAccountCreated() ) + ", " )
		+ "Pkg: " + info.getDbPackageName() + ";" ), "explanation" ) );
	if ( info.getComment() != null ) {
		final Label commentLabel = new Label();
		if ( info.getComment().length() <= 40 )
			commentLabel.setText( info.getComment() );
		else {
			commentLabel.setText( info.getComment().substring( 0, 40 ) + "..." );
			commentLabel.setTitle( info.getComment() );
		}
		userPanel.add( ClientUtils.styledWidget( commentLabel, "explanation" ) );
	}
	table.setWidget( row, column++, userPanel );
	
	final Widget dbPackageWidget = info.getDbPackageIcon() == null ? new Label( info.getDbPackageName() ) : new Image( info.getDbPackageIcon() );
	dbPackageWidget.setTitle( "Available storage: " + NUMBER_FORMAT.format( info.getPaidStorage() ) + " bytes" );
	table.setWidget( row, column++, dbPackageWidget );
	int rowSpan = 1;
	if ( info.getRepCount  () > 0 ) rowSpan++;
	if ( info.getSmpdCount () > 0 ) rowSpan++;
	if ( info.getOtherCount() > 0 ) rowSpan++;
	if ( rowSpan > 1 )
		for ( int i = column - 1; i >= 0; i-- )
			table.getFlexCellFormatter().setRowSpan( row, i, rowSpan );
	userCounter++;
	
	for ( int type = 0; type < 4; type++ ) {
		String fileType = null;
		int    count    = 0;
		long   storage  = 0;
		switch ( type ) {
		case 0 : count = info.getAllCount(); storage = info.getAllStorage(); fileType = "<all>"; break;
		case 1 : if ( ( count = info.getRepCount  () ) == 0 ) continue; storage = info.getRepStorage  (); fileType = "rep"  ; column = 0; break;
		case 2 : if ( ( count = info.getSmpdCount () ) == 0 ) continue; storage = info.getSmpdStorage (); fileType = "smpd" ; column = 0; break;
		case 3 : if ( ( count = info.getOtherCount() ) == 0 ) continue; storage = info.getOtherStorage(); fileType = "other"; column = 0; break;
		}
		table.setWidget( row, column++, new Label( fileType ) );
		final int firstNumberColumn = column;
		table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( count ) ) );
		table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( storage ) + " bytes" ) );
		table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( count == 0 ? 0 : storage / count ) + " bytes" ) );
		final int usedPercent = info.getPaidStorage() == 0 ? 0 : (int) ( storage * 100 / info.getPaidStorage() );
		table.setWidget( row, column++, new Label( usedPercent + "%" ) );
		
		for ( int i = column - 1; i >= firstNumberColumn; i-- )
			cellFormatter.setHorizontalAlignment( row, i, HasHorizontalAlignment.ALIGN_RIGHT );
		
		rowFormatter.addStyleName( row, userCounter == 1 ? "gold" : ( userCounter & 0x01 ) == 0 ? "row0" : "row1" );
		
		row++;
	}
}
 
Example #13
Source File: SettingsPanel.java    From swcv with MIT License 4 votes vote down vote up
public CaptionPanel create(WCSettings setting)
{
    this.setting = setting;

    FlexTable layout = new FlexTable();

    CellFormatter cf = layout.getCellFormatter();
    // Add some standard form options
    layout.setWidget(0, 0, createLabel("Number of Words:"));
    layout.setWidget(0, 1, createNumberListBox());
    layout.setWidget(1, 0, createLabel("Layout:"));
    layout.setWidget(1, 1, createLayoutListBox());
    layout.setWidget(2, 0, createLabel("Similarity:"));
    layout.setWidget(2, 1, createSimilarityListBox());

    layout.setWidget(3, 0, createLabel("Ranking:"));
    rankingWidget = createRankingListBox();
    layout.setWidget(3, 1, rankingWidget);

    cf.setStyleName(0, 2, "adv-cell-label");
    layout.setWidget(0, 2, createLabel("Font:"));
    fontWidget = createFontListBox();
    layout.setWidget(0, 3, fontWidget);

    cf.setStyleName(1, 2, "adv-cell-label");
    layout.setWidget(1, 2, createLabel("Color:"));
    colorSchemeWidget = createColorListBox();
    layout.setWidget(1, 3, colorSchemeWidget);

    cf.setStyleName(2, 2, "adv-cell-label");
    layout.setWidget(2, 2, createLabel("Aspect Ratio:"));
    layout.setWidget(2, 3, createAspectRatioListBox());

    cf.setStyleName(3, 2, "adv-cell-label");
    layout.setWidget(3, 2, createLabel("Language:"));
    layout.setWidget(3, 3, createLanguageListBox());

    addParseOptions(layout, cf);

    addTooltips(layout);

    // Wrap the content in a DecoratorPanel
    CaptionPanel panel = new CaptionPanel();
    panel.setCaptionText("advanced options for word cloud generation");
    panel.add(layout);
    return panel;
}
 
Example #14
Source File: InfoPanelImpl.java    From unitime with Apache License 2.0 4 votes vote down vote up
public InfoPanelImpl() {
	super("cell");
	iText = new P("text");
	add(iText);
	
	iHint = new ClickableHint(""); iHint.setStyleName("hint");
	add(iHint);
	
	iUpdateInfo = new Callback() {
		@Override
		public void execute(Callback callback) {
			if (callback != null) callback.execute(null);
		}
	};
	
	iInfo = new FlexTable();
	iInfo.setStyleName("unitime-InfoTable");
	// iUpdateInfo = updateInfo;
	iInfoPanel = new PopupPanel();
	iInfoPanel.setWidget(iInfo);
	iInfoPanel.setStyleName("unitime-PopupHint");
	sinkEvents(Event.ONMOUSEOVER);
	sinkEvents(Event.ONMOUSEOUT);
	sinkEvents(Event.ONMOUSEMOVE);
	iShowInfo = new Timer() {
		@Override
		public void run() {
			if (iInfo.getRowCount() == 0) return;
			iUpdateInfo.execute(new Callback() {
				public void execute(Callback callback) {
					iInfoPanel.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
						@Override
						public void setPosition(int offsetWidth, int offsetHeight) {
							int maxX = Window.getScrollLeft() + Window.getClientWidth() - offsetWidth - 10;
							iInfoPanel.setPopupPosition(Math.min(iX, maxX), iY);
						}
					});
					if (callback != null) callback.execute(null);
				}
			});
		}
	};
	iHideInfo = new Timer() {
		@Override
		public void run() {
			iInfoPanel.hide();
		}
	};
	
	iDefaultClickHandler = new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			if (iUrl != null && !iUrl.isEmpty())
				ToolBox.open(GWT.getHostPageBaseURL() + iUrl);
		}
	};
	iTextClick = iHint.addClickHandler(iDefaultClickHandler);
	iHintClick = iText.addClickHandler(iDefaultClickHandler);
	iHint.setTabIndex(-1);
}
 
Example #15
Source File: JsonSourceViewer.java    From dashbuilder with Apache License 2.0 4 votes vote down vote up
public JsonSourceViewer() {
    this.table = new FlexTable();
    initWidget( table );
}
 
Example #16
Source File: WebTable.java    From unitime with Apache License 2.0 4 votes vote down vote up
public FlexTable getTable() {
	return iTable;
}
 
Example #17
Source File: PlainColumnView.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public Widget asWidget() {


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

    layout.add(new HTML("<div class='metric-table-title'>"+title+"</div>"));

    grid = new FlexTable();
    grid.getElement().setAttribute("width", width+unit.getType()+"");

    // header columns
    grid.setHTML(0, 0, "Metric");
    grid.setHTML(0, 1, "Actual");
    grid.setHTML(0, 2, "&nbsp;");

    grid.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT);

    // actual values
    int row = ROW_OFFSET;
    for(Column c : columns)
    {
        grid.setHTML(row, 0, "<div class='metric-table-label'>"+c.getLabel() + ":</div>");
        grid.setHTML(row, 1, "");

        stacks.add(new StackedBar());

        if(c.getComparisonColumn()!=null)
        {
            StackedBar stack = stacks.get(row - ROW_OFFSET);
            grid.setWidget(row, 2, stack.asWidget());
            stack.setRatio(0,0);
        }
        else
            grid.setText(row, 2, "");

        grid.getCellFormatter().setHorizontalAlignment(row, 1, HasHorizontalAlignment.ALIGN_RIGHT);

        if(!c.isVisible())
            grid.getRowFormatter().setVisible(row, false);
        if(c.isBaseline())
            grid.getRowFormatter().addStyleName(row, "metric-table-baseline");


        row++;
    }

    grid.getCellFormatter().setStyleName(0,0,"metric-table-header");
    grid.getCellFormatter().setStyleName(0,1,"metric-table-header");
    grid.getCellFormatter().setStyleName(0,2,"metric-table-header");
    grid.getCellFormatter().setWidth(0, 2, "50%");


    if(null==staticHelp && address!=null)
    {
        MetricHelpPanel helpPanel = new MetricHelpPanel(address, this.columns);
        //helpPanel.setAligned(true);
        layout.add(helpPanel.asWidget());
    }
    else if(staticHelp!=null)
    {
        layout.add(staticHelp.asWidget());
    }

    layout.add(grid);

   return layout;
}
 
Example #18
Source File: ClientUtils.java    From sc2gears with Apache License 2.0 4 votes vote down vote up
/**
 * Displays a Details dialog box.<br>
 * Renders a table with 2 columns: name and value pairs.
 * @param caption title of the dialog
 * @param values  values to be displayed; each element is an array (name-value pair) which defines a row
 */
public static void displayDetailsDialog( final String caption, final Object[][] values ) {
	final DialogBox dialogBox = new DialogBox( true );
	dialogBox.setText( caption );
	dialogBox.setGlassEnabled( true );
	
	final VerticalPanel content = new VerticalPanel();
	content.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );
	
	final FlexTable table = new FlexTable();
	table.setBorderWidth( 1 );
	table.setCellSpacing( 0 );
	table.setCellPadding( 3 );
	
	
	final CellFormatter cellFormatter = table.getCellFormatter();
	for ( int i = 0; i < values.length; i++ ) {
		// Name
		table.setWidget( i, 0, new Label( values[ i ][ 0 ].toString() ) );
		cellFormatter.addStyleName( i, 0, "headerRow" );
		
		final Object value = values[ i ] [ 1 ];
		
		if ( value == null )
			table.setWidget( i, 1, new Label() );
		else if ( value instanceof Widget ) 
			table.setWidget( i, 1, (Widget) value );
		else if ( value instanceof Date )
			table.setWidget( i, 1, createTimestampWidget( (Date) value ) );
		else {
			String stringValue;
			if ( value instanceof String )
				stringValue = (String) value;
			else if ( value instanceof Number )
				stringValue = NUMBER_FORMAT   .format( (Number) value );
			else
				stringValue = value.toString();
			table.setWidget( i, 1, new Label( stringValue ) );
		}
		cellFormatter.addStyleName( i, 1, "row" + ( i & 0x01 ) );
		cellFormatter.setHorizontalAlignment( i, 1, HasHorizontalAlignment.ALIGN_LEFT );
	}
	
	content.add( table );
	
	content.add( createVerticalEmptyWidget( 8 ) );
	content.add( ClientUtils.createDialogCloseButton( dialogBox, "Close" ) );
	content.add( createVerticalEmptyWidget( 8 ) );
	
	dialogBox.setWidget( content );
	
	dialogBox.center();
}
 
Example #19
Source File: HasApiCallStatInfoTablePage.java    From sc2gears with Apache License 2.0 4 votes vote down vote up
/**
 * Builds the API call stat info table.
 * 
 * <p>On first call the table is initialized, on later calls its content is first removed.</p>
 * 
 * @param apiCallStatInfoList       API call stat info list to build the table from
 * @param table                     table to build
 * @param googleAccountClickHandler if provided, google accounts will be rendered as links (@link {@link Anchor}),
 * 		and clicking on them will call this handler; the tool tip of links will be <code>googleAccountClickHandler.toString()</code>
 */
protected void buildApiCallStatInfoTable( final List< ApiCallStatInfo > apiCallStatInfoList, final FlexTable table, final ClickHandler googleAccountClickHandler ) {
	// Build table
	if ( table.getRowCount() == 0 ) {
		// Init table
		table.setBorderWidth( 1 );
		table.setCellSpacing( 0 );
		table.setCellPadding( 3 );
		add( table );
	}
	else
		table.removeAllRows();
	
	final RowFormatter rowFormatter = table.getRowFormatter();
	
	int column = 0;
	table.setWidget( 0, column++, new Label( "#"               ) );
	table.setWidget( 0, column++, new Label( "User"            ) );
	table.setWidget( 0, column++, new Label( "Paid Ops"        ) );
	table.setWidget( 0, column++, new Label( "∑Calls"          ) );
	table.setWidget( 0, column++, new Label( "Used Ops"        ) );
	table.setWidget( 0, column++, new Label( "Avg Time"        ) );
	table.setWidget( 0, column++, new Label( "Denied"          ) );
	table.setWidget( 0, column++, new Label( "Errors"          ) );
	table.setWidget( 0, column++, new Label( "Info"            ) );
	table.setWidget( 0, column++, new Label( "Avg Info T"      ) );
	table.setWidget( 0, column++, new Label( "Map info"        ) );
	table.setWidget( 0, column++, new Label( "Avg Map info T"  ) );
	table.setWidget( 0, column++, new Label( "Parse rep"       ) );
	table.setWidget( 0, column++, new Label( "Avg Parse rep T" ) );
	table.setWidget( 0, column++, new Label( "Prof info"       ) );
	table.setWidget( 0, column++, new Label( "Avg Prof info T" ) );
	table.setWidget( 0, column++, new Label( "Share"           ) );
	rowFormatter.addStyleName( 0, "headerRow" );
	
	final CellFormatter cellFormatter = table.getCellFormatter();
	
	final int rowsCount = apiCallStatInfoList.size();
	int userCounter = 0;
	for ( int row = 1; row <= rowsCount; row++ ) {
		final ApiCallStatInfo info = apiCallStatInfoList.get( row - 1 );
		column = 0;
		
		table.setWidget( row, column++, new Label( userCounter + "." ) );
		cellFormatter.setHorizontalAlignment( row, column-1, HasHorizontalAlignment.ALIGN_RIGHT );
		if ( googleAccountClickHandler == null || userCounter == 0 )
			table.setWidget( row, column++, new Label( info.getGoogleAccount() ) );
		else {
			final Anchor googleAccountAnchor = new Anchor( info.getGoogleAccount() );
			googleAccountAnchor.setTitle( googleAccountClickHandler.toString() );
			googleAccountAnchor.addClickHandler( googleAccountClickHandler );
			table.setWidget( row, column++, googleAccountAnchor );
		}
		userCounter++;
		
		final int firstNumberColumn = column;
		table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( info.getPaidOps            () )         ) );
		table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( info.getCalls              () )         ) );
		table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( info.getUsedOps            () )         ) );
		table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( info.getAvgExecTime        () ) + " ms" ) );
		table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( info.getDeniedCalls        () )         ) );
		table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( info.getErrors             () )         ) );
		table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( info.getInfoCalls          () )         ) );
		table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( info.getAvgInfoExecTime    () ) + " ms" ) );
		table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( info.getMapInfoCalls       () )         ) );
		table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( info.getAvgMapInfoExecTime () ) + " ms" ) );
		table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( info.getParseRepCalls      () )         ) );
		table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( info.getAvgParseRepExecTime() ) + " ms" ) );
		table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( info.getProfInfoCalls      () )         ) );
		table.setWidget( row, column++, new Label( NUMBER_FORMAT.format( info.getAvgProfInfoExecTime() ) + " ms" ) );
		table.setWidget( row, column++, new Label( ( info.getPaidOps() == 0 ? 0 : 100 * info.getUsedOps() / info.getPaidOps() ) + "%" ) );
		
		for ( int i = column - 1; i >= firstNumberColumn; i-- )
			cellFormatter.setHorizontalAlignment( row, i, HasHorizontalAlignment.ALIGN_RIGHT );
		
		rowFormatter.addStyleName( row, userCounter == 1 ? "gold" : ( userCounter & 0x01 ) == 0 ? "row0" : "row1" );
	}
}
 
Example #20
Source File: NotEmptyFlextTableValidator.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public NotEmptyFlextTableValidator(FlexTable flexTable) {
	this.flexTable = flexTable;
	this.setCustomMsgKey(null);
	this.preventsPropagationOfValidationChain();
}
 
Example #21
Source File: StapleTableManager.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * addMail
 */
public static void addMail(FlexTable table, final GWTStaple staple, final String uuid, boolean enableDelete) {
	int row = table.getRowCount();
	final GWTMail mail = staple.getMail();

	// Mail is never checkout or subscribed ( because can not be changed )
	table.setHTML(row, 0, "&nbsp;");

	if (mail.getAttachments().size() > 0) {
		table.setHTML(row, 1, Util.imageItemHTML("img/email_attach.gif"));
	} else {
		table.setHTML(row, 1, Util.imageItemHTML("img/email.gif"));
	}

	Anchor anchor = new Anchor();
	anchor.setHTML(mail.getSubject());
	anchor.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent arg0) {
			String docPath = mail.getPath();
			String path = docPath.substring(0, docPath.lastIndexOf("/"));
			GeneralComunicator.openPath(path, docPath);
		}
	});
	anchor.setStyleName("okm-KeyMap-ImageHover");
	table.setWidget(row, 2, anchor);
	table.setHTML(row, 3, Util.formatSize(mail.getSize()));


	if (enableDelete) {
		Image delete = new Image(OKMBundleResources.INSTANCE.deleteIcon());
		delete.setStyleName("okm-KeyMap-ImageHover");
		delete.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				staplingService.removeStaple(String.valueOf(staple.getId()), new AsyncCallback<Object>() {
					@Override
					public void onSuccess(Object result) {
						if (staple.getType().equals(GWTStaple.STAPLE_FOLDER)) {
							Stapling.get().refreshFolder(uuid);
						} else if (staple.getType().equals(GWTStaple.STAPLE_DOCUMENT)) {
							Stapling.get().refreshDocument(uuid);
						} else if (staple.getType().equals(GWTStaple.STAPLE_MAIL)) {
							Stapling.get().refreshMail(uuid);
						}
					}

					@Override
					public void onFailure(Throwable caught) {
						GeneralComunicator.showError("remove", caught);
					}
				});
			}
		});

		table.setWidget(row, 4, delete);
	} else {
		table.setHTML(row, 4, "");
	}

	table.getCellFormatter().setWidth(row, 0, "60px");
	table.getCellFormatter().setWidth(row, 1, "25px");
	table.getCellFormatter().setWidth(row, 4, "25px");

	table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
	table.getCellFormatter().setHorizontalAlignment(row, 1, HasHorizontalAlignment.ALIGN_CENTER);
	table.getCellFormatter().setHorizontalAlignment(row, 2, HasHorizontalAlignment.ALIGN_LEFT);
	table.getCellFormatter().setHorizontalAlignment(row, 3, HasHorizontalAlignment.ALIGN_CENTER);
	table.getCellFormatter().setHorizontalAlignment(row, 4, HasHorizontalAlignment.ALIGN_CENTER);
}
 
Example #22
Source File: StapleTableManager.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * addFolder
 */
public static void addFolder(FlexTable table, final GWTStaple staple, final String uuid, boolean enableDelete) {
	int row = table.getRowCount();
	final GWTFolder folder = staple.getFolder();

	// Subscribed is a special case, must add icon with others
	if (folder.isSubscribed()) {
		table.setHTML(row, 0, Util.imageItemHTML("img/icon/subscribed.gif"));
	} else {
		table.setHTML(row, 0, "&nbsp;");
	}

	// Looks if must change icon on parent if now has no childs and properties with user security atention
	if ((folder.getPermissions() & GWTPermission.WRITE) == GWTPermission.WRITE) {
		if (folder.isHasChildren()) {
			table.setHTML(row, 1, Util.imageItemHTML("img/menuitem_childs.gif"));
		} else {
			table.setHTML(row, 1, Util.imageItemHTML("img/menuitem_empty.gif"));
		}
	} else {
		if (folder.isHasChildren()) {
			table.setHTML(row, 1, Util.imageItemHTML("img/menuitem_childs_ro.gif"));
		} else {
			table.setHTML(row, 1, Util.imageItemHTML("img/menuitem_empty_ro.gif"));
		}
	}

	Anchor anchor = new Anchor();
	anchor.setHTML(folder.getName());
	anchor.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent arg0) {
			GeneralComunicator.openPath(folder.getPath(), null);
		}
	});
	anchor.setStyleName("okm-KeyMap-ImageHover");
	table.setWidget(row, 2, anchor);
	table.setHTML(row, 3, "&nbsp;");

	if (enableDelete) {
		Image delete = new Image(OKMBundleResources.INSTANCE.deleteIcon());
		delete.setStyleName("okm-KeyMap-ImageHover");
		delete.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				staplingService.removeStaple(String.valueOf(staple.getId()), new AsyncCallback<Object>() {
					@Override
					public void onSuccess(Object result) {
						if (staple.getType().equals(GWTStaple.STAPLE_FOLDER)) {
							Stapling.get().refreshFolder(uuid);
						} else if (staple.getType().equals(GWTStaple.STAPLE_DOCUMENT)) {
							Stapling.get().refreshDocument(uuid);
						} else if (staple.getType().equals(GWTStaple.STAPLE_MAIL)) {
							Stapling.get().refreshMail(uuid);
						}
					}

					@Override
					public void onFailure(Throwable caught) {
						GeneralComunicator.showError("remove", caught);
					}
				});
			}
		});

		table.setWidget(row, 4, delete);
	} else {
		table.setHTML(row, 4, "");
	}

	table.getCellFormatter().setWidth(row, 0, "60px");
	table.getCellFormatter().setWidth(row, 1, "25px");
	table.getCellFormatter().setWidth(row, 4, "25px");

	table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
	table.getCellFormatter().setHorizontalAlignment(row, 1, HasHorizontalAlignment.ALIGN_CENTER);
	table.getCellFormatter().setHorizontalAlignment(row, 2, HasHorizontalAlignment.ALIGN_LEFT);
	table.getCellFormatter().setHorizontalAlignment(row, 3, HasHorizontalAlignment.ALIGN_CENTER);
	table.getCellFormatter().setHorizontalAlignment(row, 4, HasHorizontalAlignment.ALIGN_CENTER);
}
 
Example #23
Source File: StapleTableManager.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * addDocument
 */
public static void addDocument(FlexTable table, final GWTStaple staple, final String uuid, boolean enableDelete) {
	int row = table.getRowCount();
	final GWTDocument doc = staple.getDoc();

	if (doc.isCheckedOut()) {
		table.setHTML(row, 0, Util.imageItemHTML("img/icon/edit.png"));
	} else if (doc.isLocked()) {
		table.setHTML(row, 0, Util.imageItemHTML("img/icon/lock.gif"));
	} else {
		table.setHTML(row, 0, "&nbsp;");
	}

	// Subscribed is a special case, must add icon with others
	if (doc.isSubscribed()) {
		table.setHTML(row, 0, table.getHTML(row, 0) + Util.imageItemHTML("img/icon/subscribed.gif"));
	}

	if (doc.isHasNotes()) {
		table.setHTML(row, 0, table.getHTML(row, 0) + Util.imageItemHTML("img/icon/note.gif"));
	}

	table.setHTML(row, 1, Util.mimeImageHTML(doc.getMimeType()));
	Anchor anchor = new Anchor();
	anchor.setHTML(doc.getName());
	anchor.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent arg0) {
			String docPath = doc.getPath();
			String path = docPath.substring(0, docPath.lastIndexOf("/"));
			GeneralComunicator.openPath(path, doc.getPath());
		}
	});
	anchor.setStyleName("okm-KeyMap-ImageHover");
	table.setWidget(row, 2, anchor);
	table.setHTML(row, 3, Util.formatSize(doc.getActualVersion().getSize()));

	if (enableDelete) {
		Image delete = new Image(OKMBundleResources.INSTANCE.deleteIcon());
		delete.setStyleName("okm-KeyMap-ImageHover");
		delete.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				staplingService.removeStaple(String.valueOf(staple.getId()), new AsyncCallback<Object>() {
					@Override
					public void onSuccess(Object result) {
						if (staple.getType().equals(GWTStaple.STAPLE_FOLDER)) {
							Stapling.get().refreshFolder(uuid);
						} else if (staple.getType().equals(GWTStaple.STAPLE_DOCUMENT)) {
							Stapling.get().refreshDocument(uuid);
						} else if (staple.getType().equals(GWTStaple.STAPLE_MAIL)) {
							Stapling.get().refreshMail(uuid);
						}
					}

					@Override
					public void onFailure(Throwable caught) {
						GeneralComunicator.showError("remove", caught);
					}
				});
			}
		});

		table.setWidget(row, 4, delete);
	} else {
		table.setHTML(row, 4, "");
	}

	table.getCellFormatter().setWidth(row, 0, "60px");
	table.getCellFormatter().setWidth(row, 1, "25px");
	table.getCellFormatter().setWidth(row, 4, "25px");

	table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
	table.getCellFormatter().setHorizontalAlignment(row, 1, HasHorizontalAlignment.ALIGN_CENTER);
	table.getCellFormatter().setHorizontalAlignment(row, 2, HasHorizontalAlignment.ALIGN_LEFT);
	table.getCellFormatter().setHorizontalAlignment(row, 3, HasHorizontalAlignment.ALIGN_CENTER);
	table.getCellFormatter().setHorizontalAlignment(row, 4, HasHorizontalAlignment.ALIGN_CENTER);
}
 
Example #24
Source File: TabMailStapling.java    From document-management-system with GNU General Public License v2.0 2 votes vote down vote up
/**
 * getTable
 *
 * @return
 */
public FlexTable getTable() {
	return table;
}
 
Example #25
Source File: TabFolderStapling.java    From document-management-system with GNU General Public License v2.0 2 votes vote down vote up
/**
 * getTable
 *
 * @return
 */
public FlexTable getTable() {
	return table;
}
 
Example #26
Source File: TabDocumentStapling.java    From document-management-system with GNU General Public License v2.0 2 votes vote down vote up
/**
 * getTable
 *
 * @return
 */
public FlexTable getTable() {
	return table;
}