The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

victorp (3) [Avatar] Offline
#1
I've followed 10-11 chapter building the ServerStatus example.

In chapter 11 page 295 I failed to get the expected styles. So what I have is Server Status panel in regular view (white background and the texts) .

Any help will be appreciated.

Here is my

1.CSS file:
.server-status {
width: 200px;
height: 200px;
border: 1px solid black;

}

.server-status td {
font-family: Arial;
font-size: 12px;
}

.server-status .title-bar {
text-align: center;
background: #666;
padding: 2px 0;
color: white;
font-weight: bold;
}

.server-status .stats-grid td{
border-bottom: 1px solid #ccc;
}

.server-status .stat-name {
font-weight: bold;
}

.server-status .stat-value {
text-align: right;
}

.server-status .last-updated,
.server-status .update-button {
font-size: 10px;
margin: 0 5px;
}

2.Code fragment:
public ServerStatsComponent(){
initWidget(composite);

updateButton.addClickListener(new ClickListener(){ public void onClick(Widget sender){ PerformAsyncCommand.updateStatusData(); } });
composite.add(titleBar);
composite.add(serverStats);
composite.add(updateButton);
composite.add(labelLastUpdated);

addRowToGrid("Server name", labelServerName,0);
addRowToGrid("Total memory (kb)", labelTotalMem,1);
addRowToGrid("Free memory (kb)", labelFreeMem,2);
addRowToGrid("Max memory (kb)", labelMaxMem,3);
addRowToGrid("Thread count", labelThreadCount,4);

}

private void addRowToGrid(String name, Widget widget, int row) {
serverStats.setText(row,0 , name);
serverStats.setWidget(row,1,widget);
serverStats.getCellFormatter().setStyleName(row, 0, "stat-name");
serverStats.getCellFormatter().setStyleName(row, 1, "stat-value");


}

3.ServerStatus.wgt.xml :

<module>

<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>

<!-- Specify the app entry point class. -->
<entry-point class='com.client.ServerStatus'/>


<stylesheet src='ServerStatus.css'/>

<servlet path="/server-status" class= 'com.server.ServerServiceImpl' />

</module>