📄 textdescriptor.java
字号:
* @param state true if text of new TextDescriptor is bold. * @return TextDescriptor which differs from this TextDescriptor by bold flag. */ public TextDescriptor withBold(boolean state) { if (isBold() == state) return this; MutableTextDescriptor td = new MutableTextDescriptor(this); td.setBold(state); return newTextDescriptor(td); } /** * Returns TextDescriptor which differs from this TextDescriptor by underline flag. * @param state true if text of new TextDescriptor is underlined. * @return TextDescriptor which differs from this TextDescriptor by underline flag. */ public TextDescriptor withUnderline(boolean state) { if (isUnderline() == state) return this; MutableTextDescriptor td = new MutableTextDescriptor(this); td.setUnderline(state); return newTextDescriptor(td); } /** * Returns TextDescriptor which differs from this TextDescriptor by interior flag. * Interior text is not seen at higher levels of the hierarchy. * @param state true if text with new TextDescriptor is interior. * @return TextDescriptor which differs from this TextDescriptor by interior flag. */ public TextDescriptor withInterior(boolean state) { if (isInterior() == state) return this; MutableTextDescriptor td = new MutableTextDescriptor(this); td.setInterior(state); return newTextDescriptor(td); } /** * Returns TextDescriptor which differs from this TextDescriptor by inheritable flag. * Inheritable variables copy their contents from prototype to instance. * Only Variables on NodeProto and PortProto objects can be inheritable. * When a NodeInst is created, any inheritable Variables on its NodeProto are automatically * created on that NodeInst. * @param state true if Variable with new TextDescriptor is inheritable. * @return TextDescriptor which differs from this TextDescriptor by inheritable flag. */ public TextDescriptor withInherit(boolean state) { if (isInherit() == state) return this; MutableTextDescriptor td = new MutableTextDescriptor(this); td.setInherit(state); return newTextDescriptor(td); } /** * Returns TextDescriptor which deffers from this TextDescriptor by parameter flag. * Parameters are those Variables that have values on instances which are * passed down the hierarchy into the contents. * Parameters can only exist on Cell objects. * @param state true if Variable with new TextDescriptor is parameter. * @return TextDescriptor which deffers from this TextDescriptor by parameter flag. */ public TextDescriptor withParam(boolean state) { if (isParam() == state) return this; MutableTextDescriptor td = new MutableTextDescriptor(this); td.setParam(state); return newTextDescriptor(td); } /** * Returns TextDescriptor which differs from this TextDescriptor by * X and Y offsets of the text in the Variable's TextDescriptor. * The values are scaled by 4, so a value of 3 indicates a shift of 0.75 and a value of 4 shifts by 1. * @param xd the X offset of the text in new Variable's TextDescriptor. * @param yd the Y offset of the text in new Variable's TextDescriptor. * @return TextDescriptor which differs from this TextDescriptor by * X and Y offsets of the text in the Variable's TextDescriptor. */ public TextDescriptor withOff(double xd, double yd) { if (getXOff() == xd && getYOff() == yd) return this; MutableTextDescriptor td = new MutableTextDescriptor(this); td.setOff(xd, yd); return newTextDescriptor(td); } /** * Returns TextDescriptor which differs from this TextDescriptor by unit. * Unit describe the type of real-world unit to apply to the value. * For example, if this value is in volts, the Unit tells whether the value * is volts, millivolts, microvolts, etc. * @param u the Unit of new TextDescriptor. * @return TextDescriptor which differs from this TextDescriptor by unit. */ public TextDescriptor withUnit(Unit u) { if (u == null) u = Unit.NONE; if (getUnit() == u) return this; MutableTextDescriptor td = new MutableTextDescriptor(this); td.setUnit(u); return newTextDescriptor(td); } /** * Returns TextDescriptor which differs from this TextDescriptor by colorIndex. * Color indices are more general than colors, because they can handle * transparent layers, C-Electric-style opaque layers, and full color values. * Methods in "EGraphics" manipulate color indices. * @param colorIndex color index of new TextDescriptor. * @return TextDescriptor which differs from this TextDescriptor by colorIndex. */ public TextDescriptor withColorIndex(int colorIndex) { if (getColorIndex() == colorIndex) return this; MutableTextDescriptor td = new MutableTextDescriptor(this); td.setColorIndex(colorIndex); return newTextDescriptor(td); } public TextDescriptor withDisplayWithoutParam() { if (isDisplay() && !isParam()) return this; MutableTextDescriptor mtd = new MutableTextDescriptor(this); mtd.setDisplay(Display.SHOWN); mtd.setParam(false); return newTextDescriptor(mtd); } public static int cacheSize() { return allDescriptors.size(); } /** * Method to return mode how this TextDescriptor is displayable. * @return Display mode how this TextDescriptor is displayable. */ @Override public Display getDisplay() { return display; } /** * Low-level method to get the bits in the TextDescriptor. * These bits are a collection of flags that are more sensibly accessed * through special methods. * This general access to the bits is required because the ELIB * file format stores it as a full integer. * This should not normally be called by any other part of the system. * @return the bits in the TextDescriptor. */ @Override public long lowLevelGet() { return bits; } /** * Method to return the color index of the TextDescriptor. * Color indices are more general than colors, because they can handle * transparent layers, C-Electric-style opaque layers, and full color values. * Methods in "EGraphics" manipulate color indices. * @return the color index of the TextDescriptor. */ @Override public int getColorIndex() { return colorIndex; } /** * Method to return a displayable TextDescriptor that is a default for Variables on NodeInsts. * @return a new TextDescriptor that can be stored in a Variable on a NodeInsts. */ public static TextDescriptor getNodeTextDescriptor() { return cacheNodeDescriptor.newTextDescriptor(true); } /** * Method to return a displayable TextDescriptor that is a default for Variables on ArcInsts. * @return a new TextDescriptor that can be stored in a Variable on a ArcInsts. */ public static TextDescriptor getArcTextDescriptor() { return cacheArcDescriptor.newTextDescriptor(true); } /** * Method to return a displayable TextDescriptor that is a default for Variables on Exports. * @return a new TextDescriptor that can be stored in a Variable on a Exports. */ public static TextDescriptor getExportTextDescriptor() { return cacheExportDescriptor.newTextDescriptor(true); } /** * Method to return a displayable TextDescriptor that is a default for Variables on PortInsts. * @return a new TextDescriptor that can be stored in a Variable on a PortInsts. */ public static TextDescriptor getPortInstTextDescriptor() { return getAnnotationTextDescriptor(); } /** * Method to return a displayable TextDescriptor that is a default for Variables on Annotations. * @return a new TextDescriptor that can be stored in a Variable on a Annotations. */ public static TextDescriptor getAnnotationTextDescriptor() { return cacheAnnotationDescriptor.newTextDescriptor(true); } /** * Method to return a displayable TextDescriptor that is a default for Variables on Cell Instance Names. * @return a new TextDescriptor that can be stored in a Variable on a Cell Instance Names. */ public static TextDescriptor getInstanceTextDescriptor() { return cacheInstanceDescriptor.newTextDescriptor(true); } /** * Method to return a displayable TextDescriptor that is a default for Variables on Cell Variables. * @return a new TextDescriptor that can be stored in a Variable on a Cell Variables. */ public static TextDescriptor getCellTextDescriptor() { return cacheCellDescriptor.newTextDescriptor(true); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -