当前位置: 首页>>代码示例>>Java>>正文


Java HtmlTableRow类代码示例

本文整理汇总了Java中com.gargoylesoftware.htmlunit.html.HtmlTableRow的典型用法代码示例。如果您正苦于以下问题:Java HtmlTableRow类的具体用法?Java HtmlTableRow怎么用?Java HtmlTableRow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HtmlTableRow类属于com.gargoylesoftware.htmlunit.html包,在下文中一共展示了HtmlTableRow类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: statusesInTable

import com.gargoylesoftware.htmlunit.html.HtmlTableRow; //导入依赖的package包/类
private static List<AvailableItemStatus> statusesInTable(HtmlTable table) {
	ArrayList<AvailableItemStatus> result = new ArrayList<AvailableItemStatus>();
	int statusCol = -1;
    int rowId = 0;
    for(final HtmlTableRow row : table.getRows()) {
    	int colId = 0;
    	for(final HtmlTableCell cell : row.getCells()) {
 			if(rowId == 0) {
    			if(cell.asText().trim().equalsIgnoreCase("status")) {
    				statusCol = colId;
    				break;
    			}
    		} else {
	    		if(colId == statusCol) {
	    			result.add(AvailableItemStatus.findOrCreate(cell.asText().trim()));
	    		}
    		}
    		++colId;
    	}
    	++rowId;
    }
    return result;
}
 
开发者ID:bbloomf,项目名称:cincinnati-library-auto-renew,代码行数:24,代码来源:LibraryRenewer.java

示例2: getMeetingId

import com.gargoylesoftware.htmlunit.html.HtmlTableRow; //导入依赖的package包/类
/**
 * Gets meeting id of meeting
 * @param htmlTableRow
 * @return meeting Id
 * @throws URISyntaxException
 */
private String getMeetingId( HtmlTableRow htmlTableRow ) throws URISyntaxException
{
    String meetingId = null;
    for( HtmlTableCell cell : htmlTableRow.getCells() )
    {
        if( cell.getElementsByTagName( "a" ).getLength() != 0 )
        {
            String url = cell.getElementsByTagName( "a" ).get( 0 ).getAttribute( "href" ).toString();
            meetingId = getMeetingUniqueId( url );
        }
    }
    return meetingId;
}
 
开发者ID:Vedang18,项目名称:ProBOT,代码行数:20,代码来源:Bookie.java

示例3: test

import com.gargoylesoftware.htmlunit.html.HtmlTableRow; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void test() throws Exception {
  String pageName = uniqueWikiPageName("HistoryTest");
  HtmlPage page = editWikiPage(pageName, "Initial content", "", "", true);
  page = editWikiPage(pageName, "Altered content", "", "s/Initial/Altered", false);
  HtmlPage history = clickHistoryLink(page);
  List<HtmlTableRow> historyRows = (List<HtmlTableRow>) history.getByXPath("//tr[td]");
  assertEquals(3, historyRows.size());
  HtmlTableRow altered = historyRows.get(1);
  // First column is date/time.
  verifyRow(altered, "s/Initial/Altered");
  HtmlTableRow initial = historyRows.get(2);
  verifyRow(initial, "None");

  final List<HtmlSubmitInput> compareButtons = (List<HtmlSubmitInput>) history.getByXPath("//input[@type='submit' and @value='Compare']/.");
  assertEquals(1, compareButtons.size());
  HtmlPage diff = (HtmlPage) compareButtons.get(0).click();
  assertEquals("Altered", ((DomNode) diff.getByXPath("//ins").iterator().next()).asText());
  assertEquals("Initial", ((DomNode) diff.getByXPath("//del").iterator().next()).asText());
  List<HtmlDivision> divs = (List<HtmlDivision>) diff.getByXPath("//div[@id='flash']/.");
  assertEquals(0, divs.size());

  // Check for the warning when viewing differences backwards
  final List<HtmlRadioButtonInput> radioButtons = (List<HtmlRadioButtonInput>) history.getByXPath("//input[@type='radio']/.");
  assertEquals(4, radioButtons.size());
  radioButtons.get(0).click();
  radioButtons.get(3).click();
  diff = (HtmlPage) compareButtons.get(0).click();
  divs = (List<HtmlDivision>) diff.getByXPath("//div[@id='flash']/.");
  assertEquals(1, divs.size());

}
 
开发者ID:CoreFiling,项目名称:reviki,代码行数:33,代码来源:TestHistory.java

示例4: testRenameCommitMessage

import com.gargoylesoftware.htmlunit.html.HtmlTableRow; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testRenameCommitMessage() throws Exception {
  String fromPageName = uniqueWikiPageName("RenameTestFrom");
  String toPageName = uniqueWikiPageName("RenameTestTo");
  HtmlPage page = editWikiPage(fromPageName, "Catchy tunes", "", "Whatever", true);
  page = renamePage(fromPageName, toPageName);
  
  HtmlPage history = (HtmlPage) ((HtmlAnchor) page.getByXPath("//a[@name='history']").iterator().next()).click();
  List<HtmlTableRow> historyRows = (List<HtmlTableRow>) history.getByXPath("//tr[td]");
  assertEquals(3, historyRows.size());
  HtmlTableRow renameInfo = historyRows.get(1);
  assertTrue(renameInfo.getCell(3).asText().contains(fromPageName));
  assertTrue(renameInfo.getCell(3).asText().contains(toPageName));
}
 
开发者ID:CoreFiling,项目名称:reviki,代码行数:15,代码来源:TestRename.java

示例5: getBooking

import com.gargoylesoftware.htmlunit.html.HtmlTableRow; //导入依赖的package包/类
private List< Meeting > getBooking( User user, String uri ) throws Exception
{
    List< Meeting > bookings = new ArrayList< Meeting >();
    HtmlPage page = navigateToPage( user, uri, false );

    logger.debug( "Page loaded" );
    HtmlTable table = (HtmlTable)page.getByXPath( ".//*[@id='Grid']/table" ).get( 0 );
    List< HtmlTableRow > rows = table.getRows();

    logger.debug( "Retriving information for " + uri );
    for( HtmlTableRow htmlTableRow : Iterables.skip( rows, 1 ) )
    {
        Meeting meeting = new Meeting();

        String asText = htmlTableRow.asText();
        String[] split = asText.split( "\t" );
        if( split.length <= 1 )
        {
            return bookings;
        }
        meeting.setRoom( split[0].trim() );
        String bookingDate = split[1].trim();
        DateFormat format = new SimpleDateFormat( "MM/dd/yyyy", Locale.ENGLISH );
        meeting.setDate( format.parse( bookingDate ) );

        String bookingTime = split[2].trim();
        String[] timeArray = bookingTime.split( "-" );
        meeting.setFromTime( timeArray[0].trim() );
        meeting.setToTime( timeArray[1].trim() );

        meeting.setReason( split[3].trim() );
        if( uri.equals( SHOW_ALL_BOOKINGS ) )
        {
            meeting.setAttendees( Arrays.asList( split[4].trim() ) );
        }
        else
        {
            String meetingId = getMeetingId( htmlTableRow );
            meeting.setMeetingId( meetingId );
        }
        bookings.add( meeting );
    }
    return bookings;
}
 
开发者ID:Vedang18,项目名称:ProBOT,代码行数:45,代码来源:Bookie.java

示例6: verifyRow

import com.gargoylesoftware.htmlunit.html.HtmlTableRow; //导入依赖的package包/类
private void verifyRow(final HtmlTableRow altered, final String content) {
  assertEquals(getUsername(), altered.getCell(2).asText());
  assertEquals(content, altered.getCell(3).asText());
}
 
开发者ID:CoreFiling,项目名称:reviki,代码行数:5,代码来源:TestHistory.java

示例7: testWikiRootRename

import com.gargoylesoftware.htmlunit.html.HtmlTableRow; //导入依赖的package包/类
public void testWikiRootRename() throws Exception {
  final String wikiName = "uniqueWiki" + uniqueName();
  removeOurDirectoriesIfExists(_repository);
  createOurDirectory(_repository.getCommitEditor("Creating test directory", null));
  HtmlPage frontPage = addWiki(wikiName, DIRECTORY);

  // Perform an edit to make sure
  final String text = "Some text";
  frontPage = editWikiPage(frontPage, text, "", "Some change", null);
  assertTrue(frontPage.asText().contains(text));

  final String text2 = "Some text again";
  frontPage = editWikiPage(frontPage, text2, "", "Some change 2", null);
  assertTrue(frontPage.asText().contains(text2));

  final String otherPageText = "This is another page";
  HtmlPage otherPage = getWebPage("pages/" + wikiName + "/OtherPage");
  frontPage = editWikiPage(otherPage, otherPageText, "", "Create other page", null);

  // Now rename the Wiki's SVN location
  ISVNEditor editor = _repository.getCommitEditor("Rename wiki root", null);
  try {
    editor.openRoot(-1);
    editor.addDir(DIRECTORY2, DIRECTORY, -1);
    editor.closeDir();
    editor.deleteEntry(DIRECTORY, -1);
    editor.closeDir();
    editor.closeEdit();
  }
  catch (SVNException e) {
    abortEditAndFail(editor, e);
  }

  final String wikiName2 = "uniqueWiki" + uniqueName();
  frontPage = addWiki(wikiName2, DIRECTORY2);

  // Check we've got the same front page still
  assertTrue(frontPage.asText().contains(text2));

  // Check that the OtherPage appears in the AllPages list even though it hasn't been updated since the copy
  HtmlPage allPages = getWebPage("pages/" + wikiName2 +  "/AllPages");
  assertTrue(allPages.getTitleText().endsWith("All Pages"));
  HtmlAnchor link = getAnchorByHrefContains(allPages, BASE_URL + "/pages/" + wikiName2 + "/OtherPage");
  assertEquals("OtherPage", link.asText());

  // Otherpage should be found by the search
  HtmlPage otherPageCopy = getWebPage("pages/" + wikiName2 + "/OtherPage");
  assertSearchFindsPageUsingQuery(wikiName2, otherPageCopy, "OtherPage", "another");

  // Now edit it again
  final String text3 = "Some more stuff";
  frontPage = editWikiPage(frontPage, text3, "", "Some change 3", null);
  assertTrue(frontPage.asText(), frontPage.asText().contains(text3));

  // Do we have the complete history?
  HtmlPage history = (HtmlPage) ((HtmlAnchor) frontPage.getByXPath("//a[@name='history']").iterator().next()).click();
  List<HtmlTableRow> historyRows = (List<HtmlTableRow>) history.getByXPath("//tr[td]");
  assertEquals(4, historyRows.size());

  // Can we diff past the wiki root rename?
  final List<HtmlRadioButtonInput> radioButtons = (List<HtmlRadioButtonInput>) history.getByXPath("//input[@type='radio']/.");
  assertEquals(6, radioButtons.size());
  radioButtons.get(1).click();
  radioButtons.get(4).click();
  final List<HtmlSubmitInput> compareButtons = (List<HtmlSubmitInput>) history.getByXPath("//input[@type='submit' and @value='Compare']/.");
  assertEquals(1, compareButtons.size());
  HtmlPage diff = (HtmlPage) compareButtons.get(0).click();
  // The prefix "Some " occurs in both revisions being compared
  assertEquals("more stuff", ((DomNode) diff.getByXPath("//ins").iterator().next()).asText());
  assertEquals("text", ((DomNode) diff.getByXPath("//del").iterator().next()).asText());
}
 
开发者ID:CoreFiling,项目名称:reviki,代码行数:72,代码来源:TestWikiRootRename.java


注:本文中的com.gargoylesoftware.htmlunit.html.HtmlTableRow类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。