Example usage for com.google.gwt.event.dom.client FocusHandler FocusHandler

List of usage examples for com.google.gwt.event.dom.client FocusHandler FocusHandler

Introduction

In this page you can find the example usage for com.google.gwt.event.dom.client FocusHandler FocusHandler.

Prototype

FocusHandler

Source Link

Usage

From source file:info.magnolia.ui.vaadin.gwt.client.form.widget.FormViewImpl.java

License:Open Source License

@Override
public void setContent(Widget contentWidget) {
    if (contentWidget instanceof MagnoliaTabSheetView) {
        if (tabSheet != null) {
            remove(tabSheet);/* w  ww .  j  a  v a 2s. c o m*/
        }

        this.tabSheet = (MagnoliaTabSheetView) contentWidget;
        tabSheet.addTabSetChangedHandler(new TabSetChangedEvent.Handler() {
            @Override
            public void onTabSetChanged(TabSetChangedEvent event) {
                final List<MagnoliaTabWidget> tabs = event.getTabSheet().getTabs();
                formTabs.clear();
                for (final MagnoliaTabWidget tab : tabs) {
                    if (tab instanceof FormTabWidget) {
                        formTabs.add((FormTabWidget) tab);
                    }
                }
            }
        });

        tabSheet.addActiveTabChangedHandler(new ActiveTabChangedEvent.Handler() {
            @Override
            public void onActiveTabChanged(ActiveTabChangedEvent event) {
                // Focus the first field on the form of the current tab.
                if (!hasErrors) {
                    if (!event.isShowingAllTabs()) {
                        focusFirstFieldInTab((FormTabWidget) event.getTab());
                    } else {
                        focusFirstFieldInTab(formTabs.get(0));
                    }
                }

                // Keep track of last focused field by adding focus handlers to every field.
                lastFocused = null;
                if (!event.isShowingAllTabs()) {
                    setFieldFocusHandler((FormTabWidget) event.getTab());
                } else {
                    for (FormTabWidget tab : formTabs) {
                        setFieldFocusHandler(tab);
                    }
                }
            }

            private void focusFirstFieldInTab(FormTabWidget tab) {
                FormFieldWrapper firstField = tab.getFields().get(0);
                firstField.focusField();
            }

            private void setFieldFocusHandler(FormTabWidget tab) {
                final List<FormFieldWrapper> fields = tab.getFields();
                for (final FormFieldWrapper field : fields) {
                    field.addFocusHandler(new FocusHandler() {
                        @Override
                        public void onFocus(FocusEvent event) {
                            final Element target = event.getRelativeElement().cast();
                            lastFocused = Util.findWidget(target, FormFieldWrapper.class);
                        }
                    });
                }
            }
        });
        add(tabSheet.asWidget(), contentEl);
    }
}

From source file:net.officefloor.demo.chat.client.ChatWidget.java

License:Open Source License

/**
 * Initiate.//from   ww  w. ja  v a  2 s .c  o m
 */
public ChatWidget() {

    // Provide means to send a message
    HorizontalPanel messagePanel = new HorizontalPanel();
    // messagePanel.setSpacing(10);
    messagePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    this.add(messagePanel);

    // Provide message text box
    this.messageText.setStylePrimaryName("message");
    messagePanel.add(this.messageText);
    this.messageText.addFocusHandler(new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
            ChatWidget.this.ensureHaveUserName();
        }
    });

    // Provide send button for message
    Button sendButton = new Button("send");
    sendButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            ChatWidget.this.sendChatMessage();
        }
    });
    messagePanel.add(sendButton);

    // Provide messages in scroll area
    VerticalPanel messagesPanel = new VerticalPanel();
    messagesPanel.setSize("100%", "100%");
    ScrollPanel scrollMessagesPanel = new ScrollPanel(messagesPanel);
    scrollMessagesPanel.setStylePrimaryName("messages");
    this.add(scrollMessagesPanel);

    // Provide label to display typing users
    final Label typingLabel = new Label();
    typingLabel.setStylePrimaryName("typing");
    messagesPanel.add(typingLabel);
    typingLabel.setVisible(false); // initially hidden as no typing users

    // List to contain chat messages
    Cell<ChatMessage> chatCell = new AbstractCell<ChatMessage>() {
        @Override
        public void render(Context context, ChatMessage value, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<span><b>");
            sb.appendEscaped(value.getUserName());
            sb.appendHtmlConstant("</b>");
            sb.appendEscaped(" > ");
            sb.appendEscaped(value.getMessage());
            sb.appendHtmlConstant("</span>");
        }
    };
    CellList<ChatMessage> chatList = new CellList<ChatMessage>(chatCell);
    messagesPanel.add(chatList);

    // Add the data
    final ListDataProvider<ChatMessage> chatEntries = new ListDataProvider<ChatMessage>();
    chatEntries.addDataDisplay(chatList);

    // Handle listening for messages
    OfficeFloorComet.subscribe(ConversationSubscription.class, new ConversationSubscription() {
        @Override
        public void message(ChatMessage message) {

            // Determine if typing notification
            String userName = message.getUserName();
            if ((ChatWidget.this.userName == null) || (!(ChatWidget.this.userName.equals(userName)))) {
                // Not user so provide notification of typing
                if (message.isTyping()) {
                    // Include user as typing
                    if (!(ChatWidget.this.typingUserNames.contains(userName))) {
                        ChatWidget.this.typingUserNames.add(userName);
                    }
                } else {
                    // User has stopped typing
                    ChatWidget.this.typingUserNames.remove(userName);
                }
            }

            // Display typing notification
            if (ChatWidget.this.typingUserNames.size() == 0) {
                // No typing users
                typingLabel.setVisible(false);

            } else {
                // Display the typing users
                StringBuilder typingUsers = new StringBuilder();
                boolean isFirst = true;
                for (String typingUserName : ChatWidget.this.typingUserNames) {
                    if (!isFirst) {
                        typingUsers.append(", ");
                    }
                    isFirst = false;
                    typingUsers.append(typingUserName);
                }
                typingUsers.append(" ... (typing)");
                typingLabel.setText(typingUsers.toString());
                typingLabel.setVisible(true);
            }

            // Add the message (if one provided)
            String text = message.getMessage();
            if (text != null) {
                List<ChatMessage> list = chatEntries.getList();
                if (list.size() == 0) {
                    list.add(message);
                } else {
                    list.add(0, message);
                }
            }
        }
    }, null);

    // Handle submitting a message
    this.messageText.addKeyDownHandler(new KeyDownHandler() {
        @Override
        public void onKeyDown(KeyDownEvent event) {

            // Obtain the message text and cursor position
            String message = ChatWidget.this.messageText.getText();
            int cursorPosition = ChatWidget.this.messageText.getCursorPos();

            // Handle various scenarios of keys for sending/notification
            switch (event.getNativeKeyCode()) {
            case KeyCodes.KEY_ENTER:
                ChatWidget.this.sendChatMessage();
                break;

            case KeyCodes.KEY_BACKSPACE:
                if (ChatWidget.this.isTyping && (message.length() == 1) && (cursorPosition == 1)) {
                    // No longer typing as deleting last character
                    ChatWidget.this.sendChatMessage(false, null);
                }
                break;

            case KeyCodes.KEY_DELETE:
                if (ChatWidget.this.isTyping && (message.length() == 1) && (cursorPosition == 0)) {
                    // No longer typing as deleting last character
                    ChatWidget.this.sendChatMessage(false, null);
                }
                break;

            case KeyCodes.KEY_ALT:
            case KeyCodes.KEY_CTRL:
            case KeyCodes.KEY_DOWN:
            case KeyCodes.KEY_END:
            case KeyCodes.KEY_ESCAPE:
            case KeyCodes.KEY_HOME:
            case KeyCodes.KEY_LEFT:
            case KeyCodes.KEY_PAGEDOWN:
            case KeyCodes.KEY_PAGEUP:
            case KeyCodes.KEY_RIGHT:
            case KeyCodes.KEY_SHIFT:
            case KeyCodes.KEY_UP:
                // Do nothing
                break;

            default:
                if ((!ChatWidget.this.isTyping) && (message.length() == 0)) {
                    // Started typing a message
                    ChatWidget.this.sendChatMessage(true, null);
                }
                break;
            }
        }
    });
}

From source file:net.scran24.user.client.survey.foodlist.EditableFoodList.java

public EditableFoodList(String addButtonText, final boolean markAsDrink, Callback1<List<FoodEntry>> onChange) {
    this.markAsDrink = markAsDrink;
    this.onChange = onChange;

    FlowPanel contents = new FlowPanel();
    initWidget(contents);//from   ww w .  ja  v a 2s  .  c  om

    foodList = new UnorderedList<EditableFoodListItem>();

    foodList.sinkEvents(Event.ONMOUSEOUT);
    foodList.addHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            deselect();
        }
    }, MouseOutEvent.getType());

    newItem = new EditableFoodListItem(Option.<FoodEntry>none());
    newItem.addStyleName("intake24-food-list-new-item");
    newItem.textBox.addStyleName("intake24-food-list-textbox-new-item");

    newItem.deleteButton.removeStyleName("intake24-food-list-delete-button");
    newItem.deleteButton.addStyleName("intake24-food-list-accept-button");
    newItem.deleteButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            acceptNewItem();
        }
    });

    newItem.textBox.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            if (newItem.isEmpty())
                newItem.deleteButton.getElement().getStyle().setVisibility(Visibility.HIDDEN);
            else
                newItem.deleteButton.getElement().getStyle().setVisibility(Visibility.VISIBLE);
        }
    });

    UnorderedList<EditableFoodListItem> newItemContainer = new UnorderedList<EditableFoodListItem>();
    newItemContainer.addItem(newItem);

    newItem.showPlaceholderText();

    newItem.textBox.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER && newItem.isChanged()) {
                acceptNewItem();
            } else if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
                newItem.clearText();
                newItem.textBox.setFocus(false);
            }
        }
    });

    newItem.textBox.addFocusHandler(new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
            if (newItem.isEmpty())
                newItem.clearText();
        }
    });

    newItem.textBox.addBlurHandler(new BlurHandler() {
        @Override
        public void onBlur(BlurEvent event) {
            if (newItem.isEmpty())
                newItem.showPlaceholderText();
        }
    });

    contents.add(foodList);
    contents.add(newItemContainer);
}

From source file:net.scran24.user.client.survey.foodlist.EditableFoodList.java

public EditableFoodListItem addItem(Option<FoodEntry> init) {
    final EditableFoodListItem item = new EditableFoodListItem(init);

    if (!indentLinkedFoods)
        item.removeStyleName("intake24-food-list-linked-item");

    item.textBox.addKeyUpHandler(new KeyUpHandler() {
        @Override//from   w  w w.  j  a va  2  s . c  o  m
        public void onKeyUp(KeyUpEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
                item.textBox.setFocus(false);
            } else if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
                item.textBox.setFocus(false);
            }
        }
    });

    item.textBox.addFocusHandler(new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
            select(item);
        }
    });

    item.textBox.addBlurHandler(new BlurHandler() {
        @Override
        public void onBlur(BlurEvent event) {
            if (item.isEmpty()) {
                removeItem(item);
                onChange.call(getEnteredItems());
            } else if (item.isChanged()) {
                onChange.call(getEnteredItems());
            }
        }
    });

    item.sinkEvents(Event.ONMOUSEOVER);

    item.addHandler(new MouseOverHandler() {
        @Override
        public void onMouseOver(MouseOverEvent event) {
            select(item);
        }
    }, MouseOverEvent.getType());

    item.deleteButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            removeItem(item);
            onChange.call(getEnteredItems());
        }
    });

    foodList.addItem(item);

    IEHack.forceReflowDeferred();

    return item;
}

From source file:net.scran24.user.client.survey.prompts.RadioButtonQuestion.java

public RadioButtonQuestion(SafeHtml promptText, PVector<String> choices, String groupId,
        Option<String> otherOptionName) {
    this.choices = choices;
    this.otherOptionName = otherOptionName;

    UnorderedList<Widget> choiceList = new UnorderedList<Widget>();
    choiceList.getElement().setId("intake24-radio-button-choices");

    optionButtons = new RadioButton[choices.size()];

    for (int i = 0; i < choices.size(); i++) {
        optionButtons[i] = new RadioButton(groupId, SafeHtmlUtils.fromString(choices.get(i)));
        choiceList.addItem(optionButtons[i]);
    }/*ww  w  .ja  v a 2s  . c om*/

    radioButtons = choiceList;

    if (!otherOptionName.isEmpty()) {
        FlowPanel otherPanel = new FlowPanel();
        otherOption = new RadioButton(groupId, otherOptionName.getOrDie() + ": ");
        otherPanel.add(otherOption);
        otherBox = new TextBox();
        otherPanel.add(otherBox);
        choiceList.addItem(otherPanel);

        otherBox.addFocusHandler(new FocusHandler() {
            @Override
            public void onFocus(FocusEvent event) {
                otherOption.setValue(true);
            }
        });
    }

    contents = new FlowPanel();
    contents.addStyleName("intake24-radio-button-question");

    promptPanel = WidgetFactory.createPromptPanel(promptText);
    promptPanel.getElement().setId("intake24-radio-button-question");
    contents.add(promptPanel);

    warningDiv = new FlowPanel();
    warningDiv.addStyleName("intake24-radio-button-question-warning");

    contents.add(warningDiv);
    contents.add(choiceList);

    initWidget(contents);
}

From source file:net.scran24.user.client.surveyscheme.MultipleChoiceCheckboxQuestion.java

@Override
public SimpleSurveyStageInterface getInterface(final Callback1<Survey> onComplete,
        Callback2<Survey, Boolean> onIntermediateStateChange) {
    final FlowPanel content = new FlowPanel();
    content.addStyleName("intake24-multiple-choice-question");
    content.addStyleName("intake24-survey-content-container");

    content.add(WidgetFactory.createPromptPanel(questionText));

    FlowPanel checkboxesDiv = new FlowPanel();
    checkboxesDiv.addStyleName("scran24-ready-meals-checkboxes-block");

    final ArrayList<CheckBox> checkBoxes = new ArrayList<CheckBox>();

    for (String option : options) {
        FlowPanel rowDiv = new FlowPanel();
        CheckBox checkBox = new CheckBox(SafeHtmlUtils.htmlEscape(option));
        checkBox.setFormValue(option);//from   w w  w.j  a v a  2s  . c om
        checkBox.addStyleName("scran24-ready-meals-checkbox");
        checkBoxes.add(checkBox);
        rowDiv.add(checkBox);
        checkboxesDiv.add(rowDiv);
    }

    if (!otherOptionName.isEmpty()) {
        FlowPanel otherPanel = new FlowPanel();
        otherOption = new CheckBox(otherOptionName.getOrDie() + ": ");
        otherPanel.add(otherOption);
        otherBox = new TextBox();
        otherPanel.add(otherBox);
        checkboxesDiv.add(otherPanel);

        otherBox.addFocusHandler(new FocusHandler() {
            @Override
            public void onFocus(FocusEvent event) {
                otherOption.setValue(true);
            }
        });
    }

    content.add(checkboxesDiv);

    Button accept = WidgetFactory.createGreenButton(acceptText, new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {

            StringBuilder value = new StringBuilder();
            boolean first = true;

            for (CheckBox checkBox : checkBoxes)
                if (checkBox.getValue()) {
                    if (first)
                        first = false;
                    else
                        value.append(", ");

                    value.append(checkBox.getFormValue());
                }

            if (!otherOptionName.isEmpty()) {
                if (otherOption.getValue()) {
                    if (!first)
                        value.append(", ");
                    value.append(otherBox.getText());
                }
            }

            onComplete.call(state.withData(dataField, value.toString()));
        }
    });

    content.add(checkboxesDiv);
    content.add(accept);

    return new SimpleSurveyStageInterface(content);
}

From source file:next.celebs.ui.MiscUtils.java

License:Apache License

public static void initTextFields(final String infoTxt, final TextBox field) {

    field.addStyleName("info");
    field.setText(infoTxt);//from  www .ja va2s. co  m

    field.addFocusHandler(new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
            if (infoTxt.equals(field.getText())) {
                field.setText("");
                field.removeStyleName("info");
            }
        }
    });
    field.addBlurHandler(new BlurHandler() {
        @Override
        public void onBlur(BlurEvent event) {
            if ("".equals(field.getText())) {
                field.setText(infoTxt);
                field.addStyleName("info");
            }
        }
    });
}

From source file:nl.ru.languageininteraction.synaesthesia.client.view.MetadataView.java

License:Open Source License

public void addField(final MetadataField metadataField, final String existingValue, String labelString) {
    if (flexTable == null) {
        flexTable = new FlexTable();
        flexTable.setStylePrimaryName("metadataTable");
        outerPanel.add(flexTable);// ww  w  . j  a  v a 2s  .  c  o m
    }
    final int rowCount = flexTable.getRowCount();
    final Label label = new Label(labelString);
    flexTable.setWidget(rowCount, 0, label);
    final TextBox textBox = new TextBox();
    textBox.setStylePrimaryName("metadataOK");
    textBox.setText((existingValue == null) ? "" : existingValue);
    textBox.addFocusHandler(new FocusHandler() {

        @Override
        public void onFocus(FocusEvent event) {
            addKeyboardPadding();
            //                scrollToPosition(label.getAbsoluteTop());
        }
    });
    //        textBox.addBlurHandler(new BlurHandler() {
    //
    //            @Override
    //            public void onBlur(BlurEvent event) {
    //                removeKeyboardPadding();
    //            }
    //        });
    flexTable.setWidget(rowCount + 1, 0, textBox);
    fieldBoxes.put(metadataField, textBox);
    if (firstTextBox == null) {
        firstTextBox = textBox;
    }
}

From source file:org.apache.hupa.widgets.editor.Editor.java

License:Apache License

private void addNewlineHandlersForFireFox() {
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x2_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f30");
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x00x00x00x1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x00x00x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x00x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x0");
    area.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            InstrumentationLoggerProvider.get().instrument(
                    "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x00x00x00x1208950cc0x2_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x00x00x00x1208950cc_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x00x00x00x1208950cc0x20x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x00x00x00x1208950cc0x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x00x00x00x1208950cc0x1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x00x00x00x1208950cc0x3");
            InstrumentationLoggerProvider.get().instrument(
                    "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x00x00x00x1208950cc0x30x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x00x00x00x1208950cc0x30x00x0");
            doNline = true;//w  w  w  . j a  v a  2s. co m
        }
    });
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x10x00x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x10x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x10x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x10x00x00x1");
    area.addFocusHandler(new FocusHandler() {
        public void onFocus(FocusEvent event) {
            InstrumentationLoggerProvider.get().instrument(
                    "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x10x00x00x1f1b08ca40x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x10x00x00x1f1b08ca40x1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x10x00x00x1f1b08ca40x20x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x10x00x00x1f1b08ca4_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x10x00x00x1f1b08ca40x3_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x10x00x00x1f1b08ca40x2");
            InstrumentationLoggerProvider.get().instrument(
                    "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x10x00x00x1f1b08ca40x30x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x10x00x00x1f1b08ca40x30x0");
            doNline = true;
        }
    });
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x2");
    area.addKeyPressHandler(new KeyPressHandler() {
        public void onKeyPress(KeyPressEvent event) {
            InstrumentationLoggerProvider.get().instrument(
                    "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f2_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x20x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x2_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x3_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x0");
            InstrumentationLoggerProvider.get().instrument(
                    "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x1");
            if (!isNewMessage) {
                if (doNline && event.getCharCode() == KeyCodes.KEY_ENTER) {
                    InstrumentationLoggerProvider.get().instrument(
                            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x00x00x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x00x1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x00x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x0");
                    InstrumentationLoggerProvider.get().instrument(
                            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x00x10x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x00x10x00x0");
                    doNline = false;
                    InstrumentationLoggerProvider.get().instrument(
                            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x00x10x10x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x00x10x1");
                    leftIdentTimer.schedule(10);
                    InstrumentationLoggerProvider.get().instrument(
                            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x00x10x2_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x00x10x20x0");
                    event.preventDefault();
                }
                InstrumentationLoggerProvider.get().instrument(
                        "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x10x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x10x0");
                if (!doNline && (event.getCharCode() == KeyCodes.KEY_DOWN
                        || event.getCharCode() == KeyCodes.KEY_UP)) {
                    InstrumentationLoggerProvider.get().instrument(
                            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x10x00x10x00x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x10x00x10x00x1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x10x00x10x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x10x00x1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x10x1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x10x00x10x00x10x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x10x00x10x0");
                    InstrumentationLoggerProvider.get().instrument(
                            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x10x10x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e40688f300x20x20x00x00x1f76c84f20x30x00x10x10x10x00x0");
                    doNline = true;
                }
            }
        }
    });

}

From source file:org.bonitasoft.console.client.view.ItemCommentEditorWidget.java

License:Open Source License

protected void initContent() {
    myNewCommentTextArea.setText(ENTER_A_COMMENT);
    myNewCommentTextArea.addFocusHandler(new FocusHandler() {

        public void onFocus(FocusEvent aEvent) {
            if (ENTER_A_COMMENT.equals(myNewCommentTextArea.getValue())) {
                toggleToCompleteView();//from w ww . j a  va2s. c o  m
            }
        }
    });
    myNewCommentTextArea.addBlurHandler(new BlurHandler() {

        public void onBlur(BlurEvent aEvent) {
            if (myNewCommentTextArea.getValue() == null || myNewCommentTextArea.getValue().length() == 0) {
                toggleToSimpleView();
            }
        }
    });
    final Image theIconPlaceHolder = new Image(PICTURE_PLACE_HOLDER);
    theIconPlaceHolder.setStylePrimaryName(CSSClassManager.COMMENT_ICON_STYLE);
    myOuterPanel.add(theIconPlaceHolder);
    myOuterPanel.add(myNewCommentTextArea);

}