How to change the case structure to string input?

Hi,
I have the inner case structure that it will decide to set "DC Voltage" or "DC Current" mode. The "Output Function" contained the selection of function "DC Voltage" or "DC Current". So far it only work with DC Voltage not DC Current. My question is how do I change the case structure to string selector? When the output function is selected to DC Voltage then the case structure is selected DC voltage case. Please help Thanks.
Attachments:
test.vi ‏35 KB

You don't really need to convert the value to a string? The problem is that the value of the individual ring items are not 0 and 1, as you assumed. The values generated by the controls are:
DC Voltage: 1006
DC Current: 1007.
You can find this out by viewing the properties for the "Output Function" and going to the "Edit Items" tab.
So, all you need to do is change the 0 to 1006 and the 1 to 1007 for your case items.
By the way, your sequence frame serves no purpose.

Similar Messages

  • How to change the default structure when exporting data in CSV format?

    Hello,
    can some one tell us how to change the default structure in CRM when exporting lists in CSV format (with Option "Always use unformatted list format (CSV) for download" ? Because we want to add a new structure for our own -is it possible ?
    If it is possible where can we find these structure ? In the blueprint customizing ?
    Thank you very much,
    Christian

    There is a workaround to move from 1.5 version to the older 1.4 version. But this could be specific to the browser setting the JRE version.
    Excerpts from sun docs:
    However, a user can still run older versions. To do so, launch the Java Plug-in Control Panel for the older version, then (re)select the browser in the Browser tab.
    Example:
    Assume you are running on Microsoft Windows with Microsoft Internet Explorer, have first installed version 1.4.2, then version 5.0, and you want to run 1.4.2.
    Go to the j2re1.4.2\bin directory where JRE 1.4.2 was installed. On a Windows default installation, this would be here: C:\Program Files\Java\j2re1.4.2\bin
    Double-click the jpicpl32.exe file located there. It will launch the control panel for 1.4.2.
    Select the Browser tab. Microsoft Internet Explorer might still appear to be set (checked). However, when 5.0 was installed, the registration of the 1.4.2 JRE with Internet Explorer was overwritten by the 5.0 JRE.
    If Microsoft Internet Explorer is shown as checked, uncheck it and click Apply. You will see a confirmation dialog stating that browser settings have changed.
    Check Microsoft Internet Explorer and click Apply. You should see a confirmation dialog.
    Restart the browser. It should now use the 1.4.2 JRE for conventional APPLET tags.
    Details are here
    http://java.sun.com/j2se/1.5.0/docs/guide/deployment/deployment-guide/jcp.html
    My system (Windows XP) has the version 1.5_09 set as the default. However i just installed JRE 1.5_06 and would like to revert back to _06 as the default JRE..
    Will update if i find more information

  • How to change the Color of a string using swings/awt concept.

    Hi friends,
    How can i change the Color of a string.
    For ex:
    If i have a string "Welcome to the Java World",I want one particular Color for the string "Welcome to the" and a different Color to the "Java World" string.
    So please kindly help me out to resolve this issue.
    Thanking u in advance.

    "Text Component Features"
    http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html

  • How to change the long in to string

    Hi
    In my program i get the long value as input.
    Then i send this long value to one method for testing which accepts the argument as String.So i have to change my long in to string then i pass it to the method.
    can anybody tell me how to change my long in to string?
    Thank you so much

    There's probably a method java.lang.Long.toString.
    If not, there's probably something a lot like it in either the Long or String classes.
    I'll leave you the pleasure of looking it up in the API docs.

  • How can  change the folder structure in Bex Analyser to match the Web

    Hi Experts,
    When I create a report using the Web Analyser and save it in My Portfolio or Bex Portfolio, I can't find the report (or folders) in Bex Analyser.
    How Can i change the folder structure in Bex Analyser to match the Web Analyser?

    Hi Reddy,
           As u have created reports and saved it in BEx portfolio or My portfolio it will be saved in the KM folder which is known as Knowledge management folder for the KM services such as feedback,rating etc.So u cant view them when u open in web analyzer.U can only see them when u save in favourites or the roles folders.
                              Hope this helps
                         Sunil Reddy

  • How to change the inventory structure

    I am now running Oracle 11.0.3, 15 users, AP,AR,GL,INV,OE and PO
    on MS NT platform. The existing inventory item is using 10
    segments and 20 characters which is very difficult for data
    entry. Thus I would like to change it to 1 segment and 10
    characters. I want to keep all transactions (all data) in AR,AP
    & GL and I would give up (purge way) all data in OE, PO and INV
    after restructuring as it has different structure on item master.
    One way is to create a new instance/database, re-configure the
    AR, AP & GL setting and convert all data from AR,AP & GL, then
    configure the new item master structure and re-enter about 500
    items. This will take too much time (20-30 mandays).
    The other way is after the month-end closing, disable all 10
    segments, purge way all transactions in INV, OE & PO. Then
    create a new segment with 10 characters and re-compile it. I
    would prefer this method as it has minimum effort.
    My question is whether the 2nd method is feasible or not? Will
    there be any problem in using this method?

    You don't really need to convert the value to a string? The problem is that the value of the individual ring items are not 0 and 1, as you assumed. The values generated by the controls are:
    DC Voltage: 1006
    DC Current: 1007.
    You can find this out by viewing the properties for the "Output Function" and going to the "Edit Items" tab.
    So, all you need to do is change the 0 to 1006 and the 1 to 1007 for your case items.
    By the way, your sequence frame serves no purpose.

  • How to change the value of subtitution string in a page at runtime

    Hi,
    I need to change the value of a substitution string which is mentioned in application attributes at runtime.
    The value will be fetched from a field in database on load of each screen.
    Can anybody help.......
    Help will be appriciated........thanx in advance
    Sunil

    Substitution strings are meant to be static, like global constants.
    If you need some variable stuff, use application level items and set them using Application level computations/processes

  • Editing Chart legends: How to change the line structure within the legend?

    Hi,
    I have one problem: I have several charts in Numbers and since I need to print them in black/white, colors cannot be used to differentiate between the lines. So if I have a dotted line and a solid line, the legend only shows me solid lines as line symbols, so the line structure is not reflected within the legend. Can I change that?

    _This question was already asked and responded._
    Put a text box with the true kind of line above the one displayed automatically.
    Yvan KOENIG (VALLAURIS, France) samedi 1 mai 2010 16:52:44

  • ADF Mobile: How to change the font size of an Input Text field in .amx view

    Is there a way to change the font size of the input data (not the label) in a text field? Changing the font size in the Style Font/Text settings doesn't seem to do anything for the label or the value in the input text field. Is this a bug or is there a way to get this to work?

    Hi Anna,
    depending on the UI element there are a range of ways. (and I'm sure people will post plenty of answers to tell you how).
    However, if generically the fonts in you portal/wd applications are too small, you should consider changing your theme so as to have larger texts. Otherwise you will either need to customise all your applications, or you will get quite a lot of inconsistency of presentation between your various WDA applications.
    Do a search on "themes for Web Dynpro ABAP" and you'll find loads of resources.
    Hope this helps,
    Cheers,
    Chris

  • How to change the flag image in language input in menu bar?

    I have two languages that I have selected for regular use in my language input menu (on the right-hand side of the menu bar), and I would like to change the Spanish input flag from the Spain national flag to an Argentina flag, just for aesthetics. I figured it'd kind of be like changing the image of how the HDD looks like on the GUI (control-click, get info, copy and paste image), but I'm not sure where to start or if it's even possible. Anyone have any clues or experience with this? I may just have to make do with keeping the Spanish flag up there but just for curiosity's sake I want to know if it can be done.

    There is no problem doing this if you are willing to create and install a custom keyboard layout.  You can find the tool and a manual at
    http://scripts.sil.org/ukelele

  • How to change the content of a text input?

    Hi!
    I would like to help me with the following
    I've create and input text, for example this:
    var one= sym.$("one")
    one.html("Enter your answer: ");
    inputOne = $('<input />').attr({'type':'text', 'value':'', 'id':'one'});
    inputOne .css ('font-size', 14);
    inputOne .css ('width', 350);
    inputOne .css ('background-color', '#0a81fb');
    inputOne .appendTo(one);
    Now the user can write anything in this input text.
    The corret word that the user has to write is "correct"
    so i use an if to validate it
    if (inputOne.val() == "correct"){
         alert ("good")
    }else {
           // HERE IS MY PROBLEM!!!   What i need to do is: if the user types a wrong answer i           //need to show him the correct answer in the input text.
    I hope you can help me.
    Thank's =)

    sym.$("NameofInputTextElement").html("What you want to change the text to");
    Have you tried this yet?
    Katherine

  • How to change the Element structure of a DefaultSyledDocument

    Hello,
    I'm trying to override the insertUpdate method of DefaultStyledDocument so that I could build my own Element structure by adding my own BranchElement- and LeafElement-s. If I examine the Element hierarchy everything seems OK. But when I use my document in a JTextPane. I get the error Exception in thread "AWT-EventQueue-0" javax.swing.text.StateInvariantError: GlyphView: Stale view: javax.swing.text.BadLocationException: Invalid location (I add the whole dump at the end of this message), whenever I add a new line to the document (to test this compile and run the included code and press then newline after the 'He' in 'Hello'. I suspect that the error is caused by the fact that the view hierarchy is not updated correctly but I'm not sure. To be honest I have searched for a while for some example code, explaning how you can make your own element hierarchy in a DefaultStyledDocument (without using ElementBuffer), but to no avail.
    Can any of the Text gurus here shed some lights on my code and see what is wrong with it or point me to some example code.
    Thanks a lot in advance.
    Marc Mertens
    Full Stack Dump
    Exception in thread "AWT-EventQueue-0" javax.swing.text.StateInvariantError: GlyphView: Stale view: javax.swing.text.BadLocationException: Invalid location
    at javax.swing.text.GlyphView.getText(GlyphView.java:117)
    at javax.swing.text.GlyphPainter1.getSpan(GlyphPainter1.java:43)
    at javax.swing.text.GlyphView.getPreferredSpan(GlyphView.java:537)
    at javax.swing.text.FlowView$LogicalView.getPreferredSpan(FlowView.java:689)
    at javax.swing.text.FlowView.calculateMinorAxisRequirements(FlowView.java:216)
    at javax.swing.text.BoxView.checkRequests(BoxView.java:911)
    at javax.swing.text.BoxView.getMinimumSpan(BoxView.java:542)
    at javax.swing.text.BoxView.calculateMinorAxisRequirements(BoxView.java:879)
    at javax.swing.text.BoxView.checkRequests(BoxView.java:911)
    at javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:325)
    at javax.swing.text.BoxView.layout(BoxView.java:682)
    at javax.swing.text.BoxView.setSize(BoxView.java:379)
    at javax.swing.plaf.basic.BasicTextUI$RootView.setSize(BasicTextUI.java:1618)
    at javax.swing.plaf.basic.BasicTextUI.getPreferredSize(BasicTextUI.java:812)
    at javax.swing.JComponent.getPreferredSize(JComponent.java:1615)
    at javax.swing.JEditorPane.getPreferredSize(JEditorPane.java:1227)
    at javax.swing.ScrollPaneLayout.layoutContainer(ScrollPaneLayout.java:769)
    at java.awt.Container.layout(Container.java:1401)
    at java.awt.Container.doLayout(Container.java:1390)
    at java.awt.Container.validateTree(Container.java:1473)
    at java.awt.Container.validate(Container.java:1448)
    at javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:379)
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:113)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    Exception in thread "AWT-EventQueue-0" javax.swing.text.StateInvariantError: GlyphView: Stale view: javax.swing.text.BadLocationException: Invalid location
    at javax.swing.text.GlyphView.getText(GlyphView.java:117)
    at javax.swing.text.GlyphPainter1.getSpan(GlyphPainter1.java:43)
    at javax.swing.text.GlyphView.getPreferredSpan(GlyphView.java:537)
    at javax.swing.text.FlowView$LogicalView.getPreferredSpan(FlowView.java:689)
    at javax.swing.text.FlowView.calculateMinorAxisRequirements(FlowView.java:216)
    at javax.swing.text.BoxView.checkRequests(BoxView.java:911)
    at javax.swing.text.BoxView.getMinimumSpan(BoxView.java:542)
    at javax.swing.text.BoxView.calculateMinorAxisRequirements(BoxView.java:879)
    at javax.swing.text.BoxView.checkRequests(BoxView.java:911)
    at javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:325)
    at javax.swing.text.BoxView.layout(BoxView.java:682)
    at javax.swing.text.BoxView.setSize(BoxView.java:379)
    at javax.swing.plaf.basic.BasicTextUI$RootView.setSize(BasicTextUI.java:1618)
    at javax.swing.plaf.basic.BasicTextUI.modelToView(BasicTextUI.java:946)
    at javax.swing.text.DefaultCaret.repaintNewCaret(DefaultCaret.java:1246)
    at javax.swing.text.DefaultCaret$1.run(DefaultCaret.java:1225)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    Exception in thread "AWT-EventQueue-0" javax.swing.text.StateInvariantError: GlyphView: Stale view: javax.swing.text.BadLocationException: Invalid location
    at javax.swing.text.GlyphView.getText(GlyphView.java:117)
    at javax.swing.text.GlyphPainter1.getSpan(GlyphPainter1.java:43)
    at javax.swing.text.GlyphView.getPreferredSpan(GlyphView.java:537)
    at javax.swing.text.FlowView$LogicalView.getPreferredSpan(FlowView.java:689)
    at javax.swing.text.FlowView.calculateMinorAxisRequirements(FlowView.java:216)
    at javax.swing.text.BoxView.checkRequests(BoxView.java:911)
    at javax.swing.text.BoxView.getMinimumSpan(BoxView.java:542)
    at javax.swing.text.BoxView.calculateMinorAxisRequirements(BoxView.java:879)
    at javax.swing.text.BoxView.checkRequests(BoxView.java:911)
    at javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:325)
    at javax.swing.text.BoxView.layout(BoxView.java:682)
    at javax.swing.text.BoxView.setSize(BoxView.java:379)
    at javax.swing.plaf.basic.BasicTextUI$RootView.setSize(BasicTextUI.java:1618)
    at javax.swing.plaf.basic.BasicTextUI.modelToView(BasicTextUI.java:946)
    at javax.swing.text.DefaultCaret.setVisible(DefaultCaret.java:952)
    at javax.swing.text.DefaultCaret.focusLost(DefaultCaret.java:347)
    at java.awt.AWTEventMulticaster.focusLost(AWTEventMulticaster.java:172)
    at java.awt.Component.processFocusEvent(Component.java:5380)
    at java.awt.Component.processEvent(Component.java:5244)
    at java.awt.Container.processEvent(Container.java:1966)
    at java.awt.Component.dispatchEventImpl(Component.java:3955)
    at java.awt.Container.dispatchEventImpl(Container.java:2024)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1810)
    at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:840)
    at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:530)
    at java.awt.Component.dispatchEventImpl(Component.java:3841)
    at java.awt.Container.dispatchEventImpl(Container.java:2024)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.SentEvent.dispatch(SentEvent.java:50)
    at java.awt.DefaultKeyboardFocusManager$DefaultKeyboardFocusManagerSentEvent.dispatch(DefaultKeyboardFocusManager.java:161)
    at java.awt.DefaultKeyboardFocusManager.sendMessage(DefaultKeyboardFocusManager.java:188)
    at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:595)
    at java.awt.Component.dispatchEventImpl(Component.java:3841)
    at java.awt.Container.dispatchEventImpl(Container.java:2024)
    at java.awt.Window.dispatchEventImpl(Window.java:1778)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.SequencedEvent.dispatch(SequencedEvent.java:93)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    java.lang.ThreadDeath
    at java.lang.Thread.stop(Thread.java:698)
    at java.lang.ThreadGroup.stopOrSuspend(ThreadGroup.java:671)
    at java.lang.ThreadGroup.stop(ThreadGroup.java:584)
    at org.netbeans.core.execution.DefaultSysProcess.stop(DefaultSysProcess.java:54)
    at org.netbeans.core.execution.ProcessNodeItem$1.stop(ProcessNodeItem.java:41)
    at org.netbeans.core.execution.ProcessNodeItem$TerminateProcessAction.performAction(ProcessNodeItem.java:69)
    at org.openide.util.actions.NodeAction$3.run(NodeAction.java:531)
    at org.netbeans.modules.openide.util.ActionsBridge.doPerformAction(ActionsBridge.java:47)
    at org.openide.util.actions.NodeAction$DelegateAction.actionPerformed(NodeAction.java:527)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
    at java.awt.Component.processMouseEvent(Component.java:5488)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
    at java.awt.Component.processEvent(Component.java:5253)
    at java.awt.Container.processEvent(Container.java:1966)
    at java.awt.Component.dispatchEventImpl(Component.java:3955)
    at java.awt.Container.dispatchEventImpl(Container.java:2024)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
    at java.awt.Container.dispatchEventImpl(Container.java:2010)
    at java.awt.Window.dispatchEventImpl(Window.java:1778)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    package Document;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    import javax.swing.text.AbstractDocument.*;
    * EditorDocument.java
    * Created on September 10, 2006, 3:58 PM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    * Document to represent the content of a syntax highlighting editor
    * @author marc
    public class EditorDocument extends DefaultStyledDocument {
        /** List of the white space characters */
        private char[] _whiteSpaceChars;
        /** List of the delimiter characters */
        private char[] _delimiterChars;
        /** Creates a new instance of EditorDocument */
        public EditorDocument(char[] whiteSpaceChars,char[] delimiterChars) {
            _whiteSpaceChars=whiteSpaceChars;
            _delimiterChars=delimiterChars;
         * Updates document structure as a result of text insertion.  This
         * will happen within a write lock.  Since this document simply
         * maps out lines, we refresh the line map.
         * @param chng the change event describing the dit
         * @param attr the set of attributes for the inserted text
        protected void insertUpdate(AbstractDocument.DefaultDocumentEvent chng, AttributeSet attr) {
            int begin=Math.max(0,chng.getOffset()-1);
            int end=begin+chng.getLength()+1;
            Element rootElement=getDefaultRootElement();
            int index;
            int m=rootElement.getElementCount();
            AbstractDocument.BranchElement line;
            super.insertUpdate(chng,attr);
            // Add the tokens
            index=rootElement.getElementIndex(begin);
            m=rootElement.getElementCount();
            if (index>=0)
                for (;index<m && (line=(AbstractDocument.BranchElement) rootElement.getElement(index)).getStartOffset()<=end;index++) {
                chng.addEdit(addTokens(line,attr));
            //fireChangedUpdate(chng);
        protected void insertUpdate(AbstractDocument.DefaultDocumentEvent chng,AttributeSet attr) {
            int begin=chng.getOffset();
            int end=begin+chng.getLength();
            BranchElement root=(BranchElement) getDefaultRootElement();
            // Find the lines that must be removed
            int indexFirstLine=root.getElementIndex(begin);
            int indexLastLine=root.getElementIndex(end);
            BranchElement[] removeLines=new BranchElement[indexLastLine-indexFirstLine+1];
            for (int i=indexFirstLine;i<=indexLastLine;i++)
                removeLines=(BranchElement) root.getElement(i);
    // Add the lines must replace the removed lines
    int beginFirstLine=removeLines[0].getStartOffset();
    int endLastLine=removeLines[removeLines.length-1].getEndOffset();
    Segment segment=new Segment();
    ArrayList<BranchElement> newLines=new ArrayList<BranchElement>(removeLines.length); // Guess the length of the new lines
    try {
    getText(beginFirstLine,endLastLine,segment);
    char c=segment.current();
    BranchElement line;
    while (c!=Segment.DONE) {
    if (c=='\n') {
    line=new BranchElement(root,attr);
    newLines.add(line);
    addTokens(line,attr,beginFirstLine,segment.getIndex()+1);
    beginFirstLine=segment.getIndex()+1;
    c=segment.next();
    if (beginFirstLine<endLastLine) {
    line=new BranchElement(root,attr);
    newLines.add(line);
    addTokens(line,attr,beginFirstLine,endLastLine);
    // Add the lines to the Root element
    BranchElement[] linesAdded=newLines.toArray(new BranchElement[newLines.size()]);
    root.replace(indexFirstLine,indexLastLine-indexFirstLine+1,linesAdded);
    // Notify listeners
    DefaultDocumentEvent edit=new DefaultDocumentEvent(begin,end-begin,DefaultDocumentEvent.EventType.CHANGE);
    edit.addEdit(new ElementEdit(root,indexFirstLine,removeLines,linesAdded));
    fireChangedUpdate(edit);
    } catch (Exception e) {
    throw new EditorException("Error in insertUpdate, message was "+e.getMessage(),e);
    //super.insertUpdate(chng,attr);
    private void addTokens(AbstractDocument.BranchElement line,AttributeSet attr,int begin,int end) {
    try {
    ArrayList<TokenElement> childTokens=new ArrayList<TokenElement>();
    int strLength=end-begin;
    // Create the new tokens
    Segment segment=new Segment();
    getText(begin,end-begin,segment);
    char c;
    int b=0;
    TokenElement token;
    //System.out.println(str);
    c=segment.current();
    while (c!=Segment.DONE) {
    if (isWhite(c)) {
    // Whitespace character
    if (b<segment.getIndex()) {
    token=new TokenElement(line,attr,begin+b,begin+segment.getIndex(),false);
    childTokens.add(token);
    b=segment.getIndex();
    // Find all the white spaces
    while ((c=segment.next())!=Segment.DONE && isWhite(c));
    token=new TokenElement(line,attr,begin+b,begin+segment.getIndex(),true);
    childTokens.add(token);
    b=segment.getIndex(); // Begin of next token
    } else if (isDelimiter(c)) {
    // Delimiter
    if (b<segment.getIndex()) {
    token=new TokenElement(line,attr,begin+b,begin+segment.getIndex(),false);
    childTokens.add(token);
    token=new TokenElement(line,attr,begin+segment.getIndex(),begin+segment.getIndex(),c);
    childTokens.add(token);
    b=segment.getIndex();
    c=segment.next();
    } else {
    c=segment.next();
    if (b<segment.getIndex()) {
    token=new TokenElement(line,attr,begin+b,begin+segment.getIndex(),false);
    childTokens.add(token);
    Element[] removed=new Element[line.getElementCount()];
    for (int i=0;i<removed.length;i++)
    removed[i]=line.getElement(i);
    TokenElement[] newElements=childTokens.toArray(new TokenElement[childTokens.size()]);
    line.replace(0,line.getElementCount(),newElements);
    } catch (Exception e) {
    throw new EditorException("Unexpected BadlocationException ");
    * Returns a iterator of the tokens starting from the given position
    * @param The position that is covered by the first token returned by this iterator
    * @return A iterator of all the tokens starting at the given position
    public Iterator<IToken> getTokensFrom(int position) {
    return new TokenIterator(position);
    private String getText(Element element) {
    int begin=element.getStartOffset();
    int end=Math.min(element.getEndOffset(),getLength());
    try {
    return getText(begin,end-begin);
    } catch (BadLocationException e) {
    throw new EditorException("Unexpected BadLocationException (this should not happen at all)");
    * Check if a character is a white space
    * @return True if a character is a white space
    private boolean isWhite(char c) {
    if (c=='\n') // End of line is always a white space
    return true;
    for (char whiteChar : _whiteSpaceChars)
    if (whiteChar==c)
    return true;
    return false;
    * Check if a character is a delimiter character (different from a white space character)
    * @return True if a character is a delimiter character
    private boolean isDelimiter(char c) {
    for (char delimiterChar : _delimiterChars)
    if (delimiterChar==c)
    return true;
    return c=='\0';
    * Test code
    public static void main(String[] args) {
    // Display a test frame containing a test document
    try {
    JFrame frm=new JFrame();
    EditorDocument doc=new EditorDocument(new char[] {' ','\n','\t','\r'},new char[0]);
    doc.insertString(0,"Hello",null);
    JTextPane pane=new JTextPane(doc);
    JScrollPane scroll=new JScrollPane(pane);
    frm.getContentPane().add(scroll);
    frm.setSize(200,300);
    frm.setVisible(true);
    } catch (Exception e) {
    * Class that is a iterator over the tokens in the document
    private class TokenIterator implements Iterator<IToken> {
    private int _lineIndex=-1;
    private int _tokenIndex=-1;
    public TokenIterator(int position) {
    AbstractDocument.BranchElement root=(AbstractDocument.BranchElement) getDefaultRootElement();
    _lineIndex=root.getElementIndex(position);
    AbstractDocument.BranchElement line=(AbstractDocument.BranchElement) root.getElement(_lineIndex);
    _tokenIndex=line.getElementIndex(position)-1;
    * Removes from the underlying collection the last element returned by the
    * iterator (optional operation). This method can be called only once per
    * call to <tt>next</tt>. The behavior of an iterator is unspecified if
    * the underlying collection is modified while the iteration is in
    * progress in any way other than by calling this method.
    * @exception UnsupportedOperationException if the <tt>remove</tt>
    *           operation is not supported by this Iterator.
    * @exception IllegalStateException if the <tt>next</tt> method has not
    *           yet been called, or the <tt>remove</tt> method has already
    *           been called after the last call to the <tt>next</tt>
    *           method.
    public void remove() {
    // Do nothing
    * Returns the next element in the iteration. Calling this method
    * repeatedly until the {@link #hasNext()} method returns false will
    * return each element in the underlying collection exactly once.
    * @return the next element in the iteration.
    * @exception NoSuchElementException iteration has no more elements.
    public IToken next() {
    Element root=getDefaultRootElement();
    if (_lineIndex>=root.getElementCount())
    return null;
    Element line=root.getElement(_lineIndex);
    _tokenIndex++;
    if (_tokenIndex>=line.getElementCount()) {
    _lineIndex++;
    if (_lineIndex>=root.getElementCount())
    return null;
    line=root.getElement(_lineIndex);
    if (line.getElementCount()==0)
    return null;
    _tokenIndex=0;
    return (IToken) line.getElement(_tokenIndex);
    * Returns <tt>true</tt> if the iteration has more elements. (In other
    * words, returns <tt>true</tt> if <tt>next</tt> would return an element
    * rather than throwing an exception.)
    * @return <tt>true</tt> if the iterator has more elements.
    public boolean hasNext() {
    int lineIndex=_lineIndex;
    int tokenIndex=_tokenIndex;
    Element root=getDefaultRootElement();
    if (lineIndex>=root.getElementCount())
    return false;
    Element line=root.getElement(lineIndex);
    tokenIndex++;
    if (tokenIndex>=line.getElementCount()) {
    lineIndex++;
    if (lineIndex>=root.getElementCount())
    return false;
    line=root.getElement(lineIndex);
    if (line.getElementCount()==0)
    return false;
    return true;
    * Represents a token in the document
    private class TokenElement extends AbstractDocument.LeafElement implements IToken, Comparable<TokenElement> {
    private boolean _isWhiteSpace;
    private char _separatorChar='\0';
    public TokenElement(Element parent,AttributeSet attributeSet,int offs0,int offs1,boolean whiteSpace) {
    super(parent,attributeSet,offs0,offs1);
    _isWhiteSpace=whiteSpace;
    public TokenElement(Element parent,AttributeSet attributeSet,int offs0,int offs1,char separatorChar) {
    super(parent,attributeSet,offs0,offs1);
    _separatorChar=separatorChar;
    * Returns the separator character if this token is a separator, returns '\0' otherwise
    * @return The separator charactor or null otherwise
    public char getSeparatorChar() {
    return _separatorChar;
    * Compares this object with the specified object for order. Returns a
    * negative integer, zero, or a positive integer as this object is less
    * than, equal to, or greater than the specified object.<p>
    * In the foregoing description, the notation
    * <tt>sgn(</tt><i>expression</i><tt>)</tt> designates the mathematical
    * <i>signum</i> function, which is defined to return one of <tt>-1</tt>,
    * <tt>0</tt>, or <tt>1</tt> according to whether the value of <i>expression</i>
    * is negative, zero or positive.
    * The implementor must ensure <tt>sgn(x.compareTo(y)) ==
    * -sgn(y.compareTo(x))</tt> for all <tt>x</tt> and <tt>y</tt>. (This
    * implies that <tt>x.compareTo(y)</tt> must throw an exception iff
    * <tt>y.compareTo(x)</tt> throws an exception.)<p>
    * The implementor must also ensure that the relation is transitive:
    * <tt>(x.compareTo(y)>0 && y.compareTo(z)>0)</tt> implies
    * <tt>x.compareTo(z)>0</tt>.<p>
    * Finally, the implementer must ensure that <tt>x.compareTo(y)==0</tt>
    * implies that <tt>sgn(x.compareTo(z)) == sgn(y.compareTo(z))</tt>, for
    * all <tt>z</tt>.<p>
    * It is strongly recommended, but <i>not</i> strictly required that
    * <tt>(x.compareTo(y)==0) == (x.equals(y))</tt>. Generally speaking, any
    * class that implements the <tt>Comparable</tt> interface and violates
    * this condition should clearly indicate this fact. The recommended
    * language is "Note: this class has a natural ordering that is
    * inconsistent with equals."
    * @param o the Object to be compared.
    * @return a negative integer, zero, or a positive integer as this object
    *           is less than, equal to, or greater than the specified object.
    * @throws ClassCastException if the specified object's type prevents it
    * from being compared to this Object.
    public int compareTo(TokenElement o) {
    return getStartOffset()-o.getStartOffset();
    * Indicates this is a white space token
    * @return true if this is a white space token false otherwise
    public boolean isWhiteSpace() {
    return _isWhiteSpace;
    * Returns the string this token is representing
    * @return The string behind this token
    public String getText() {
    return EditorDocument.this.getText(this);
    class SearchToken implements IToken {
    private int _offset;
    public SearchToken(int offset) {
    _offset=offset;
    * @return The start of the token used in comparisation operations
    public int getEndOffset() {
    return _offset;
    public int getStartOffset() {
    return _offset;
    public boolean isWhiteSpace() {
    throw new EditorException("May not be called");
    public String getText() {
    throw new EditorException("May not be called");
    public char getSeparatorChar() {
    throw new EditorException("May not be called");

    I am trying to add primitive syntax highlighting to my JTextPane and have serious problems which I already stated in this forum. Now I read from uncle_alice that the text package from swing is not ment for that and that I need to write my own JTextPane and my own document and view.
    Can you explain what you mean by "writing my own JTextPane and View and Dcoument".
    My own Document I already have in order to provide SQL-highlighting.
    But what exactly do you mean by suggesting to write my own View! Whoever uses JTextPane doesnt really have much to do with its view. Can you give me a hint as I am completely stuck with an Exception : "javax.swing.text.StateInvariantError: GlyphView: Stale view: javax.swing.text.BadLocationException: Length must be positive"
    can you pinpoint the standard text-package's deficiency? it lacks what? what is the best work around?
    cheers
    ioannis

  • How to change the format of a decimal input field?

    Hello,
    When creating an input field of type decimal the numbers appear at this format: 123,123.
    Is it possible to disable this format and let the numbers to be displayed like this: 123123 ?
    Regards,
    Roy

    Hi Roy,
    Create a simple type in local dictionary of built in type integer. In the representation tab you can give any format you want. For your requirement you can give ####### in the  format. You can also try other formats like ##,#### etc. Now create a context attribute and in it's type property give the simple type you have created by selecting the appropriate folder. Now map this attribute with the input field. 
    Regards,
    Jaydeep

  • The case structure is not working well on comaring two strings using true or false string matching VI

    I need an execution of commands after the reply from the instrument matches with the string I provided for that i used true or false string match VI on which the true string the matching command and the string is the reply from the instrument. And I put the further executionable commands in frame after frame of sequence loop in the true of the case structure. Amd finally I given all the output strings to the concatenate string to get all the replies as one loop. But when I execute the program the desired result is not available. So kindly please help me to overcome this problem.  
    Attachments:
    basic serial with changes.vi ‏24 KB

    You VI makes absolutely no sense and I would recommend you start with a few simple LabVIEW tutorials before trying to tackle this.
    What is the point of the FOR loop with 1 iteration, it might as well not even be there, same difference.
    Why is there an abort primitive in the FOR loop, this mean the program will unconditionally stop abort before any downstream code will ever go into action. The program will never get past the FOR loop.
    You created a circular data dependency and LabVIEW inserted a feedback node automatically, making things even worse. (see also)
    You need to learn about dataflow, execution order, and data dependency.
    You need to learn about the various types of tunnels (plain, autoindexing, etc.)
    There is a tremendous amount of duplicate code. Large code sections are the same, differeing only by a string. You should only have one copy of that code inside a proper state machine. Have a look at the design templates and examples that ship with LabVIEW.
    LabVIEW Champion . Do more with less code and in less time .

  • How to change the type of Case selector

    Hallo,
    I'm running LV 6i on NT4.0.
    I have a Case structure with several strings as cases, lets say stringA
    (Standard), stringB, stringC, stringD and so on.
    So my Case selector is of type string. That works fine so far.
    Now I want to change that structure from StringType to EnumType, so I would
    have cases CaseA(Standard), CaseB, CaseC and CaseD. So I want to change the
    slector type to Enum and associate the former string cases to Enum cases.
    1. I wired an Enum constant to my string selector, and tried to assign a
    case for each enum, the machine crashes.
    2. I duplicated each string case and tried to assign the duplicated to the
    enum, the mashine crashed.
    Is there a way to do this, without deleting the case structure, or starting
    a copy paste orgie?
    Oliver Friedrich

    Something very strange is going on. I have tried what you explained in V6.0.2 running under W2K and all is well with the world. Can you post the VI that's doing it and let me play with it? Perhaps I might see something. In the mean time, it might be that the VI is corrupted and you'll have to rebuild it. This is a very rare circumstance with LV, but it can happen--especially when the computer crashes.
    Have you upgraded to 6.0.2. If not that's another thing to try. The upgrade is free and can be downloaded from NI's website.
    Mike...
    [email protected]
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

Maybe you are looking for

  • Additional Fields in F-28 Screen

    Dear Friends Our client needs additional fields in F-28 screen to capture some business information like the cheque is from which bank and branch, town, challan number etc.....  For this we need to go for Field exits.  Can I know 1.  Is it possible t

  • SQL Loader for mainframe platform

    Hi all, Is there any utility on mainframe platform that corresponds to SQL*Loader in Windows/Unix? Thanks Edited by: Valli on Feb 25, 2010 11:38 AM

  • How to remove myself from receiving notifications?

    You'll need to either update the Role Responsible within the workflow settings (Admin -> Manage Workflow -> Manage Steps) or remove yourself from the role (Admin -> Manage Roles) altogether.

  • Upgrading Raw Conversion X-Trans Censors

    Good Morning, I a thinking of upgrading my LR to the new 5.  I was able to try Irdient new upgrade for X-Trans and my file are so much more crisp and detailed then they are in LR with your support for the X-Trans.  Are you going to upgrade you suppor

  • Wifi itunes store and downloading movies

    I'm not sure if on some thread posted in the last two weeks, someone hasn't already answered the question: Can you download movies [even Pixar shorts] directly to the iTouch? Or is direct downloading only permitted for getting music from the wifi iTu