private T addMessageLocationImpl(boolean buttonAddedLocation, MessageLocation messageLocation) {
    for (T locationUI : getModel().getElements()) {
      if (locationUI.getLocation().overlaps(messageLocation)) {
        View.getSingleton()
            .showWarningDialog(
                Constant.messages.getString(
                    "messagelocationspanel.add.location.warning.locations.overlap"));
        return null;
      }
    }

    MessageLocationHighlight highlight = null;
    MessageLocationHighlight highlightReference = null;
    MessageLocationHighlightsManager highlightsManager = selectMessageLocationsPanel.create();
    if (highlightsManager != null) {
      highlight = highlightsManager.getHighlight(messageLocation);
      highlightReference = selectMessageLocationsPanel.highlight(messageLocation, highlight);
    }

    T entry =
        createMessageLocationTableEntry(
            buttonAddedLocation, messageLocation, highlight, highlightReference);
    if (entry == null) {
      if (highlightsManager != null) {
        selectMessageLocationsPanel.removeHighlight(messageLocation, highlightReference);
      }
      return null;
    }
    getModel().addElement(entry);

    int row = getTable().convertRowIndexToView(getModel().getRow(entry));
    getTable().setRowSelectionInterval(row, row);

    return null;
  }
    @Override
    public void highlightChanged(HighlightChangedEvent<T> event) {
      T tableEntry = event.getEntry();

      MessageLocationHighlight highlightReference = event.getHighlightReference();
      if (highlightReference != null) {
        selectMessageLocationsPanel.removeHighlight(
            tableEntry.getLocation(), event.getHighlightReference());
      }

      MessageLocationHighlight highlight = tableEntry.getHighlight();
      if (highlight != null) {
        highlightReference =
            selectMessageLocationsPanel.highlight(
                tableEntry.getLocation(), tableEntry.getHighlight());
        tableEntry.setHighlightReference(highlightReference);
      }
    };
 public void reset() {
   for (T entry : getMultipleOptionsModel().getElements()) {
     MessageLocationHighlight highlightReference = entry.getHighlightReference();
     if (highlightReference != null) {
       selectMessageLocationsPanel.removeHighlight(entry.getLocation(), highlightReference);
     }
   }
   getMultipleOptionsModel().clear();
 }
  @Override
  public void accept(T t) {
    final Location<World> location = t.getLocation();

    final Explosion.Builder builder = Explosion.builder();
    builder.location(location);
    builder.canCauseFire(this.canCauseFire);
    builder.radius((float) this.radius);
    builder.shouldBreakBlocks(this.shouldBreakBlocks);
    builder.shouldDamageEntities(this.shouldDamageEntities);
    builder.shouldPlaySmoke(this.shouldPlaySmoke);

    location.getExtent().triggerExplosion(builder.build(), Cause.source(t).build());
  }
  @Override
  public boolean showRemoveDialogue(T e) {
    if (!getRemoveWithoutConfirmationCheckBox().isSelected()) {
      if (!showRemoveDialogueImpl(e)) {
        return false;
      }
    }

    MessageLocationHighlight highlightReference = e.getHighlightReference();
    if (highlightReference != null) {
      selectMessageLocationsPanel.removeHighlight(e.getLocation(), highlightReference);
    }

    return true;
  }
Example #6
0
 public Point getLocation() {
   return scrollable.getLocation();
 }