public class MenuUtils extends Object
Constructor and Description |
---|
MenuUtils() |
Modifier and Type | Method and Description |
---|---|
static Menu.Heading |
createHeading(TopicIF topic,
String title)
Create new Heading as child of the given parent
|
static Menu.Item |
createItem(TopicIF topic,
String title)
Create new Item as child of the given parent
|
static Object |
getFirstValue(TopicIF topic,
ParsedQueryIF pq)
Runs the given query with the given topic as parameter %topic% and returns
the first value (of the first collumn) in the result collection.
|
static boolean |
getResultTrue(TopicIF topic,
String query)
Test if the given query returns any result rows.
|
static List |
getResultValues(TopicIF topic,
ParsedQueryIF parsedQuery)
Get the values of a given query with a given %topic% parameter as a List
|
static void |
moveOne(TopicIF topic,
boolean up)
Move the given child one step up or down the list of children on the parent
|
protected static ParsedQueryIF |
optimisticParse(String query,
TopicMapIF tm)
Parse the given query for the given topic map.
|
protected static DeclarationContextIF |
optimisticParse(TopicMapIF tm,
String query)
Parse the given declaration-context-query for the given topic map.
|
static void |
setUniqueAssociation(TopicIF player1,
String rType1Id,
String aTypeId,
String rType2Id,
TopicIF player2)
Set the binary association with given role types, association types and
players, removing any existing associations with the same role types and
association type on player1.
|
static void |
setUniqueOccurrence(TopicIF topic,
String typeId,
String value)
Set the occurrence of a given type on a given topic, removing any existing
occurrences of the same type on that topic.
|
static void |
setUniqueTopicName(TopicIF topic,
String baseName)
Set the basename of a given topic, removing any old basenames.
|
public static final boolean UP
public static final boolean DOWN
public static Object getFirstValue(TopicIF topic, ParsedQueryIF pq)
topic
- The parameter refered to as %topic% in the query.pq
- The query that genereates the result.public static List getResultValues(TopicIF topic, ParsedQueryIF parsedQuery)
topic
- The topic parameter represened by %topic% in the query.parsedQuery
- The query.public static boolean getResultTrue(TopicIF topic, String query)
topic
- The %topic% parameter in the query.query
- The query.public static Menu.Heading createHeading(TopicIF topic, String title)
topic
- Represents the parent.title
- The title of the Heading.public static Menu.Item createItem(TopicIF topic, String title)
topic
- Represents the parent.title
- The title of the Item.public static void moveOne(TopicIF topic, boolean up)
topic
- Represents the chils.up
- use UP or DOWN to move up or down the list, respectively.public static void setUniqueTopicName(TopicIF topic, String baseName)
topic
- The topic.baseName
- The new basename.public static void setUniqueOccurrence(TopicIF topic, String typeId, String value)
topic
- The topic that should have the occurrence.typeId
- The type, as refered to in the query (e.g. "menu:link")value
- The value of the occurrence.public static void setUniqueAssociation(TopicIF player1, String rType1Id, String aTypeId, String rType2Id, TopicIF player2)
player1
- The first player, for which old associations are removed.rType1Id
- The first role type, as a string (e.g. "menu:item")aTypeId
- The association type, as a string (e.g. "menu:item-topic")rType2Id
- The second role type, as a string (e.g. "menu:topic")player2
- The second player.protected static ParsedQueryIF optimisticParse(String query, TopicMapIF tm)
query
- The query to parse.tm
- The topicmap used by the query.protected static DeclarationContextIF optimisticParse(TopicMapIF tm, String query)
tm
- The topicmap used by the query.query
- The query to parse.