GlideTimelineItem - グローバル
GlideTimelineItem API は、抽象 ScheduleItem クラスを拡張して、タイムラインに固有の追加のプロパティを定義します。
タイムラインアイテムは、基本的にタイムライン全体で単一の行に表示されるアイテムです。GlideTimelineItem には、0 個以上のスパン (TimelineSpan オブジェクト) が関連付けられています。
GlideTimelineItem - GlideTimelineItem(文字列 tableName)
「ダミー」の GlideTimelineItem オブジェクトを作成します。
これは、YMoving を許可しない行を作成する場合に便利ですが、ネストされた子が含まれます (グループリソースタイムラインの最上位の「ユーザー」行など)。sys_id は、DOM レベル関数を正しく解析するために一意である必要があります。デフォルトでは、テーブル名が指定されていないためこのオブジェクトは「ドロップ可能」ではありません。
| 名前 | タイプ | 説明 |
|---|---|---|
| tableName | 文字列 | 現在のオブジェクトに関連付けられているテーブルの名前。 |
| タイプ | 説明 |
|---|---|
| なし |
GlideTimelineItem - GlideTimelineItem(文字列 tableName, 文字列 sys_id)
必要なテーブルと sys_id プロパティを設定するコンストラクター。
このオブジェクトの残りのプロパティは、問い合わせユーザーが設定する必要があります。デフォルトでは、テーブル名が指定されているためこのオブジェクトインスタンスは「ドロップ可能」です。
| 名前 | タイプ | 説明 |
|---|---|---|
| tableName | 文字列 | 現在のオブジェクトに関連付けられているテーブルの名前。 |
| sys_id | 文字列 | オブジェクトの sys ID。 |
| タイプ | 説明 |
|---|---|
| なし |
GlideTimelineItem - createTimelineSpan(文字列 tableName)
現在のインスタンスオブジェクトに関連付けられた新しい TimelineSpan オブジェクトを作成します。
他の TimelineSpan オブジェクトが存在しない場合、新しく作成されたオブジェクトは現在のインスタンスオブジェクトと同じ sys_id を共有します。それ以外の場合は、ランダムに生成された GUID が使用されます。
| 名前 | タイプ | 説明 |
|---|---|---|
| tableName | 文字列 | 現在のオブジェクトに関連付けられているテーブルの名前。 |
| タイプ | 説明 |
|---|---|
| オブジェクト | 新しく作成されたスパンオブジェクトインスタンス。 |
GlideTimelineItem - createTimelineSpan(文字列 tableName, 文字列 sys_id)
指定されたテーブルと sys_id を使用して現在のインスタンスオブジェクトに関連付けられた新しい TimelineSpan オブジェクトを作成します。
| 名前 | タイプ | 説明 |
|---|---|---|
| tableName | 文字列 | 現在のオブジェクトに関連付けられているテーブルの名前。 |
| sys_id | 文字列 | オブジェクトの sys_id。 |
| タイプ | 説明 |
|---|---|
| オブジェクト | 新しく作成されたスパンオブジェクトインスタンス。 |
次の例は、createTimelineSpan() を使用して新しい TimelineSpan オブジェクトを作成する方法を示しています。
var project_id="741cc7491b6f1c5043de32231b4bcbc5"; // Project ID
var grUser = new GlideRecord('user_resource');
grUser.addQuery('planned_task', project_id);
grUser.setQueryReferences(true);
grUser.orderBy('user.name', 'DESC');
grUser.query();
while (grUser.next()) {
var item = new GlideTimelineItem(grUser.getTableName(), grUser.user);
/* Specify the text to display in the left pane for this item. */
item.setLeftLabelText(grUser.user.name);
/* Set the name of the image file (including it's path) */
item.setImage('../images/icons/user.gifx');
/* Specify whether or not to bold the text style of the item in the left pane. */
item.setTextBold(true);
/* Set whether or not the current instance object can be clicked and dragged into another GlideTimelineItem */
item.setIsDraggable(true);
/* Create a new TimelineSpan object associated with the current instance object using the specified table and sys_id. */
item.createTimelineSpan(grUser.getTableName(), grUser.getUniqueValue());
}
GlideTimelineItem - getImage( )
現在の GlideTimelineItem に関連付けられている画像ファイルの名前を指定する文字列を返します。
| 名前 | タイプ | 説明 |
|---|---|---|
| none |
| タイプ | 説明 |
|---|---|
| 文字列 | 現在の GlideTimelineItem に関連付けられている画像ファイルの名前。現在のアイテムに画像が関連付けられていない場合は、空の文字列 ("") が返されます。 |
GlideTimelineItem - getIsDroppable( )
タイムライン要素を垂直に移動するときに、現在のインスタンスオブジェクトを「ドロップゾーン」として許可するかどうかを示します。
| 名前 | タイプ | 説明 |
|---|---|---|
| none |
| タイプ | 説明 |
|---|---|
| ブーリアン | ドロップ可能な場合は true。可能でない場合は false。 |
GlideTimelineItem - getLeftLabelText( )
左ペインに表示されるテキストを返します (有効な場合)。
| 名前 | タイプ | 説明 |
|---|---|---|
| none |
| タイプ | 説明 |
|---|---|
| 文字列 | 左ペインに表示されるテキストの値。 |
GlideTimelineItem - getParent( )
現在の GlideTimelineItem の親オブジェクトの一意の sysId を返します。
| 名前 | タイプ | 説明 |
|---|---|---|
| none |
| タイプ | 説明 |
|---|---|
| 文字列 | 現在の GlideTimelineItem の親オブジェクトの一意の sysId。親が存在しない場合は、空の文字列 ("") が返されます。 |
GlideTimelineItem - getTimelineSpans( )
ArrayList の現在のインスタンスに関連付けられているすべての TimelineSpan オブジェクトを返します。
| 名前 | タイプ | 説明 |
|---|---|---|
| none |
| タイプ | 説明 |
|---|---|
| オブジェクトアレイ | 現在のインスタンスに関連付けられている TimelineSpan オブジェクトのリスト。 |
GlideTimelineItem - isTextBold( )
左ペインのテキストが太字で表示されるように設定されているかどうかを示します。
| 名前 | タイプ | 説明 |
|---|---|---|
| なし |
| タイプ | 説明 |
|---|---|
| ブーリアン | テキストを太字にするかどうかを示すフラグ。 可能な値:
|
次の例では、インシデントのステータスが「新規」かどうかを確認し、アイテムのテキストを太字に設定します。
var NewIncidentTimelineScriptInclude = Class.create();
NewIncidentTimelineScriptInclude.prototype = Object.extendsObject(AbstractTimelineSchedulePage, {
getItems: function() {
// Specify the page title
this.setPageTitle('New Incident Timeline');
var groupNew = new GlideTimelineItem('new');
groupNew.setLeftLabelText('New Incidents');
groupNew.setImage('../images/icons/all.gifx');
this.add(groupNew);
// Get all the new incidents and add them to a new label
var grIncident = new GlideRecord('incident');
grIncident.query();
while (grIncident.next()) {
// Loop through all and capture new incidents
if (grIncident.incident_state != '1') continue;
// Create the item and the span item.
var item = new GlideTimelineItem(grIncident.getTableName(), grIncident.sys_id);
var span = item.createTimelineSpan(grIncident.getTableName(), grIncident.sys_id);
if (grIncident.incident_state == '1') { // New
item.setParent(groupNew.getSysId());
// Check and set bold text
item.setTextBold(item.isTextBold() ? false : true);
}
item.setImage('../images/icons/open.gifx');
span.setTimeSpan(grIncident.getElement('opened_at').getGlideObject().getNumericValue(),
grIncident.getElement('opened_at').getGlideObject().getNumericValue());
// Show different colors based upon the priorities only for new incidents
switch (grIncident.getElement('priority').toString()) {
case '1':
span.setPointIconClass('red_circle');
break;
case '2':
span.setPointIconClass('red_square');
break;
case '3':
span.setPointIconClass('blue_circle');
break;
case '4':
span.setPointIconClass('blue_square');
break;
case '5':
span.setPointIconClass('sepia_circle');
break;
default: // Otherwise, the default point icon class will be used (Milestone)
}
// Common item properties
item.setLeftLabelText(grIncident.short_description);
// Common span properties
span.setSpanText(grIncident.short_description);
span.setSpanColor('blue');
span.setTooltip('<strong>' + GlideStringUtil.escapeHTML(grIncident.short_description) +
'</strong><br>' + grIncident.number);
this.add(item);
}
}
});
GlideTimelineItem - setImage(文字列 strImageName)
左ペインのアイテムのアイコンとして使用する画像ファイルの名前 (パスを含む) を設定します。
| 名前 | タイプ | 説明 |
|---|---|---|
| strImageName | 文字列 | パスを含む画像の名前。 |
| タイプ | 説明 |
|---|---|
| なし |
次の例は、setImage() を使用して左ペインのアイコンに表示される画像を定義する方法を示しています。
var project_id="741cc7491b6f1c5043de32231b4bcbc5"; // Project ID
var grUser = new GlideRecord('user_resource');
grUser.addQuery('planned_task', project_id);
grUser.setQueryReferences(true);
grUser.orderBy('user.name', 'DESC');
grUser.query();
while (grUser.next()) {
var item = new GlideTimelineItem(grUser.getTableName(), grUser.user);
/* Specify the text to display in the left pane for this item. */
item.setLeftLabelText(grUser.user.name);
/* Set the name of the image file (including it's path) */
item.setImage('../images/icons/user.gifx');
/* Specify whether or not to bold the text style of the item in the left pane. */
item.setTextBold(true);
/* Set whether or not the current instance object can be clicked and dragged into another GlideTimelineItem */
item.setIsDraggable(true);
}
GlideTimelineItem - setIsDraggable(ブーリアン b)
現在のインスタンスオブジェクトをクリックして別の GlideTimelineItem にドラッグできるかどうかを設定します。
| 名前 | タイプ | 説明 |
|---|---|---|
| b | ブーリアン | クリックアンドドラッグでアイテムを移動できるかどうかを示すフラグ。 有効な値:
|
| タイプ | 説明 |
|---|---|
| なし |
次の例は、setIsDraggable() を使用して、現在のオブジェクトを別の GlideTimelineItem にドラッグできるようにする方法を示しています。
var project_id="741cc7491b6f1c5043de32231b4bcbc5"; // Project ID
var grUser = new GlideRecord('user_resource');
grUser.addQuery('planned_task', project_id);
grUser.setQueryReferences(true);
grUser.orderBy('user.name', 'DESC');
grUser.query();
while (grUser.next()) {
var item = new GlideTimelineItem(grUser.getTableName(), grUser.user);
/* Specify the text to display in the left pane for this item. */
item.setLeftLabelText(grUser.user.name);
/* Set the name of the image file (including it's path) */
item.setImage('../images/icons/user.gifx');
/* Specify whether or not to bold the text style of the item in the left pane. */
item.setTextBold(true);
/* Set whether or not the current instance object can be clicked and dragged into another GlideTimelineItem */
item.setIsDraggable(true);
}
GlideTimelineItem - setLeftLabelText(文字列 strText)
このアイテムの左ペインに表示するテキストを指定します。
| 名前 | タイプ | 説明 |
|---|---|---|
| strText | 文字列 | このアイテムの左ペインに表示するテキスト。 |
| タイプ | 説明 |
|---|---|
| なし |
次の例は、setLeftLabelText() を使用して左ペインのテキストを設定する方法を示しています。
var project_id="741cc7491b6f1c5043de32231b4bcbc5"; // Project ID
var grUser = new GlideRecord('user_resource');
grUser.addQuery('planned_task', project_id);
grUser.setQueryReferences(true);
grUser.orderBy('user.name', 'DESC');
grUser.query();
while (grUser.next()) {
var item = new GlideTimelineItem(grUser.getTableName(), grUser.user);
/* Specify the text to display in the left pane for this item. */
item.setLeftLabelText(grUser.user.name);
/* Set the name of the image file (including it's path) */
item.setImage('../images/icons/user.gifx');
/* Specify whether or not to bold the text style of the item in the left pane. */
item.setTextBold(true);
/* Set whether or not the current instance object can be clicked and dragged into another GlideTimelineItem */
item.setIsDraggable(true);
}
GlideTimelineItem - setParent(文字列 sysId)
現在の GlideTimelineItem の親を設定します。
| 名前 | タイプ | 説明 |
|---|---|---|
| sysId | 文字列 | 現在の GlideTimelineItem の親になる必要がある GlideTimelineItem の sysID。 |
| タイプ | 説明 |
|---|---|
| なし |
GlideTimelineItem - setTextBold(ブーリアン b)
左ペインのアイテムのテキストスタイルを太字にするかどうかを指定します。
| 名前 | タイプ | 説明 |
|---|---|---|
| b | ブーリアン | 左ペインのテキストを太字にするかどうかを示すフラグ。 有効な値:
|
| タイプ | 説明 |
|---|---|
| なし |
次の例は、左ペインのテキストを太字に設定する方法を示しています。
var project_id="741cc7491b6f1c5043de32231b4bcbc5"; // Project ID
var grUser = new GlideRecord('user_resource');
grUser.addQuery('planned_task', project_id);
grUser.setQueryReferences(true);
grUser.orderBy('user.name', 'DESC');
grUser.query();
while (grUser.next()) {
var item = new GlideTimelineItem(grUser.getTableName(), grUser.user);
/* Specify the text to display in the left pane for this item. */
item.setLeftLabelText(grUser.user.name);
/* Set the name of the image file (including it's path) */
item.setImage('../images/icons/user.gifx');
/* Specify whether or not to bold the text style of the item in the left pane. */
item.setTextBold(true);
/* Set whether or not the current instance object can be clicked and dragged into another GlideTimelineItem */
item.setIsDraggable(true);
}