HelpCallBacks.writeAttrib
handle an attribute change while displaying a help page
Calling Sequence
Parameters
Description
Examples
void writeAttrib( Object data, int attrib ) throws MapleException
data
-
arbitrary data that was passed into the getHelp call
attrib
new attribute
writeAttrib is a member function of the com.maplesoft.openmaple.HelpCallBacks interface. It is called when special formatting is expected for the following characters. The given attribute should be used until the next call to writeAttrib.
The following exports of HelpCallBacks are the possible values for attrib.
MAPLE\_ATTRIB\_NORMAL is used to indicate that the following characters should be displayed normally.
MAPLE\_ATTRIB\_BOLD is used to indicate that the following characters should be displayed boldfaced.
MAPLE\_ATTRIB\_ITAL is used to indicate that the following characters should be displayed in italics.
MAPLE\_ATTRIB\_UNDER is used to indicate that the following characters should be displayed underlined.
If writeAttrib returns true the rendering of the help page is terminated.
import com.maplesoft.openmaple.*;
import com.maplesoft.externalcall.MapleException;
class Example
{
static private class CallBacks implements HelpCallBacks
int currentAttrib;
StringBuffer sBuf;
int lineNum;
CallBacks()
currentAttrib = MAPLE_ATTRIB_NORMAL;
sBuf = new StringBuffer( 100 );
lineNum = 1;
}
public boolean writeChar( Object data, int c )
if ( c == 'n' )
System.out.print( lineNum + " " );
System.out.println( sBuf.toString() );
sBuf.delete( 0, sBuf.length() );
lineNum++;
else
sBuf.append( (char)c );
return false;
public boolean writeAttrib( Object data, int attrib )
if ( currentAttrib != attrib )
switch ( currentAttrib )
case MAPLE_ATTRIB_BOLD:
sBuf.append( "</B>" );
break;
case MAPLE_ATTRIB_ITAL:
sBuf.append( "</I>" );
case MAPLE_ATTRIB_UNDER:
sBuf.append( "</U>" );
currentAttrib = attrib;
sBuf.append( "<B>" );
sBuf.append( "<I>" );
sBuf.append( "<U>" );
public static void main( String notused[] ) throws MapleException
String mapleArgs[];
Engine engine;
mapleArgs = new String[1];
mapleArgs[0] = "java";
engine = new Engine( mapleArgs, new EngineCallBacksDefault(),
null, null );
engine.getHelp( "colon",
engine.MAPLE_HELP_ALL, new CallBacks(), 70, null );
Executing this code produces the following output.
1 <B>Statement Separators</B>
2
3 <B>Description</B>
4 - The statement separators in Maple are semicolon (;) and colon (:).
5
6 - The semicolon is the normal statement separator.
7
8 - In an interactive Maple session, the result of the statement will
9 not be displayed if the statement is terminated with a colon.
10
11 - The two statement separators (semicolon and colon) are equivalent in
12 the case of statements nested one or more levels (inside if
13 -statements, do-statements, or procedures).
14
15 Important: When exporting a worksheet as Maple Input, your worksheet
16 must contain explicit semicolons and not auto-inserted ones. The
17 resulting exported .mpl file will not run in Command-line Maple with
18 auto-inserted semicolons.
19
20
21 <B>Examples</B>
22 > one := 0+1:
23 > two := one+1;
24
25 <I>two</I> := 2
26
27
28 <B>See Also </B>
29 <U>worksheet,managing,exportMapleInput</U>, <U>statement</U>
30
See Also
OpenMaple
OpenMaple/Java/Engine
OpenMaple/Java/Engine/getHelp
OpenMaple/Java/HelpCallBacks
OpenMaple/Java/HelpCallBacksDefault
OpenMaple/Java/HelpCallBacksDefault/writeAttrib
Download Help Document